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

58521 Commits

Author SHA1 Message Date
Lennart Poettering
a87af99ef1
Merge pull request #23855 from keszybz/drop-list-is-empty
basic/list: drop LIST_IS_EMPTY
2022-07-05 17:29:53 +02:00
Daan De Meyer
87a3a4a802 firstboot: Don't skip passwd/shadow logic if only one of the files exists
If one of the files exists but not the other one, we want to make sure
we create the other file to make sure the passwd database is in a valid
state.
2022-07-05 17:09:16 +02:00
Lennart Poettering
e386a6d69b
Merge pull request #23906 from poettering/isdigitisalpha
tree-wide: add global ascii_isalpha() + ascii_isdigit() and use it everywhere
2022-07-05 16:40:39 +02:00
Quentin Deslandes
57f28dee00 machine: switch to BusLocator-oriented helpers
Replace existing sd_bus_x calls with counterparts from bus-locator.h.
2022-07-05 16:40:16 +02:00
Zbigniew Jędrzejewski-Szmek
b8df7f8629 user: delegate cpu controller, assign weights to user slices
So far we didn't enable the cpu controller because of overhead of the
accounting. If I'm reading things correctly, delegation was enabled for a while
for the units with user and pam context set, i.e. for user@.service too.
a931ad47a8 added the explicit Delegate=yes|no
switch, but it was initially set to 'yes'.
acc8059129 disabled delegation for user@.service
with the justication that CPU accounting is expensive, but half a year later
a88c5b8ac4 changed DefaultCPUAccounting=yes for
kernels >=4.15 with the justification that CPU accounting is inexpensive there.

In my (very noncomprehensive) testing, I don't see a measurable overhead if the
cpu controller is enabled for user slices. I tried some repeated compilations,
and there is was no statistical difference, but the noise level was fairly
high. Maybe better benchmarking would reveal a difference.

The goal of this change is very simple: currently all of the user session,
including services like the display server and pipewire are under user@.service.
This means that when e.g. a compilation job is started in the session's
app.slice, the processes in session.slice compete for CPU and can be starved.
In particular, audio starts to stutter, etc. With CPU controller enabled,
I can start start 'ninja -C build -j40' in a tab and this doesn't have any
noticable effect on audio.

I don't think the particular values matter too much: the CPU controller is
work-convserving, and presumably the session slice would never need more than
e.g. one 1 full CPU, i.e. half or a quarter of available CPU resources on even
the smallest of today's machines. app.slice and session.slice are assigned
equal weights, background.slice is assigned a smaller fraction. CPUWeight=100
is the default, but I wrote it explicitly to make it easier for users to see
how the split is done. So effectively this should result in session.slice
getting as much power as it needs.

If if turns out that this does have a noticable overhead, we could make it
opt-in. But I think that the benefit to usability is important enough to enable
it by default. W/o something like this the session is not really usable with
background tasks.
2022-07-05 14:40:01 +02:00
Lennart Poettering
ff25d3385d tree-wide: add global ascii_isdigit() + ascii_isalpha()
We now have a local implementation in string-util-fundamental.c, but
it's useful at a lot of other places, hence let's give it a more
expressive name and share it across the tree.

Follow-up for: 8d9156660d
2022-07-05 14:25:07 +02:00
Lennart Poettering
82c3a0b74c sd-id128: don't allow chars > f in valid id128 values 2022-07-05 14:23:11 +02:00
Lennart Poettering
d486b26fe3 update TODO 2022-07-05 14:22:03 +02:00
Lennart Poettering
a22a4e1d1a docs: move some stuff into "Networking" section
The "Networking" section has a lonely single document listed right now,
even though the "Concepts" section has two more network related docs.
Move them over, let's end this loneliness.
2022-07-05 11:22:06 +01:00
Li kunyu
aea29a300d
tree-wide: Remove the repeated ';' from code (#23901) 2022-07-05 16:06:47 +09:00
nl6720
0e68582323 tree-wide: link to docs.kernel.org for kernel documentation
https://www.kernel.org/ links to https://docs.kernel.org/ for the documentation.
See https://git.kernel.org/pub/scm/docs/kernel/website.git/commit/?id=ebc1c372850f249dd143c6d942e66c88ec610520

These URLs are shorter and nicer looking.
2022-07-04 19:56:53 +02:00
Yu Watanabe
7c38952e68
Merge pull request #23104 from mrc0mmand/resolved-tests
Introduce systemd-resolved test suite
2022-07-04 23:46:16 +09:00
Daan De Meyer
c3191c6d4f meson: Assign tests a suite based on their directory
This can be used to run only a subset of tests, e.g.
"meson test -C build --suite journal" to run only the journal
unit tests.
2022-07-04 14:46:30 +02:00
Frantisek Sumsal
fb6f25d7b9 test: Introduce systemd-resolved test suite
Resolves: #19599
2022-07-04 12:21:55 +02:00
Frantisek Sumsal
17082e8ac1 test: resize the terminal automagically with INTERACTIVE_DEBUG=yes 2022-07-04 09:41:06 +02:00
Frantisek Sumsal
8afe2f53b2 test: install /usr/libexec/vi as well
since `/bin/vi` (at least on Fedora) is a shell wrapper which runs
either `/bin/vim` or `/usr/libexec/vi` based on availability.
2022-07-04 09:41:06 +02:00
Yu Watanabe
5932c87000
Merge pull request #23886 from keszybz/https-links-kernel
tree-wide: use html links for kernel docs
2022-07-03 00:55:59 +09:00
Zbigniew Jędrzejewski-Szmek
025f1279c7
Merge pull request #23088 from yuwata/udev-event-blocker
udev: cleanups for event blocker
2022-07-02 17:08:45 +02:00
Zbigniew Jędrzejewski-Szmek
7b3b2e5ad6
Merge pull request #23865 from keszybz/drop-memcpy-call
sd-id128: avoid an unnecessary function call in inline helper
2022-07-02 16:59:32 +02:00
Nick Rosbrook
ddbc88188c test: copy libgcc_s.so.1 to TPM2 test image on Debian-like systems
On Ubuntu, cryptsetup does not link against libgcc_s.so.1 which leads to
the following test failure in TEST-70-TPM2:

 systemd[1]: Starting testsuite-70.service...
 systemd[329]: testsuite-70.service: Executing: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh
 testsuite-70.sh[329]: + export SYSTEMD_LOG_LEVEL=debug
 testsuite-70.sh[329]: + SYSTEMD_LOG_LEVEL=debug
 testsuite-70.sh[329]: + img=/var/tmp/test.img
 testsuite-70.sh[329]: + dd if=/dev/zero of=/var/tmp/test.img bs=1024k count=20 status=none
 testsuite-70.sh[329]: + echo -n passphrase
 testsuite-70.sh[329]: + cryptsetup luksFormat -q --use-urandom /var/tmp/test.img /tmp/passphrase
 testsuite-70.sh[333]: libgcc_s.so.1 must be installed for pthread_exit to work
 testsuite-70.sh[329]: /usr/lib/systemd/tests/testdata/units/testsuite-70.sh:
     line 12: 333 Aborted (core dumped) cryptsetup luksFormat -q --use-urandom $img /tmp/passphrase

To fix this, manually install libgcc_s.so.1 to the test image if running
on Debian-like systems.
2022-07-02 15:01:30 +01:00
Zbigniew Jędrzejewski-Szmek
f217f9a8b3 man/network: fix wording and syntax
Follow-up for 0bcc6557fb. Docbook doesn't
know <variable>.
2022-07-02 13:40:49 +02:00
Zbigniew Jędrzejewski-Szmek
4b2942aaea
Merge pull request #23835 from yuwata/nspawn-private-users-identity
nspawn: follow-ups for --private-users=identity
2022-07-02 12:58:06 +02:00
Zbigniew Jędrzejewski-Szmek
c4f2bff121 test-list: rename field to indicate that it's a list
With this commit, lists are generally either names with plural (items),
or in a way that indicates a multi-item container (queue, *_list, or similar).
2022-07-02 12:51:37 +02:00
Zbigniew Jędrzejewski-Szmek
eb506199f0 systemctl: rename field for clarity 2022-07-02 12:51:37 +02:00
Zbigniew Jędrzejewski-Szmek
d5fe7f7fb1 udev: rename field
When we start, the contents of the variable match the name. But then
in the loop, the variable doesn't point at the old head any more. So let's
rename it to something with a plural.
2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
ed828563a5 sd-event: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
0601b95877 sd-event: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
3f3548f8d2 sd-event: align table 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
d70f15f5aa resolved: rename field to indicate that it's a list 2022-07-02 12:46:19 +02:00
Zbigniew Jędrzejewski-Szmek
64903d18df basic/list: drop LIST_IS_EMPTY
This was a trivial wrapper that didn't provide any added value. With more
complicated structures like strvs, hashmaps, sets, and arrays, it is possible
to have an empty container. But in case of a list, the list is empty only when
the head is missing.

Also, we generally want the positive condition, so we replace many
if (!LIST_IS_EMPTY(x)) with just if (x).
2022-07-02 12:46:16 +02:00
Zbigniew Jędrzejewski-Szmek
1474e66a52 homework: silence gcc warning
gcc was warning that found_fs_uuid was used unitialized. The issue stemmed from
the call to open(), where gcc seemingly didn't know that errno must be negative.
When that is set, we can drop some unnecessary initializations without warnings.
2022-07-02 12:39:26 +02:00
Yu Watanabe
0e85550eb5 debug-generator: shorten code a bit 2022-07-02 12:20:14 +02:00
Zbigniew Jędrzejewski-Szmek
2f8211c64a tree-wide: use html links for kernel docs
Instead of using "*.txt" as reference name, use the actual destination title.
2022-07-02 12:13:00 +02:00
Yu Watanabe
a96e670844
Merge pull request #23883 from yuwata/pid1-do-not-filter-out-systemd-unit
core: do not filter out systemd.unit= from kernel command line
2022-07-02 09:42:09 +09:00
Frantisek Sumsal
d1b1bbfbfa test: add a simple test for daemon-reexec 2022-07-02 05:23:03 +09:00
Yu Watanabe
bffde9b586 core: do not filter out systemd.unit= and run-level specifier from kernel command line
Fixes a bug introduced by 846f1da465.

The commit 846f1da465 made systemd.unit=
filtered out from the command line. That causes debug-generator does not
work as expected on daemon-reexecute, and we cannot call `systemctl
daemon-reexecute` in our test suite running on nspawn.

Fixes issue reported in https://github.com/systemd/systemd/pull/23851#issuecomment-1170992052.
2022-07-02 05:07:23 +09:00
Yu Watanabe
12bdeb58a6 unit: prioritize module devices
Also, prioritize tty and network devices.

Follow-up for 2336bde964

Fixes #23850.
2022-07-01 15:47:45 +02:00
Zbigniew Jędrzejewski-Szmek
55ce4e1bcb sd-journal: silence bogus gcc warning
In function 'sd_id128_equal',
    inlined from 'journal_file_verify' at ../src/libsystemd/sd-journal/journal-verify.c:1047:29:
../src/systemd/sd-id128.h:119:43: error: 'entry_boot_id.qwords[0]' may be used uninitialized [-Werror=maybe-uninitialized]
  119 |         return a.qwords[0] == b.qwords[0] && a.qwords[1] == b.qwords[1];
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/libsystemd/sd-journal/journal-verify.c: In function 'journal_file_verify':
../src/libsystemd/sd-journal/journal-verify.c:823:20: note: 'entry_boot_id.qwords[0]' was declared here
  823 |         sd_id128_t entry_boot_id;
      |                    ^~~~~~~~~~~~~
cc1: all warnings being treated as errors

entry_boot_id is only used when entry_monotonic_set has been set, and that's
only done in one place where entry_boot_id is also initalized.
2022-07-01 13:42:46 +02:00
dependabot[bot]
71562f5174 build(deps): bump meson from 0.62.0 to 0.62.2 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 0.62.0 to 0.62.2.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/0.62.0...0.62.2)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-01 14:36:52 +03:00
dependabot[bot]
573fb26ca2 build(deps): bump github/codeql-action from 2.1.6 to 2.1.15
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.1.6 to 2.1.15.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](28eead2408...3f62b754e2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-01 14:34:01 +03:00
Yu Watanabe
3daf1f913c journalctl: fix to show user slice
Fixes #23867.
2022-07-01 09:29:16 +01:00
Zbigniew Jędrzejewski-Szmek
74c4bd6b1a units: add IgnoreOnIsolate=yes to systemd-journald too
We already had it on the socket units, so it's possible that
systemd-journald.service would be stopped and then restarted when trafic hits
the sockets when something logs. Let's not try to stop it. It is supposed to
run until the end and be eventually killed in the final killing spree.

This might (or not) help with #23287.
2022-07-01 14:17:33 +09:00
Yu Watanabe
3bdb60055e
Merge pull request #23868 from keszybz/lib-resplit-2
Export sd-netlink and clean up exported interfaces a bit
2022-07-01 13:13:42 +09:00
Zbigniew Jędrzejewski-Szmek
9075066955 logind: log wall messages to the journal
Currently kde installs a fake utmp session to listen for this. This provides an
alternative mechanism as discussed in #23574.

Example with 'shutdown 6 -r' and shutdown -c':
    PRIORITY=6
    SYSLOG_FACILITY=4
    SYSLOG_IDENTIFIER=systemd-logind
    ...
    CODE_FILE=src/login/logind-utmp.c
    CODE_LINE=90
    CODE_FUNC=warn_wall
    MESSAGE_ID=9e7066279dc8403da79ce4b1a69064b2
    OPERATOR=root
    MESSAGE=The system will reboot at Thu 2022-06-30 12:16:43 CEST!
    ACTION=reboot

    PRIORITY=5
    SYSLOG_FACILITY=4
    SYSLOG_IDENTIFIER=systemd-logind
    ...
    OPERATOR=root
    CODE_FILE=src/login/logind-dbus.c
    CODE_LINE=2407
    CODE_FUNC=method_cancel_scheduled_shutdown
    MESSAGE=System shutdown has been cancelled
    MESSAGE_ID=249f6fb9e6e2428c96f3f0875681ffa3
    ACTION=reboot
2022-06-30 19:28:41 +01:00
Zbigniew Jędrzejewski-Szmek
e1c52cb271 docs/ARCHITECTURE: mention src/fundamental/ and add more details 2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek
28e7e9347d basic/socket-util: rename fd_inc_rcvbuf → fd_increase_rxbuf
See previous commit for justification.
2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek
78cca583fe sd-netlink: rename sd_netlink_inc_rcvbuf → sd_netlink_increase_rxbuf
We have RxBufferSize= and TxBufferSize= in .link files. Let's use the same
abbreviation here. OTOH, "inc" could be short for "increment" or "increase",
let's avoid that.
2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek
2c4ccaefc2 sd-bus: indentation 2022-06-30 11:02:13 +02:00
Zbigniew Jędrzejewski-Szmek
628f7b1e70 sd-bus: use assert_return() in public function sd_bus_message_dump
Also, document that NULL is allowed.
2022-06-30 10:55:39 +02:00
Zbigniew Jędrzejewski-Szmek
7e922b0584 sd-event: let sd_event_source_set_enabled accept NULL
Same story as before: disabling a non-existent event source shouldn't
need to be guarded by an if. I retained the wrapper so that that we don't
have to say SD_EVENT_OFF in the many places where this is called.
2022-06-30 10:35:27 +02:00