Commit Graph
68862 Commits
Author SHA1 Message Date
Luca Boccassi f5bb0a3163 loop-util: restart loop_configure and reopen FD when O_DIRECT fails
On kernel 5.10.178, when a squashfs file is stored on an EXT4 filesystem
backed by a dm-crypt volume, dissecting fails:

$ SYSTEMD_LOG_LEVEL=debug systemd-dissect /var/foo/bar.raw
Opened '/var/foo/bar.raw' in O_RDONLY access mode, with O_DIRECT enabled.
Couldn't find any partition table to derive sector size of.
loop2: Acquired exclusive lock.
Could not enable direct IO mode, proceeding in buffered IO mode.
Successfully acquired /dev/loop2, devno=7:2, nr=2, diskseq=87
Opened /dev/loop2 (fd=3, whole_block_devnum=7:2, diskseq=87).
      Name: bar.raw
      Size: 67.2M
 Sec. Size: 512
     Arch.: n/a

Successfully forked off '(sd-dissect)' as PID 4110.
Mounting /proc/self/fd/3 (squashfs) on /tmp/dissect-Zk3K5F (MS_RDONLY|MS_NODEV "")...
Failed to mount /proc/self/fd/3 (type squashfs) on /tmp/dissect-Zk3K5F (MS_RDONLY|MS_NODEV ""): Input/output error
Failed to mount dissected image: Input/output error
Failed to read /etc/hostname of image: No such file or directory
/etc/machine-id file of image is empty.
Failed to read has-init-system boolean: Input/output error
(sd-dissect) failed with exit status 1.
Failed to acquire image metadata: Input/output error

The kernel shows I/O errors:

kernel: blk_update_request: I/O error, dev loop2, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 0
kernel: SQUASHFS error: Failed to read block 0x0: -5
kernel: unable to read squashfs_super_block

This is independent of a particular filesystem and can be reproduced
reliably in my setup, starting from freshly formatted disks.

Instead of continuing when O_DIRECT fails, start over the setup
process without the flag, including opening a new FD, to make the
kernel happy.
2023-11-16 21:12:40 +00:00
Luca Boccassi 905dd9d6e6 Merge pull request #30055 from YHNdnzj/logind-handle-action
logind-action: several cleanups
2023-11-16 16:04:37 +00:00
Lennart Poettering face0d0efa update TODO 2023-11-16 13:46:55 +01:00
Lennart Poettering 3c28ebace0 update TODO 2023-11-16 13:34:25 +01:00
Frantisek Sumsal f1e02423a9 login: mark the TTY property as "emits change"
Triggered by the SetTTY() method.

Follow-up to 092e6cd19a.
Addresses: https://github.com/systemd/systemd/pull/30043#pullrequestreview-1733628935
2023-11-16 11:26:26 +00:00
Luca Boccassi 9037ebf991 Merge pull request #30052 from dtardon/udev-fixes
Two small udev fixes
2023-11-16 11:25:24 +00:00
Mike Yuan 99416b6d4e logind-action: check if inhibit_what is valid
Fixes #30037
2023-11-16 17:49:33 +08:00
Mike Yuan febe81313e logind-inhibit: introduce inhibit_what_is_valid 2023-11-16 17:49:33 +08:00
Mike Yuan ddd0c2be81 logind-action: split out logic for handle_action_sleep
Preparation for #29853
2023-11-16 17:49:33 +08:00
Mike Yuan 51eeeb7bde logind: return "no" if sleep operation is disabled
According to org.freedesktop.login1:

> If "na" is returned, the operation is not available because
> hardware, kernel, or drivers do not support it. If "yes" is
> returned, the operation is supported and the user may execute
> the operation without further authentication. If "no" is returned,
> the operation is available but the user is not allowed to execute
> the operation.

Therefore, we should return "no" if sleep is explicitly disabled,
otherwise we return "na".
2023-11-16 17:49:33 +08:00
Mike Yuan 15b5bb6262 TODO: remove an already implemented entry
Follow-up for #23640
2023-11-16 17:49:32 +08:00
Yo-Jung Lin eb8258c1bc hwdb: Mark Dell platform accel sensor location to base
Dell would like to disable screen rotation for the platform eternally.
Mark the aceel sensor location base to disable it.
2023-11-16 09:36:38 +00:00
Luca Boccassi fd13d32ba7 Merge pull request #30047 from yuwata/sd-bus-assert-return
sd-bus: several fixlets found by making assert_return() critical
2023-11-16 09:34:31 +00:00
Yu Watanabe 25ac30bdb8 log: rename variables to store function call results 2023-11-16 09:21:10 +00:00
David Tardon 3afe909b75 udev-manager: fix log message 2023-11-16 10:16:11 +01:00
David Tardon 08d5c74a01 test: read from the right device 2023-11-16 10:16:11 +01:00
Yu Watanabe ebfbc5b9d8 Merge pull request #30043 from mrc0mmand/more-assert_return
More `assert_return()` shenanigans
2023-11-16 11:28:33 +09:00
Yu Watanabe 335185f1f2 Merge pull request #30045 from poettering/discover-image-tweaklets
discover-image: tiny tweaklets
2023-11-16 11:28:04 +09:00
Yu Watanabe 4d8b8f79d0 Merge pull request #30044 from poettering/dissect-tool-tweaklets
systemd-dissect --discover tweaklets
2023-11-16 11:27:47 +09:00
Luca Boccassi 461ef3981f sd-dhcp: use CMSG_FIND_AND_COPY_DATA to avoid build failures on x32 architectures
On architectures where timeval is 64bit but size_t is 32bit
we have to use CMSG_FIND_AND_COPY_DATA. This affects x32 and riscv32.

Follow-up for 905d0ea7b0
2023-11-16 11:26:57 +09:00
Yu Watanabe 69f1c33425 test: sd_bus_process() may assign NULL even if it returns positive
Let's not trigger assert_return() needlessly.

Prompted by #30029.
2023-11-16 09:35:44 +09:00
Yu Watanabe ce5a6d5307 test: several cleanups for test-bus-chat
- use sd_bus_query_sender_creds() to retrieve credentials,
- read credentials only when we get credentials, to avoid triggering
  assert_return(),
- downgrade log level of expected failure, and update log message about
  unexpected success.

Prompted by #30029.
2023-11-16 09:35:44 +09:00
Yu Watanabe 02dd646b16 sd-bus: drop SD_BUS_CREDS_AUGMENT flag
On checking if the message has enough credentials, the special flag
needs to be dropped.

Fixes a bug introduced by 705a415f68.
2023-11-16 09:35:44 +09:00
Yu Watanabe 22185cb71e sd-bus: insert missing space 2023-11-16 09:35:44 +09:00
Lennart Poettering 5df1a5538b discover-image: use TAKE_PTR() where appropriate 2023-11-15 22:53:35 +01:00
Lennart Poettering 25cdbd0428 discover-image: reindent string table 2023-11-15 22:53:35 +01:00
Lennart Poettering ba113008de dissect: set dash as ersatz string 2023-11-15 22:51:37 +01:00
Lennart Poettering 8f488d4634 dissect: right-align size column in --discover table 2023-11-15 22:51:37 +01:00
Frantisek Sumsal 236cb01622 login: mark the Display property as "emits change"
With the introduction of SetDisplay() method in 4885d7490b the Display
property emits a "properties changed" message every time the display is
changed using this method, so mark it appropriately.

Caught by systemd/systemd#30029:

systemd-logind[1366]: Got message type=method_call sender=:1.165 destination=org.freedesktop.login1 path=/org/freedesktop/login1/session/_310 interface=org.freedesktop.login1.Session member=SetDisplay  cookie=8 reply_cookie=0 signature=s error-name=n/a error-message=n/a
systemd-logind[1366]: Assertion 'v->vtable->flags & SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE || v->vtable->flags & SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION' failed at src/libsystemd/sd-bus/bus-objects.c:2141, function emit_properties_changed_on_interface(). Ignoring.

Follow-up to 4885d7490b.
2023-11-15 22:41:24 +01:00
Frantisek Sumsal 9988043b6b sd-journal: don't assert on invalid field
Also, field_is_valid(field) already does isempty(field), so drop that as
well.

$ SYSTEMD_LOG_LEVEL=debug journalctl -o verbose -F foo-bar-baz
...
Assertion 'field_is_valid(field)' failed at src/libsystemd/sd-journal/sd-journal.c:2789, function sd_journal_query_unique(). Ignoring.
Failed to query unique data objects: Invalid argument
2023-11-15 22:31:02 +01:00
Frantisek Sumsal 1fa20dde9f Merge pull request #30040 from yuwata/assert-return-fixes
several assert_return() fixes
2023-11-15 21:05:06 +00:00
Krzesimir Nowak 59c8afbc89 repart: Fix compilation warning when tpm2 is disabled
The warning is about unused variable "flags":

```
../src/partition/repart.c: In function ‘partition_encrypt’:
../src/partition/repart.c:3690:19: warning: unused variable ‘flags’ [-Wunused-variable]
 3690 |         TPM2Flags flags = 0;
      |                   ^~~~~
```

Move the flags variable into the scope where it is actually used, which happens
to be inside the HAVE_TPM2 block.
2023-11-15 19:55:50 +00:00
Yu Watanabe aecedc48a6 sd-device: do not trigger assertion by a bad udev rules
The assertion can be triggered by bad `$attr{[<subsys>/<sysname>]<attribute>}`
formatting. That's not a programmer's error, but a runtime error.

Prompted by #30029.
2023-11-16 02:32:12 +09:00
Yu Watanabe c0b927eb3a dhcp: do not trigger assertion by malformed messages
This also changes error code from -ENODATA -> -EBADMSG,
as we received bad message in that case.

Prompted by #30029.
2023-11-16 02:32:12 +09:00
Yu Watanabe 4f6ae86629 network: do not try to create netdev from tests
Prompted by #30029.
2023-11-16 02:32:12 +09:00
Luca Boccassi 298b218fc8 NEWS: finalize for v255-rc2 2023-11-15 16:31:53 +00:00
Luca Boccassi 83aa04b998 Merge pull request #30033 from mrc0mmand/assert_return-tweaks
Dial back a couple of `assert_return()` uses
2023-11-15 16:24:48 +00:00
Luca Boccassi 5b2e6c7c67 Merge pull request #30035 from keszybz/buid-sys-cleanups
Build system cleanups
2023-11-15 16:05:29 +00:00
Mike Yuan dfb210c8fb man/systemd-creds: fix a typo 2023-11-15 22:28:52 +08:00
Zbigniew Jędrzejewski-Szmek a05bf18ed9 hwdb/acpi-update.py: streamline python code
Use f-strings and simplify the code a bit.

When I call 'acpi-update.py' after those changes, the resulting .hwdb files are
the same except for two additions that appeared in the meantime. I don't think
it makes sense to update them again, because the ma-*.txt files changed and we
don't want to store big blobs unnecessarilly.
2023-11-15 15:25:26 +01:00
Zbigniew Jędrzejewski-Szmek 94113d5f19 hwdb: rename .html=>.csv
The old suffix is now confusing.
2023-11-15 15:21:26 +01:00
Frantisek Sumsal 59461f086f test: update Ubuntu CI instructions 2023-11-15 14:58:20 +01:00
Luca Boccassi 03745d68f3 Merge pull request #30030 from poettering/gpt-growfs-root-fix
make gpt flag 59 (growfs) actually work on the root fs
2023-11-15 13:57:28 +00:00
Zbigniew Jędrzejewski-Szmek 3e0cf73243 meson: use ternary op for brevity 2023-11-15 14:53:11 +01:00
Zbigniew Jędrzejewski-Szmek 7eff3e2cdb NEWS: adjust indentation
A non-breaking space is used between "PCR" and the number. I did
search&replace on the whole file, so that when people select&paste
later, they are more likely to use the same format.
2023-11-15 14:53:11 +01:00
Frantisek Sumsal 6565b9d0b1 sd-bus: don't treat invalid user/machine as a programming error
$ SYSTEMD_LOG_LEVEL=debug machinectl status --machine=@
Assertion 'r > 0' failed at src/libsystemd/sd-bus/sd-bus.c:1694, function sd_bus_open_system_machine(). Ignoring.
2023-11-15 13:56:50 +01:00
Frantisek Sumsal 6e07f600ba mount: don't call sd_device_get_property_value() with a NULL pointer
Otherwise bad thing would've happened is this was a hard assert:

+ systemd-mount --umount /dev/loop0
Assertion 'device' failed at src/libsystemd/sd-device/sd-device.c:2202, function sd_device_get_property_value(). Ignoring.
2023-11-15 13:46:09 +01:00
Frantisek Sumsal 17122c3de1 sd-journal: don't treat invalid match as a programming error
Don't use assert_runtime() when we get an invalid match string, since
that's a runtime error:

$ SYSTEMD_LOG_LEVEL=debug coredumpctl info =
...
Adding match: =
Assertion 'match_is_valid(data, size)' failed at src/libsystemd/sd-journal/sd-journal.c:240, function sd_journal_add_match(). Ignoring.
Failed to add match "=": Invalid argument
2023-11-15 13:38:02 +01:00
Lennart Poettering 4bec240751 boot: measure config first, only then parse
Fixes: #30026
2023-11-15 13:36:46 +01:00
Lennart Poettering 6b5fe5d75e gpt-auto-generator: hook in "growfs" for the root fs if the GPT flag 59 says so
Fixes: #29791
2023-11-15 13:21:15 +01:00