Skip to content

Commit c7ef1b5

Browse files
committed
sys-apps/ignition: Apply oem:// and mounting fixes
Loading config from the initrd with `oem://` was broken because Ignition was still looking in /usr/share/oem, which is now moved to /oem by the minimal initrd. This also fixes mounting the OEM partition when /mnt does not already exist. This fix is slightly academic, because this currently only happens when PXE booting, where the OEM partition won't exist anyway, but we should fail for the right reason. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
1 parent d380460 commit c7ef1b5

6 files changed

Lines changed: 112 additions & 17 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fixed loading Ignition config from the initrd with `ignition.config.url=oem:///myconf.ign`. This was broken since moving to the minimal initrd.
Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
From 12188bc2ac6220685b9a43132d0e85dce36c4ca5 Mon Sep 17 00:00:00 2001
2-
From: Krzesimir Nowak <knowak@microsoft.com>
3-
Date: Tue, 4 Apr 2023 12:12:42 +0200
4-
Subject: [PATCH 18/19] /usr/share/oem -> /oem
1+
From 8bf635277ccd8f0aeb3bb2e2c67f73dd4188e618 Mon Sep 17 00:00:00 2001
2+
From: James Le Cuirot <jlecuirot@microsoft.com>
3+
Date: Wed, 25 Mar 2026 10:55:24 +0000
4+
Subject: [PATCH 18/21] /usr/share/oem -> /oem
55

6+
Flatcar previously kept looking at the initrd's /usr/share/oem even
7+
after the migration for compatibility, but the minimal initrd now moves
8+
it to /oem before Ignition starts.
69
---
7-
config/util/translate.go | 2 +-
8-
internal/distro/distro.go | 5 ++++-
9-
2 files changed, 5 insertions(+), 2 deletions(-)
10+
config/util/translate.go | 2 +-
11+
docs/supported-platforms.md | 2 +-
12+
internal/distro/distro.go | 2 +-
13+
3 files changed, 3 insertions(+), 3 deletions(-)
1014

1115
diff --git a/config/util/translate.go b/config/util/translate.go
1216
index 347d148c..d4c057b2 100644
@@ -21,22 +25,32 @@ index 347d148c..d4c057b2 100644
2125
} else {
2226
// generate a new path
2327
fsMap[name] = "/tmp/" + name + "-ign" + strconv.FormatUint(addedSuffixCounter, 10)
28+
diff --git a/docs/supported-platforms.md b/docs/supported-platforms.md
29+
index 0a30664c..1522d0ef 100644
30+
--- a/docs/supported-platforms.md
31+
+++ b/docs/supported-platforms.md
32+
@@ -12,7 +12,7 @@ Ignition is currently supported for the following platforms:
33+
* [Amazon Web Services] (`aws`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
34+
* [Microsoft Azure] (`azure`)- Ignition will read its configuration from the custom data provided to the instance. Cloud SSH keys are handled separately.
35+
* [Microsoft Azure Stack] (`azurestack`) - Ignition will read its configuration from the custom data provided to the instance. Cloud SSH keys are handled separately.
36+
-* 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`.
37+
+* 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 `/oem`.
38+
* [Brightbox] (`brightbox`) - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
39+
* [CloudStack] (`cloudstack`) - Ignition will read its configuration from the instance userdata via either metadata service or config drive. Cloud SSH keys are handled separately.
40+
* `cloudsigma` - Ignition will read its configuration from the instance userdata. Cloud SSH keys are handled separately.
2441
diff --git a/internal/distro/distro.go b/internal/distro/distro.go
25-
index f3c32aaf..7359eefe 100644
42+
index f3c32aaf..36bdf3f5 100644
2643
--- a/internal/distro/distro.go
2744
+++ b/internal/distro/distro.go
28-
@@ -32,7 +32,10 @@ var (
29-
bootIDPath = "/proc/sys/kernel/random/boot_id"
45+
@@ -33,7 +33,7 @@ var (
3046
// initramfs directory containing distro-provided base config
3147
systemConfigDir = "/usr/lib/ignition"
32-
- // initramfs directory to check before retrieving file from OEM partition
33-
+ // initramfs directory to check before retrieving file from
34-
+ // OEM partition; note that OEM partition is mounted on /oem
35-
+ // on the host, but initrds still use /usr/share/oem for
36-
+ // backwards compatilibity
37-
oemLookasideDir = "/usr/share/oem"
48+
// initramfs directory to check before retrieving file from OEM partition
49+
- oemLookasideDir = "/usr/share/oem"
50+
+ oemLookasideDir = "/oem"
3851

3952
// Helper programs
53+
groupaddCmd = "groupadd"
4054
--
41-
2.51.0
55+
2.53.0
4256

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From 14b7be1a0a51408df54b36590a25d2cbab228bbc Mon Sep 17 00:00:00 2001
2+
From: James Le Cuirot <jlecuirot@microsoft.com>
3+
Date: Wed, 25 Mar 2026 11:09:40 +0000
4+
Subject: [PATCH 20/21] Create /mnt directory before attempting to mount OEM
5+
partition
6+
7+
This was previously fixed, but it then broke again when the /mnt/oem
8+
mount path was replaced with a temp directory under /mnt. Parent
9+
directories are not created for you when requesting a temp directory.
10+
---
11+
internal/resource/url.go | 10 +++++-----
12+
1 file changed, 5 insertions(+), 5 deletions(-)
13+
14+
diff --git a/internal/resource/url.go b/internal/resource/url.go
15+
index 4471db96..86136422 100644
16+
--- a/internal/resource/url.go
17+
+++ b/internal/resource/url.go
18+
@@ -478,6 +478,11 @@ func (f *Fetcher) fetchFromOEM(u url.URL, dest io.Writer, opts FetchOptions) err
19+
f.Logger.Info("oem config not found in %q, looking on oem partition",
20+
distro.OEMLookasideDir())
21+
22+
+ if err := os.MkdirAll("/mnt", 0755); err != nil {
23+
+ f.Logger.Err("failed to create /mnt directory for oem mount path: %v", err)
24+
+ return err
25+
+ }
26+
+
27+
oemMountPath, err := ioutil.TempDir("/mnt", "oem")
28+
if err != nil {
29+
f.Logger.Err("failed to create mount path for oem partition: %v", err)
30+
@@ -800,11 +805,6 @@ func (f *Fetcher) mountOEM(oemMountPath string) error {
31+
return err
32+
}
33+
34+
- if err := os.MkdirAll(oemMountPath, 0700); err != nil {
35+
- f.Logger.Err("failed to create oem mount point: %v", err)
36+
- return err
37+
- }
38+
-
39+
if err := f.Logger.LogOp(
40+
func() error {
41+
return syscall.Mount(dev[0], oemMountPath, "ext4", 0, "")
42+
--
43+
2.53.0
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From daab4ae13c6511183609c5160999ab1e011a0d8c Mon Sep 17 00:00:00 2001
2+
From: James Le Cuirot <jlecuirot@microsoft.com>
3+
Date: Wed, 25 Mar 2026 11:12:37 +0000
4+
Subject: [PATCH 21/21] Replace deprecated ioutil.TempDir call with
5+
os.MkdirTemp
6+
7+
---
8+
internal/resource/url.go | 3 +--
9+
1 file changed, 1 insertion(+), 2 deletions(-)
10+
11+
diff --git a/internal/resource/url.go b/internal/resource/url.go
12+
index 86136422..a38f4e87 100644
13+
--- a/internal/resource/url.go
14+
+++ b/internal/resource/url.go
15+
@@ -23,7 +23,6 @@ import (
16+
"fmt"
17+
"hash"
18+
"io"
19+
- "io/ioutil"
20+
"net"
21+
"net/http"
22+
"net/url"
23+
@@ -483,7 +482,7 @@ func (f *Fetcher) fetchFromOEM(u url.URL, dest io.Writer, opts FetchOptions) err
24+
return err
25+
}
26+
27+
- oemMountPath, err := ioutil.TempDir("/mnt", "oem")
28+
+ oemMountPath, err := os.MkdirTemp("/mnt", "oem")
29+
if err != nil {
30+
f.Logger.Err("failed to create mount path for oem partition: %v", err)
31+
return ErrFailed
32+
--
33+
2.53.0
34+

sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-2.24.0.ebuild renamed to sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-2.24.0-r1.ebuild

File renamed without changes.

sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-9999.ebuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ else
3535
"${FILESDIR}/0017-docs-Add-re-added-platforms-to-docs-to-pass-tests.patch"
3636
"${FILESDIR}/0018-usr-share-oem-oem.patch"
3737
"${FILESDIR}/0019-internal-exec-stages-mount-Mount-oem.patch"
38+
"${FILESDIR}/0020-Create-mnt-directory-before-attempting-to-mount-OEM-.patch"
39+
"${FILESDIR}/0021-Replace-deprecated-ioutil.TempDir-call-with-os.Mkdir.patch"
3840
)
3941
fi
4042

0 commit comments

Comments
 (0)