1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00
Commit Graph

61007 Commits

Author SHA1 Message Date
Lennart Poettering
45e99be3fb
Merge pull request #24855 from kraxel/qemu
better qemu support (handle direct kernel boot etc).
2022-11-16 14:53:42 +01:00
Lennart Poettering
155519f4a3
Merge pull request #25393 from poettering/tpm2-override
tpm2-util: force default TCTI to be "device" with parameter "/dev/tpm…
2022-11-16 14:30:26 +01:00
Gerd Hoffmann
941d418d19 systemd-boot man page: add section for virtual machines 2022-11-16 12:52:58 +01:00
Gerd Hoffmann
8fec4f95be boot: improve support for qemu
systemd-boot expects being loaded from ESP and is quite unhappy in case
the loaded image device path is something else.  When running on qemu
this can easily happen though.  Case one is direct kernel boot, i.e.
loading via 'qemu -kernel systemd-bootx64.efi'.  Case two is sd-boot
being added to the ovmf firmware image and being loaded from there.

This patch detects both cases and goes inspect all file systems known to
the firmware, trying to find the ESP.  When present the
VMMBootOrderNNNN variables are used to inspect the file systems in the
given order.
2022-11-16 12:52:58 +01:00
Zbigniew Jędrzejewski-Szmek
b8d6b1608e
Merge pull request #24555 from medhefgo/bootctl
bootctl: Small improvements
2022-11-16 12:27:30 +01:00
Lennart Poettering
f038576943 localectl,analyze: some minor vertical table rework fixes
Follow-up for #25339
2022-11-16 11:39:32 +01:00
Daan De Meyer
bb8b8875f4
Merge pull request #24944 from DaanDeMeyer/repart-rootless
repart: Add support for running without root privileges
2022-11-16 09:09:06 +01:00
Daan De Meyer
1db6dbb1dc Revert "journal: Make sd_journal_previous/next() return 0 at HEAD/TAIL"
This commit broke backwards compatibility so let's revert it until
we find a better solution.

This reverts commit 977ad21b5b.
2022-11-16 00:20:54 +01:00
Marcus Schäfer
883e7cbfc0
Fix reading /etc/machine-id in kernel-install (#25388)
* Fix reading /etc/machine-id in kernel-install

The kernel-install script has code to read the contents of
/etc/machine-id into the MACHINE_ID variable. Depending
on the variable content kernel-install either logs the
value or creates a new machine id via 'systemd-id128 new'.
In that logic there is one issue. If the file /etc/machine-id
exists but is empty, the script tries to call read on an
empty file which return with an exit code != 0. As the
script code also uses 'set -e', kernel-install will exit at
this point which is unexpected.

The condition of an empty /etc/machine-id file exists for
example when building OS images, which should initialize the
system id on first boot but not staticly inside of the image.
afaik an empty /etc/machine-id is also a common approach
to make systemd indicate that it should create a new system
id. Because of this, the commit makes sure the reading of
/etc/machine-id does not fail in any case such that the
handling of the MACHINE_ID variable takes place.
2022-11-15 23:17:19 +00:00
angus-p
847dd8927b Update hostnamectl.xml
set-hostname is obsolete
2022-11-16 00:12:16 +01:00
Lennart Poettering
50a085143f tpm2: add some extra validation of device string before using it
Let's add some extra validation before constructing and using the .so
name to load. This isn't really security sensitive, given that we
used secure_getenv() to get the device string (and it thus should have
been come from a trusted source) but let's better be safe than sorry.
2022-11-15 23:14:54 +01:00
Lennart Poettering
34906680af tpm2-util: force default TCTI to be "device" with parameter "/dev/tpmrm0"
Apparently some distros default to tss-abmrd. Let's bypass that and
always go to the kernel resource manager.

abmrd cannot really work for us, since we want to access the TPM already
in earliest boot i.e. in environments the abmrd service is not available
in.

Fixes: #25352
2022-11-15 23:14:13 +01:00
Pasha Vorobyev
d7fe0a6723 MemoryZSwapMax directive to configure new memory.zswap.max cgroup file 2022-11-15 21:15:37 +01:00
Daan De Meyer
e2d057456d repart: Run most repart integration tests without root privileges
To make sure rootless mode keeps working, let's run all repart
integration tests that we can without root privileges. The only ones
we need to keep running with root privileges are the tests that operate
on a block/loop device and those that use --image=.
2022-11-15 20:23:51 +01:00
Daan De Meyer
a64769d605 repart: Don't use loop devices when we're not operating on a block device
When repart is not operating on a block device, if we avoid using
any loop devices at all, it becomes possible to run repart without
needing root privileges.

Note that this also depends on the filesystems in use to support
population without needing root privileges (specifically, squashfs,
ext4 or btrfs).
2022-11-15 20:23:51 +01:00
Daan De Meyer
0b34f351d1 repart: Change mode of temporary root to 755
Let's make sure regular users can access read/execute files when
we're populating from a temporary root.
2022-11-15 20:23:51 +01:00
Daan De Meyer
0eb23798d5 repart: Fail early if no sources are provided for a read-only filesystem 2022-11-15 20:23:51 +01:00
Daan De Meyer
2a99f964ff repart: Skip partition_populate_directory() if no sources are provided 2022-11-15 20:23:51 +01:00
Daan De Meyer
6d6cefad37 repart: Fail early if we're missing privileges to populate a filesystem 2022-11-15 20:23:51 +01:00
Daan De Meyer
e59678b2cf repart: Ensure files end up owned by root in generated filesystems
By forking off a user namespace before running mkfs and ID mapping
the user running repart to root in the user namespace, we can make
sure that files in the generated filesystems are all owned by root
instead of the user running repart.

To make this work we have to make sure that all the files in the
root directory that's passed to the mkfs binary are owned by the
user running repart, so we have to drop the shortcut for only a
single root directory in partition_populate_directory().
2022-11-15 20:23:51 +01:00
Daan De Meyer
cf2ed23cd2 repart: Fix copy failure error message 2022-11-15 20:23:51 +01:00
Daan De Meyer
4ecd39c511 repart: Move verity sig formatting into data partition functions
Refactoring to make implementing rootless repart easier.
2022-11-15 20:23:47 +01:00
Daan De Meyer
2b392d860e repart: Move verity hash formatting into data partition functions
Refactoring to make implementing rootless repart easier.
2022-11-15 20:23:28 +01:00
Daan De Meyer
48a09a8fff repart: Do offline encryption instead of online
Offline encryption can be done without mounting the luks device. For
now we still use loop devices to split out the partition we want to
write to but in a later commit we'll replace this with a regular file.

For offline encryption, we need to keep 2x the luks header size space
free at the end of the partition, so this means our encrypted partitions
will be 16M larger than before.
2022-11-15 20:07:54 +01:00
Daan De Meyer
98e0456ec0 repart: Let libcryptsetup calculate the volume key
We also bump the volume key size to 512 bits.
2022-11-15 20:07:54 +01:00
Daan De Meyer
bf3598beff mkfs-util: Add support to populate vfat without mounting using mcopy
mkfs.vfat doesn't support specifying a root directory to bootstrap
the filesystem from (see https://github.com/dosfstools/dosfstools/issues/183).
Instead, we can use the mcopy tool from the mtools package to copy
files into the vfat filesystem after creating it without needing to
mount the vfat filesystem.
2022-11-15 20:07:54 +01:00
Daan De Meyer
68665704dc mkosi: Add mkfs tools to mkosi image
Useful for testing systemd-repart
2022-11-15 20:07:54 +01:00
Daan De Meyer
59e2be46cc mkfs-util: Add root support for ext and btrfs
For these filesysrems, it's useful to provide the filesystem upfront
so that we don't have to mount it later which requires root privileges.
2022-11-15 20:07:54 +01:00
Daan De Meyer
ddf615a11c mkfs-util: Make argument handling for mkfs binaries more flexible
Preparation for the next commit.
2022-11-15 20:07:54 +01:00
Daan De Meyer
c93b0efdb9 btrfs-util: Remove bogus assert()
If size is zero, BTRFS_IOC_CLONE_RANGE will copy until the end of
the source file.
2022-11-15 20:07:54 +01:00
Daan De Meyer
2b0cff0469
Merge pull request #25001 from DaanDeMeyer/repart-filter
repart: Add --include/--exclude-partitions
2022-11-15 20:07:24 +01:00
Daan De Meyer
56bb434e9b repart: Add integration test for --include/--exclude-partitions 2022-11-15 13:45:28 +01:00
Daan De Meyer
81d1098bc1 repart: Add --include/--exclude-partitions
Let's allow filtering the partitions to operate on by partition
type UUID. This is necessary when building bootable images with a
verity protected root/usr partition as we can only build the UKI
image when we have the verity roothash which means we cannot populate
the EFI partition yet when we run repart initially to determine the
verity roothash.
2022-11-15 13:45:25 +01:00
Daan De Meyer
00428745e3 repart: Use first unused partition number for new partitions
If we skip some partition types in a first run of systemd-repart,
we don't want their partition numbers to be different than usual,
so let's change the allocation of partition numbers to account for
that.
2022-11-15 13:27:59 +01:00
Daan De Meyer
22e932f4d1 gpt: Expose GptPartitionType and get rid of SECONDARY/OTHER
Instead of exposing just the partition type UUID, let's expose the
GptPartitionType struct, which has a lot more information available
in a much more accessible way.

Also, let's get rid of SECONDARY/OTHER in PartitionDesignator. These
were only there to support preferred architectures in dissect-image.c,
but we can easily handle that by comparing architectures when we decide
whether to override a partition. This is done in a new function
compare_arch().
2022-11-15 13:27:15 +01:00
Li kunyu
bef69ae878
repart: Remove the repeated ';' from code (#25386) 2022-11-15 17:02:51 +09:00
Daan De Meyer
32a3f802f6
Merge pull request #24908 from DaanDeMeyer/repart-minimize
repart: Add Minimize setting
2022-11-15 08:19:28 +01:00
Daan De Meyer
14697c4156 repart: Add Minimize= integration test 2022-11-14 13:06:17 +01:00
Frantisek Sumsal
09cd639a59
Merge pull request #25327 from keszybz/mkosi-less-work
Skip mkosi runs on docs-only changes and some small cleanups
2022-11-14 11:44:16 +00:00
Luca Boccassi
b06624e47e
Merge pull request #25361 from bluca/readme
README: note a couple more kconfigs
2022-11-14 12:32:39 +01:00
Vitaly Kuznetsov
019243553d measure: fix section names in 'objcopy' example in systemd-measure man
A copy paste error has crippled in the objcopy example in 'systemd-measure'
manual,  "--change-section-vma" should reference the section being added,
not ".splash". When used as-is, the resulting UKI is unbootable.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
2022-11-14 12:31:33 +01:00
Luca Boccassi
a460debc8e README: note Kconfig for verifying DDIs via MoK keys
Also note them in the mkosi.build kernel config list
2022-11-14 11:09:36 +00:00
Zbigniew Jędrzejewski-Szmek
f7ad96506e mkosi: drop spaces after shell redirection operator 2022-11-14 11:59:30 +01:00
Zbigniew Jędrzejewski-Szmek
e642816b65 ci: use mkosi executable directly 2022-11-14 11:59:30 +01:00
Yu Watanabe
0b51a1c8c4 systemctl: do not show unit properties with --all
Fixes a bug introduced by a6e334649d.

Fixes #25343.
2022-11-14 10:00:02 +01:00
Luca Boccassi
244c2a8344 tmpfiles: log at info level when some allowed failures occur
In provision.conf we ship:

d- /root :0700 root :root -
d- /root/.ssh :0700 root :root -

These are allowed to fail, for example on a read-only filesystem. But they still
log at error level, which is annoying and gets flagged. Tune those specific errors
down to info.

There are likely more that could be tuned down, but the important thing is to cover
the tmpfiles.d that we ship right now.

Before:

$ echo -e "d- /root :0700 root :root - \nd- /root/.ssh :0700 root :root -" | SYSTEMD_LOG_LEVEL=err build/systemd-tmpfiles --root=/tmp/img --create -
Failed to create directory or subvolume "/tmp/img/root": Read-only file system
Failed to open path '/tmp/img/root': No such file or directory
$

After:

$ echo -e "d- /root :0700 root :root - \nd- /root/.ssh :0700 root :root -" | SYSTEMD_LOG_LEVEL=err build/systemd-tmpfiles --root=/tmp/img --create -
$
2022-11-14 08:53:07 +01:00
Mike Yuan
dab0156f03 module-util: use the blacklist from module_blacklist= in cmdline
When a module is blacklisted using module_blacklist=
we shouldn't fail with 'Operation not permitted'.
Instead we check for it and skip it if this is the case.
2022-11-14 10:52:01 +09:00
Yu Watanabe
bf0d5cba56
Merge pull request #25368 from yuwata/bootctl-ignore-invalid-boot-entries
bootctl: ignore invalid boot entries
2022-11-14 10:51:33 +09:00
Yu Watanabe
3a7c2bca2b
Merge pull request #25373 from medhefgo/boot-fixes
boot: Small fixes
2022-11-14 08:18:21 +09:00
Yu Watanabe
088377e092 dissect-image: do not try to close invalid fd
Fixes a bug introduced by f7725647bb.

Hopefully fixes #25348.
2022-11-13 21:02:53 +01:00