Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation procedure for 2.4.27 for UDM/PRO bootscript #501

Open
goldriver2 opened this issue Feb 23, 2023 · 33 comments
Open

Installation procedure for 2.4.27 for UDM/PRO bootscript #501

goldriver2 opened this issue Feb 23, 2023 · 33 comments

Comments

@goldriver2
Copy link

goldriver2 commented Feb 23, 2023

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

@ghost
Copy link

ghost commented Feb 23, 2023

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.

@TheWood1978
Copy link

TheWood1978 commented Feb 26, 2023

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!

@SamErde
Copy link
Contributor

SamErde commented Feb 26, 2023

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.)

@TheWood1978
Copy link

TheWood1978 commented Feb 26, 2023

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.

@m4n63
Copy link

m4n63 commented Mar 23, 2023

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.

@stephanGarland
Copy link

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.

@m4n63
Copy link

m4n63 commented Apr 18, 2023

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.

@SGXander
Copy link

+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

@m4n63
Copy link

m4n63 commented Apr 19, 2023

+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.

@SGXander
Copy link

+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?

@m4n63
Copy link

m4n63 commented Apr 19, 2023

+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.

@SGXander
Copy link

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?

@m4n63
Copy link

m4n63 commented Apr 19, 2023

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
Copy link

m4n63 commented Apr 19, 2023

cd /tmp

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

@SGXander
Copy link

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
Copy link

SGXander commented May 2, 2023

Has anyone tried this install on 3.0.20?

@m4n63
Copy link

m4n63 commented May 10, 2023

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

@SGXander
Copy link

SGXander commented May 10, 2023

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
Copy link

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

@m4n63
Copy link

m4n63 commented Aug 25, 2023

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

So far all seems to work fine.

@dvhub
Copy link

dvhub commented Aug 30, 2023

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.

@m4n63
Copy link

m4n63 commented Aug 30, 2023

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
Copy link

m4n63 commented Aug 30, 2023

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

@SGXander
Copy link

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!

@m4n63
Copy link

m4n63 commented Aug 30, 2023

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

@SGXander
Copy link

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

@m4n63
Copy link

m4n63 commented Aug 30, 2023

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

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

@SGXander
Copy link

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
Copy link

SGXander commented Aug 30, 2023

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.

@ddkedr
Copy link

ddkedr commented Sep 10, 2023

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.

@herrep
Copy link

herrep commented Sep 20, 2023

@SGXander wrote:

Also confirmed working on 3.1.15. Looks like this link works so updated the commands below:
#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

I am still on UDMP firmware 2.5.17 and downloaded udm-boot with curl as shown above. However, I failed to install udm-boot:

root@UDMPRO:/tmp# dpkg -i udm-boot-2x_1.0.1_all.deb
dpkg: error: error executing hook '/usr/bin/systemd-cat -t ubnt-dpkg-status /sbin/ubnt-dpkg-status-pre', exit code 256

I am not familiar with the specialities of the linux system behind UDMP. I wonder whether 100% run partition is the root cause for the above problem:

root@UDMPRO:/run# df -k
Filesystem                        1K-blocks    Used Available Use% Mounted on
udev                                2016856       0   2016856   0% /dev
tmpfs                                404104  404104         0 100% /run
/dev/disk/by-partlabel/root         1998672 1751016    126416  94% /boot/firmware
/dev/loop0                           892672  892672         0 100% /mnt/.rofs
/dev/disk/by-partlabel/overlay      9822100 3398648   5904796  37% /mnt/.rwfs
overlayfs-root                      9822100 3398648   5904796  37% /
/dev/disk/by-partlabel/log           999320  213656    716852  23% /var/log
/dev/disk/by-partlabel/persistent   1998672   28424   1849008   2% /persistent
tmpfs                               2020516       4   2020512   1% /dev/shm
tmpfs                                  5120       0      5120   0% /run/lock
tmpfs                               2020516       0   2020516   0% /sys/fs/cgroup
tmpfs                               1010260    4160   1006100   1% /tmp
tmpfs                                 16384       0     16384   0% /var/log/ulog
tmpfs                                 65536       0     65536   0% /var/opt/unifi/tmp

Does anyone has a hint as how to further proceed to install udm-boot?

Thanks and best regards,
Peter

@fdcastel
Copy link

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

No. It seems this was fixed in this commit on Feb 22.

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

Same here.

@fdcastel
Copy link

fdcastel commented Sep 25, 2023

For reference. Installed on-boot-script-2.x today in a UDM-PRO running 3.1.16 following these steps.

Edit: moved actual steps to more appropriate issue related to UDM-PRO 3.0.

(this issue is for 2.4.x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants