Skip to content
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

o/devicestate, tests: setup bind mount from /run/mnt/ubuntu-seed to /var/lib/snapd/seed on hybrid system install #15006

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andrewphelpsj
Copy link
Member

Hybrid systems might not have this mountpoint setup in the pre-existing rootfs. Here, this change makes it so when we install a hybrid system and copy the seed over, we also install and enable a mount unit that will bind mount /run/mnt/ubuntu-seed (which is mounted in the initramfs) to /var/lib/snapd/seed.

Copy link

github-actions bot commented Jan 30, 2025

Tue Feb 4 18:08:31 UTC 2025
The following results are from: https://github.com/canonical/snapd/actions/runs/13137962897

Failures:

Executing:

  • google-nested:ubuntu-22.04-64:tests/nested/manual/muinstaller-real:partial
  • google-nested:ubuntu-22.04-64:tests/nested/manual/muinstaller-real:plain
  • google-nested:ubuntu-22.04-64:tests/nested/manual/muinstaller-real:encrypted
  • google-nested:ubuntu-24.04-64:tests/nested/manual/muinstaller-real:seeded
  • google-nested:ubuntu-24.04-64:tests/nested/manual/muinstaller-real:partial
  • google-nested:ubuntu-24.04-64:tests/nested/manual/muinstaller-real:plain
  • google-nested:ubuntu-24.04-64:tests/nested/manual/muinstaller-real:encrypted
  • google:ubuntu-20.04-64:tests/main/snapd-snap:lxd

Restoring:

  • openstack:fedora-41-64:tests/main/snap-services

@andrewphelpsj andrewphelpsj force-pushed the create-hybrid-seed-mount-during-install branch from 4d973e6 to 1bc1544 Compare January 30, 2025 16:43
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 70.96774% with 9 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@6fa2df6). Learn more about missing BASE report.
Report is 55 commits behind head on master.

Files with missing lines Patch % Lines
overlord/devicestate/handlers_install.go 70.96% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #15006   +/-   ##
=========================================
  Coverage          ?   78.23%           
=========================================
  Files             ?     1160           
  Lines             ?   154012           
  Branches          ?        0           
=========================================
  Hits              ?   120496           
  Misses            ?    26094           
  Partials          ?     7422           
Flag Coverage Δ
unittests 78.23% <70.96%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, a couple of comments

tests/nested/manual/muinstaller-real/task.yaml Outdated Show resolved Hide resolved
tests/nested/manual/muinstaller-real/task.yaml Outdated Show resolved Hide resolved
overlord/devicestate/handlers_install.go Outdated Show resolved Hide resolved
@@ -1129,6 +1129,39 @@ func (m *DeviceManager) doInstallFinish(t *state.Task, _ *tomb.Tomb) error {
}, perfTimings); err != nil {
return fmt.Errorf("cannot copy seed: %w", err)
}

hybrid := systemAndSnaps.Model.Classic() && systemAndSnaps.Model.KernelSnap() != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check made me realize that a check that we do a few lines before (https://github.com/canonical/snapd/blob/master/overlord/devicestate/handlers_install.go#L1085-L1086) is actually wrong as indeed the device context seen by doInstallFinish is the one of the installer, not the one for the model we are installing (thanks for this!). It is not surprising that this has not exploded yet as we don't have that many tests for using the installer API to install UC. Would you mind fixing that too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, fixed in 7fff430.

@andrewphelpsj andrewphelpsj force-pushed the create-hybrid-seed-mount-during-install branch from 1bc1544 to 7fff430 Compare January 30, 2025 18:47
Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the changes

Copy link
Contributor

@mwhudson mwhudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting to this so quickly. I spotted a typo!

I presume to make this work I need to arrange for /var/lib/snapd/seed to be present but empty in the rootfs that I install?


hybrid := systemAndSnaps.Model.Classic() && systemAndSnaps.Model.KernelSnap() != nil
if hybrid {
// boot.InitramfsUbuntuSeedDir (/run/mny/ubuntu-data, usually) is a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here, mny vs mnt

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@andrewphelpsj
Copy link
Member Author

@mwhudson good question, maybe we should verify that is true at install time, or even make it if it isn’t there?

@alfonsosanchezbeato
Copy link
Member

Thanks for getting to this so quickly. I spotted a typo!

I presume to make this work I need to arrange for /var/lib/snapd/seed to be present but empty in the rootfs that I install?

systemd would take care of creating it if not present

@andrewphelpsj andrewphelpsj force-pushed the create-hybrid-seed-mount-during-install branch from 7fff430 to 70a55cb Compare February 4, 2025 14:40
@ndyer ndyer added this to the 2.68 milestone Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants