-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/snap-bootstrap: mount base directly on /sysroot #14537
base: master
Are you sure you want to change the base?
cmd/snap-bootstrap: mount base directly on /sysroot #14537
Conversation
Opening as draft as we will need canonical/core-initrd#265 landed first. As a side note, we should discuss how to handle this initramfs/snap-bootstrap interlocks in an easier way. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14537 +/- ##
=========================================
Coverage ? 78.20%
=========================================
Files ? 1162
Lines ? 154334
Branches ? 0
=========================================
Hits ? 120692
Misses ? 26199
Partials ? 7443
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
} | ||
} | ||
|
||
// Do a daemon reload so systemd knows about the new mount units |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it also perform the mount then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, as the new mount unit has an After=snap-initramfs-mounts.service
dependency
} | ||
} | ||
|
||
// Do a daemon reload so systemd knows about the new mount units | ||
sysd := systemd.New(systemd.SystemMode, nil) | ||
if err := sysd.DaemonReload(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will will always have units that need loading? daemon-reload is costly. If we could try to not do it if we did not call writeSysrootMountUnit, then it would be very good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but note that we are always creating the unit in this case (the base is always in the essSnaps slice).
87a834f
to
dcba9a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have rebased this PR and added the changes to the initramfs that were previously in a PR in the core-initrd repo.
The changes in snap-bootstrap could need to check for the UC release. It depends on whether we want the initramfs changes to be backported to UC20/22.
} | ||
} | ||
|
||
// Do a daemon reload so systemd knows about the new mount units | ||
sysd := systemd.New(systemd.SystemMode, nil) | ||
if err := sysd.DaemonReload(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but note that we are always creating the unit in this case (the base is always in the essSnaps slice).
@valentindavid @pedronis this is ready now for review. |
Tue Feb 4 18:30:20 UTC 2025 Failures:Preparing:
Executing:
Restoring:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
}{what, mntType}); err != nil { | ||
return err | ||
} | ||
unitContent.Bytes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a spurious left over?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed, removed now, thanks
Mount the base directly on /sysroot in UC modes, while for hybrid we mount /run/mnt/data instead of the /run/mnt/sysroot symlink that was pointing to the former.
dcba9a9
to
a1ae5af
Compare
Some debugging has revealed that this was not working anymore because I had removed the static |
With the snap-bootstrap changes, the base/rootfs is mounted directly to /sysroot. With this, we do not need the symlinks created by detect-*-sysroot.service units. However, we need to keep the static sysroot mount unit so dependencies are still honored. kernel-snap-generator and classic-mounts.service are not needed as for 24+ the kernel mount units are created by snap-bootstrap. The units that need to detect if we are on core/hybrid check now for the /run/mnt/data/system-data (if present, it is UC) instead of for a mountpoint in /run/mnt/base.
a1ae5af
to
0a2606a
Compare
I have now also restricted the change to systems based on 24.04 or latter - otherwise we would need to wait for changes in the UC20/22 initramfs before releasing a new snapd and that can take some time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
We need to mount the base so we can build the password related files.
Mount the base directly on /sysroot in all UC modes, while for hybrid
we mount /run/mnt/data instead of the /run/mnt/sysroot symlink that
was pointing to the former. With this change we do not need to have
the /run/mnt/base mount anymore.