snap preseed failing to umount /tmp/snapd-preseed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Image |
Fix Released
|
High
|
Paul Mars |
Bug Description
When building a classic image, the preseed_image steps is failing with the following error:
[8] preseed_image
ubuntu classic preseeding
starting to preseed root: /home/paul/
using snapd binary: /tmp/snapd-
2024/03/21 09:55:31.100621 main.go:53: running for preseeding
2024/03/21 09:55:31.160617 overlord.go:271: Acquiring state lock file
2024/03/21 09:55:31.160652 overlord.go:276: Acquired state lock file
2024/03/21 09:55:31.215560 daemon.go:247: started snapd/2.61.2 (series 16; classic) ubuntu/24.04 (amd64) linux/6.
2024/03/21 09:55:31.234105 daemon.go:340: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
2024/03/21 09:55:31.258774 backends.go:58: AppArmor status: apparmor is enabled and all features are available (using snapd provided apparmor_parser)
2024/03/21 09:55:31.458153 helpers.go:146: error trying to compare the snap system key: system-key missing on disk
2024/03/21 09:55:32.573216 daemon.go:425: stopping snapd as requested
2024/03/21 09:55:32.618884 daemon.go:519: gracefully waiting for running hooks
2024/03/21 09:55:32.618921 daemon.go:521: done waiting for running hooks
2024/03/21 09:55:35.574257 overlord.go:515: Released state lock file
unmounting: /tmp/snapd-preseed
exit status 32remove /tmp/snapd-preseed: device or resource busy
umount: /home/paul/
umount: /home/paul/
umount: /home/paul/
umount: /home/paul/
umount: /home/paul/
duration: 5.286563398s
Error: teardown failed: teardown command "/usr/bin/umount --recursive debootstrap-
umount: /home/paul/
teardown command "/usr/bin/umount --recursive debootstrap-
umount: /home/paul/
teardown command "/usr/bin/umount --recursive debootstrap-
umount: /home/paul/
teardown command "/usr/bin/umount --recursive debootstrap-
umount: /home/paul/
teardown command "/usr/bin/umount --recursive debootstrap-
umount: /home/paul/
The call to snap-preseed is failing because the umounting of /tmp/snapd-preseed is failing.
sudo mount -l | grep "debootstrap-2"
devtmpfs-build on /home/paul/
devpts-build on /home/paul/
proc-build on /home/paul/
none on /home/paul/
none on /home/paul/
/home/paul/
I suspect a race condition because once the build has failed, I can unmount these mountpoints.
The preseed_image state is executed after prepare_image, which is also calling /usr/lib/
To reproduce: ubuntu-image --verbose --debug classic --workdir debootstrap-2 image_definitio
Image definition used:
name: ubuntu-server-amd64
display-name: Ubuntu Server amd64
revision: 1
architecture: amd64
series: noble
class: preinstalled
kernel: linux-image-generic
gadget:
url: "https:/
branch: classic
type: "git"
rootfs:
components:
- main
- restricted
seed:
urls:
- "git://
branch: noble
names:
- server
- minimal
- standard
- cloud-image
customization:
cloud-init:
user-data: |
#cloud-config
chpasswd:
expire: true
users:
- name: ubuntu
type: text
meta-data: |
dsmode: local
instance_id: ubuntu-server
extra-snaps:
- name: snapd
artifacts:
img:
-
name: ubuntu-
manifest:
name: "filesystem-
filelist:
name: "filesystem-
tags: | added: foundations-todo |
description: | updated |
description: | updated |
Changed in ubuntu-image: | |
status: | Confirmed → In Progress |
Changed in ubuntu-image: | |
status: | In Progress → Fix Committed |
Changed in ubuntu-image: | |
status: | Fix Committed → Fix Released |
tags: | removed: foundations-todo |
I was previously able to reproduce reliably this behavior but I am not anymore, which is at the same time a good and a bad news. Meanwhile, I now it a similar issue, but at the update_bootloader stage.
[18] update_bootloader d/30_os- prober to /etc/grub. d/30_os- prober. dpkg-divert' 6.5.0-9- generic img-6.5. 0-9-generic d/30_os- prober to /etc/grub. d/30_os- prober. dpkg-divert' scratch/ debootstrap- 2/scratch/ loopback/ proc: target is busy. scratch/ debootstrap- 2/scratch/ loopback: target is busy. scratch/ debootstrap- 2/scratch/ loopback/ proc" failed. Output: scratch/ debootstrap- 2/scratch/ loopback/ proc: target is busy.
Adding 'local diversion of /etc/grub.
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-
Found initrd image: /boot/initrd.
Adding boot menu entry for UEFI Firmware Settings ...
done
Removing 'local diversion of /etc/grub.
umount: /home/paul/
umount: /home/paul/
duration: 1.053857891s
Error: teardown failed: teardown command "/usr/bin/umount --recursive /home/paul/
umount: /home/paul/
teardown command "/usr/bin/umount /home/paul/ scratch/ debootstrap- 2/scratch/ loopback" failed. Output: scratch/ debootstrap- 2/scratch/ loopback: target is busy.
umount: /home/paul/
This is also not always happening and mounted dirs can be umounted manually after the build failed. So I suspect a race condition again.