Skip to content

Commit 711f39b

Browse files
committed
Mount /boot ro by default
See bootc-dev/bootc#294 This is particularly motivated by CentOS/centos-bootc-dev#27 because with that suddenly `dnf` will appear to start working but trying to do anything involving the kernel (i.e. mutating `/boot`) will end in sadness, and this puts a stop to that. (This also relates of course to ye olde #18 where we want the partitioning setup in the default case to come from the container) Signed-off-by: Colin Walters <[email protected]>
1 parent 17b016a commit 711f39b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bib/cmd/bootc-image-builder/partition_tables.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import (
99
const (
1010
MebiByte = 1024 * 1024 // MiB
1111
GibiByte = 1024 * 1024 * 1024 // GiB
12+
// BootOptions defines the mountpoint options for /boot
13+
// See https://github.com/containers/bootc/pull/341 for the rationale for
14+
// using `ro` by default. Briefly it protects against corruption
15+
// by non-ostree aware tools.
16+
BootOptions = "ro"
1217
)
1318

1419
var partitionTables = distro.BasePartitionTableMap{
@@ -44,7 +49,7 @@ var partitionTables = distro.BasePartitionTableMap{
4449
Type: "ext4",
4550
Mountpoint: "/boot",
4651
Label: "boot",
47-
FSTabOptions: "defaults",
52+
FSTabOptions: BootOptions,
4853
FSTabFreq: 1,
4954
FSTabPassNo: 2,
5055
},
@@ -89,7 +94,7 @@ var partitionTables = distro.BasePartitionTableMap{
8994
Type: "ext4",
9095
Mountpoint: "/boot",
9196
Label: "boot",
92-
FSTabOptions: "defaults",
97+
FSTabOptions: BootOptions,
9398
FSTabFreq: 1,
9499
FSTabPassNo: 2,
95100
},

0 commit comments

Comments
 (0)