-
Notifications
You must be signed in to change notification settings - Fork 600
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
many: add target install system checks for passphrase support #14943
many: add target install system checks for passphrase support #14943
Conversation
overlord/devicestate/devicemgr.go
Outdated
@@ -2201,6 +2201,29 @@ func (m *DeviceManager) systems() ([]*System, error) { | |||
return systems, nil | |||
} | |||
|
|||
func snapdVersionByTypeFromSeed20(s seed.Seed, types []snap.Type) (snapdVersionByType map[snap.Type]string, err error) { |
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.
The bare map that's passed around without additional context looks slightly weird. I think I'd return a structure here, e.g.
// in overlord/install/install.go
type SystemSnapdVersions struct {
// SnapdVersion is the version of snapd in a given system
SnapdVersion string
// SnapdInitramfsVersion is the version of snapd related component, which participates
// in the boot process and performs unlocking. Typically snap-bootstrap in the kernel snap.
SnapdInitramfsVersion string
}
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 thought of doing this, but loadSystemAndEssentialSnaps
expects a list of essential snap types so changing its internals to implicitly add snapd and kernel types could have unintended consequences, also snapd is only expected on UC20+.
I am open to suggestions, just wanted to share my thought process.
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.
my bad, this was intended for #14943 (comment), regarding the struct, totally agree, thanks for the suggestion.
// Find snapd versions for snapd and kernel snaps in the seed for | ||
// the passphrase/PINs auth checks. | ||
// FDE is only supported in UC20+ (i.e. Model grade is set). | ||
if volumesAuthRequired && systemAndSeeds.Model.Grade() != asserts.ModelGradeUnset { |
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.
can we always attempt to get the info?
if volumesAuthRequired && systemAndSeeds.Model.Grade() != asserts.ModelGradeUnset { | |
if systemAndSeeds.Model.Grade() != asserts.ModelGradeUnset { |
@@ -1278,7 +1295,19 @@ func (m *DeviceManager) doInstallSetupStorageEncryption(t *state.Task, _ *tomb.T | |||
return fmt.Errorf("reading gadget information: %v", err) | |||
} | |||
|
|||
encryptInfo, err := m.encryptionSupportInfo(systemAndSeeds.Model, secboot.TPMProvisionFull, systemAndSeeds.InfosByType[snap.TypeKernel], gadgetInfo) |
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.
actually would it make sense to add the snapd version structure to systemAndEssentialSnaps
type and populate it in loadAndMountSystemLabelSnaps()
?
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.
As @pedronis explained we don't expect the relevant code paths to only run for UC20+, I embedded the snapd version structure to systemAndEssentialSnaps
. Thanks for the suggestion!
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.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14943 +/- ##
=========================================
Coverage ? 78.15%
=========================================
Files ? 1168
Lines ? 157051
Branches ? 0
=========================================
Hits ? 122740
Misses ? 26703
Partials ? 7608
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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, some comments
// Find snapd versions for snapd and kernel snaps in the seed for | ||
// the passphrase/PINs auth checks. | ||
// FDE is only supported in UC20+ (i.e. Model grade is set). | ||
if systemAndSeeds.Model.Grade() != asserts.ModelGradeUnset { |
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'm actually not sure we need the check at this point because we wouldn't have made this far if the system is not UC20+
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.
though it would be interesting to double check what kind of errors /v2/systems/foo gives on UC18/classic system
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.
Thank you! I didn't know that UC18 is not even installable through the systems API, and indeed snap prepare-image
for a UC18 model doesn't even create the system-seed
directory.
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.
Removed restriction, Now the snapd versions structure is populated loadAndMountSystemLabelSnaps
and embedded inside systemAndEssentialSnaps
.
overlord/devicestate/devicemgr.go
Outdated
// Find snapd versions for snapd and kernel snaps in the seed for | ||
// the passphrase/PINs auth checks. | ||
// FDE is only supported in UC20+ (i.e. Model grade is set). | ||
if systemAndSnaps.Model.Grade() != asserts.ModelGradeUnset { |
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.
same here
overlord/devicestate/devicemgr.go
Outdated
@@ -2201,6 +2201,31 @@ func (m *DeviceManager) systems() ([]*System, error) { | |||
return systems, nil | |||
} | |||
|
|||
func snapdVersionByTypeFromSeed20(s seed.Seed, types []snap.Type) (systemSnapdVersions *install.SystemSnapdVersions, err error) { | |||
perf := &timings.Timings{} | |||
if err := s.LoadEssentialMeta(types, perf); 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.
can't we avoid this, by adding TypeSnapd to the system load calls in the couple of callers to this?
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.
Done
7005c64
to
25f9119
Compare
1dac19e
to
a08ed37
Compare
Rebased on top of latest fde branch |
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.
thank you
Marking blocked until fde branch is merged into master |
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.
LGTM
Mon Feb 10 20:08:10 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.
LGTM, thanks
a08ed37
to
577ec57
Compare
577ec57
to
310cede
Compare
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
… versions Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
310cede
to
52d961d
Compare
This PR adds a simple snapd version check that gates passphrase authentication support in the install API based on the target install system.
For passphrase support:
usr/lib/snapd/info
snapd-info
Please check SD201 for more details.