Skip to content

Commit 2291572

Browse files
authored
Merge pull request #3934 from flatcar/chewi/ignition-mounting
Drop old Ignition OEM mounting code and bump bootengine with new mount handling
2 parents 52dec2d + 32f35c2 commit 2291572

16 files changed

+97
-270
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Reworked how the OEM partition is mounted at boot time so that Ignition no longer has to handle this by itself, thereby requiring less patching. This should not affect any existing usage, but it is a significant underlying change, so it needs to be called out. Please report any unexpected issues. ([flatcar/script#3934](https://github.com/flatcar/scripts/pull/3934))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DIST coreos-init-1660f54f79dbba285a64c52d3338f5566e1d770d.tar.gz 59695 BLAKE2B 02c67fa98ee0b97123cb322fb6eabacf7ae7a282914408a8246371552ed222cc3eb56f27d5c42230158a4f7907db9cdfd4b7f51e96995aac2a0f903ff34d034d SHA512 d1282837b52f550855e6c0990796e270c32d7b0882b062f401aff9c9eea7a7c8fba4f2a051f9c42be9316022fa8ee214dc28a8078b306577629d01d96e32d5e8
1+
DIST coreos-init-9c940ec78b8eb513397ece28bd6cb0d2af6cc342.tar.gz 60774 BLAKE2B b141646a9ff796825cd0726413c3deacc3d60ac1e9dedbfa72e2f563c4b10ef5f7db5dcafefae75f83a21dd83d811c73611598c27faf70e7d486ffff9d62377e SHA512 4532a1069313cacf2f2d92a71859f6550e87e6cfe1966326b2bfa0279770f2e58d9956ccebc1ddebca2336a8d0e0bc778e73fa0d79c63374a23de5c2b8638c9b

sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-0.0.1-r203.ebuild renamed to sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-0.0.1-r204.ebuild

File renamed without changes.

sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [[ ${PV} == 9999 ]]; then
1414
EGIT_REPO_URI="https://github.com/flatcar/init.git"
1515
inherit git-r3
1616
else
17-
EGIT_VERSION="1660f54f79dbba285a64c52d3338f5566e1d770d" # flatcar-master
17+
EGIT_VERSION="9c940ec78b8eb513397ece28bd6cb0d2af6cc342" # flatcar-master
1818
SRC_URI="https://github.com/flatcar/init/archive/${EGIT_VERSION}.tar.gz -> ${PN}-${EGIT_VERSION}.tar.gz"
1919
S="${WORKDIR}/init-${EGIT_VERSION}"
2020
KEYWORDS="amd64 arm arm64 x86"

sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/files/0013-Revert-drop-OEM-URI-support.patch renamed to sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/files/0013-Partially-revert-drop-OEM-URI-support.patch

Lines changed: 25 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
From b617624e830507f68268db881fdb1576ed25fb41 Mon Sep 17 00:00:00 2001
2-
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
3-
Date: Wed, 25 May 2022 10:38:16 +0200
4-
Subject: [PATCH 13/19] Revert "*: drop OEM URI support"
1+
From df6384f8f0e93ab3b61cd04822cf808c7c2d289a Mon Sep 17 00:00:00 2001
2+
From: James Le Cuirot <jlecuirot@microsoft.com>
3+
Date: Wed, 1 Apr 2026 16:11:52 +0100
4+
Subject: [PATCH 13/17] Partially revert "*: drop OEM URI support"
55

6-
This reverts commit 0c088d6de77aa1b1f47b9252a07f51cb1e249df3.
6+
This partially reverts commit 0c088d6de77aa1b1f47b9252a07f51cb1e249df3.
7+
8+
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
79
---
810
config/v3_0/types/url.go | 2 +-
911
config/v3_1/types/url.go | 2 +-
1012
config/v3_2/types/url.go | 2 +-
1113
config/v3_3/types/url.go | 2 +-
1214
config/v3_4/types/url.go | 2 +-
13-
docs/supported-platforms.md | 1 +
14-
internal/distro/distro.go | 11 ++++-
15-
internal/resource/url.go | 91 +++++++++++++++++++++++++++++++++++++
16-
8 files changed, 106 insertions(+), 7 deletions(-)
15+
docs/supported-platforms.md | 2 ++
16+
internal/distro/distro.go | 3 +++
17+
internal/resource/url.go | 27 +++++++++++++++++++++++++++
18+
8 files changed, 37 insertions(+), 5 deletions(-)
1719

1820
diff --git a/config/v3_0/types/url.go b/config/v3_0/types/url.go
1921
index 2d8c44b1..f560bc22 100644
@@ -81,32 +83,23 @@ index b1f96337..752044ce 100644
8183
case "s3":
8284
if v, ok := u.Query()["versionId"]; ok {
8385
diff --git a/docs/supported-platforms.md b/docs/supported-platforms.md
84-
index afd49437..f8e1d3ae 100644
86+
index afd49437..897eeabd 100644
8587
--- a/docs/supported-platforms.md
8688
+++ b/docs/supported-platforms.md
87-
@@ -12,6 +12,7 @@ Ignition is currently supported for the following platforms:
89+
@@ -12,6 +12,8 @@ Ignition is currently supported for the following platforms:
8890
* [Amazon Web Services] (`aws`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
8991
* [Microsoft Azure] (`azure`)- Ignition will read its configuration from the custom data provided to the instance. Cloud SSH keys are handled separately.
9092
* [Microsoft Azure Stack] (`azurestack`) - Ignition will read its configuration from the custom data provided to the instance. Cloud SSH keys are handled separately.
9193
+* Bare Metal - Use the `ignition.config.url` kernel parameter to provide a URL to the configuration. The URL can use the `http://`, `https://`, `tftp://`, `s3://`, or `gs://` schemes to specify a remote config or the `oem://` scheme to specify a local config, rooted in `/usr/share/oem`.
94+
+* PXE - Use the `ignition.config.url` and first boot kernel parameters to provide a URL to the configuration. The URL can use the `http://`, `https://`, `tftp://`, or `s3://` schemes to specify a remote config or the `oem://` scheme to specify a local config, rooted in `/usr/share/oem`.
9295
* [Brightbox] (`brightbox`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
9396
* [CloudStack] (`cloudstack`) - Ignition will read its configuration from the instance userdata via either metadata service or config drive. Cloud SSH keys are handled separately.
9497
* [DigitalOcean] (`digitalocean`) - Ignition will read its configuration from the droplet userdata. Cloud SSH keys and network configuration are handled separately.
9598
diff --git a/internal/distro/distro.go b/internal/distro/distro.go
96-
index 9d9351e7..f3c32aaf 100644
99+
index 9d9351e7..fb12b792 100644
97100
--- a/internal/distro/distro.go
98101
+++ b/internal/distro/distro.go
99-
@@ -23,13 +23,17 @@ import (
100-
// -X github.com/flatcar/ignition/v2/internal/distro.mdadmCmd=/opt/bin/mdadm
101-
var (
102-
// Device node directories and paths
103-
- diskByLabelDir = "/dev/disk/by-label"
104-
+ diskByLabelDir = "/dev/disk/by-label"
105-
+ diskByPartUUIDDir = "/dev/disk/by-partuuid"
106-
+ oemDevicePath = "/dev/disk/by-label/OEM"
107-
108-
// initrd file paths
109-
kernelCmdlinePath = "/proc/cmdline"
102+
@@ -30,6 +30,8 @@ var (
110103
bootIDPath = "/proc/sys/kernel/random/boot_id"
111104
// initramfs directory containing distro-provided base config
112105
systemConfigDir = "/usr/lib/ignition"
@@ -115,15 +108,7 @@ index 9d9351e7..f3c32aaf 100644
115108

116109
// Helper programs
117110
groupaddCmd = "groupadd"
118-
@@ -83,11 +87,14 @@ var (
119-
luksCexSecureKeyRepo = "/etc/zkey/repository/"
120-
)
121-
122-
-func DiskByLabelDir() string { return diskByLabelDir }
123-
+func DiskByLabelDir() string { return diskByLabelDir }
124-
+func DiskByPartUUIDDir() string { return diskByPartUUIDDir }
125-
+func OEMDevicePath() string { return fromEnv("OEM_DEVICE", oemDevicePath) }
126-
111+
@@ -88,6 +90,7 @@ func DiskByLabelDir() string { return diskByLabelDir }
127112
func KernelCmdlinePath() string { return kernelCmdlinePath }
128113
func BootIDPath() string { return bootIDPath }
129114
func SystemConfigDir() string { return fromEnv("SYSTEM_CONFIG_DIR", systemConfigDir) }
@@ -132,33 +117,26 @@ index 9d9351e7..f3c32aaf 100644
132117
func GroupaddCmd() string { return groupaddCmd }
133118
func GroupdelCmd() string { return groupdelCmd }
134119
diff --git a/internal/resource/url.go b/internal/resource/url.go
135-
index 5f08f059..a9f7f7ba 100644
120+
index 5f08f059..ab1d80fa 100644
136121
--- a/internal/resource/url.go
137122
+++ b/internal/resource/url.go
138-
@@ -23,10 +23,12 @@ import (
139-
"fmt"
140-
"hash"
141-
"io"
142-
+ "io/ioutil"
143-
"net"
123+
@@ -27,6 +27,7 @@ import (
144124
"net/http"
145125
"net/url"
146126
"os"
147127
+ "path/filepath"
148128
"strings"
149129
"syscall"
150130
"time"
151-
@@ -34,7 +36,9 @@ import (
131+
@@ -34,6 +35,7 @@ import (
152132
"cloud.google.com/go/compute/metadata"
153133
"cloud.google.com/go/storage"
154134
configErrors "github.com/flatcar/ignition/v2/config/shared/errors"
155135
+ "github.com/flatcar/ignition/v2/internal/distro"
156136
"github.com/flatcar/ignition/v2/internal/log"
157-
+ "github.com/flatcar/ignition/v2/internal/systemd"
158137
"github.com/flatcar/ignition/v2/internal/util"
159138
"golang.org/x/oauth2/google"
160-
"google.golang.org/api/option"
161-
@@ -165,6 +169,8 @@ func (f *Fetcher) FetchToBuffer(u url.URL, opts FetchOptions) ([]byte, error) {
139+
@@ -165,6 +167,8 @@ func (f *Fetcher) FetchToBuffer(u url.URL, opts FetchOptions) ([]byte, error) {
162140
err = f.fetchFromTFTP(u, dest, opts)
163141
case "data":
164142
err = f.fetchFromDataURL(u, dest, opts)
@@ -167,7 +145,7 @@ index 5f08f059..a9f7f7ba 100644
167145
case "s3", "arn":
168146
buf := &s3buf{
169147
WriteAtBuffer: manager.NewWriteAtBuffer([]byte{}),
170-
@@ -237,6 +243,8 @@ func (f *Fetcher) Fetch(u url.URL, dest *os.File, opts FetchOptions) error {
148+
@@ -237,6 +241,8 @@ func (f *Fetcher) Fetch(u url.URL, dest *os.File, opts FetchOptions) error {
171149
return f.fetchFromTFTP(u, dest, opts)
172150
case "data":
173151
return f.fetchFromDataURL(u, dest, opts)
@@ -176,7 +154,7 @@ index 5f08f059..a9f7f7ba 100644
176154
case "s3", "arn":
177155
return f.fetchFromS3(u, dest, opts)
178156
case "gs":
179-
@@ -447,6 +455,53 @@ type s3target interface {
157+
@@ -447,6 +453,27 @@ type s3target interface {
180158
io.ReadSeeker
181159
}
182160

@@ -195,81 +173,15 @@ index 5f08f059..a9f7f7ba 100644
195173
+ if fi, err := os.Open(absPath); err == nil {
196174
+ defer fi.Close()
197175
+ return f.decompressCopyHashAndVerify(dest, fi, opts)
198-
+ } else if !os.IsNotExist(err) {
199-
+ f.Logger.Err("failed to read oem config: %v", err)
200-
+ return ErrFailed
201-
+ }
202-
+
203-
+ f.Logger.Info("oem config not found in %q, looking on oem partition",
204-
+ distro.OEMLookasideDir())
205-
+
206-
+ oemMountPath, err := ioutil.TempDir("/mnt", "oem")
207-
+ if err != nil {
208-
+ f.Logger.Err("failed to create mount path for oem partition: %v", err)
209-
+ return ErrFailed
210-
+ }
211-
+ // try oemMountPath, requires mounting it.
212-
+ if err := f.mountOEM(oemMountPath); err != nil {
213-
+ f.Logger.Err("failed to mount oem partition: %v", err)
214-
+ return ErrFailed
215-
+ }
216-
+ defer os.Remove(oemMountPath)
217-
+ defer f.umountOEM(oemMountPath)
218-
+
219-
+ absPath = filepath.Join(oemMountPath, path)
220-
+ fi, err := os.Open(absPath)
221-
+ if err != nil {
176+
+ } else {
222177
+ f.Logger.Err("failed to read oem config: %v", err)
223178
+ return ErrFailed
224179
+ }
225-
+ defer fi.Close()
226-
+
227-
+ return f.decompressCopyHashAndVerify(dest, fi, opts)
228180
+}
229181
+
230182
// FetchFromS3 gets data from an S3 bucket as described by u and writes it into
231183
// dest, returning an error if one is encountered. It will attempt to acquire
232184
// IAM credentials from the EC2 metadata service, and if this fails will attempt
233-
@@ -735,3 +790,39 @@ func (f *Fetcher) parseARN(arnURL string) (string, string, string, string, error
234-
key := strings.Join(urlSplit[1:], "/")
235-
return bucket, key, "", regionHint, nil
236-
}
237-
+
238-
+// mountOEM waits for the presence of and mounts the oem partition at
239-
+// oemMountPath. oemMountPath will be created if it does not exist.
240-
+func (f *Fetcher) mountOEM(oemMountPath string) error {
241-
+ dev := []string{distro.OEMDevicePath()}
242-
+ if err := systemd.WaitOnDevices(context.Background(), dev, "oem-cmdline"); err != nil {
243-
+ f.Logger.Err("failed to wait for oem device: %v", err)
244-
+ return err
245-
+ }
246-
+
247-
+ if err := os.MkdirAll(oemMountPath, 0700); err != nil {
248-
+ f.Logger.Err("failed to create oem mount point: %v", err)
249-
+ return err
250-
+ }
251-
+
252-
+ if err := f.Logger.LogOp(
253-
+ func() error {
254-
+ return syscall.Mount(dev[0], oemMountPath, "ext4", 0, "")
255-
+ },
256-
+ "mounting %q at %q", distro.OEMDevicePath(), oemMountPath,
257-
+ ); err != nil {
258-
+ return fmt.Errorf("failed to mount device %q at %q: %v",
259-
+ distro.OEMDevicePath(), oemMountPath, err)
260-
+ }
261-
+
262-
+ return nil
263-
+}
264-
+
265-
+// umountOEM unmounts the oem partition at oemMountPath.
266-
+func (f *Fetcher) umountOEM(oemMountPath string) {
267-
+ // ignore the error for the linter
268-
+ _ = f.Logger.LogOp(
269-
+ func() error { return syscall.Unmount(oemMountPath, 0) },
270-
+ "unmounting %q", oemMountPath,
271-
+ )
272-
+}
273185
--
274-
2.51.0
186+
2.53.0
275187

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 22332650e3b97479aca7144b04a6dbd2590596de Mon Sep 17 00:00:00 2001
2+
From: James Le Cuirot <jlecuirot@microsoft.com>
3+
Date: Mon, 6 Apr 2026 13:13:58 +0100
4+
Subject: [PATCH 14/18] config: Support oem:// schema in newer config spec
5+
versions
6+
7+
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
8+
---
9+
config/v3_5/types/url.go | 2 +-
10+
config/v3_6_experimental/types/url.go | 2 +-
11+
2 files changed, 2 insertions(+), 2 deletions(-)
12+
13+
diff --git a/config/v3_5/types/url.go b/config/v3_5/types/url.go
14+
index b1f96337..752044ce 100644
15+
--- a/config/v3_5/types/url.go
16+
+++ b/config/v3_5/types/url.go
17+
@@ -32,7 +32,7 @@ func validateURL(s string) error {
18+
}
19+
20+
switch u.Scheme {
21+
- case "http", "https", "tftp", "gs":
22+
+ case "http", "https", "tftp", "gs", "oem":
23+
return nil
24+
case "s3":
25+
if v, ok := u.Query()["versionId"]; ok {
26+
diff --git a/config/v3_6_experimental/types/url.go b/config/v3_6_experimental/types/url.go
27+
index b1f96337..752044ce 100644
28+
--- a/config/v3_6_experimental/types/url.go
29+
+++ b/config/v3_6_experimental/types/url.go
30+
@@ -32,7 +32,7 @@ func validateURL(s string) error {
31+
}
32+
33+
switch u.Scheme {
34+
- case "http", "https", "tftp", "gs":
35+
+ case "http", "https", "tftp", "gs", "oem":
36+
return nil
37+
case "s3":
38+
if v, ok := u.Query()["versionId"]; ok {
39+
--
40+
2.53.0
41+

sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/files/0014-internal-resource-url-support-btrfs-as-OEM-partition.patch

Lines changed: 0 additions & 39 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 9840bd7740f5667f8b2d6e3d87da226dab14bf83 Mon Sep 17 00:00:00 2001
1+
From f0030362abcedf24149860673ef0596cf3051787 Mon Sep 17 00:00:00 2001
22
From: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
33
Date: Mon, 4 Mar 2024 15:05:14 +0100
4-
Subject: [PATCH 17/19] docs: Add re-added platforms to docs to pass tests
4+
Subject: [PATCH 17/18] docs: Add re-added platforms to docs to pass tests
55

66
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
77
Co-Authored-By: Krzesimir Nowak <knowak@microsoft.com
@@ -10,18 +10,18 @@ Co-Authored-By: Krzesimir Nowak <knowak@microsoft.com
1010
1 file changed, 4 insertions(+)
1111

1212
diff --git a/docs/supported-platforms.md b/docs/supported-platforms.md
13-
index f8e1d3ae..0a30664c 100644
13+
index 897eeabd..2a861637 100644
1414
--- a/docs/supported-platforms.md
1515
+++ b/docs/supported-platforms.md
16-
@@ -15,6 +15,7 @@ Ignition is currently supported for the following platforms:
17-
* Bare Metal - Use the `ignition.config.url` kernel parameter to provide a URL to the configuration. The URL can use the `http://`, `https://`, `tftp://`, `s3://`, or `gs://` schemes to specify a remote config or the `oem://` scheme to specify a local config, rooted in `/usr/share/oem`.
16+
@@ -16,6 +16,7 @@ Ignition is currently supported for the following platforms:
17+
* PXE - Use the `ignition.config.url` and first boot kernel parameters to provide a URL to the configuration. The URL can use the `http://`, `https://`, `tftp://`, or `s3://` schemes to specify a remote config or the `oem://` scheme to specify a local config, rooted in `/usr/share/oem`.
1818
* [Brightbox] (`brightbox`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
1919
* [CloudStack] (`cloudstack`) - Ignition will read its configuration from the instance userdata via either metadata service or config drive. Cloud SSH keys are handled separately.
2020
+* `cloudsigma` - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2121
* [DigitalOcean] (`digitalocean`) - Ignition will read its configuration from the droplet userdata. Cloud SSH keys and network configuration are handled separately.
2222
* [Exoscale] (`exoscale`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2323
* [Google Cloud] (`gcp`) - Ignition will read its configuration from the instance metadata entry named "user-data". Cloud SSH keys are handled separately.
24-
@@ -30,6 +31,9 @@ Ignition is currently supported for the following platforms:
24+
@@ -31,6 +32,9 @@ Ignition is currently supported for the following platforms:
2525
* [Equinix Metal] (`packet`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2626
* [IBM Power Systems Virtual Server] (`powervs`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2727
* [QEMU] (`qemu`) - Ignition will read its configuration from the 'opt/com.coreos/config' key on the QEMU Firmware Configuration Device (available in QEMU 2.4.0 and higher).
@@ -32,5 +32,5 @@ index f8e1d3ae..0a30664c 100644
3232
* [UpCloud] (`upcloud`) - Ignition will read its configuration from the instance userdata fetched from the metadata service (which is NOT enabled by default, make sure you enable it if you use custom images). Cloud SSH keys are handled separately.
3333
* [VirtualBox] (`virtualbox`) - Use the VirtualBox guest property `/Ignition/Config` to provide the config to the virtual machine.
3434
--
35-
2.51.0
35+
2.53.0
3636

0 commit comments

Comments
 (0)