|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a bug in our fstab layout generation,
currently we fail to generate the complete fstab layout, so /etc/fstab
in any newly deployed or upgraded baserocks contains just:
# Morph default system layout
UUID=<uuid> / btrfs defaults,rw,noatime 0 1
This is actually a pretty bad problem because it breaks
system-version-manager, since systemd creates a btrfs subvolume and
mounts it to /var/lib/machines if /var/lib/machines doesn't already
exist[1]. As a result system-version-manager when asked to remove an image
will fail to do so, since it will fail to remove the /run subvolume
because of the subvolume created at /run/var/lib/machines. The result is
a partially removed image that cannot be removed with system-version-manager.
The fstab layout we use currently:
UUID=<uuid> / btrfs defaults,rw,noatime 0 1
UUID=<uuid> /var btrfs subvol=/state/var,defaults,rw,noatime 0 2
UUID=<uuid> /opt btrfs subvol=/state/opt,defaults,rw,noatime 0 2
UUID=<uuid> /srv btrfs subvol=/state/srv,defaults,rw,noatime 0 2
UUID=<uuid> /root btrfs subvol=/state/root,defaults,rw,noatime 0 2
UUID=<uuid> /home btrfs subvol=/state/home,defaults,rw,noatime 0 2
ensures that anything created under /var goes into a shared /state/var subvolume,
so when systemd creates its 'machines' subvolume it will be under state/
which doesn't cause any problems when we try to remove a system.
To reproduce, deploy an upgrade to your machine, reboot into the upgraded
system, when you cat /etc/fstab you should see only one entry, mounting /.
Now switch back to the previous image with,
system-version-manager set-default <previous image name>
reboot
remove the newly deployed image with,
system-version-manager remove <upgraded image name>
after some time this will fail with an error message similar to this:
Removing system: faultylayout
Delete subvolume (no-commit): '/tmp/tmp1gdIL2/systems/faultylayout/run'
ERROR: cannot delete '/tmp/tmp1gdIL2/systems/faultylayout/run' - Directory not empty
Delete subvolume (no-commit): '/tmp/tmp1gdIL2/systems/faultylayout/orig'
Traceback (most recent call last):
File "/usr/bin/system-version-manager", line 421, in <module>
SystemVersionManager(sys.argv, mount_dir).run()
File "/usr/bin/system-version-manager", line 401, in run
self.cmd_remove(args.system_name)
File "/usr/bin/system-version-manager", line 363, in cmd_remove
shutil.rmtree(system_root)
File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "/usr/lib/python2.7/shutil.py", line 256, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "/usr/lib/python2.7/shutil.py", line 254, in rmtree
os.rmdir(path)
OSError: [Errno 1] Operation not permitted: '/tmp/tmp1gdIL2/systems/faultylayout/run/var/lib/machines
[1]: http://cgit.freedesktop.org/systemd/systemd/commit/?id=113b3fc1a8061f4a24dd0db74e9a3cd0083b2251
Change-Id: I9c160d1fdd75fbbf9a3336d1ce35e4ce8ed7787d
|