Skip to content

Commit 6ef8a8e

Browse files
authored
secboot: preinstall check only permits VM during testing (#16620)
* preinstall_sb: restore using ignore action for VM We relaxed in snapd 2.72 the preinstall check to allow installation in VMs. Now that we have the action API, an ignore action will be available to the rest of the system and users. Restore this. However, keep the current behaviour for nested tests as muinstaller does not support interactions to ignore errors. * preinstall_sb_test: Adapt the test to new defaults New defaults does not permit VM.
1 parent 043577c commit 6ef8a8e

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

secboot/preinstall_sb.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232

3333
"github.com/snapcore/snapd/logger"
3434
"github.com/snapcore/snapd/osutil"
35+
"github.com/snapcore/snapd/snapdenv"
3536
"github.com/snapcore/snapd/systemd"
3637
)
3738

@@ -80,10 +81,9 @@ func PreinstallCheck(ctx context.Context, bootImagePaths []string) (*PreinstallC
8081
// - listed as Driver#### load options
8182
// - referenced in the DriverOrder UEFI variable
8283
// - loaded from PCI device option ROMs (e.g. network card PXE ROMs)
83-
//TODO:FDEM: remove once secboot provides an action to apply this configuration
8484
checkFlags := sb_preinstall.PermitAddonDrivers
85-
if systemd.IsVirtualMachine() {
86-
// when running in Virtual Machine, allow it
85+
// For nested tests: muinstaller does not support interactions to ignore errors.
86+
if systemd.IsVirtualMachine() && snapdenv.Testing() {
8787
checkFlags |= sb_preinstall.PermitVirtualMachine
8888
}
8989

secboot/preinstall_sb_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (s *preinstallSuite) TestPreinstallCheckConfig(c *C) {
294294
permitVM bool
295295
}{
296296
{false, false}, // default config
297-
{true, true}, // modify default config to permit VM
297+
{true, false}, // VM will trigger an ignore action
298298
}
299299

300300
for _, tc := range testCases {

0 commit comments

Comments
 (0)