1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00
Commit Graph

60019 Commits

Author SHA1 Message Date
Frantisek Sumsal
761b1d8314 test: don't overwrite existing $QEMU_OPTIONS 2022-09-20 22:40:02 +02:00
Daan De Meyer
06d6ea1b16 mkosi: Set ExtraSearchPaths=build/ by default
When hacking on systemd, let's have mkosi prefer executables from
the build directory over the system ones.
2022-09-20 21:59:00 +02:00
Lennart Poettering
0026791f2e
Merge pull request #24521 from poettering/boot-loader-spec-dollar-boot-fix
boot loader spec fixes
2022-09-20 21:51:22 +02:00
Lennart Poettering
0b81e47e80 boot-loader-spec: undo redefinition of $BOOT
In 53c26db4da the meaning of $BOOT was
redefined. I think that's quite problematic, since the concept is
implemented in code and interface of bootctl. Thus, I think we should
stick to the original definition, which is: "where to *place* boot menu
entries" (as opposed to "where to *read* boot menu entries from").

The aforementioned change was done to address two things afaiu:

1. it focussed on a $BOOT as the single place to put boot entries in,
   instead of mentioning that both ESP and $BOOT are expected to be
   the source

2. it mentioned the /loader/ dir (as location for boot loader resources)
   itself as part of the spec, which however only really makes sense in
   the ESP. /loader/entries/ otoh makes sense in either the ESP or
   $BOOT.

With this rework I try to address these two issues differently:

1. I intend to make clear the $BOOT is the "primary" place to put stuff
   in, and is what should be mounted to /boot/.

2. The ESP (if different from $BOOT) is listed as "secondary" source to
   read from, and is what should be mounted to /efi/. NB we now make the
   distinction between "where to put" (which is single partition) and
   "where to read from".

3. This drops any reference of the /loader/ dir witout the /entries/
   suffix. Only the full /loader/entries/ dir (and its companion file
   /loader/entries.srel) are now mentioned. Thus isolated /loader/
   directory hence becomes irrelevant in the spec, and the fact that
   sd-boot maintains some files there (and only in the ESP) is kept out
   of the spec, because it is irrelevant to other boot loaders.

4. It puts back the suggestion to mount $BOOT to /boot/ and the ESP to
   /efi/ (and suggests adding a symlink or bind mount if both are the
   same partition). Why? Because the dirs are semantically unrelated:
   it's OK and common to have and ESP but no $BOOT, hence putting ESP
   inside of a useless, non-existing "ghost" dir /boot/ makes little
   sense. More importantly though, because these partitions are
   typically backed by VFAT we want to maintain them as an autofs, with
   a short idle delay, so that the file systems are unmounted (and thus
   fully clean) at almost all times. This doesn't work if they are
   nested within each other, as the establishment of the inner autofs
   would pin the outer one, making the excercise useless. Now I don't
   think the spec should mention autofs (since that is an implementation
   detail), but it should arrange things so that this specific, very
   efficient, safe and robust implementation can be implemented.

The net result should be easy from an OS perspective:

1. *Put* boot loader entries in /boot/, always.

2. *Read* boot loader entries from both /boot/ and /efi/ -- if these are distinct.

3. The only things we define in the spec are /loader/entries/*.conf and
   /EFI/Linux/*.efi in these two partitions (well, and the companion
   file /loader/entries.srel

4. /efi/ and /boot/ because not nested can be autofs.

5. bootctl code and interface (in particular --esp-path= and
   --boot-path=) match the spec again. `bootctl -x` and `bootctl -p`
   will now print the path to $BOOT and ESP again, matching the concepts
   in the spec again.

From the sd-boot perspective things are equally easy:

1. Read boot enrties from ESP and XBOOTLDR.

2. Maintain boot loader config/other resources in ESP only.

And that's it.

Fixes: #24247
2022-09-20 21:49:58 +02:00
Lennart Poettering
e04ef18e48 boot-loader-spec: fix typo 2022-09-20 21:35:58 +02:00
Lennart Poettering
cae6a289db boot-loader-spec: add comment about case sensitivity of file names 2022-09-20 21:35:58 +02:00
Luca Boccassi
3d4cbc3f8e TODO: drop support for unmerged-usr in H2 2023 2022-09-20 20:08:18 +01:00
Yu Watanabe
9616f550b8 core/device: introduce device_propagate_reload() 2022-09-21 03:12:12 +09:00
Yu Watanabe
c072b84c7e core/device: introduce device_by_path() helper function 2022-09-21 03:12:12 +09:00
Yu Watanabe
1cb89339bc core/device: removed devices are not ready 2022-09-21 03:12:12 +09:00
Yu Watanabe
ef9ca572e1 core/device: use DEVICE_NOT_FOUND 2022-09-21 03:12:12 +09:00
Lennart Poettering
996dbf98e4 measure: separate out PE section options in --help text
Let's separate the PE section options in the --help text to make clearer
that they are about PE sections, and thus make things less confusing
regarding the cryptic names. Specifically, there's now a separate
section in the --help text that looks like this:

<snip>
UKI PE Section Options:                                         UKI PE Section
     --linux=PATH        Path Linux kernel image                → .linux
     --osrel=PATH        Path to os-release file                → .osrel
     --cmdline=PATH      Path to file with kernel command line  → .cmdline
     --initrd=PATH       Path to initrd image                   → .initrd
     --splash=PATH       Path to splash bitmap                  → .splash
     --dtb=PATH          Path to Devicetree file                → .dtb
     --pcrpkey=PATH      Path to public key for PCR signatures  → .pcrpkey
</snipe>

(The section title is underlined, like we usually do it)

I think separating this out, and organizing the section name in tabular
form emphasizes nicely where this switches get their name from and what
they mean.

Hopefully addresses concerns from
https://github.com/systemd/systemd/pull/24458#discussion_r967052720 in a
diferent way.

(Also dropped a hint regarding DER format for public key. it's simply
wrong, we use PEM like everyone else on Linux. Outside of Java land DER
isn't popular, so we don't need to mention it here in the --help text,
man page should be enough.)
2022-09-20 18:51:37 +02:00
Lennart Poettering
5dcb9c3ccd stub: typo fix in comment
https://github.com/systemd/systemd/pull/24458#discussion_r966941104
2022-09-20 18:40:39 +02:00
Yu Watanabe
0a935bb850
Merge pull request #24711 from poettering/verify_fsroot_dir-rework
find-esp: rework verify_fsroot_dir()  a bit
2022-09-21 00:56:00 +09:00
Lennart Poettering
739d9cae40 recurse-dir: use fd_reopen() at one more place
Inspired by 83b94cf10e
2022-09-21 00:55:23 +09:00
Zbigniew Jędrzejewski-Szmek
7bb99e23e5
Delete CNAME 2022-09-20 17:46:40 +02:00
Daan De Meyer
92cd7e7ccb repart: Rename fs to root in do_copy_files() and do_make_directories()
Preparation for future commits
2022-09-20 16:49:59 +02:00
Zbigniew Jędrzejewski-Szmek
6d88188249 man/systemd-gpt-auto-generator: reword phrasing about partition location
"located on the same disk as the ESP is located on" is hard to grok. Let's
use more natural phrasing. Also, we shouldn't say that "The first foo partition
… is mounted to …", because this doesn't explain what is happening. The
partition could be empty, and there could be other partitions with the "foo"
content, but what matters is the UUID.
2022-09-20 16:48:50 +02:00
Zbigniew Jędrzejewski-Szmek
c6a173ef3b man/systemd-gpt-auto-generator: export type flags by name, trim table
We listed many of the root-partition type uuids, but not all. I think the
chances of somebody using the discoverable partition magic on an Itanium system
are fairly low at this point. So let's remove all architectures except the two
most popular consumer architectures. People building Longsoon or RISC-V images
are likely to have the online version of the Discoverable Partitions
Specifications handy anyway, and it makes the man page easier to read. It also
reduces the chances that somebody adding new entries to the table has some
select&paste mishap. We've already had this happen in the past and it's fairly
nasty bug. We don't need to expose the information in two places with manual
propagation between them.
2022-09-20 16:48:50 +02:00
Zbigniew Jędrzejewski-Szmek
9a941ffefe sd-gpt, docs: define s390 before s390x
In all other cases we have the older variant before the newer. And since we
generate some documentation tables from the header, this order is also visible
for users. Let's restore the order. This commit does
4565246911 in a slightly different fashion.
2022-09-20 16:48:50 +02:00
Zbigniew Jędrzejewski-Szmek
974fcc916c tools/list-discoverable-partitions: make the script work again 2022-09-20 16:48:50 +02:00
Zbigniew Jędrzejewski-Szmek
92e7202812 headers: export partition uuids and flags in new sd-gpt.h file
I think those constants are generally useful. It's quite easy to make a mistake
when copying things from the docs, so let's make them easy and convenient to
access.
2022-09-20 16:48:50 +02:00
Zbigniew Jędrzejewski-Szmek
b66a6e1a58 man: "the initial RAM disk" → "the initrd"
In many places we spelled out the phrase behind "initrd" in full, but this
isn't terribly useful. In fact, no "RAM disk" is used, so emphasizing this
is just confusing to the reader. Let's just say "initrd" everywhere, people
understand what this refers to, and that it's in fact an initramfs image.

Also, s/i.e./e.g./ where appropriate.

Also, don't say "in RAM", when in fact it's virtual memory, whose pages
may or may not be loaded in page frames in RAM, and we have no control over
this.

Also, add <filename></filename> and other minor cleanups.
2022-09-20 16:48:50 +02:00
Luca BRUNO
72ceee435d docs: add a note about selectively overriding default dependencies
This documents that explicit `Before=`/`After=` dependencies can be
used to selectively override implicit ordering coming from default
dependencies. That allows for more granular control compared to the
already documented `DefaultDependencies=no` option.

The alternative approach came up in a discussion around the ordering
of `boot-complete.target`, so this also adds an explicit suggestion
in that direction to the "Automatic Boot Assessment" documentation.

Ref: https://lists.freedesktop.org/archives/systemd-devel/2022-September/048330.html
2022-09-20 13:57:26 +02:00
Lennart Poettering
2b3a821f91 find-esp: when searching, don't trip over inodes we expect to be dirs to be something else, just continue searching 2022-09-20 13:52:01 +02:00
Lennart Poettering
bd80fd7e56 find-esp: rework verify_fsroot_dir() around statx()
Let's rework verify_fsroot_dir() around two statx() calls, which should
usually give us all information we need. Let's then add a call to the
btrfs ioctl only if the caller actually wants to know the backing block
device (which it generally only wants if it then intends to verify
partition type, and similar).

This makes things more robust on new kernels, and bypasses the btrfs
ioctls in environments where we cannot actually interpret the results
properly (since they reference btrfs devices via /dev/ paths, which we
likely cannot resolve in containers)

Fixes: #24616
2022-09-20 13:52:01 +02:00
Lennart Poettering
52f19d9678 stat-util: add statx_mount_same() to check if two stax refer to the same mount 2022-09-20 13:52:01 +02:00
Lennart Poettering
2bd315fb2b stat-util: add statx_inode_same() helper to check if two statx structs refer to same inode
The same as stat_inode_same(), but for struct statx rather than struct
stat.
2022-09-20 13:52:01 +02:00
Lennart Poettering
d45dee7c00 chase-symlinks: don't insist on absolute paths if CHASE_PREFIX_ROOT is set
There's little reason to require this, given that we can just say that
if a relative path is specified it is to be read relative to the root.

This fixes a bootctl bug introduced by
3730dc5d5b which didn't bother prefixing
paths as necessary.
2022-09-20 13:52:01 +02:00
Lennart Poettering
13879c54d4 blockdev-util: make sure get_block_device_fd() works reliably for O_PATH, too 2022-09-20 13:52:01 +02:00
Lennart Poettering
fc5bd43503 test-blockdev-util: check if r is actually a failure before ERRNO_IS_PRIVILEGE 2022-09-20 13:52:01 +02:00
Jan Janssen
ba2a105c2b stub: Always use LINUX_INITRD_MEDIA_GUID if available
The kernel PE image version can be used to detect support for this
feature, allowing us to prefer the generic code of the deprecated EFI
handover protocol.
2022-09-20 13:05:41 +02:00
Jan Janssen
a3461db85f stub: Be explicit about EFI handover calling convention 2022-09-20 12:55:43 +02:00
Jan Janssen
c4e2302ee6 stub: Remove unnecessary asm cli call
Apparently, this is not needed when red zones are disabled and we do
that.
2022-09-20 12:55:43 +02:00
Jan Janssen
09173c916c stub: Properly clean up pages on error 2022-09-20 12:55:39 +02:00
Jan Janssen
757d6c916d stub: Refuse operation if kernel lacks EFI handover support 2022-09-20 12:54:53 +02:00
Jan Janssen
6944c61163 stub: Refuse operating above 4G if not supported
We could try to relocate these but that is probably not needed. So far
we have not been bitten by this in the real world and kernels we boot
likely already support this anyway.
2022-09-20 12:54:53 +02:00
Jan Janssen
d62c177756 stub: Provide a proper boot params page
The boot params passed to the kernel only has to be one page in size
and the size of the setup header has to be calculated as it depends on
the boot protocol version supported by the kernel.
2022-09-20 12:54:47 +02:00
Jan Janssen
e163680774 stub: Fix above 4G boot
The kernel x86 boot protocol does not expect this value to be set when
using EFI handover protocol. If the stub is loaded above 4G we would
end up discarding the high bits, breaking boot.

Fixes: #24707
2022-09-20 12:45:07 +02:00
Jan Janssen
55b5daf9b2 boot: Change the way we provide builtins
Relying on symbol aliasing seems to be rather unreliable. Instead just
use some light #ifdefery.

Fixes: #24630
2022-09-20 12:43:48 +02:00
Yu Watanabe
2f9d231738 udev: use block_device_is_whole_disk()
No functional changes, just refactoring.

Note, this also makes synthesize_change() propagate the error from
synthesize_change_one(). However, the caller of synthesize_change()
ignores the failure anyway, hence the change does not take any effect.
2022-09-20 09:44:19 +02:00
Yu Watanabe
83b94cf10e sd-device: use fd_reopen() at one more place
It provides recognizable error if /proc is not mounted.
2022-09-20 09:41:34 +02:00
William Roberts
3fab44b2ff cryptsetup: use TPM flags over bool
This works becuase TPM2_FLAGS_USE_PIN is 1 and bool is a 1 so the bits
line up as expected, however if for some reason flags change values and
for clarity check if the boolean indicates this flag and pass the flag
value.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
2022-09-20 08:05:33 +09:00
Yu Watanabe
57c15ca357 meson: make several tests run sequentially
Follow-up for f93ba37530.
2022-09-20 02:56:57 +09:00
Yu Watanabe
8ef0fc7acc
Merge pull request #24744 from yuwata/mkdir-chase-symlinks
mkdir: chase_symlinks_and_stat() does not return 0
2022-09-20 01:43:00 +09:00
Daan De Meyer
4cde368a08
Merge pull request #24731 from yuwata/sd-device-opendir
sd-device: introduce device_opendir()
2022-09-19 17:06:38 +02:00
Yu Watanabe
f8d5048dbf test: add more test cases for mkdir_p_safe() and mkdir_p_root() 2022-09-19 22:55:47 +09:00
Yu Watanabe
f1d93b84bc mkdir: chase_symlinks_and_stat() does not return 0
This reverts commits e22916e61d and
1e146d7382.
2022-09-19 22:54:05 +09:00
Yu Watanabe
4b544b5ffd
Merge pull request #24742 from keszybz/hwdb-252
hwdb update for v252-rc1
2022-09-19 22:51:13 +09:00
Lennart Poettering
f92ebc86dd tpm2-util: make tpm2_pcr_bank_from_string() case-insensitive
This way we can use it directly in measure.c, and thus remove a bit of
redundant code.

OpenSSL prefers uppercasing the MD names, others don't hence let's be
lenient here.
2022-09-19 22:50:44 +09:00