Skip to content

Commit

Permalink
fix: change the UEFI firmware search path order
Browse files Browse the repository at this point in the history
Ensure that SecureBoot enabled images come before regular ones.

With Ubuntu 24.04 `ovmf` package, due to the ordering of the search
paths `talosctl` might pick up a wrong image and disable SecureBoot.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Jul 11, 2024
1 parent a727a1d commit 736c148
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,10 @@ func getContainerInspector(ctx context.Context, namespace string, driver common.
func (s *Server) Read(in *machine.ReadRequest, srv machine.MachineService_ReadServer) (err error) {
stat, err := os.Stat(in.Path)
if err != nil {
if os.IsNotExist(err) {
return status.Error(codes.NotFound, err.Error())
}

return err
}

Expand Down
4 changes: 3 additions & 1 deletion internal/integration/base/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ func (apiSuite *APISuite) HashKubeletCert(ctx context.Context, node string) (str

_, err = io.Copy(hash, reader)
if err != nil {
return "", err
if client.StatusCode(err) != codes.NotFound { // not found, swallow it
return "", err
}
}

return hex.EncodeToString(hash.Sum(nil)), reader.Close()
Expand Down
8 changes: 6 additions & 2 deletions pkg/provision/providers/qemu/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ func (arch Arch) PFlash(uefiEnabled bool, extraUEFISearchPaths []string) []PFlas
"ovmf-x86_64-4m-vars.bin",
}

uefiSourceFiles = append(uefiSourceFiles, uefiSourceFilesInsecure...)

// Append extra search paths
uefiSourcePathPrefixes = append(uefiSourcePathPrefixes, extraUEFISearchPaths...)

Expand All @@ -143,6 +141,12 @@ func (arch Arch) PFlash(uefiEnabled bool, extraUEFISearchPaths []string) []PFlas
}
}

for _, p := range uefiSourcePathPrefixes {
for _, f := range uefiSourceFilesInsecure {
uefiSourcePaths = append(uefiSourcePaths, filepath.Join(p, f))
}
}

return []PFlash{
{
Size: 0,
Expand Down

0 comments on commit 736c148

Please sign in to comment.