1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00
Commit Graph

66884 Commits

Author SHA1 Message Date
Daan De Meyer
bc6a6130ac fs-util: Add XO_SUBVOLUME flag for xopenat()
When specified, xopenat() will try to create a btrfs subvolume and
fall back to creating a regular directory.
2023-08-14 18:46:08 +02:00
Daan De Meyer
e54c79ccc2 btrfs-util: Move subvolume creation to basic/btrfs.h
Also make btrfs_subvol_make() an openat style function.
2023-08-14 18:46:08 +02:00
Daan De Meyer
6819924c30 path-util: Make ret argument optional for path_extract_directory() 2023-08-14 18:46:06 +02:00
Daan De Meyer
672de611dd
Merge pull request #28828 from DaanDeMeyer/sysupdate-fdisk
fdisk-util: Make fdisk_new_context_fd() more generic
2023-08-14 14:23:03 +02:00
Daan De Meyer
e36c6210b7 dissect-image: Fix mount_point_is_available()
We call dir_is_empty() to check if the directory is empty but don't
take the result into account when returning from the function.
2023-08-14 14:22:38 +02:00
Daan De Meyer
2af02e6165 tree-wide: Always include <net/if.h> before related linux headers
Otherwise, we get redefinition errors if <net/if.h> is included later
on by another header.
2023-08-14 13:16:46 +02:00
Daan De Meyer
93f125a66f repart: Use 4096 as the fallback sector size for verity/luks/filesystems
When we don't know the sector size of the actual block device, because
we're building an image in a loopback file and no sector size was specified
explicitly, let's use 4096 as the sector size for filesystems, verity and
LUKS. This should be the most compatible option, since 4096 will also work
on devices with sector size 512 or 2048.

For the actual GPT partition table size, we stick with 512 as the default
value since UEFI firmware and the kernel will only try to read the GPT
partition table from the first LBA on the device and the sector size for
most devices is still 512. It can also be trivially modified when copying
the image to another device using --copy-from + --sector-size.
2023-08-14 11:04:52 +02:00
Daan De Meyer
4492eb1186 tree-wide: Use fdisk_new_context_at() more 2023-08-14 10:42:43 +02:00
Daan De Meyer
fd9fe57a26 fdisk-util: Make fdisk_new_context_fd() more generic
Let's make this an openat() style function so we can also pass a
device path.
2023-08-14 10:27:57 +02:00
Daan De Meyer
59120e89d8
Merge pull request #28827 from gioele/docs-fix-network-online-example-unit
docs/NETWORK_ONLINE: Move `Type=`, `RemainAfterExit=` to `[Service]` + Use `until` instead of `while !`
2023-08-14 10:08:20 +02:00
Gioele Barabucci
4a899c5a23 docs/NETWORK_ONLINE: Use until instead of while !
`until` is the standard POSIX shell builtin to be used when waiting for
a condition to appear.
2023-08-14 09:15:31 +02:00
Gioele Barabucci
3078ece8c4 docs/NETWORK_ONLINE: Move Type=, RemainAfterExit= to [Service]
`Type=` and `RemainAfterExit=` belong in `[Service]`, not `[Unit]`.

Fixes #28826
2023-08-14 09:15:21 +02:00
Yu Watanabe
e323d2e463 Revert "mount: check right before invoking /bin/umount if it makes sense"
This reverts commit 1483892a42.

As the commit says, it does not solve the race. Moreover, it introduces
an regression #28410.

Also, checking by `path_is_mount_point()` may trigger automount. From
statx(2),
> AT_NO_AUTOMOUNT
>     Don't automount the terminal ("basename") component of pathname
>     if it is a directory that is an automount point.
Similar statements can be found in fstatat(2), which is used in the
fallback call for statx() in glibc, and name_to_handle_at(2), which is
used as the fallback when statx() failed.
So, `path_is_mount_point()` may _do_ trigger automount for parent paths.
That should be avoided especially on shutdown.

The original issue #25527 that is 'fixed' by the commit is not serious,
and should be fixed by making umount command handle path gracefully:
https://github.com/util-linux/util-linux/issues/2132

Fixes #28410.
2023-08-14 13:39:15 +09:00
Susant Sahani
3912d49d0d network: ndisc - Ignore route information if reserved (10) value is
received

RFC4191 – Section 2.3 Route Information Option's Prf field:
If the Reserved (10) value is received, the Route Information Option MUST be ignored.
2023-08-14 12:43:38 +09:00
Mike Yuan
031a399d87 sleep: clear EFI HibernateLocation if writing kernel config fails
Follow-up for f1f331a252
2023-08-13 22:12:32 +01:00
Yu Watanabe
57ffa99daa core: drop redundant assignment of UNIT_MERGED in unit_load_fragment()
If the unit is merged into another unit, then the load state is already
set in merge_by_names() -> unit_merge(). Let's drop the redundant assignment.
2023-08-13 12:56:08 +01:00
Yu Watanabe
e3390a22dc
Merge pull request #28744 from YHNdnzj/battery-check-minor-followup
battery-util: minor follow-ups
2023-08-13 19:27:56 +09:00
Yu Watanabe
88321d5d77
Merge pull request #28809 from YHNdnzj/proc-cmdline-true-when-missing
proc-cmdline: introduce PROC_CMDLINE_TRUE_WHEN_MISSING and use it where appropriate
2023-08-13 19:25:22 +09:00
Sam James
0b4e0943a0 basic: add comment for LFS assert in dirent-util.h
Followup to eb29296937 as promised; requested
by lennart at https://github.com/systemd/systemd/pull/27599#discussion_r1192619263.
2023-08-13 10:40:36 +01:00
Luca Boccassi
a0b0b670ab test: skip test-path on Salsa CI
Salsa is the Debian git forge. In the package build environment test-path
always fails as we cannot set up cgroups and so the path unit fails to
start. Skip the test in that environment.

Unfortunately meson doesn't allow to skip individual tests by name.
2023-08-13 10:27:04 +01:00
Mike Yuan
46b0b7e24a
battery-util: log_notice when unsure about battery state
Follow-up for 02f7f8aa4f

This deserves some highlight.

Addresses https://github.com/systemd/systemd/pull/28597#discussion_r1288592726
2023-08-13 13:02:58 +08:00
Mike Yuan
60d83c3e86
battery-util: don't log duplicate message
Follow-up for 02f7f8aa4f

Addresses https://github.com/systemd/systemd/pull/28597#discussion_r1288591215

> this is pretty unnecessary, battery_read_capacity_percentage()
debug logs on its own about this already, in more detailed way?
2023-08-13 13:02:57 +08:00
Mike Yuan
022a19c9f6
reboot-util: cache the result of shall_restore_state 2023-08-13 12:54:56 +08:00
Mike Yuan
ca05933a1b
battery-check: use proc_cmdline_get_bool 2023-08-13 12:52:16 +08:00
Mike Yuan
9d7b189bf3
fstab-util: make use of PROC_CMDLINE_TRUE_WHEN_MISSING 2023-08-13 12:52:15 +08:00
Mike Yuan
60499ed1c8
proc-cmdline: do assert on flags earlier 2023-08-13 12:52:15 +08:00
Mike Yuan
97d5f09bd2
proc-cmdline: introduce PROC_CMDLINE_TRUE_WHEN_MISSING 2023-08-13 12:52:15 +08:00
Luca Boccassi
f7590e3cb4 mkosi: disable key check on Fedora Rawhide for now
There are key issues so jobs are failing, disable the check for now
2023-08-12 22:58:46 +02:00
Yu Watanabe
0d290cbcd6 test: disable TEST-08-INITRD on ubuntu CI
Currently, the test does not work on ubuntu CI, unfortunately.
Let's disable it at least tentatively.
2023-08-12 18:12:43 +01:00
Yu Watanabe
c208bf3324 test: fix expected result of systemd-repart
Follow-up for e1536d1fb0.

Fixes #28807.
Replaces #28802.
2023-08-12 18:11:46 +01:00
Daan De Meyer
1d117b068f mkfs-util: Pass sector size to mkfs.f2fs
Let's pass the sector size to mkfs.f2fs as well.
2023-08-12 13:29:50 +02:00
Daan De Meyer
89dfac6b8f mkfs-util: Set sector size environment variables when invoking mkfs.ext4
Let's inform mkfs.ext4 about the sector size we're using.
2023-08-12 13:28:10 +02:00
Yu Watanabe
5cdcaf89be meson: drop unnecessary dependency on libidn 2023-08-12 20:04:51 +09:00
Yu Watanabe
ba77e00659
Merge pull request #28801 from mrc0mmand/initrd-shutdown-test
test: introduce TEST-08-INITRD
2023-08-12 20:04:06 +09:00
Rahil Bhimjiani
f5263dd09e man: kernel-install(8) add uki.conf in FILES & add ukify(1) in SEE ALSO
Signed-off-by: Rahil Bhimjiani <rahil3108@gmail.com>
2023-08-12 11:24:43 +01:00
Frantisek Sumsal
7294632c2c test: introduce TEST-08-INITRD
And move the initrd related tests from TEST-01-BASIC there.

Additionally, this should provide coverage for recemt shutdown initrd
related issues, see:
  - https://github.com/systemd/systemd/issues/28645
  - https://github.com/systemd/systemd/pull/28648
  - https://github.com/systemd/systemd/pull/28793
2023-08-12 10:13:56 +02:00
Yu Watanabe
353c8497b1
Merge pull request #28784 from yuwata/udev-vs-tmpfiles-take-3
Udev vs tmpfiles take 3
2023-08-12 13:12:10 +09:00
Luca Boccassi
3748aec575
Merge pull request #28799 from bluca/fixlets
core: some fixlets
2023-08-12 00:25:15 +01:00
Luca Boccassi
e17076b9f0 man: systemd-repart can now create filesystems, update manpage 2023-08-12 00:06:07 +01:00
Yu Watanabe
bb7f485f4b units: introduce systemd-tmpfiles-setup-dev-early.service
This makes tmpfiles, sysusers, and udevd invoked in the following order:
1. systemd-tmpfiles-setup-dev-early.service
   Create device nodes gracefully, that is, create device nodes anyway
   by ignoring unknown users and groups.
2. systemd-sysusers.service
   Create users and groups, to make later invocations of tmpfiles and
   udevd can resolve necessary users and groups.
3. systemd-tmpfiles-setup-dev.service
   Adjust owners of previously created device nodes.
4. systemd-udevd.service
   Process all devices. Especially to make block devices active and can
   be mountable.
5. systemd-tmpfiles-setup.service
   Setup basic filesystem.

Follow-up for b42482af90.

Fixes #28653.
Replaces #28681 and #28732.
2023-08-12 07:55:20 +09:00
Yu Watanabe
12aac8ea45 Revert "unit: make udev rules really take precedence over tmpfiles"
This reverts commits 112a41b6ec,
3178698bb5, and
b768379e8b.

The commit 112a41b6ec introduces #28765,
as systemd-tmpfiles-setup.service has ordering after local-fs.target,
but usually the target requires block devices processed by udevd.
Hence, the service can only start after the block devices timed out.

Fixes #28765.
2023-08-12 07:55:20 +09:00
Lennart Poettering
82ee54b2d8 iovec-util: add iovw_isempty() helper
Follow-up for: 3746131aac
2023-08-11 21:51:17 +01:00
Luca Boccassi
05be3e8be8 core: split manager's process killing on shutdown to separate helper 2023-08-11 17:14:09 +01:00
Luca Boccassi
5ee8e9887a core: allow to pass EINVAL to unit_add_two_dependencies()
Useful to conditionally add two deps at a time
2023-08-11 17:14:09 +01:00
Luca Boccassi
bf85c2395e core: copy os-release with COPY_TRUNCATE
Otherwise if the os-release file shrinks between updates, there
will be a merge of the two.
Also remove redundant ENOENT check.

Follow-up for 3f37a82545
2023-08-11 17:14:09 +01:00
Frantisek Sumsal
cb16b72e9c test: correctly propagate return code from check_result hooks 2023-08-11 16:57:06 +02:00
Frantisek Sumsal
701e0c2660 test: save the console log to a file
So we can refer to it later if needed.
2023-08-11 16:57:06 +02:00
Lennart Poettering
579fbe5b78 man: don't claim BindPaths= file systems would remain "in memory", they are just kept "mounted"
Follow-up for: 947d836a6e

(I guess in the original patch authors usecase the root fs actually
*does* remain in memory, but that's a special case and does not belong
in the man pages this way).
2023-08-11 15:41:53 +01:00
Daan De Meyer
9a441937e1
Merge pull request #28766 from DaanDeMeyer/repart-copy-from
repart: Allow specifying --copy-from more than once
2023-08-11 14:51:24 +02:00
Michael A Cassaniti
c2dfcbd48e file-io: Fix copying sparse files
This change makes sure a data copy using copy_bytes() does not exceed the
max_bytes value when using COPY_HOLES and max_bytes stops before the next
data section.
2023-08-11 14:30:54 +02:00