-
-
Notifications
You must be signed in to change notification settings - Fork 440
Description
Describe the bug
A few years back I installed the nspawn-container script on my UDR and things have been working mostly without issues. Unfortunately I sometimes run into the following error:
root@UDR:~# apt update
Hit:1 https://security.debian.org/debian-security bullseye-security InRelease
Hit:2 https://deb.debian.org/debian bullseye InRelease
Hit:3 https://deb.debian.org/debian bullseye-updates InRelease
Hit:4 https://deb.debian.org/debian bullseye-backports InRelease
Hit:5 https://apt.artifacts.ui.com bullseye InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
30 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@UDR:~# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
systemd-container : Depends: systemd (= 247.3-7+deb11u1) but 247.3-7+deb11u6 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
From my research it appears that this happens because the systemd version does not match the systemd-container version anymore. Once the system is in this state automatic updates for applications stop working and you have to manually run apt --fix-broken install.
The 0-setup-system.sh script appears to automatically install systemd-container on startup, so perhaps the dpkg commands trigger the versions being out of sync? I did some ChatGPT-foo because my understanding of APT is very limited and for a while the following /etc/apt/preferences.d/systemd-container fixed the issue:
Package: systemd systemd-container libnss-mymachines
Pin: version *
Pin-Priority: 1001This worked while the OS version was unchanged, but it broke again when I upgraded Unifi OS (since it wipes the /etc/apt/preferences.d folder). Would appreciate any insights!
In 0-setup-system.sh I see that there is an attempt to use apt -y install systemd-container debootstrap, but it then falls back to dpkg -i /data/custom/dpkg/*.deb:
#!/bin/bash
# This script installs systemd-container if it's not installed.
# Also links any containers from /data/custom/machines to /var/lib/machines.
if ! dpkg -l systemd-container | grep ii >/dev/null; then
if ! apt -y install systemd-container debootstrap; then
yes | dpkg -i /data/custom/dpkg/*.deb
fi
fi
mkdir -p /var/lib/machines
for machine in $(ls /data/custom/machines/); do
if [ ! -e "/var/lib/machines/$machine" ]; then
ln -s "/data/custom/machines/$machine" "/var/lib/machines/"
machinectl enable $machine
machinectl start $machine
fi
doneThe versions in /data/custom/dpkg appear to match the error:
root@UDR:/data/on_boot.d# ls /data/custom/dpkg/
arch-test_0.17-1_all.deb debootstrap_1.0.123+deb11u1_all.deb libnss-mymachines_247.3-7+deb11u1_arm64.deb systemd-container_247.3-7+deb11u1_arm64.deb
Would doing an apt update before the apt install fix the issue? After a system upgrade I don't think the package cache is present yet, so it likely falls back to the old .deb and triggers the failure?
To Reproduce
Steps to reproduce the behavior:
- Perform a Unifi OS update
apt update && apt upgrade- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
UDM Information
- Variant: UDR
- Firmware Version: 4.2.12 (but happens for every update)
- Controller Version: not sure
Additional context
Add any other context about the problem here.