Small, single-file Bash installer for the ugreen_leds_controller project. It clones, installs the kernel module, copies helper scripts and a systemd unit, and enables the service.
Always validate what the script does before running
Run the following command to install:
curl -sf https://raw.githubusercontent.com/0x556c79/install_ugreen_leds_controller/main/install_ugreen_leds_controller.sh -o install_ugreen_leds_controller.sh ; sudo bash install_ugreen_leds_controller.shNEW: The installer now supports TrueNAS Scale systems with read-only root filesystems (common when Nvidia drivers are installed).
- ✅ Persistent Storage: Stores kernel module and scripts on a writable ZFS pool location
- ✅ Version Tracking: Only downloads kernel modules when TrueNAS version changes
- ✅ Smart Reuse: Reuses existing files on subsequent boots (no re-download)
- ✅ Auto-Recovery: Survives TrueNAS updates when configured as Init Script
- ✅ Config Preservation: Your
/etc/ugreen-leds.confsettings always persist
/mnt/ (on a ZFS pool) to ensure persistence across reboots on TrueNAS Scale. The script will abort if run from outside /mnt/.
The script intelligently detects the persistent directory location:
-
Script in
leds_controller/directory: If the script is already located in a folder namedleds_controller, this folder is used as the persistent directory.# Example: Script is at /mnt/tank/apps/leds_controller/install_ugreen_leds_controller.sh cd /mnt/tank/apps/leds_controller sudo bash install_ugreen_leds_controller.sh --yes
-
Existing
leds_controller/at same level: If aleds_controllerdirectory exists at the same level as the script, it will be reused.# Example: Script is at /mnt/tank/apps/install_ugreen_leds_controller.sh # and /mnt/tank/apps/leds_controller/ already exists cd /mnt/tank/apps sudo bash install_ugreen_leds_controller.sh --yes
-
New installation: If neither condition above is met, the script creates a new
leds_controller/directory.
cd /mnt/<POOL>/<DATASET>/<FOLDER>
sudo bash install_ugreen_leds_controller.shThe installer will prompt you to choose a persistent storage location.
cd /mnt/<POOL>/<DATASET>/<FOLDER>
sudo bash install_ugreen_leds_controller.sh --use-current-dirCreates leds_controller/ in your current directory.
sudo bash install_ugreen_leds_controller.sh --pool-path <POOL>/<DATASET>/<FOLDER>Example: --pool-path tank/apps/ugreen
sudo bash install_ugreen_leds_controller.sh --persist-dir /mnt/<POOL>/<PATH>/leds_controllerTo ensure LED controller starts after every reboot:
-
Copy the installer to the persistent directory (if not already there):
cp install_ugreen_leds_controller.sh /mnt/<POOL>/<PATH>/leds_controller/
-
Navigate to System Settings → Advanced → Init/Shutdown Scripts
-
Click Add
-
Configure:
- Description:
UGREEN LED Controller - Type:
Command - Command:
/bin/bash /mnt/<POOL>/<PATH>/leds_controller/install_ugreen_leds_controller.sh --yes - When:
Post Init - Enabled: ✓ (checked)
- Timeout:
10seconds
- Description:
-
Click Save
Why this works:
- The script detects it's running from inside the
leds_controller/directory - It uses that directory as the persistent storage location
- The
--yesflag enables non-interactive mode for automated execution - Version tracking ensures fast subsequent boots (~3-5 seconds, no re-download)
The installer creates the following structure:
/mnt/<POOL>/<PATH>/leds_controller/
├── .version # TrueNAS version tracker
├── led-ugreen.ko # Kernel module
├── install_ugreen_leds_controller.sh # Installer copy for reuse
├── ugreen_leds_controller/ # Cloned repository
│ └── scripts/
└── scripts/ # Installed scripts
├── ugreen-diskiomon
├── ugreen-netdevmon
├── ugreen-probe-leds
└── ugreen-power-led
/etc/ugreen-leds.conf # Your configuration (writable)
The installer automatically handles configuration in the following priority order:
- Existing persistent config: Uses
${PERSIST_DIR}/ugreen-leds.confif it exists - Existing system config: Migrates
/etc/ugreen-leds.confto persistent directory (preserves your settings) - Template config: Uses repository template for new installations
Migration Note: If you have an existing /etc/ugreen-leds.conf from a standard installation, it will be automatically detected and copied to your persistent directory on first run, preserving all your custom settings.
Options:
-h Print help message
-v <version> Use specific TrueNAS version (e.g., 24.10.0)
--persist-dir <path> Specify custom persistent storage directory
--use-current-dir Use current working directory for leds_controller/ folder
--pool-path <path> Specify ZFS pool path under /mnt/
--dry-run Show actions without making changes
--yes Non-interactive mode (assume yes to all prompts)
--force Allow destructive actions
- First Run: Downloads kernel module, installs scripts, copies installer
- Subsequent Runs: Checks version tracker, reuses existing files if version matches
- Version Change: Automatically downloads new kernel module when TrueNAS updates
- Read-Only Detection: Automatically adapts to read-only
/usrfilesystem
Check service status:
systemctl status ugreen-diskiomon.service
systemctl status ugreen-netdevmon@<interface>.serviceView installer logs:
ls -lh /mnt/<POOL>/<PATH>/leds_controller/
cat /mnt/<POOL>/<PATH>/leds_controller/.versionForce module re-download:
rm /mnt/<POOL>/<PATH>/leds_controller/.version
/mnt/<POOL>/<PATH>/leds_controller/install_ugreen_leds_controller.sh --yesVerify module is loaded:
lsmod | grep led_ugreenCheck persistent directory paths in services:
grep ExecStart /etc/systemd/system/ugreen-*.serviceIf you have existing installation in system directories:
- Run the adapted installer with your preferred persistent directory option
- The script will automatically migrate your
/etc/ugreen-leds.confto the persistent directory - Service files are updated to reference the new persistent directory paths
- Old files in
/usr/binremain but are unused - Optionally remove old files:
rm -f /usr/bin/ugreen-* /lib/modules/*/extra/led-ugreen.ko
Your configuration is preserved: The installer detects existing /etc/ugreen-leds.conf and copies it to the persistent directory automatically.
- Full usage, configuration details, and troubleshooting: project Wiki
- Use
--dry-runto preview actions without changing the system - Configuration changes in
/etc/ugreen-leds.confpersist across reboots
Use at your own risk.
Tested and developed on a Ugreen DXP8800 Plus NAS.
Also confirmed working on a UGREEN DXP4800 with TrueNAS SCALE 25.04.2.5 (#6) (with Version 1.0 of the script)
The author is not responsible for damage caused by running this script.