Skip to content

Commit 00fe50d

Browse files
committed
fix: uefi bootorder setting
Drop setting UEFI bootorder. Signed-off-by: Noel Georgi <git@frezbo.dev>
1 parent 3a88118 commit 00fe50d

File tree

3 files changed

+9
-65
lines changed

3 files changed

+9
-65
lines changed

hack/release.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ When set to `disk`, a full block device is used for the volume.
179179
180180
When `volumeType = "disk"`:
181181
- Size specific settings are not allowed in the provisioning block (`minSize`, `maxSize`, `grow`).
182+
"""
183+
184+
[notes.uefi-boot]
185+
title = "UEFI Boot"
186+
description = """\
187+
When using UEFI boot with systemd-boot as bootloader (on new installs of Talos from 1.10+ onwards), Talos will now not touch the UEFI boot order.
188+
Talos 1.11 made a fix to create UEFI boot entry and set the boot order as first entry, but this behavior caused issues on some systems.
189+
To avoid further issues, Talos will now only create the UEFI boot entry if it does not exist, but will not modify the boot order.
182190
"""
183191

184192
[make_deps]

internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/efivars.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,6 @@ func CreateBootEntry(rw efivarfs.ReadWriter, blkidInfo *blkid.Info, printf func(
158158
// but UEFI firmware settings can set a different boot order on boot, which lead to multiple Talos Linux UKI entries in the boot order,
159159
// causing some UEFI firmwares to fail to boot at all.
160160
// See https://github.com/siderolabs/talos/issues/11829
161-
//
162-
// So we remove any existing Talos Linux UKI entries from the boot order
163-
// making sure the BootOrder only contains non Talos entries.
164-
bootOrderUnique := efivarfs.UniqueBootOrder(bootOrder)
165-
166-
for _, idx := range existingTalosBootEntryIndexes {
167-
bootOrderUnique = slices.DeleteFunc(bootOrderUnique, func(i uint16) bool {
168-
return i == uint16(idx)
169-
})
170-
}
171-
172-
printf("Updated BootOrder without Talos entries: %v", bootOrderUnique)
173161

174162
// find the next minimal available index for the new Talos Linux UKI boot entry
175163
nextMinimalIndex := -1
@@ -221,26 +209,5 @@ func CreateBootEntry(rw efivarfs.ReadWriter, blkidInfo *blkid.Info, printf func(
221209

222210
printf("created Talos Linux UKI boot entry at index %d", nextMinimalIndex)
223211

224-
if len(bootOrder) > 0 && bootOrder[0] == uint16(nextMinimalIndex) && !slices.Contains(bootOrder[1:], uint16(nextMinimalIndex)) {
225-
// Talos Linux UKI boot entry is already first in the BootOrder
226-
printf("Talos Linux UKI boot entry at index %d is already first in BootOrder: %v", nextMinimalIndex, bootOrder)
227-
228-
return nil
229-
}
230-
231-
// if we have the new Talos Linux UKI boot entry index in the boot order already, we need to remove it first
232-
// to avoid having it twice in the boot order
233-
bootOrderUnique = slices.DeleteFunc(bootOrderUnique, func(i uint16) bool {
234-
return i == uint16(nextMinimalIndex)
235-
})
236-
237-
bootOrderUnique = slices.Insert(bootOrderUnique, 0, uint16(nextMinimalIndex))
238-
239-
printf("setting Talos Linux UKI boot entry at index %d as first in BootOrder: %v", nextMinimalIndex, bootOrderUnique)
240-
241-
if err := efivarfs.SetBootOrder(rw, bootOrderUnique); err != nil {
242-
return fmt.Errorf("failed to set BootOrder: %w", err)
243-
}
244-
245212
return nil
246213
}

internal/app/machined/pkg/runtime/v1alpha1/bootloader/sdboot/efivars_test.go

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,12 @@ func TestSetBootEntry(t *testing.T) {
7373
name string
7474
efivarfsMock *efivarfs.Mock
7575

76-
expectedMessageContains string
77-
expectedBootOrder efivarfs.BootOrder
78-
expectedEntries map[int]string
76+
expectedEntries map[int]string
7977
}{
8078
{
8179
name: "empty efivarfs", // both BootOrder and BootEntries are initially empty
8280
efivarfsMock: &efivarfs.Mock{},
8381

84-
expectedMessageContains: "setting Talos Linux UKI boot entry at index 0 as first in BootOrder: [0]",
85-
expectedBootOrder: efivarfs.BootOrder{0},
8682
expectedEntries: map[int]string{
8783
0: sdboot.TalosBootEntryDescription,
8884
},
@@ -100,8 +96,6 @@ func TestSetBootEntry(t *testing.T) {
10096
},
10197
},
10298

103-
expectedMessageContains: "setting Talos Linux UKI boot entry at index 1 as first in BootOrder: [1]",
104-
expectedBootOrder: efivarfs.BootOrder{1},
10599
expectedEntries: map[int]string{
106100
0: "Default Boot Entry",
107101
1: sdboot.TalosBootEntryDescription,
@@ -120,8 +114,6 @@ func TestSetBootEntry(t *testing.T) {
120114
},
121115
},
122116

123-
expectedMessageContains: "Talos Linux UKI boot entry at index 0 is already first in BootOrder: [0]",
124-
expectedBootOrder: efivarfs.BootOrder{0},
125117
expectedEntries: map[int]string{
126118
0: sdboot.TalosBootEntryDescription,
127119
},
@@ -143,8 +135,6 @@ func TestSetBootEntry(t *testing.T) {
143135
},
144136
},
145137

146-
expectedMessageContains: "setting Talos Linux UKI boot entry at index 1 as first in BootOrder: [1 0]",
147-
expectedBootOrder: efivarfs.BootOrder{1, 0},
148138
expectedEntries: map[int]string{
149139
0: "Default Boot Entry",
150140
1: sdboot.TalosBootEntryDescription,
@@ -167,8 +157,6 @@ func TestSetBootEntry(t *testing.T) {
167157
},
168158
},
169159

170-
expectedMessageContains: "Talos Linux UKI boot entry at index 1 is already first in BootOrder: [1]",
171-
expectedBootOrder: efivarfs.BootOrder{1},
172160
expectedEntries: map[int]string{
173161
0: "Default Boot Entry",
174162
1: sdboot.TalosBootEntryDescription,
@@ -195,8 +183,6 @@ func TestSetBootEntry(t *testing.T) {
195183
},
196184
},
197185

198-
expectedMessageContains: "Talos Linux UKI boot entry at index 1 is already first in BootOrder: [1 0 3 2]",
199-
expectedBootOrder: efivarfs.BootOrder{1, 0, 3, 2},
200186
expectedEntries: map[int]string{
201187
0: "Default Boot Entry",
202188
1: sdboot.TalosBootEntryDescription,
@@ -224,8 +210,6 @@ func TestSetBootEntry(t *testing.T) {
224210
},
225211
},
226212

227-
expectedMessageContains: "setting Talos Linux UKI boot entry at index 1 as first in BootOrder: [1 5 0 3 2]",
228-
expectedBootOrder: efivarfs.BootOrder{1, 5, 0, 3, 2},
229213
expectedEntries: map[int]string{
230214
0: "Default Boot Entry",
231215
1: sdboot.TalosBootEntryDescription,
@@ -245,8 +229,6 @@ func TestSetBootEntry(t *testing.T) {
245229
},
246230
},
247231

248-
expectedMessageContains: "setting Talos Linux UKI boot entry at index 0 as first in BootOrder: [0 1 3 2]",
249-
expectedBootOrder: efivarfs.BootOrder{0, 1, 3, 2},
250232
expectedEntries: map[int]string{
251233
0: sdboot.TalosBootEntryDescription,
252234
},
@@ -276,8 +258,6 @@ func TestSetBootEntry(t *testing.T) {
276258
},
277259
},
278260

279-
expectedMessageContains: "Removing existing Talos Linux UKI boot entry at index 2",
280-
expectedBootOrder: efivarfs.BootOrder{1},
281261
expectedEntries: map[int]string{
282262
0: "Default Boot Entry",
283263
1: sdboot.TalosBootEntryDescription,
@@ -308,8 +288,6 @@ func TestSetBootEntry(t *testing.T) {
308288
},
309289
},
310290

311-
expectedMessageContains: "Removing existing Talos Linux UKI boot entry at index 2",
312-
expectedBootOrder: efivarfs.BootOrder{1, 0},
313291
expectedEntries: map[int]string{
314292
0: "Default Boot Entry",
315293
1: sdboot.TalosBootEntryDescription,
@@ -344,8 +322,6 @@ func TestSetBootEntry(t *testing.T) {
344322
},
345323
},
346324

347-
expectedMessageContains: "setting Talos Linux UKI boot entry at index 2 as first in BootOrder: [2 1 0 3]",
348-
expectedBootOrder: efivarfs.BootOrder{2, 1, 0, 3},
349325
expectedEntries: map[int]string{
350326
0: "Default Boot Entry",
351327
1: "Default Boot Entry",
@@ -366,13 +342,6 @@ func TestSetBootEntry(t *testing.T) {
366342

367343
require.NoError(t, sdboot.CreateBootEntry(testData.efivarfsMock, blkidInfo, logger.Printf, "test-entry"))
368344

369-
bootOrder, err := efivarfs.GetBootOrder(testData.efivarfsMock)
370-
require.NoError(t, err)
371-
372-
require.Contains(t, logger.String(), testData.expectedMessageContains, "expected log message not found")
373-
374-
require.Equal(t, testData.expectedBootOrder, bootOrder, "BootOrder does not match expected value")
375-
376345
bootEntries, err := efivarfs.ListBootEntries(testData.efivarfsMock)
377346
require.NoError(t, err)
378347

0 commit comments

Comments
 (0)