1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-05 21:57:27 +03:00

56878 Commits

Author SHA1 Message Date
Lennart Poettering
1fe368e526 test: add test that verifies correct order of boot entries 2022-03-18 11:59:30 +01:00
Lennart Poettering
d23b3bfdd6 kernel-install: automatically generate "sort-key" field
Let's order by IMAGE_ID=/ID= by default.
2022-03-18 11:59:30 +01:00
Lennart Poettering
cf5d9598b6 sd-boot: add comments highlighting type 1 vs. type 2 2022-03-18 11:59:30 +01:00
Lennart Poettering
20ec8f534f sd-boot: make use of new "sort-key" boot loader spec field 2022-03-18 11:59:30 +01:00
Lennart Poettering
1011935785 docs: add new "sort-key" field to boot loader spec
This allows snippet generators to explicitly order entries: any string
can be set as an entry's "sort key". If set, sd-boot will use it to sort
entries on display.

New logic is hence (ignore the boot counting logic)

  sort-key is set → primary sort key: sort-key (lexicographically increasing order)
                  → secondary sort key: machine-id (also increasing order)
                  → tertiary sort key: version (lexicographically decreasing order!)

  sort-key is not set → primary sort key: entry filename (aka id), lexicographically increasing order)

With this scheme we can order OSes by their names from A-Z but then put
within the same OS still the newest version first. This should clean up
the order to match expectations more.

Based on discussions here:

https://github.com/systemd/systemd/pull/22391#issuecomment-1040092633
2022-03-18 11:59:30 +01:00
Lennart Poettering
f65a33269e Revert "boot: Change boot entry sorting"
This reverts commit 9818ec8ea56e14902ac8e548a0f366dbb259f051.
2022-03-18 11:59:30 +01:00
Lennart Poettering
09d4d60360 doc: mention that setfsuid() is a reason why UIDs >= 2147483648 are icky 2022-03-18 11:54:45 +01:00
Lennart Poettering
af5ee76c56
Merge pull request #22784 from poettering/bootctl-fixlets
Trivial bootctl/kernel-install fixlets
2022-03-18 11:53:08 +01:00
Zbigniew Jędrzejewski-Szmek
23484e1205 systemctl: fix operations on relative paths
We should treat ./some.service and $PWD/some.service as equivalent. But we'd
try to send the relative paths over dbus, which can't work well:

$ sudo systemctl enable ./test2.service
Failed to look up unit file state: Invalid argument
$ sudo systemctl enable $PWD/test2.service
Created symlink /etc/systemd/system/multi-user.target.wants/test2.service → /home/zbyszek/src/systemd/test2.service.
Created symlink /etc/systemd/system/test2.service → /home/zbyszek/src/systemd/test2.service.

Now both are equivalent.
2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
2cdd6bef9c shared/install-printf: drop now-unused install_path_printf() 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
46801e7647 shared/install: do not print aliases longer than UNIT_NAME_MAX
065364920281e1cf59cab989e17aff21790505c4 did the conversion to install_path_printf().
But IIUC, here we are just looking at a unit file name, not the full
path.
2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
09f5fc66f2 basic/env-file: inline one variable declaration 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
20afd9a184 systemctl: remove unused parameter 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
4f5160698e systemctl: drop left-over parens 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
f60b0813ea man/systemd.exec: tweak markup a bit 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
4f5c24857b shared/install: adjust comment formatting 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
d29cc4d6e1 tree-wide: use strv_contains() in more places 2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
d3e85c9c81 shared/install: drop unnecessary casts
The compiler coerces to bool for us, no need to do it explicitly.
2022-03-18 10:22:20 +01:00
Zbigniew Jędrzejewski-Szmek
066931818d shared/install: drop unnecessary parentheses 2022-03-18 10:22:20 +01:00
Nishal Kulkarni
f1c70ed13d shell-completion: Add completion in bootctl
Added new completion for `--make-machine-id-directory`
provideds 3 options(yes no auto)

Closes: #22308
2022-03-18 09:19:56 +00:00
Zbigniew Jędrzejewski-Szmek
c3e7fba07c shared/install: consistently use 'lp' as the name for the LookupPaths instance
Most of the codebase does this. Here we were using 'p' or 'paths'
instead. Those names are very generic and not good for a "global-like"
object like the LookupPaths instance. And we also have 'path' variable,
and it's confusing to have 'path' and 'paths' in the same function that
are unrelated.

Also pass down LookupPaths* lower in the call stack, in preparation for
future changes.
2022-03-18 10:11:37 +01:00
Luca Boccassi
1219bd4306 Add tests and documentation for all remaining sandboxing in user manager 2022-03-18 10:09:56 +01:00
Luca Boccassi
4355c04fef core: insist on sandboxing if ExtensionImages/Directories are configured
Same as other image mounting in the namespace
2022-03-18 10:02:47 +01:00
Yu Watanabe
827f865063 sd-device: shorten code a bit 2022-03-18 09:57:24 +01:00
Yu Watanabe
29e6f70b8d sd-device-enumerator: fix typo: contolC -> controlC
Also shorten code a bit.
2022-03-18 09:43:09 +01:00
Yu Watanabe
f79856d9e8 sort-util: add missing parens
With this, we can call e.g.
```
typesafe_qsort(buf + m, n - m, comp);
```
2022-03-18 09:42:38 +01:00
Lennart Poettering
8d3e0d607e bootctl: add comment, explaining when verb_install() is called 2022-03-18 09:30:29 +01:00
Lennart Poettering
d16da79ec0 bootctl: use faccessat() more 2022-03-18 09:30:25 +01:00
Lennart Poettering
1c2b617703 bootctl: fix typo 2022-03-18 09:30:21 +01:00
Lennart Poettering
acbb4d7ec4 kernel-install: drop spurious double empty line 2022-03-18 09:30:17 +01:00
Lennart Poettering
d9ea4a210b kernel-install: make clear which variables are supposed to be placed in install.conf in a comment 2022-03-18 09:29:47 +01:00
Lennart Poettering
55c8f9ecb0
Merge pull request #22754 from mrc0mmand/creds_dir_specifier
core: add %d specifier for the $CREDENTIALS_DIRECTORY
2022-03-18 09:23:01 +01:00
Michael Biebl
ad337e55a3 tree-wide: fix duplicated words
the the
in in
not not
we we
2022-03-18 08:14:01 +09:00
Yu Watanabe
3c45ad24c2
Merge pull request #22752 from yuwata/udev-ctrl-manage-sender-pids
udev: enable Delegate=
2022-03-18 07:38:35 +09:00
Luca Boccassi
3e6f89e013
Merge pull request #22774 from poettering/nspawn-uidmap-fix
nspawn: uidmap mount fix
2022-03-17 21:59:29 +00:00
Lennart Poettering
0456118807 homed: permit inodes owned by UID_MAPPED_ROOT to be created in $HOME
If people use nspawn in their $HOME we should allow this inodes owned by
this special UID to be created temporarily, so that UID mapped nspawn
containers just work.
2022-03-17 19:08:12 +01:00
Lennart Poettering
50ae2966d2 nspawn: make sure host root can write to the uidmapped mounts we prepare for the container payload
When using user namespaces in conjunction with uidmapped mounts, nspawn
so far set up two uidmappings:

1. One that is used for the uidmapped mount and that maps the UID range
   0…65535 on the backing fs to some high UID range X…X+65535 on the
   uidmapped fs. (Let's call this mapping the "mount mapping")

2. One that is used for the userns namespace the container payload
   processes run in, that maps X…X+65535 back to 0…65535. (Let's call
   this one the "process mapping").

These mappings hence are pretty much identical, one just moves things up
and one back down. (Reminder: we do all this so that the processes can
run under high UIDs while running off file systems that require no
recursive chown()ing, i.e. we want processes with high UID range but
files with low UID range.)

This creates one problem, i.e. issue #20989: if nspawn (which runs as
host root, i.e. host UID 0) wants to add inodes to the uidmapped mount
it can't do that, since host UID 0 is not defined in the mount mapping
(only the X…X+65536 range is, after all, and X > 0), and processes whose
UID is not mapped in a uidmapped fs cannot create inodes in it since
those would be owned by an unmapped UID, which then triggers
the famous EOVERFLOW error.

Let's fix this, by explicitly including an entry for the host UID 0 in
the mount mapping. Specifically, we'll extend the mount mapping to map
UID 2147483646 (which is INT32_MAX-1, see code for an explanation why I
picked this one) of the backing fs to UID 0 on the uidmapped fs. This
way nspawn can creates inode on the uidmapped as it likes (which will
then actually be owned by UID 2147483646 on the backing fs), and as it
always did. Note that we do *not* create a similar entry in the process
mapping. Thus any files created by nspawn that way (and not chown()ed to
something better) will appear as unmapped (i.e. as overflowuid/"nobody")
in the container payload. And that's good. Of course, the latter is
mostly theoretic, as nspawn should generally chown() the inodes it
creates to UID ranges that actually make sense for the container (and we
generally already do this correctly), but it#s good to know that we are
safe here, given we might accidentally forget to chown() some inodes we
create.

Net effect: the two mappings will not be identical anymore. The mount
mapping has one entry more, and the only reason it exists is so that
nspawn can access the uidmapped fs reasonably independently from any
process mapping.

Fixes: #20989
2022-03-17 19:08:12 +01:00
Lennart Poettering
264caae299 base-filesystem: use uid_is_valid() at one more place 2022-03-17 19:08:12 +01:00
Lennart Poettering
aff7ae0d67 nspawn: if we refuse to operate on some directory, explain why
(Also, some refactoring to use safer path_join())
2022-03-17 19:08:12 +01:00
Lennart Poettering
1eb874b978 nspawn: make more stuff const
And if we make it const, we can also make it static.
2022-03-17 19:07:48 +01:00
Lennart Poettering
d1d0b895dc nspawn: rebreak all comments in outer_child() 2022-03-17 19:03:58 +01:00
David
19c510bec7 Changed wording in systemd-debug-generator manpage 2022-03-17 19:02:10 +01:00
Frantisek Sumsal
43b9b2053c core: add %d specifier for the $CREDENTIALS_DIRECTORY
Resolves: #22549
2022-03-17 17:45:01 +01:00
Yu Watanabe
b7ee9b3551 test: wait for loopback device being ready to manipulate
Follow-up for 6626ea08f6db3c050b5e05fa760cf0e371862173.
2022-03-17 16:11:12 +00:00
Lennart Poettering
63a185dc72 update TODO 2022-03-17 16:24:31 +01:00
Frantisek Sumsal
598a1d7633 core: drop an unnecessary initialization 2022-03-17 14:39:51 +01:00
Yu Watanabe
a1f4fd3876 udev: run the main process, workers, and spawned commands in /udev subcgroup
And enable cgroup delegation for udevd.
Then, processes invoked through ExecReload= are assigned .control
subcgroup, and they are not killed by cg_kill().

Fixes #16867 and #22686.
2022-03-17 20:24:38 +09:00
Vishal Chillara Srinivas
e8aba093b4 varlink_error_invalid_parameter(...) always returns EINVAL
varlink_error(...) expects a json object as the third parameter. Passing a string variant causes
parameter sanitization to fail, and it returns -EINVAL. Pass object variant instead.
2022-03-17 20:12:26 +09:00
Yu Watanabe
ac33e14754 repart: use assert() when no state is changed 2022-03-17 20:10:17 +09:00
Yu Watanabe
8fe84dc8de core: ExecContext::restrict_filesystems is set of string 2022-03-17 20:09:59 +09:00