snap-preseed hangs indefinitely with firefox snap

Bug #1990884 reported by William Wilson
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
livecd-rootfs (Ubuntu)
Fix Released
High
Brian Murray
Jammy
Won't Fix
Undecided
Unassigned
snapd (Ubuntu)
Fix Released
Critical
Philip Meulengracht
Jammy
Fix Released
Critical
Unassigned

Bug Description

During our automated image builds, we found a scenario where `snap-preseed` was hanging indefinitely. The logs are as follows:

```
sudo /usr/lib/snapd/snap-preseed /home/jawn-smith/sandbox/chroot/
ubuntu classic preseedingstarting to preseed root: /home/jawn-smith/sandbox/chroot
using snapd binary: /usr/lib/snapd/snapd (2.57.1+22.10.1)
AppArmor status: apparmor is enabled and all features are available
2022/09/26 19:56:40.922864 main.go:57: running for preseeding
2022/09/26 19:56:40.923469 overlord.go:263: Acquiring state lock file
2022/09/26 19:56:40.923655 overlord.go:268: Acquired state lock file
2022/09/26 19:56:40.930761 daemon.go:247: started snapd/2.57.1+22.10.1 (series 16; classic) ubuntu/22.10 (amd64) linux/5.19.0-15-generic.
2022/09/26 19:56:40.936802 daemon.go:340: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
2022/09/26 19:56:41.116159 helpers.go:147: error trying to compare the snap system key: system-key missing on disk
```

I was able to reproduce the behavior by running the following commands on a kinetic system:

```
sudo debootstrap --variant=minbase --arch=amd64 kinetic chroot
sudo snap prepare-image --arch=amd64 --snap=core --snap=firefox --snap=core20 --snap=gtk-common-themes --snap=gnome-3-38-2004 --snap=bare --classic generic.model chroot
for mountpoint in /dev /proc /sys /sys/kernel/security/; do sudo mount --bind $mountpoint chroot/$mountpoint; done
sudo chroot chroot apt install -y squashfs-tools snapd
sudo /usr/lib/snapd/snap-preseed --reset <full path to chroot>
sudo /usr/lib/snapd/snap-preseed <full path to chroot>
```

In this scenario I am using the following generic.model:

```
type: model
authority-id: generic
series: 16
brand-id: generic
model: generic-classic
classic: true
timestamp: 2017-07-27T00:00:00.0Z
sign-key-sha3-384: d-JcZF9nD9eBw7bwMnH61x-bklnQOhQud1Is6o_cn2wTj8EYDi9musrIT9z2MdAa

AcLBXAQAAQoABgUCWYuXiAAKCRAdLQyY+/mCiST0D/0XGQauzV2bbTEy6DkrR1jlNbI6x8vfIdS8
KvEWYvzOWNhNlVSfwNOkFjs3uMHgCO6/fCg03wGXTyV9D7ZgrMeUzWrYp6EmXk8/LQSaBnff86XO
4/vYyfyvEYavhF0kQ6QGg8Cqr0EaMyw0x9/zWEO/Ll9fH/8nv9qcQq8N4AbebNvNxtGsCmJuXpSe
2rxl3Dw8XarYBmqgcBQhXxRNpa6/AgaTNBpPOTqgNA8ZtmbZwYLuaFjpZP410aJSs+evSKepy/ce
+zTA7RB3384YQVeZDdTudX2fGtuCnBZBAJ+NYlk0t8VFXxyOhyMSXeylSpNSx4pCqmUZRyaf5SDS
g1XxJet4IP0stZH1SfPOwc9oE81/bJlKsb9QIQKQRewvtUCLfe9a6Vy/CYd2elvcWOmeANVrJK0m
nRaz6VBm09RJTuwUT6vNugXSOCeF7W3WN1RHJuex0zw+nP3eCehxFSr33YrVniaA7zGfjXvS8tKx
AINNQB4g2fpfet4na6lPPMYM41WHIHPCMTz/fJQ6dZBSEg6UUZ/GiQhGEfWPBteK7yd9pQ8qB3fj
ER4UvKnR7hcVI26e3NGNkXP5kp0SFCkV5NQs8rzXzokpB7p/V5Pnqp3Km6wu45cU6UiTZFhR2IMT
l+6AMtrS4gDGHktOhwfmOMWqmhvR/INF+TjaWbsB6g==
```

Tags: iso-testing

Related branches

Changed in snapd (Ubuntu):
importance: Undecided → High
description: updated
Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
William Wilson (jawn-smith) wrote :

Here's a full stack trace from the hanging command: https://paste.ubuntu.com/p/TbNmDBGHSr/

Revision history for this message
Brian Murray (brian-murray) wrote :

Removing `--snap firefox` from the `sudo snap prepare` command prevents `snap-preseed` from hanging.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Here's some more clues maybe. While the preseed is hanging you "chroot chroot snap changes" outputs

ID Status Spawn Ready Summary
1 Doing today at 22:25 UTC - Initialize system state

and "chroot chroot snap tasks 1" outputs https://paste.ubuntu.com/p/ZpyMPPsv3R/. The stuck task appears to be:

Doing today at 22:24 UTC - Automatically connect eligible plugs and slots of snap "gtk-common-themes"

and I presume the output at the bottom of

2022-09-26T22:28:08Z INFO Waiting for conflicting change in progress: conflicting plug snap firefox, task "connect" every 5 seconds is relevant?

Changed in livecd-rootfs (Ubuntu):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Here's the state.json from the preseed attempt: https://paste.ubuntu.com/p/r8nFv7sknd/ which is almost certainly relevant. On a trivial look-see there is no cycle in the task

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Oh running with SNAPD_DEBUG=1 gives some more output: https://paste.ubuntu.com/p/7zq5Nqq9qd/ (not really telling us anything new though).

Revision history for this message
Philip Meulengracht (the-meulengracht) wrote :

I'll look into this. It could be a case with how we deal with slots/plugs between dependencies - but I don't know anything for sure yet.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package livecd-rootfs - 2.785

---------------
livecd-rootfs (2.785) kinetic; urgency=medium

  * Disable the snap-preseed calls in the interest of getting images built for
    the 22.10 beta. (LP: #1990884)

 -- Brian Murray <email address hidden> Mon, 26 Sep 2022 15:55:26 -0700

Changed in livecd-rootfs (Ubuntu):
status: Triaged → Fix Released
Changed in snapd (Ubuntu):
milestone: none → ubuntu-22.10-beta
Revision history for this message
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
https://iso.qa.ubuntu.com/qatracker/reports/bugs/1990884

tags: added: iso-testing
Changed in snapd (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Philip Meulengracht (the-meulengracht)
Changed in snapd (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Philip Meulengracht (the-meulengracht) wrote :

Fix will be released with snapd 2.57.4

Revision history for this message
Gauthier Jolly (gjolly) wrote :

> Disable the snap-preseed calls in the interest of getting images built for the 22.10 beta. (LP: #1990884)

This is great fix for ISOs but what about cloud-images? As part of our testing for all cloud-images, CPC makes sure that the snap-preseed was run to (significantly) reduce the first boot time of Ubuntu images on the clouds. This test is now failing across all the clouds.
I believe we should reduce this fix to only the "ubuntu" project as "ubuntu-server" and "ubuntu-cpc" are not likely to be affected by the original issue.

Revision history for this message
Carlos Nihelton (cnihelton) wrote (last edit ):

WSL rootfs images built since Sep 27th lack the hardlinks inside `/var/lib/snapd/snaps/` that should point to the files existing in `/var/lib/snapd/seed/snaps/`. Could that be a consequence of disabling snapd-preseed calls?

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Re: [Bug 1990884] Re: snap-preseed hangs indefinitely with firefox snap

On Wed, 5 Oct 2022 at 06:15, Carlos Nihelton <email address hidden>
wrote:

> WSL rootfs images built since Sep 27th lack the hardlinks inside
> `/var/lib/snapd/snaps/` that should point to the files existing in
> `/var/lib/snapd/seed/snaps/`. Could that be a consequence of disabling
> snapd-preseed calls?
>

Yes.

Revision history for this message
John Chittum (jchittum) wrote :

small poke -- will this be rectified soon, to ensure Kinetic releases are pre-seeded?

If not, we'll need to put a "skip" in the livecd-rootfs code to ensure CPC projects are being preseeded (we weren't hit by the specific bug for firefox,and thus we are having downstream issues with all our tests failing due to pre-seed not happening and boot times being too slow)

Revision history for this message
Philip Meulengracht (the-meulengracht) wrote :

Hi John,

We committed a fix for this with snapd 2.57.4 (if you can use the edge channel). But for the release schedule for when 2.57 is officially available you'll have to hear Michael Vogt (mvo) about. I believe it should be early next week, but I am not quite sure.

Revision history for this message
Carlos Nihelton (cnihelton) wrote :

Hi John and Gauthier!

Did snapd 2.57.4 work out for CPC? I still see WSL kinetic images not being preseeded.

Revision history for this message
John Chittum (jchittum) wrote :

CPC isn't driving this. We can't use edge channels on the launchpad builders for pre-seeding, so we have to wait for a release. And CPC builds weren't originally affected.

if whomever was originally affected can create a build env with snapd from edge for testing, they can verify the change. Otherwise we must wait for the release this week. I see it moved to candidate today.

Steve Langasek (vorlon)
Changed in snapd (Ubuntu):
importance: High → Critical
Changed in snapd (Ubuntu Jammy):
importance: Undecided → Critical
status: New → Triaged
Changed in livecd-rootfs (Ubuntu Jammy):
status: New → Won't Fix
Revision history for this message
Steve Langasek (vorlon) wrote :

This is only marked fix committed, but 2.57.4 with the necessary fixes is in kinetic and images are building with the livecd-rootfs workaround disabled.

Changed in snapd (Ubuntu):
status: Fix Committed → Fix Released
Changed in snapd (Ubuntu Jammy):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.