Skip to content

Conversation

@poettering
Copy link
Member

This extends systemd-import-generator to not only download a disk image at boot, but also attach it to a loopback device, so that we can boot from it.

We have most of the pieces already in place, this just polishes some things, to make this round.

The topmost commit contains example command lines that just work to make systemd-vmspawn boot from a mkosi serve call.

Note that this does not address how to get the UKI running on the target system, this only deals with the later boot phase once the UKI is already running.

This is WIP, because it lacks docs, and I want to do some more polishing. But it works great.

Ultimate goal, provide a complete solution so that we also can do uefi http boot for ukis

Copy link
Member

@yuwata yuwata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

@yuwata yuwata added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed please-review PR is ready for (re-)review by a maintainer labels Feb 8, 2025
@github-actions github-actions bot added documentation util-lib sd-boot/sd-stub/bootctl mkosi please-review PR is ready for (re-)review by a maintainer and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Feb 10, 2025
@poettering
Copy link
Member Author

Added docs, and the ability to automatically derive the rootfs URL from the UEFI network boot URL.

@davidmalcolm
Copy link
Contributor

Shouldn't this be boot "from https" rather than "from http"? Downloading the rootfs via "http" sounds like a security hole waiting to be exploited e.g. by manipulation of the data between the server and the client, or via untrustworthy DNS redirecting the client to an entirely different rootfs. Is there something in place to warn the user about such configurations?

@poettering
Copy link
Member Author

Shouldn't this be boot "from https" rather than "from http"? Downloading the rootfs via "http" sounds like a security hole waiting to be exploited e.g. by manipulation of the data between the server and the client, or via untrustworthy DNS redirecting the client to an entirely different rootfs. Is there something in place to warn the user about such configurations?

the security model of uefi builds on secureboot and tpm measurements, and in Linux world on shim. hence, it doesn't matter if the download is attacked on the wire, because it will be validated before it is used using the usual mechanisms.

I think it's illusionary to believe that the certificate database in uefi could ever be kept reasonably up-to-date to make https work reasonably (unless you enroll your own https certs to the uefi https cert db).

This one is between "efi" and "linux": we'll recognize such entries as
linux, but we'll just invoke them as EFI binaries.

This creates a high-level concept for invoking UKIs via indirection of a
bls type #1 entry, for example to permit invocation from a non-standard
path or for giving entries a different name.

Companion BLS spec PR:

uapi-group/specifications#135

(Let's rename LOADER_UNIFIED_LINUX to LOADER_TYPE2_UKI at the same time
to reduce confusion what is what)
With this we can now do:

systemd-vmspawn -n -i foobar.raw -s io.systemd.boot.entries-extra:particleos-current.conf=$'title ParticleOS Current\nuki-url http://example.com/somedir/uki.efi'

Assuming sd-boot is available inside the ESP of foobar.raw a new item
will show up in the boot menu that allows booting directly into the
specified UKI.
@poettering poettering merged commit 4a2f437 into systemd:main Feb 21, 2025
42 of 47 checks passed
@poettering poettering added the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Feb 21, 2025
/* passno= */ is_device_path(what) ? 1 : 0,
flags,
SPECIAL_INITRD_ROOT_FS_TARGET,
"imports.target");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After=imports.target should be conditional, I think.

flags,
SPECIAL_INITRD_USR_FS_TARGET);
SPECIAL_INITRD_USR_FS_TARGET,
"imports.target");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here.

@bluca bluca removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Jun 3, 2025
g7 pushed a commit to droidian/systemd that referenced this pull request Aug 17, 2025
poettering added a commit to poettering/specifications2 that referenced this pull request Sep 26, 2025
This is used by systemd/systemd#36314 to make
networking boot work nicely within the BLS constructs.

The "uki" stanza also should have uses in a world where a single UKI
shall be invoked by multiple locally defined menu entries, for example
on nixos or ostree systems, where each commit shall synthesize a
separate menu entry, often referencing the same UKI.
poettering added a commit to uapi-group/specifications that referenced this pull request Sep 26, 2025
This is used by systemd/systemd#36314 to make
networking boot work nicely within the BLS constructs.

The "uki" stanza also should have uses in a world where a single UKI
shall be invoked by multiple locally defined menu entries, for example
on nixos or ostree systems, where each commit shall synthesize a
separate menu entry, often referencing the same UKI.
qwertviop added a commit to qwertviop/systemd that referenced this pull request Sep 28, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed correctly, currently the same way that
`efi` is.
qwertviop added a commit to qwertviop/systemd that referenced this pull request Sep 28, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed correctly, currently the same way that
`efi` is.
qwertviop added a commit to qwertviop/systemd that referenced this pull request Sep 28, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.
qwertviop added a commit to qwertviop/systemd that referenced this pull request Sep 28, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.
qwertviop added a commit to qwertviop/systemd that referenced this pull request Sep 29, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.
qwertviop added a commit to qwertviop/systemd that referenced this pull request Sep 29, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.
keszybz pushed a commit to keszybz/systemd that referenced this pull request Oct 13, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.

(cherry picked from commit 4a94a1b)
keszybz pushed a commit that referenced this pull request Oct 13, 2025
Commit e2a3d56 (as part of #36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.

(cherry picked from commit 4a94a1b)
keszybz pushed a commit to keszybz/systemd that referenced this pull request Nov 6, 2025
Commit e2a3d56 (as part of systemd#36314)
makes sd-boot recognize a 'uki' stanza in a boot loader entry and
uapi-group/specifications@3f2bd82 adds
it to the BLS, but bootctl and other components parsing said config do
not know about it, leading to the error message
`Unknown line 'uki', ignoring.` when attempting to parse the same entry.

This commit makes it get parsed the same way that that 'efi' is.

(cherry picked from commit 4a94a1b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

9 participants