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

UniFi OS - Dream Machines 3.x #523

Open
pedropombeiro opened this issue Mar 23, 2023 · 76 comments
Open

UniFi OS - Dream Machines 3.x #523

pedropombeiro opened this issue Mar 23, 2023 · 76 comments

Comments

@pedropombeiro
Copy link
Contributor

pedropombeiro commented Mar 23, 2023

Ubiquiti recently made 3.0.19 available in EA at https://community.ui.com/releases/UniFi-OS-Dream-Machines-3-0-19/aae685bb-4b96-4016-9125-29e57d7f2844

Known aspects of 3.x

  • /data is preserved in the upgrade, but udm-boot_1.0.7_all.deb needs to be installed again;
  • ssh-proxy is not present in 3.x, but manual install runs correctly;
  • This release has a kernel which is compiled without CONFIG_BPF_SYSCALL (tracked in Error when trying to run pihole container on UDM SE #510), meaning podman cannot run on it without a custom kernel;
  • The /etc/apt/sources.list is still pointing to stretch. It now points to bullseye.

UPDATE: I've started a discussion at https://github.com/orgs/unifi-utilities/discussions/564 to get some feedback on how the migration to 3.x went for the more adventurous users among us.

@boostchicken
Copy link
Member

use udm-boot-2x, it does not use ssh-proxy

@boostchicken
Copy link
Member

Did you compain to Ubi regarding apt not pointing at bullseye?

@mabunixda
Copy link
Collaborator

Yeah just dropped that info on the UI discussion

@boostchicken
Copy link
Member

I havve requested the kernel sources for 3.0.19, lets see how long it takes

@marco3181
Copy link

marco3181 commented Mar 23, 2023

Hello,
For the podman problem, there is this message : #510 (comment)
Seems that we can replace it with systemd-nspawn.

@marco3181
Copy link

@mabunixda : after your message on ui forum, rekoil says that his sources are pointing at bullseye. Maybe EA problem

@mabunixda
Copy link
Collaborator

I'd prefer a common solution that is backwards compatible about podman/docker 🤔

@marco3181 Yeah donot know ... could be EA stuff yeah

@operinko
Copy link

My /etc/apt/sources.list is properly pointing to bullseye (and have been since the start). I updated only a few hours after 3.x landed for UDM Pro in EA.

@spali
Copy link
Contributor

spali commented Mar 24, 2023

Mine too (updates within minutes after EA announcement:

root@udmp:~# cat /etc/apt/sources.list
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb http://deb.debian.org/debian/ bullseye-backports main
deb http://security.debian.org/debian-security bullseye-security main contrib non-free

@mabunixda
Copy link
Collaborator

Fixed it on my installation - might also be an old EA update that did not change this definitions...

@boostchicken
Copy link
Member

See my update here

So I have not upgraded yet, but on 2.5x is overlayfs working, I expect it will work on 3 as well. So the disk space issue is now fixed @peacey

I am pretty sure I can get podman running on the UDMSE. See BPF is used for security lockdown on syscalls. We are always root anyways so it doesnt matter. I am going to drop seccomp and apparmor from the UDMP-UDMSE build and edit configs accordingly and I think that will get you in business.

Also, they new podman builds come with crun, if you want to use it. It's much better on resources. Uses less memory, and executes faster

Also, netavark is built and in the latest zips as well. This is a replacement for CNI which is now deprecated. It has cool things like macvlan dhcp working, but its not zero effort to migrate your networks, syntax of the files is quite different.

I would move to netavark ASAP. It makes containers much much much faster and much less latent on the network. It is written in Rust instead of Go (much like crun). I also included the dhcp-client-proxy if anyone wants to macvlan dhcp working.

I am not sure when I can move to 3. If someone would volunteer to test my new build for 3 build with the mods above I'll crank it out asap that would be awesome.

](#510 (comment))

@boostchicken
Copy link
Member

systemd-nspawn

Yeah that works for the short term, I think I can get podman working see above. It's really just a matter of pulling anything bpf related. Thats all for rootless containers and we don't have to worry about it. Also make sure you do the fix for the disk space when using VFS

@boostchicken
Copy link
Member

You know what it just dawned on the current builds should work fine on the latest 3. You just need to edit /usr/share/containers/seccomp.json and disallow any bpf syscalls, BOOM.

Beyound that you can just do this --security-opt=seccomp=unconfined in your podman command and it wont call bpf at all, no security stuff happening.

@boostchicken
Copy link
Member

New builds coming out now with a fixxed seccomp.json that removevs bpf from the allows, also fixes some registry issues

@boostchicken
Copy link
Member

Grab the two latest builds here if ipfs is being a shit head

https://github.com/unifi-utilities/unifios-utilities/actions

@peacey
Copy link
Contributor

peacey commented Mar 25, 2023

You know what it just dawned on the current builds should work fine on the latest 3. You just need to edit /usr/share/containers/seccomp.json and disallow any bpf syscalls, BOOM.

Beyound that you can just do this --security-opt=seccomp=unconfined in your podman command and it wont call bpf at all, no security stuff happening.

No bueno @boostchicken, it still doesn't work with these modification and your new build. Still same issue with BPF error, unfortunately.

@sidprax
Copy link

sidprax commented Mar 25, 2023

Yes, same issue and I was wondering if I did something wrong! I also started getting warning for namespace:
WARN[0000] Failed to read current user namespace mappings

@SSJPKXL
Copy link

SSJPKXL commented Mar 26, 2023

UDM Boot remote script still works fine. Firmware 3.X comes with DNSCrypt-Proxy service already pre-installed natively, which is a great replacement for simpe local DNS servers and doesn't require Podman!

@georgeboot
Copy link

Firmware 3.X comes with DNSCrypt-Proxy service already pre-installed natively, which is a great replacement for simpe local DNS servers and doesn't require Podman!

That's quite interesting! Wondering if I can get that to work with my blocklist (https://oisd.nl). I only use porman for Adguard, so this looks like a nice workaround.

@operinko
Copy link

Firmware 3.X comes with DNSCrypt-Proxy service already pre-installed natively, which is a great replacement for simpe local DNS servers and doesn't require Podman!

That's quite interesting! Wondering if I can get that to work with my blocklist (https://oisd.nl). I only use porman for Adguard, so this looks like a nice workaround.

Absolutely can be.
https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Public-blocklist & https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Combining-Blocklists

You'll need to trigger the generate-domains-blocklist.py with your configs during cron and possibly reload dnscrypt-proxy afterwards.

@georgeboot
Copy link

georgeboot commented Mar 27, 2023

and possibly reload dnscrypt-proxy afterwards.

From the UDM, i can use it via dig google.com @127.0.2.1 and that works. However, how do I configure this DNS to listen on the UDM's internal IP, instead of dnsmasq? Because currently it's only listening on 127.0.2.1 and thats no routable from my subnets.

@SSJPKXL
Copy link

SSJPKXL commented Mar 27, 2023

I also need specific instructions on how to make DNSCrypt-Proxy the main DNS resolver for UDM for WAN and for LAN.

I think DNSCrypt-Proxy is normally configured via a TOML file, but UDM firmware 3.X uses SystemD, which is listed in DNSCrypt-Proxy manual as a non-standard way of making it work. So... Still need specific instructions.

@paskal
Copy link

paskal commented Apr 1, 2023

I've followed @peacey's https://github.com/peacey/unifios-utilities/tree/nspawn/nspawn-container instructions to make nspawn containers replacement work for me. I created an Alpine nspawn container instead of Debian (5Mb instead of 300+, and it takes seconds to bootstrap) using https://gist.github.com/sfan5/52aa53f5dca06ac3af30455b203d3404#file-alpine-container-sh with replacing x86 in text with aarch64. I didn't do any setup with passwd and so on, the container just works.

With installing the multicast package from the community repo within alpine, I've got multicast working for my Sonos in a separate VLAN with such nspawn config for the container (called /etc/systemd/nspawn/alpine-multicast.nspawn in my case):

[Exec]
Boot=on
Capability=all
Parameters=multicast-relay.py --interfaces br0 br4 --foreground

[Network]
Private=off
VirtualEthernet=off
ResolvConf=off

@gatesry
Copy link
Contributor

gatesry commented Apr 1, 2023

@paskal - An on boot script also works to just call the python script directly.

@Stealthii
Copy link
Contributor

@gatesry do you have an example?

@gatesry
Copy link
Contributor

gatesry commented Apr 1, 2023

@Stealthii For sure!

#!/bin/sh

/usr/bin/python3 /data/custom/multicast-relay/multicast-relay.py --interfaces br0 br20 br30

@Stealthii
Copy link
Contributor

Thanks @gatesry! I'd no idea that the script was that simple all the dependencies were available in the UDM environment. No real need for a container.

@SSJPKXL
Copy link

SSJPKXL commented Apr 1, 2023

Is it possible to make the on-boot script load sooner? I think it is set to "After/Wants=network-online.target". It loads my scripts like custom IPTables after UDM makes network connections. I need my custom rules to load before such connections happen. With old UniFi-OS 1.X firmware, booting sequence was stricter, I think.

FYI, there is no more need for SSH on-boot scripts. Once authorized_keys file is made, it persists after reboots on its own.

@ausfestivus
Copy link

ausfestivus commented Sep 3, 2023

I found the correct string to use in the systemd unit file for the udm-boot.service.

ExecStart=bash -c 'mkdir -p ${DATA_DIR}/on_boot.d && find -L ${DATA_DIR}/on_boot.d -mindepth 1 -maxdepth 1 -type f -print0 | sort -z | xargs -0 -r -n 1 -- bash -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\''

Full unit file is as follows:

[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=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 -- bash -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

@fdcastel
Copy link

fdcastel commented Sep 25, 2023

For reference. Installed today in a UDM-PRO running 3.1.16 with:

# 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

Everything is working fine. Except for a minor bump I hit with ppp interfaces and network availability: #567

@bruvv
Copy link
Contributor

bruvv commented Sep 25, 2023

@fdcastel does not work on my UDM v3.1.16

# systemctl status udm-boot.service
● udm-boot.service - Run On Startup UDM
     Loaded: loaded (/etc/systemd/system/udm-boot.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Mon 2023-09-25 19:11:11 CEST; 12s ago
        CPU: 13.433s

Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:9bb61484bb07dd2a0582926f7faf12f7ffb2e193fc9b366438c4d590268098b3
Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:6afd91e12d00f0acf46a0663794806a3983cedf5087cbf9ee2068c80b8256e22
Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:15f67f31c2afc3853f803b54e5645f2ceef21c3b63199bd6670f71c0087cc5a5
Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:0bb78c3854f74738ff40ba8b65fe34cc59af60afab322d605b69c2fca47e8ed8
Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:0577ae6f826efe27b9a9dbb972eb0f56843c9f1cd14858d660c0a49daa9736b7
Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: start operation timed out. Terminating.
Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: Control process exited, code=killed, status=15/TERM
Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: Failed with result 'timeout'.
Sep 25 19:11:11 DreamMachineV systemd[1]: Failed to start Run On Startup UDM.
Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: Consumed 13.433s CPU time.

@fdcastel
Copy link

Sorry @bruvv but I have no idea what could possibly be wrong just looking at this log. We will probably need help from the script authors.

  • Did you run exactly all the steps I described above?

  • Do you remember of anything going wrong (any error messages?)

All I can suggest you for now is to uninstall the .deb package and try again.

If possible, post here the output of installation process.

@m4n63
Copy link

m4n63 commented Sep 25, 2023

@fdcastel does not work on my UDM v3.1.16


# systemctl status udm-boot.service

● udm-boot.service - Run On Startup UDM

     Loaded: loaded (/etc/systemd/system/udm-boot.service; enabled; vendor preset: enabled)

     Active: failed (Result: timeout) since Mon 2023-09-25 19:11:11 CEST; 12s ago

        CPU: 13.433s



Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:9bb61484bb07dd2a0582926f7faf12f7ffb2e193fc9b366438c4d590268098b3

Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:6afd91e12d00f0acf46a0663794806a3983cedf5087cbf9ee2068c80b8256e22

Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:15f67f31c2afc3853f803b54e5645f2ceef21c3b63199bd6670f71c0087cc5a5

Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:0bb78c3854f74738ff40ba8b65fe34cc59af60afab322d605b69c2fca47e8ed8

Sep 25 19:09:52 DreamMachineV bash[228831]: Copying blob sha256:0577ae6f826efe27b9a9dbb972eb0f56843c9f1cd14858d660c0a49daa9736b7

Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: start operation timed out. Terminating.

Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: Control process exited, code=killed, status=15/TERM

Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: Failed with result 'timeout'.

Sep 25 19:11:11 DreamMachineV systemd[1]: Failed to start Run On Startup UDM.

Sep 25 19:11:11 DreamMachineV systemd[1]: udm-boot.service: Consumed 13.433s CPU time.

Can it be one of the scripts in the startup folder that does not terminate timely?

EDIT: the package basically justs runs your scripts in the /data/on_boot.d folder in a sorted order. So if any of these times out it could well give that error.

EDIT2: also what file did you install? the output indicates an older version, mine reads:
udm-boot.service - Run On Startup UDM 2.x (notice the trailing 2.x)

@bruvv
Copy link
Contributor

bruvv commented Sep 25, 2023

Ooops indeed I already had a version installed, removed everything redid and it works. saidly I am running against errors with podman and zerotier.

@pedropombeiro
Copy link
Contributor Author

saidly I am running against errors with podman and zerotier.

That is to be expected though, given 3.x doesn't support podman.

@fdcastel
Copy link

EDIT2: also what file did you install? the output indicates an older version, mine reads: udm-boot.service - Run On Startup UDM 2.x (notice the trailing 2.x)

@m4n63 Nice catch! I didn't see this.

@bruvv It seems you have installed the wrong package.

If you follow the same steps I did this should be:

● udm-boot.service - Run On Startup UDM 3.x

Note that mine says 3.x because one of the steps was literally to replace 2.x with 3.x: -- Yeah. I have O.C.D. 😄

sed -i 's/Description=Run On Startup UDM 2.x/Description=Run On Startup UDM 3.x/g' /lib/systemd/system/udm-boot.service

@SGXander
Copy link

For reference. Installed today in a UDM-PRO running 3.1.16 with:

# 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

Everything is working fine. Except for a minor bump I hit with ppp interfaces and network availability: #567

Working for 3.1.16 for me too. Has anyone successfully gone to 3.2.7?

@ausfestivus
Copy link

Has anyone successfully gone to 3.2.7?

I can confirm that the above snippet works on 3.2.7.

@pedropombeiro
Copy link
Contributor Author

Working for 3.1.16 for me too. Has anyone successfully gone to 3.2.7?

I upgraded and initially my Pi-hole container didn't start. I had to run machinectl enable and machinectl start. But that was all. It was probably something with the startup script and not really a problem with the upgrade though.

@fdcastel
Copy link

fdcastel commented Dec 14, 2023

Working for 3.1.16 for me too. Has anyone successfully gone to 3.2.7?

Tonight, my UDM-PRO was upgraded from 3.1.16 to 3.2.7. Unfortunately, udm-boot didn't survive the process.

  • Contents of /data/on_boot.d were preserved.

  • Service udm-boot was removed:

    # systemctl start udm-boot
    Failed to start udm-boot.service: Unit udm-boot.service not found.

A reinstall (following these steps) was needed to bring it back again.

Until we have a fix for this, I'd recommend keeping the Unifi OS Console away from auto-updates.

@jgrig472
Copy link

jgrig472 commented Dec 15, 2023

UDM nSpawn Setup.pdf
PiHole_Unbound Setup nSpawn.pdf
I upgraded mine tonight to 3.2.7 and was able to get everything back up and working fine. Took me about 10 minutes of reinstalling a couple broken packages and then ran through some of my documentation steps to get it back up and working. I've attached a PDF copy of my setup instructions for this. I had to meld the instructions out there together when we had podman go away. I also have separate instructions for setting up PiHole with nSpawn too that I've attached.

image

@kpr0th
Copy link
Contributor

kpr0th commented Dec 15, 2023

For whatever it's worth, my udm-boot service survived the upgrade from 3.1.16 to 3.2.7, on a UDMB. But I only use it to kick off a script on boot, that uses cron to re-schedule itself to run a couple times a day. And I had most recently installed it using this method:
curl -fsL "https://raw.githubusercontent.com/unifi-utilities/unifios-utilities/HEAD/on-boot-script/remote_install.sh" | /bin/sh

@achalker
Copy link

I think I've figured out the root cause of some of the issues people are having (in particular @bruvv and @m4n63 and maybe others).

I too followed the steps from @fdcastel several times, but noticed that the comments about being labeled "Run On Startup UDM 3.x" weren't there when doing a systemctl status udm-boot. That's when I also noticed that it was loading /etc/systemd/system/udm-boot.service NOT /lib/systemd/system/udm-boot.service (notice the /etc instead of /lib).

For some reason a previous version of the install script put things in /etc, and while dpkg was reinstalling stuff in /lib, the /etc version was still being used (and the /etc version seems to still be hardcoded in the remote_install.sh [FYI @boostchicken ])

So to get it working, all I had to do was to 'back out of everything I could':

rm /tmp/udm-boot-2x_1.0.1_all.deb
rm /etc/systemd/system/udm-boot.service
rm /etc/systemd/system/multi-user.target.wants/udm-boot.service
systemctl disable udm-boot
rm /lib/systemd/system/udm-boot.service

Then run the commands multiple people have already posted:

# 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

Previously, when I ran this last command it would sit forever and then give me a time out error. This time it completed nearly immediately. A systemctl status udm-boot shows it as active and most importantly has the "Run On Startup UDM 3.x" label.

Hope this helps some people!

@achalker
Copy link

Another minor issue I just discovered. Looks like I had one of the original podman versions of containers running, and as such I had the 04-container-common.sh script in my on_boot.d folder, which is supposed to set limits on podman container logs. However, with podman gone in unifi os 3+, that script generates an error, which cause the udm-boot service to fail and exit instead of exit and stay active. I wonder if this is also causing some of the weirdness / inconsistencies people are seeing? Bottom line is to check for various older scripts in on_boot.d folder and remove them. Also might want to make a comment about not needing this script anymore in the appropriate readme here: https://github.com/unifi-utilities/unifios-utilities/blob/main/container-common/README.md

@fdcastel
Copy link

fdcastel commented Dec 19, 2023

@achalker could you please provide the output for the following command on your UDM-PRO?

# find / | grep -F 'udm-boot' | grep -v -e '^/sys/fs/cgroup' | sort

Edit: Added | sort to the above command for easier comparisons.

This will list every file containing udm-boot on name, except for the ones found under /sys/fs/cgroup (which doesn't matter). Mine currently is:

/etc/systemd/system/multi-user.target.wants/udm-boot.service
/lib/systemd/system/udm-boot.service
/mnt/.rwfs/data/etc/systemd/system/multi-user.target.wants/udm-boot.service
/mnt/.rwfs/data/lib/systemd/system/udm-boot.service
/mnt/.rwfs/data/usr/share/doc/udm-boot-2x
/mnt/.rwfs/data/usr/share/doc/udm-boot-2x/copyright
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.list
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.md5sums
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.postinst
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.postrm
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.preinst
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.prerm
/mnt/.rwfs/data/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/udm-boot.service
/mnt/.rwfs/data/var/lib/systemd/deb-systemd-helper-enabled/udm-boot.service.dsh-also
/run/systemd/units/invocation:udm-boot.service
/usr/share/doc/udm-boot-2x
/usr/share/doc/udm-boot-2x/copyright
/var/lib/dpkg/info/udm-boot-2x.list
/var/lib/dpkg/info/udm-boot-2x.md5sums
/var/lib/dpkg/info/udm-boot-2x.postinst
/var/lib/dpkg/info/udm-boot-2x.postrm
/var/lib/dpkg/info/udm-boot-2x.preinst
/var/lib/dpkg/info/udm-boot-2x.prerm
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/udm-boot.service
/var/lib/systemd/deb-systemd-helper-enabled/udm-boot.service.dsh-also

@achalker
Copy link

@fdcastel happy to. Note I don't have a UDM-PRO, just a plain old UDM (I've got 3 of them are various relatives sites in fact). Keep in mind I did already manually remove the /etc/systemd/system/udm-boot.service file yesterday on all 3 of them, as well as the symlink in /etc/systemd/system/multi-user.target.wants/udm-boot.service

Here's the output you requested from the newest UDM, which appears to be identical to yours.

/etc/systemd/system/multi-user.target.wants/udm-boot.service
/lib/systemd/system/udm-boot.service
/mnt/.rwfs/data/lib/systemd/system/udm-boot.service
/mnt/.rwfs/data/etc/systemd/system/multi-user.target.wants/udm-boot.service
/mnt/.rwfs/data/usr/share/doc/udm-boot-2x
/mnt/.rwfs/data/usr/share/doc/udm-boot-2x/copyright
/mnt/.rwfs/data/var/lib/systemd/deb-systemd-helper-enabled/udm-boot.service.dsh-also
/mnt/.rwfs/data/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/udm-boot.service
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.list
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.postinst
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.postrm
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.preinst
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.prerm
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.md5sums
/usr/share/doc/udm-boot-2x
/usr/share/doc/udm-boot-2x/copyright
/var/lib/dpkg/info/udm-boot-2x.list
/var/lib/dpkg/info/udm-boot-2x.postinst
/var/lib/dpkg/info/udm-boot-2x.postrm
/var/lib/dpkg/info/udm-boot-2x.preinst
/var/lib/dpkg/info/udm-boot-2x.prerm
/var/lib/dpkg/info/udm-boot-2x.md5sums
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/udm-boot.service
/var/lib/systemd/deb-systemd-helper-enabled/udm-boot.service.dsh-also
/run/systemd/units/invocation:udm-boot.service
/tmp/udm-boot-2x_1.0.1_all.deb

Running this on the oldest UDM (which I did most of my original testing / setup on), the output is similar, but there are some differences:

/etc/systemd/system/multi-user.target.wants/udm-boot.service
/lib/systemd/system/udm-boot.service
/mnt/.rwfs/data/var/lib/systemd/deb-systemd-helper-enabled/udm-boot.service.dsh-also
/mnt/.rwfs/data/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/udm-boot.service
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.postinst
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.preinst
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.list
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.prerm
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.postrm
/mnt/.rwfs/data/var/lib/dpkg/info/udm-boot-2x.md5sums
/mnt/.rwfs/data/lib/systemd/system/udm-boot.service
/mnt/.rwfs/data/etc/systemd/system/multi-user.target.wants/udm-boot.service
/mnt/.rwfs/data/usr/share/doc/udm-boot-2x
/mnt/.rwfs/data/usr/share/doc/udm-boot-2x/copyright
/usr/share/doc/udm-boot-2x
/usr/share/doc/udm-boot-2x/copyright
/var/lib/dpkg/info/udm-boot-2x.postinst
/var/lib/dpkg/info/udm-boot-2x.preinst
/var/lib/dpkg/info/udm-boot-2x.list
/var/lib/dpkg/info/udm-boot-2x.prerm
/var/lib/dpkg/info/udm-boot-2x.postrm
/var/lib/dpkg/info/udm-boot-2x.md5sums
/var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/udm-boot.service
/var/lib/systemd/deb-systemd-helper-enabled/udm-boot.service.dsh-also
/persistent/dpkg/bullseye/actions/udm-boot
/tmp/udm-boot-2x_1.0.1_all.deb

@fdcastel
Copy link

fdcastel commented Dec 19, 2023

Here's the output you requested from the newest UDM, which appears to be identical to yours.

It is. Except for /tmp/udm-boot-2x_1.0.1_all.deb which should go away in the next few days. 👍

Running this on the oldest UDM (which I did most of my original testing / setup on), the output is similar, but there are some differences:

There are two differences:

  • /persistent/dpkg/bullseye/actions/udm-boot on yours
  • /run/systemd/units/invocation:udm-boot.service on mine

Unfortunately I don't have any UDM to inspect.

Anybody could chime in about these 2 files and tell us if this is the expected state on a UDM?

@SGXander
Copy link

SGXander commented Feb 2, 2024

From 3.1.16 to 3.2.9 and on_boot scripts weren't deleted... Confirmed working with 3.2.9 on UDM-Pro.

@mrk3767
Copy link

mrk3767 commented Feb 8, 2024

Also running into the podman issues. Is there a workaround for this? Trying to get ZeroTier running on my UDM.

@fdcastel
Copy link

Manually upgraded from 3.2.7 to 3.2.9. Unfortunately, once again, udm-boot didn't survive the process.

  • Contents of /data/on_boot.d were preserved.

  • Service udm-boot was removed:

    # systemctl start udm-boot
    Failed to start udm-boot.service: Unit udm-boot.service not found.

A reinstall (following these steps) was needed to bring it back again.

Until we have a fix for this, I'd recommend keeping the Unifi OS Console away from auto-updates.

@waffles0042
Copy link

Manually upgraded from 3.2.7 to 3.2.9. Unfortunately, once again, udm-boot didn't survive the process.

* Contents of `/data/on_boot.d` were preserved.

* Service `udm-boot` was removed:
  ```shell
  # systemctl start udm-boot
  Failed to start udm-boot.service: Unit udm-boot.service not found.
  ```

A reinstall (following these steps) was needed to bring it back again.

Until we have a fix for this, I'd recommend keeping the Unifi OS Console away from auto-updates.

Just thought I'd share that an abbreviated version of above linked 'recipe' has worked for me in my recent OS upgrade efforts:

systemctl enable udm-boot
systemctl daemon-reload
systemctl start udm-boot

@charkins
Copy link

I spent a little time digging into this yesterday. Unfortunately, I don't have a solution yet, but do have a pretty good understanding of why udm-boot is not surviving updates. I know that udm-boot used to survive firmware updates, but I don't have a udmpro running really old firmware and don't want to risk trying to downgrade that far, so I haven't determined what might have been different on the older firmwares.

Here is what I've figured out, which I thought might help if others also want to dig in...

TLDR;

Only these packages will be restored on firmware update:

DPKG_CACHE_UBNT_PKGS="unifi unifi-protect ulp-go unifi-access uid-agent unifi-drive unifi-innerspace unifi-connect unifi-talk"

ubnt-dpkg-cache/restore

When a package is installed (e.g. udm-boot-2x), a hook (/etc/dpkg/dpkg.cfg.d/020-ubnt-dpkg-cache) triggers execution of the /sbin/ubnt-dpkg-cache script, which is responsible for cacheing packages for restoring on firmware updates. In the default configuration, it will only cache packages these packages:

DPKG_CACHE_UBNT_PKGS="unifi unifi-protect ulp-go unifi-access uid-agent unifi-drive unifi-innerspace unifi-connect unifi-talk"

This behavior can be changed by adding DPKG_CACHE_ALL_PKG=yes to /etc/default/ubnt-dpkg-cache before the hook executes (i.e. before installing the udm-boot package). If we do so, then the package does get cached in /persistent/dpkg/bullseye/packages.

Unfortunately, this isn't enough. The /sbin/ubnt-dpkg-restore script only installs packages with an "install" action in /persistent/dpkg/bullseye/actions. The ubnt-dpkg-cache script creates the action file only for the DPKG_CACHE_UBNT_PKGS packages, regardless of the DPKG_CACHE_ALL_PKG setting.

I manually created the "install" action, hoping this would be enough:

echo "install" > /persistent/dpkg/bullseye/actions/udm-boot-2x

Unfortunately, I was thwarted again by the ubnt-dpkg-restore script also honoring the DPKG_CACHE_ALL_PKG setting. A firmware update overwrites /etc/default/ubnt-dpkg-cache, so when the restore script is executed after a firmware update, despite now having the cached package and an "install" action, it won't restore it because udm-boot-2x is not in DPKG_CACHE_UBNT_PKGS and DPKG_CACHE_ALL_PKG is unset.

Test Setup

To help others that have a udmpro that they can experiment with, here are the steps I used to facilitate repeated testing of the firmware update from v3.1.16 to v3.2.12.

I started with a udmpro fully updated to v3.2.12. I disconnected the WAN cable from the udmpro and am wired to a LAN port from my computer, which is also connected to internet via wifi. This ensures that firmware will NOT update during the initial setup wizard!

I downloaded copies of the the v3.1.16 and v3.2.12 firmwares on my laptop using the download links from the corresponding releases posts:

curl -o udmpro-v3.1.16.bin https://fw-download.ubnt.com/data/unifi-dream/84e6-UDMPRO-3.1.16-54b0d2b8-e966-4dbf-973e-bbc84c58ce47.bin

curl -o udmpro-v3.2.12.bin https://fw-download.ubnt.com/data/unifi-dream/b1a0-UDMPRO-3.2.12-24a7e106-d7e6-4c63-aefa-046c7eaf5a8e.bin

Factory Reset to v3.1.16

The udmpro can be downgraded to v3.1.16 by first scp'ing the firmware to the udmpro:

scp udmpro-v3.1.16.bin root@192.168.1.1:/tmp/fwupdate.bin

Then from the udmpro, apply the firmware update:

ubnt-systool fwupdate /tmp/fwupdate.bin

After the update completes, hold the hardware reset button down to force a factory reset.

The setup wizard will allow you to complete an offline setup. Enable ssh and set a password and you have a fresh v3.1.16 udmpro to test with.

Update to v3.2.12

After installing udm-boot and making any other tweaks to try and get it to survive the firmware update, the update can be applied in the same manner as v3.1.16 (without the factory reset). First scp the firmware to the udmpro:

scp udmpro-v3.2.12.bin root@192.168.1.1:/tmp/fwupdate.bin

Then from the udmpro, apply the firmware update:

ubnt-systool fwupdate /tmp/fwupdate.bin

After confirming the failure to preserve udm-boot, repeat the downgrade / factory reset to v3.1.16 to try again!

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