1
0
mirror of https://github.com/systemd/systemd synced 2024-07-09 04:26:06 +00:00
Commit Graph

1742 Commits

Author SHA1 Message Date
Lennart Poettering
d42edbf1b8
Merge pull request #33430 from YHNdnzj/buserror-notify
core/service: store BUSERROR= & VARLINKERROR= received and show them through systemctl status
2024-06-20 23:05:32 +02:00
Mike Yuan
4b89c55c3f
TEST-80-NOTIFYACCESS: introduce test for ERRNO= + BUS/VARLINKERROR= 2024-06-20 20:51:12 +02:00
Lennart Poettering
ea441dbd9d ci: test new --graceful= switch of varlinkctl 2024-06-20 18:20:09 +02:00
Lennart Poettering
9e10f3a7e8 bootctl: normalize how we report no boot entries found
This normalizes how we report an empty list of boot entries in
ListBootEntries(). Our usual pattern is to return one item per method
call, but when there is none we usually return a NoSuchXYZ error. Do so
here too.

Before this we'd return a null item instead here, and only here.

This is a minor compat break, but given that this IPC interface is very
new and probably not used so far (we don't use it in our code at least,
and google doesn#t find any other use) I think this normalization is OK
at this point.
2024-06-20 10:02:40 +02:00
Luca Boccassi
5163c9b1e5 install: allow removing symlinks even for units that are gone
If a symlink is leftover, still allow cleaning it up via 'disable'. This
happens when a unit is stopped and removed, but not disabled, and a reload
has already happened. At that point, cleaning up the old symlinks becomes
impossible through the APIs, and needs to be done manually. Always allow
cleaning up symlinks, if they exist, by only erroring out if there is an
OOM.

Follow-up for f31f10a620
2024-06-18 16:07:26 +02:00
Luca Boccassi
3f4f065bab
Merge pull request #33359 from bluca/test_apparmor_unpriv
mkosi: enable unprivileged user ns for integration tests
2024-06-18 00:13:15 +01:00
Luca Boccassi
0e551b04ef core: do not imply PrivateTmp with DynamicUser, create a private tmpfs instead
DynamicUser= enables PrivateTmp= implicitly to avoid files owned by reusable uids
leaking into the host. Change it to instead create a fully private tmpfs instance
instead, which also ensures the same result, since it has less impactful semantics
with respect to PrivateTmp=yes, which links the mount namespace to the host's /tmp
instead. If a user specifies PrivateTmp manually, let the existing behaviour
unchanged to ensure backward compatibility is not broken.
2024-06-17 17:05:55 +01:00
Luca Boccassi
e1daedb4be test: check the skip condition before installing additional files 2024-06-17 11:34:52 +01:00
Lennart Poettering
aa413d5fc6 ci: add superficial --quiet testcase 2024-06-13 11:31:44 +02:00
Lennart Poettering
e1ef88e56e test: add test for new varlinkctl features 2024-06-13 09:37:15 +02:00
Frantisek Sumsal
2ac0e52f29 test: dump a simple summary at the end of TEST-02-UNITTEST
Let's dump a list of skipped tests and logs from failed tests at the end
of TEST-02-UNITTEST to make debugging fails in CI slightly less painful.
2024-06-12 14:04:10 +01:00
Lennart Poettering
8c5045f9b2 analyze: add verb for dumping SMBIOS Type #11 data
I find myself wanting to check this data with a quick command, and
browsing through /sys/ manually getting binary data sucks. Hence let's
do add a nice little analysis tool.
2024-06-12 12:48:28 +02:00
Daan De Meyer
1a48d8549f core: Fix CPUQuotaPerSecUSec unit file serialization
CPUQuota= can deal with float percentages perfectly fine these days
(up to two places after the dot), so let's take that into account
when serializing the value to the transient unit file so we don't lose
precision when specifying e.g. "CPUQuota=0.5%".
2024-06-05 16:50:36 +02:00
Luca Boccassi
d6243ebedd journald: enable persistent FD Store to fix logging during soft-reboot
A unit with StandardOutput=journal (the default) will get its stdout/stderr sockets
disconnected when journald stops, as the file descriptors on journald's side are
not preserved (it works on restart, as the FD Store keeps them open during restarts).
Set FileDescriptorStorePreserve=yes so that the journal FD's stay open during a soft
reboot, and applications don't get broken stdout/stderr.
2024-06-03 16:30:54 +01:00
Luca Boccassi
88c2ef1f75 Revert "test: Run end.sh when running integration tests with mkosi"
It seems this introduced a regression in the CentOS CI;

14:25:58 FAILED TASKS:14:25:58 -------------
14:25:58 TEST-03-JOBS
14:25:58 TEST-52-HONORFIRSTSHUTDOWN
14:25:58 TEST-63-PATH

Revert for now.

This reverts commit da3c6fc553.
2024-06-03 16:29:23 +01:00
Daan De Meyer
9619fdc102
Merge pull request #33157 from DaanDeMeyer/end
test: Run end.sh when running integration tests with mkosi
2024-06-02 21:04:56 +02:00
Daan De Meyer
da3c6fc553 test: Run end.sh when running integration tests with mkosi 2024-06-02 19:15:21 +02:00
Yu Watanabe
46322f2742 test: exit earlier when cgroup user xattr is not supported
Also, use trap for cleaning up the test environment.
2024-06-01 22:35:07 +09:00
Yu Watanabe
5f03c19f7b test: reduce number of 'systemctl daemon-reload' a bit 2024-06-01 22:28:32 +09:00
Yu Watanabe
7faf8987ed test: sync journal in short-living services
This also adjusts LogLevelMax=.

Hopefully, this makes the test much stabler.
2024-06-01 22:25:50 +09:00
Yu Watanabe
052500a072 test: make it sure that devices are processed by udevd before running subtests 2024-05-31 16:10:55 +09:00
Yu Watanabe
60914351c8 test: lock device on sfdisk or mkfs, and extend timeout
Hopefully fixes #33111.
2024-05-31 16:09:31 +09:00
Luca Boccassi
0630069f0b
Merge pull request #33081 from keszybz/networkctl-formatting
Fix formatting of speeds in networkctl
2024-05-30 16:33:38 +02:00
Daan De Meyer
9029f20b35 TEST-02-UNITTESTS: Pass asan environment to units if it is available
Some tests (e.g. test-udev.py) might trigger one of our NSS modules
which means LD_PRELOAD has to be configured properly.
2024-05-30 12:47:45 +02:00
Daan De Meyer
aae2990907 TEST-79-MEMPRESS: Load systemd-asan-env if available
Required since we run with DynamicUser=1.
2024-05-30 12:47:45 +02:00
Daan De Meyer
0cd488617c TEST-36-NUMAPOLICY: Skip when running with sanitizers
The test does not work under sanitizers as strace is used. Until the
test is fixed to not use strace let's skip it when running with
sanitizers.
2024-05-30 12:47:43 +02:00
Zbigniew Jędrzejewski-Szmek
11226bf19b shared/format-table: do not print '.0'
This makes output a bit shorter and nicer. For us, shorter output is generally
better.

Also, drop unnecessary UINT64_C macros. The left operand is always uint64_t,
and C upcasting rules mean that it doesn't matter if the right operand is
narrower or signed, the operation is always done on the wider unsigned type.
2024-05-30 11:38:30 +02:00
Daan De Meyer
8acb02f395 TEST-02-UNITTESTS: Fix exit code checks 2024-05-30 09:59:30 +02:00
Daan De Meyer
412e2a6487 TEST-05-RLIMITS: Bump memory limits
When running with sanitizers we need more memory otherwise the unit
gets OOM killed.
2024-05-30 09:59:30 +02:00
Daan De Meyer
ac09c21d45 TEST-64-UDEV-STORAGE: Replace megasas2 controller with virtio scsi controller
The virtio-scsi driver is available in the KVM/cloud kernel
packages provided by distributions whereas the megasas2 driver is
not. Let's switch to virtio-scsi so we can switch back to the KVM/cloud
kernel packages.
2024-05-29 15:24:03 +02:00
Daan De Meyer
a635b33214
Merge pull request #32562 from Werkov/test-cgroup-opensuse
Revert "TEST-19-CGROUP: Skip on opensuse"
2024-05-29 11:01:00 +02:00
Yu Watanabe
47e881ee65 test: lock device when sfdisk or mkfs
Or, trigger devices after the command incase the device is dm or md.

Fixes #33056.
2024-05-28 15:43:55 +02:00
Yu Watanabe
36c5035f2a test: suppress logs generated by journal tests
Note, journal_file_dump() is only used by tests.

Closes #33035.
2024-05-28 10:38:53 +02:00
Yu Watanabe
61fdb5b214 test: wait for the kernel finishes to attach backing file to loop device
Fixes #32680.
2024-05-28 08:49:47 +02:00
Yu Watanabe
fbe1e72eff test: use SYSLOG_IDENTIFIER= filter instead of "journalctl -u"
"journalctl -u foo.service" may not work as expected, especially entries
for _TRANSPORT=stdout, for short-living services or when the service manager
generates debugging logs. Instead, SYSLOG_IDENTIFIER= should be reliable for
stdout. Let's use it.

An example case:
```
__CURSOR=s=06278e3bf011458e973c81d370a8f7a5;i=1e4dc;b=1b0258a5c78341609bf462c72d4541c3;m=308de65;t=6194c3895a13f;x=50c7e9af5b8cfc37
__REALTIME_TIMESTAMP=1716665017803071
__MONOTONIC_TIMESTAMP=50912869
_BOOT_ID=1b0258a5c78341609bf462c72d4541c3
SYSLOG_FACILITY=3
_UID=0
_GID=0
_MACHINE_ID=d3490e076ab24968bfa19a6aab26beb3
_HOSTNAME=H
_RUNTIME_SCOPE=system
_TRANSPORT=stdout
PRIORITY=6
_PID=2668
_STREAM_ID=3f9b8855636041988d003a9c63379b8a
SYSLOG_IDENTIFIER=echo
MESSAGE=foo
```
As you can see, there is no unit identifier.
2024-05-26 11:00:22 +02:00
Michal Koutný
307abfc83a Revert "TEST-19-CGROUP: Skip on opensuse"
This reverts commit 60d064d3fd.

The logged test failure was because of missing memory controller in
testing cgroup. With the test fixed in previous commit, memory
attributes are delegated as expected.

Ref: #32439
2024-05-23 18:05:25 +02:00
Michal Koutný
8fd755ffe6 test: Ensure delegation test unit has memory controller
When the test used to be run on distro that doesn't enable memory
accounting by default (such as openSUSE TW), there is no guarantee that
testing unit has memory.* cgroup attributes and delegation test would
fail if they are missing.

Require memory controller explicitly inside the unit so that test can
work in any environment.
2024-05-23 18:05:25 +02:00
Lennart Poettering
f5faf4ec5b varlinkctl: when operating in --more mode, fail correcly on Varlink method error
In varlink.c we generally do not make failing callback functions fatal,
since that should be up to the app. Hence, in case of varlinkctl (where
we want failures to be fatal), make sure to propagate the error back
explicitly.

Before this change a failing call to "varlinkctl --more call …" would result in
a zero exit code. With this it will correctly exit with a non-zero exit
code.
2024-05-22 22:08:28 +02:00
Yu Watanabe
87ed87efe1 test: also flush and rotate journal before read
Follow-up for a610ba00d9.

Fixes #32890.
2024-05-22 12:42:09 +02:00
Yu Watanabe
505b20ecdd test: replace journal checkers with journalctl --follow + grep -m
Recently, for slow test environments, journalctl --sync was added to the
loop in the timeout. However, journalctl --sync may be slow in such systems,
and timeout easily triggered during syncing.
Hopefully, reading journal with --follow and grep the output with an expected
line should be efficient.

Hopefully fixes #32712.
2024-05-22 12:03:35 +02:00
Yu Watanabe
be43c9b029 test: lock device during running cryptsetup
On running cryptsetup, udevd detects two inotify events for the
underlying device. Running the test on enough fast host, the expected
symlinks based on UUID and disk label are created by the second event.

During processing a uevent for a device, udevd disables the inotify
watch for the device. If the test runs on slow system, the second
inotify event may comes during a udev worker processing the synthesized
uevent triggered by the first inotify event. Hence, no synthesized
uevent for the second inotify event will be generated, and the expected
symlinks will be never created.

To prevent the issue, we need to lock the device during cryptsetup
command is running.

Fixes #32913.
2024-05-22 05:37:02 +09:00
Yu Watanabe
bb6ce6b6a4 Revert "test: wipe filesystem before moving to the next test case"
This reverts commit 301d7ee611.

This does not solve issue #32913.
2024-05-22 05:37:02 +09:00
Luca Boccassi
2d988c149d
Merge pull request #32944 from yuwata/test-74
test: several changes for TEST-74-AUX-UTILS
2024-05-21 20:44:13 +02:00
Zbigniew Jędrzejewski-Szmek
dcbf670430
Merge pull request #32957 from mrc0mmand/fix-coverage-builds
test: make TEST-65-ANALYZE happy when built with gcov
2024-05-21 18:42:08 +02:00
Yu Watanabe
a5edb9b7b1 test: wait a bit before stopping/killing service
Otherwise, when stopping the service, the last command may not be
started yet, and the service manager may not send SIGTERM signal to the
last command, but send SIGKILL on timeout.

===
May 21 08:23:24 test19-exit-cgroup.sh[437]: + disown
May 21 08:23:24 test19-exit-cgroup.sh[438]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[437]: + systemd-notify --ready
May 21 08:23:24 test19-exit-cgroup.sh[437]: + sleep infinity
May 21 08:23:24 test19-exit-cgroup.sh[441]: + systemctl stop one
May 21 08:23:24 test19-exit-cgroup.sh[443]: + sleep infinity
(snip)
May 21 08:23:24 systemd[1]: one.service: Changed running -> stop-sigterm
May 21 08:23:24 systemd[1]: Stopping one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one"...
May 21 08:23:24 systemd[1]: Received SIGCHLD from PID 441 (systemctl).
May 21 08:23:24 systemd[1]: Child 437 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 437 belongs to one.service.
May 21 08:23:24 systemd[1]: one.service: Main process exited, code=killed, status=15/TERM (success)
May 21 08:23:24 systemd[1]: Child 439 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 439 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 441 (systemctl) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 441 belongs to one.service.
May 21 08:23:24 systemd[1]: Child 442 (bash) died (code=killed, status=15/TERM)
May 21 08:23:24 systemd[1]: one.service: Child 442 belongs to one.service.
(snip)
May 21 08:24:54 systemd[1]: one.service: State 'stop-sigterm' timed out. Killing.
May 21 08:24:54 systemd[1]: one.service: Killing process 443 (sleep) with signal SIGKILL.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigterm -> stop-sigkill
May 21 08:24:54 systemd[1]: Received SIGCHLD from PID 443 (sleep).
May 21 08:24:54 systemd[1]: Child 443 (sleep) died (code=killed, status=9/KILL)
May 21 08:24:54 systemd[1]: one.service: Child 443 belongs to one.service.
May 21 08:24:54 systemd[1]: one.service: Control group is empty.
May 21 08:24:54 systemd[1]: one.service: Failed with result 'timeout'.
May 21 08:24:54 systemd[1]: one.service: Service restart not allowed.
May 21 08:24:54 systemd[1]: one.service: Changed stop-sigkill -> failed
May 21 08:24:54 systemd[1]: one.service: Job 738 one.service/stop finished, result=done
May 21 08:24:54 systemd[1]: Stopped one.service - /tmp/test19-exit-cgroup.sh "systemctl stop one".
May 21 08:24:54 systemd[1]: one.service: Unit entered failed state.
May 21 08:24:54 systemd[1]: one.service: Releasing resources...
===

Fixes #32947.
2024-05-21 18:35:15 +02:00
Yu Watanabe
07cbd02e9a test: collect information about loopback device on failure 2024-05-21 23:13:45 +09:00
Yu Watanabe
e504f5a339 test: wait for loop/backing_file attribute being removed
Hopefully fixes issue like
https://github.com/systemd/systemd/issues/32680#issuecomment-2120959238
https://github.com/systemd/systemd/issues/32680#issuecomment-2122074805
2024-05-21 23:13:38 +09:00
Yu Watanabe
4a8ca3c6d5 test: wait for unit generated from /proc/self/mountinfo to be unloaded
Fixes https://github.com/systemd/systemd/issues/32680#issuecomment-2120974685.
===
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2475]: + mountpoint /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2476]: /tmp/tmp.eaRV7lSbX2/mnt is not a mountpoint
May 21 02:45:08 TEST-74-AUX-UTILS.sh[2449]: + systemd-mount /dev/loop0 /tmp/tmp.eaRV7lSbX2/mnt
May 21 02:45:08 systemd-mount[2477]: Failed to start transient mount unit: Unit tmp-tmp.eaRV7lSbX2-mnt.mount was already loaded or has a fragment file.
===
2024-05-21 23:09:38 +09:00
Yu Watanabe
ee213b54ae test: also run some basic test cases on nspawn 2024-05-21 23:09:38 +09:00
Yu Watanabe
d67e86ed67 test: stop container when it is not necessary anymore 2024-05-21 23:09:38 +09:00