unifios-utilities icon indicating copy to clipboard operation
unifios-utilities copied to clipboard

Installation procedure for 2.4.27 for UDM/PRO bootscript

Open goldriver2 opened this issue 2 years ago • 33 comments

I tried to follow installation instruction but it seems that many changes as occured since the doc was updated the last time

First command to remove /etc/init.d/udm.sh does'nt exist

Wondering if I should continue with the rest of the process or anyway it won't work with 2.4.27

thanks

Here is the messages from installation UniFi Dream Machine Pro version 2.4.27 was detected Installing on-boot script... Failed to disable unit: Unit file udm-boot.service does not exist. Creating systemctl service file Enabling UDM boot... Created symlink /etc/systemd/system/multi-user.target.wants/udm-boot.service → /etc/systemd/system/udm-boot.service. UDM Boot Script installed

goldriver2 avatar Feb 23 '23 18:02 goldriver2

Yes, UDM 2.4.7 firmware brought many changes and it will take some time before everything is working. I am also waiting on a singular DEB file I can download and apply to UDM offline after factory reset.

ghost avatar Feb 23 '23 20:02 ghost

Yeah as it said in the patch notes.

Note: Any 3rd party modifications made to the OS of the console will be lost after the upgrade, proceed with caution if you modified your console's OS.

Its deleted all data for on_boot.

It also seems to have removed unifi-os command too!

TheWood1978 avatar Feb 26 '23 13:02 TheWood1978

I noticed the removal of the UniFi-os command set as well. What has replaced this? (Sorry if I'm missing an answer that has already been posted.)

SamErde avatar Feb 26 '23 20:02 SamErde

Hey. It looks to me like they have gone to a standard Linux build. I say this cos before ssh keys wouldn't take in the normal way. They had to be added in unifi-os. Now ya can ssh copy key directly to UDM and it now works same as any other Linux build.

TheWood1978 avatar Feb 26 '23 20:02 TheWood1978

There is a new build to be found that at least installs clean on my 2.4.27. link: https://unifi.boostchicken.io/udm-boot-2x_1.0.1_all.deb I simply installed as follows:

dpkg -i udm-boot-2x_1.0.1_all.deb
Selectdpkg -i udm-boot-2x_1.0.1_all.deb
Selecting previously unselected package udm-boot-2x.
(Reading database ... 95090 files and directories currently installed.)
Preparing to unpack udm-boot-2x_1.0.1_all.deb ...
Unpacking udm-boot-2x (1.0.1) ...
Setting up udm-boot-2x (1.0.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/udm-boot.service → /lib/systemd/system/udm-boot.serviceing previously unselected package udm-boot-2x.
(Reading database ... 95090 files and directories currently installed.)
Preparing to unpack udm-boot-2x_1.0.1_all.deb ...
Unpacking udm-boot-2x (1.0.1) ...
Setting up udm-boot-2x (1.0.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/udm-boot.service → /lib/systemd/system/udm-boot.service

and then enable...

systemctl enable udm-boot 

and hmm.. this actually fails I just noticed.. and I think I found why... there is an error in the command, and if I edit and remove the blank space it seems to work as intended... Here is a diff of what I changed

root@unify-dmp-01:/lib/systemd/system# diff udm-boot.service udm-boot.service.BAK
11c11
< ExecStart=bash -c 'mkdir -p /data/on_boot.d && find -L /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'\'
---
> ExecStart=bash - c 'mkdir -p /data/on_boot.d && find -L /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'\'

Then reload and start

systemctl daemon-reload
systemctl start udm-boot

and the on_boot.d is created.. I then did a reboot and it seems to work for me now.

m4n63 avatar Mar 23 '23 14:03 m4n63

Can confirm that @m4n63's method worked on v2.4.27 of UDMP, with the exception that the URL for the .deb package seems to be at https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb now.

stephanGarland avatar Apr 09 '23 15:04 stephanGarland

Upgraded to 2.5.17 today, and the /data/on_boot.d is retained, but the udm-boot-2x_1.0.1_all.deb is not automatically reinstalled after upgrade. Not a huge deal, I just reinstalled it manually, and applied the fix above again.

m4n63 avatar Apr 18 '23 16:04 m4n63

+1 for 2.5.17 and the above package installing after removing the errant space. Any ideas on where the /mnt/data/on_boot.d is now as the unifi-os shell isn't available any more

SGXander avatar Apr 18 '23 23:04 SGXander

+1 for 2.5.17 and the above package installing after removing the errant space. Any ideas on where the /mnt/data/on_boot.d is now as the unifi-os shell isn't available any more

The on_boot.d directory is directly under /data now.

m4n63 avatar Apr 19 '23 08:04 m4n63

+1 for 2.5.17 and the above package installing after removing the errant space. Any ideas on where the /mnt/data/on_boot.d is now as the unifi-os shell isn't available any more

The on_boot.d directory is directly under /data now.

Thanks for that. The directory doesn't exist though. I've made it and placed the same script I had before (just conditional dns forwarders) in there but not restarted to test it yet. Is the on-boot program simply looking for that dir or have I missed something resulting in it not being created?

SGXander avatar Apr 19 '23 08:04 SGXander

+1 for 2.5.17 and the above package installing after removing the errant space. Any ideas on where the /mnt/data/on_boot.d is now as the unifi-os shell isn't available any more

The on_boot.d directory is directly under /data now.

Thanks for that. The directory doesn't exist though. I've made it and placed the same script I had before (just conditional dns forwarders) in there but not restarted to test it yet. Is the on-boot program simply looking for that dir or have I missed something resulting in it not being created?

It gets created automatically when you fix the error in the command in this file as described in my post above.

m4n63 avatar Apr 19 '23 09:04 m4n63

not sure what's gone wrong there then. steps were:

cd /tmp
curl -L https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb -o udm-boot-2x_1.0.1_all.deb
dpkg -i udm-boot-2x_1.0.1_all.deb
cd /lib/systemd/system
vi udm-boot.service (remove errant space and save)
systemctl enable udm-boot
cd /data/
ls

I've made the folder manually and will try a restart later today to see if it works as intended. If so may be a bug?

SGXander avatar Apr 19 '23 09:04 SGXander

Install the .deb package Then amend the command in /lib/systemd/system/udm-boot.service to read as below: (there is a space to remove)

ExecStart=bash -c 'mkdir -p /data/on_boot.d && find -L /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''

remove these lines as well from the file as to handle errors better: Restart=on-failure RestartSec=5s

then reload: systemctl daemon-reload

and start systemctl start udm-boot

then the directory should be created if it does not already exist

so you probably missed the reload and start command

m4n63 avatar Apr 19 '23 09:04 m4n63

cd /tmp

should work after restart, or use the reload / start commands as detailed in the post above

m4n63 avatar Apr 19 '23 09:04 m4n63

ah looks like I did miss those out. Removed my dir and those restart lines from the service file then ran again and it made the dir for me. Thank you!

For anyone as daft as me here's my start-to-end:

cd /tmp
#download
curl -L https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb -o udm-boot-2x_1.0.1_all.deb
#install
dpkg -i udm-boot-2x_1.0.1_all.deb
#Remove restart lines
sed -i '/Restart=on-failure/d' /lib/systemd/system/udm-boot.service
sed -i '/RestartSec=5s/d' /lib/systemd/system/udm-boot.service
#correct exec line
sed -i 's/- c/-c/g' /lib/systemd/system/udm-boot.service
#enable reload and start
systemctl enable udm-boot
systemctl daemon-reload
systemctl start udm-boot

Will try a restart when finished with work for the day

SGXander avatar Apr 19 '23 09:04 SGXander

Has anyone tried this install on 3.0.20?

SGXander avatar May 02 '23 10:05 SGXander

I did the update from 2.5.17 -> 3.0.20 on my DMP today. Worked just as it did when I upgraded from 2.4.27 -> 2.5.17

steps:

  1. apply update
  2. reinstall .deb
  3. apply fix/changes to /lib/systemd/system/udm-boot.service
  4. exec these commands: systemctl daemon-reload systemctl start udm-boot

ping @SGXander

m4n63 avatar May 10 '23 09:05 m4n63

I did the update from 2.5.17 -> 3.0.20 on my DMP today. Worked just as it did when I upgraded from 2.4.27 -> 2.5.17

steps:

  1. apply update
  2. reinstall .deb
  3. apply fix/changes to /lib/systemd/system/udm-boot.service
  4. exec these commands: systemctl daemon-reload systemctl start udm-boot

ping @SGXander

Star thanks for confirming. Will give it a go tonight. Help.ui.com wont let you raise tickets without updating to the latest version but I rely on a DNS view for daytoday so can't stomach upgrades without being sure! Wish they'd add forwarders to the network app!

SGXander avatar May 10 '23 09:05 SGXander

Confirmed working. Actually /data/on-boot.d and my script inside the dir were still present after the upgrade but blatted and rerun anyway.

SGXander avatar May 10 '23 22:05 SGXander

Upgraded from 3.0.20 to 3.1.15 today, same procedure as last time ;-)

So far all seems to work fine.

m4n63 avatar Aug 25 '23 13:08 m4n63

I did the update from 2.5.17 -> 3.0.20 on my DMP today. Worked just as it did when I upgraded from 2.4.27 -> 2.5.17

steps:

  1. apply update
  2. reinstall .deb
  3. apply fix/changes to /lib/systemd/system/udm-boot.service
  4. exec these commands: systemctl daemon-reload systemctl start udm-boot

ping @SGXander

Can you please point me to the fix/changes referenced in step 3?

TIA.

dvhub avatar Aug 30 '23 03:08 dvhub

I did the update from 2.5.17 -> 3.0.20 on my DMP today. Worked just as it did when I upgraded from 2.4.27 -> 2.5.17 steps:

  1. apply update
  2. reinstall .deb
  3. apply fix/changes to /lib/systemd/system/udm-boot.service
  4. exec these commands: systemctl daemon-reload systemctl start udm-boot

ping @SGXander

Can you please point me to the fix/changes referenced in step 3?

TIA.

A few steps up ;-) or below again #Remove restart lines sed -i '/Restart=on-failure/d' /lib/systemd/system/udm-boot.service sed -i '/RestartSec=5s/d' /lib/systemd/system/udm-boot.service #correct exec line sed -i 's/- c/-c/g' /lib/systemd/system/udm-boot.service

m4n63 avatar Aug 30 '23 06:08 m4n63

also, make sure you install the latest .deb..

#download curl -L https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb -o udm-boot-2x_1.0.1_all.deb #install dpkg -i udm-boot-2x_1.0.1_all.deb

m4n63 avatar Aug 30 '23 06:08 m4n63

also, make sure you install the latest .deb..

#download curl -L https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb -o udm-boot-2x_1.0.1_all.deb #install dpkg -i udm-boot-2x_1.0.1_all.deb

Have the things from the sed lines above been fixed? Not looked at it yet will have an upgrade this weekend!

SGXander avatar Aug 30 '23 13:08 SGXander

No, the package in the link is still broken and need the fixes applied after install.

m4n63 avatar Aug 30 '23 15:08 m4n63

fair enough thanks for confirming. has anyone gone to 3.1.15 yet?

SGXander avatar Aug 30 '23 20:08 SGXander

fair enough thanks for confirming. has anyone gone to 3.1.15 yet?

Yes, it worked the same way as last time for me.

m4n63 avatar Aug 30 '23 21:08 m4n63

anyone got the .deb mirrored? I'm getting "failed to resolve /ipns/unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb: could not resolve name" from https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb

SGXander avatar Aug 30 '23 22:08 SGXander

Also confirmed working on 3.1.15. Looks like this link works so updated the commands below:

cd /tmp
#download
#old: curl -L https://unifi.boostchicken.io/udm-boot-v2+/udm-boot-2x_1.0.1_all.deb -o udm-boot-2x_1.0.1_all.deb
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 udm-boot-2x_1.0.1_all.deb
#install
dpkg -i udm-boot-2x_1.0.1_all.deb
#Remove restart lines
sed -i '/Restart=on-failure/d' /lib/systemd/system/udm-boot.service
sed -i '/RestartSec=5s/d' /lib/systemd/system/udm-boot.service
#correct exec line
sed -i 's/- c/-c/g' /lib/systemd/system/udm-boot.service
#create dirs
mkdir /mnt/data
mkdir /mnt/data/on_boot.d
#enable reload and start
systemctl enable udm-boot
systemctl daemon-reload
systemctl start udm-boot

Although it did not create the directory under /mnt this time I had to mkdir /mnt/data and mkdir /mnt/data/on_boot.d which I've added above too.

SGXander avatar Aug 30 '23 22:08 SGXander

Hey, @SGXander @m4n63 ! Are you sure this space thing I still there?

I've just downloaded the file with the link below and I don't see this error

I did dpkg -c udm-boot-2x_1.0.1_all.deb and I get this Exec command

ExecStart=bash -c 'mkdir -p /data/on_boot.d && find -L /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

It seems totally fine.

Please, let me know if I'm looking at the wrong file

No, the package in the link is still broken and need the fixes applied after install.

ddkedr avatar Sep 10 '23 20:09 ddkedr