mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
80 lines
2.6 KiB
YAML
80 lines
2.6 KiB
YAML
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
|