OSInside / kiwi

KIWI - Appliance Builder Next Generation
https://osinside.github.io/kiwi
GNU General Public License v3.0
300 stars 152 forks source link

kiwi 10 fails to umount some subvolumes #2529

Closed lnussel closed 5 months ago

lnussel commented 5 months ago

Problem description

https://build.opensuse.org/package/live_build_log/openSUSE:Factory/openSUSE-MicroOS:kvm-and-xen-sdboot/images/x86_64

Has errors like this:

[  104s] [ DEBUG   ]: 16:21:35 | EXEC: [umount /var/tmp/kiwi_volumes.smcpb8p1]
[  104s] [ DEBUG   ]: 16:21:35 | EXEC: Failed with stderr: umount: /var/tmp/kiwi_volumes.smcpb8p1: target is busy.
[  104s] , stdout: (no output on stdout)
[  104s] [ WARNING ]: 16:21:35 | 0 umount of /var/tmp/kiwi_volumes.smcpb8p1 failed with: umount: stderr: umount: /var/tmp/kiwi_volumes.smcpb8p1: target is busy.
[  104s] , stdout: (no output on stdout)

That does not happen with python3-kiwi-9.25.22-2.2

Comparing the logs one can see that the new version does not umount certain subvolume underneath /@/.snapshots/1/snapshot, eg there's a a line

[   74s] [ DEBUG   ]: 12:11:46 | EXEC: [mount -o subvol=@/home /dev/loop0p3 /var/tmp/kiwi_volumes.tis_hfxv/@/.snapshots/1/snapshot/home]

but no matching umount. In kiwi9 it did umount.

Steps to reproduce the behaviour

Build https://build.opensuse.org/package/show/openSUSE:Factory/openSUSE-MicroOS using profile kvm-and-xen-sdboot Reproducible locally.

OS and Software information

lnussel commented 5 months ago

commit a39a19b35f22953eebd8520109a81155d18d6e80 does something to the umounting

schaefi commented 5 months ago

I think related to the changes with regards to context managers. I'll take a look

schaefi commented 5 months ago

@lnussel the problem is, I cannot reproduce this. We have a MicroOS integration test here:

and neither the standard nor the encrypted variant shows the busy states. Also a local build umounts correctly. Can you point me to a reproducer example please. Thanks

lnussel commented 5 months ago

the one I linked above. It uses a custom boot loader setup, ie not grub

schaefi commented 5 months ago

the one I linked above. It uses a custom boot loader setup, ie not grub

Ah sorry, I'm blind ... looking

schaefi commented 5 months ago

Hmm, your disk.sh looks scary, why do you need this ? We fully support systemd-boot

<bootloader name="systemd_boot" timeout="10"/>

I guess it's because of initrd_system="none"

So it's hard to work with the original Factory description, too much stuff in there, a refactoring would be good imho

So I took the type setup from the profile you used and can reproduce the busy state. I'm pretty sure it was there before but got ignored by the v9 kiwi version.

I'll take a look

schaefi commented 5 months ago

@lnussel I added a patch to fix the busy state which worked for me. Can you please double check if this makes sense for you too. Thanks

lnussel commented 5 months ago

Hmm, your disk.sh looks scary, why do you need this ? We fully support systemd-boot

Upstream systemd is not aware of btrfs snapshots and neither support installation of shim which is required for secure boot.

https://www.youtube.com/watch?v=drgo6pvn5hI&list=PLWYdJViL9EioDNHn7xIqQJLyCayNPKeYf&index=22 https://github.com/openSUSE/sdbootutil/blob/main/ARCHITECTURE.md