1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
summary: Check that mounts are mounted correctly if snapd gets activated
details: |
When booting with basic.target for example, snap mounts are not
mounted. But sockets.target is active, which means snapd.socket
is. If a snap command is emitted, then snapd will start. But it
expects mounts to be there.
systems: [ubuntu-2*]
prepare: |
cat <<\EOF >/etc/default/grub.d/99-basic.cfg
# Use basic.target as default target
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} systemd.unit=basic.target"
# spread will need to reconnnect to ssh
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} systemd.wants=ssh.service"
# ... through network
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} systemd.wants=systemd-networkd.service"
# .. as a non-system user
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} systemd.wants=systemd-user-sessions.service"
EOF
update-grub
restore: |
if [ "${SPREAD_REBOOT}" = 0 ]; then
rm -f /etc/default/grub.d/99-basic.cfg
update-grub
if MATCH 'systemd[.]unit=basic[.]target' </proc/cmdline; then
REBOOT
fi
fi
debug: |
systemctl list-units --all 'snap-*.mount' || true
systemctl list-units --all 'snapd.*' || true
systemctl list-unit-files --all 'snap-*.mount' || true
systemctl list-unit-files --all 'snapd.*' || true
ls /etc/systemd/system/default.target.wants || true
ls /etc/systemd/system/default.target.requires || true
execute: |
if [ "${SPREAD_REBOOT}" = 0 ]; then
REBOOT
else
# Wait for systemd to have finished booting
systemctl --wait is-system-running | MATCH '(running|degraded)'
MATCH 'systemd[.]unit=basic[.]target' </proc/cmdline
# basic.target and snapd.socket should be active
systemctl is-active basic.target
systemctl is-active snapd.socket
# ... but snapd.service and multi-user.target should not.
not systemctl is-active multi-user.target
not systemctl is-active snapd.service
# Let's emit a snap command. That will start snapd.
snap list
# multi-user should still be inactive but snapd active.
not systemctl is-active multi-user.target
systemctl is-active snapd.service
# the mounts should be active
systemctl show --all --state=loaded -p ActiveState 'snap-*.mount' | tee states.txt | MATCH 'ActiveState=active'
NOMATCH 'ActiveState=inactive' <states.txt
# bonus, we check we did not cheat, nothing should be installed to default.target
not [ -e /etc/systemd/system/default.target.wants/snap-*.mount ]
not [ -e /etc/systemd/system/default.target.requires/snap-*.mount ]
fi
|