snapd's mkfs.MakeWithContent() uses the host fakeroot instead of the snap-bundled one in ubuntu-image

Bug #1955017 reported by Łukasz Zemczak
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snappy
Fix Committed
High
Unassigned
Ubuntu Image
Fix Released
High
Unassigned
snapd
Fix Committed
High
Unassigned

Bug Description

We noticed a regression when trying to run our latest 2.1 ubuntu-image snap on jammy. The image builds fail on the mkfs.ext4 stage with the following error:

Error: Error running mkfs: mkfs.ext4: /snap/core20/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-sysv.so)

William dug a bit deeper and found that the reason for that is that the wrong fakeroot is used during the mkfs stage. Since ubuntu-image has been re-written in Go and using snap directly, we use the mkfs.MakeWithContent() instead of calling mkfs ourselves (to avoid any incompatibilities). But this results in using the host fakeroot instead of the bundled one. Overriding the environment with LD_LIBRARY_PATH etc. via snapcraft.yaml does not work as the environment does not seem to be passed to the mkfs call.

We suppose this could be fixed by doing a `cmd.Env = os.Environ()` right after preparing the fakeroot call in https://github.com/snapcore/snapd/blob/master/osutil/mkfs/mkfs.go#L108 , but we're not sure about the implications of that.

How should we proceed? How can we use mkfs.MakeWithContent() and have guarantee that the right fakeroot is used?

Changed in snapd:
importance: Undecided → High
Changed in ubuntu-image:
importance: Undecided → High
Changed in ubuntu-image:
status: New → Fix Released
Changed in snapd:
status: New → Fix Committed
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote :
Changed in snappy:
status: New → Fix Committed
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.