unifi-utilities / unifios-utilities

A collection of enhancements for UnifiOS based devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UXG-Pro - udm boot fails to start due to invalid characters in udm-boot.service

Firstyear opened this issue · comments

Describe the bug
When running systemctl start udm-boot, the service fails to start.

The error is as follows:

Oct 09 13:53:59 uxg-pro-bne1netblackhatsnetau systemd[1]: /lib/systemd/system/udm-boot.service:11: Executable name contains special characters: mkdir -p /mnt/data/on_boot.d && find -L /mnt/data/on_boot.d -mindepth 1 -maxdepth 1 -type f -print0 | sort -z | xargs -0 -r -n 1 -- sh -c 'if test -x "$0"; then echo "udm-boot.service: running $0"; "$0"; else case "$0" in *.sh) echo "udm-boot.service: sourcing $0"; . "$0";; *) echo "udm-boot.service: ignoring $0";; esac; fi'
Oct 09 13:53:59 uxg-pro-bne1netblackhatsnetau systemd[1]: udm-boot.service: Unit configuration has fatal error, unit will not be started.

To Reproduce
Steps to reproduce the behavior:

  1. Follow https://github.com/unifi-utilities/unifios-utilities/blob/main/on-boot-script/README.md
  2. Fails to enable/start the service.

Expected behavior
udm-boot to start.

Screenshots
N/A

UDM Information

  • UXG Pro
  • Firmware Version: 3.1.11
  • Controller Version: 7.4.162

Additional context

# systemctl --version
systemd 247 (247.3-7+deb11u4)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified
# cat /lib/systemd/system/udm-boot.service
[Unit]
Description=Run On Startup UDM
Wants=network-online.target
After=network-online.target
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s
ExecStart='mkdir -p /mnt/data/on_boot.d && find -L /mnt/data/on_boot.d -mindepth 1 -maxdepth 1 -type f -print0 | sort -z | xargs -0 -r -n 1 -- sh -c '\''if test -x "$0"; then echo "%n: running $0"; "$0"; else case "$0" in *.sh) echo "%n: sourcing $0"; . "$0";; *) echo "%n: ignoring $0";; esac; fi'\'
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

Per internet research I removed the ' ' between execstart and the = to attempt to resolve.

It may be simpler to break out this script to a seperate .sh file and thene have ExecStart trigger it rather than relying on the shell embedding in the unit file.

It also looks like https://github.com/unifi-utilities/unifios-utilities/tree/main the readme shows:

[on-boot-script-2.x](https://github.com/unifi-utilities/unifios-utilities/tree/main#on-boot-script-2x)
Do this first. Enables init.d style scripts to run on every boot of your UDM. Includes examples to run wpa-supplicant/eap-proxy and/or ntop-ng on startup. Follow this [readme](https://github.com/unifi-utilities/unifios-utilities/blob/main/on-boot-script/README.md).

But if you look the readme it points to is the older boot script.

Could the method by fdcastel for a UDM-PRO installation work for your UXG-PRO #523 (comment)

# Download package
curl -L https://github.com/unifi-utilities/unifios-utilities/raw/main/on-boot-script-2.x/packages/udm-boot-2x_1.0.1_all.deb -o /tmp/udm-boot-2x_1.0.1_all.deb

# Install it
dpkg -i /tmp/udm-boot-2x_1.0.1_all.deb

# Patches for 'udm-boot-2x_1.0.1_all.deb' package
sed -i 's/Description=Run On Startup UDM 2.x/Description=Run On Startup UDM 3.x/g' /lib/systemd/system/udm-boot.service
sed -i '/Restart=on-failure/d' /lib/systemd/system/udm-boot.service
sed -i '/RestartSec=5s/d' /lib/systemd/system/udm-boot.service

# Enable reload and start
systemctl enable udm-boot
systemctl daemon-reload
systemctl start udm-boot