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

51892 Commits

Author SHA1 Message Date
Yu Watanabe
3da0caf5bb core/socket: do not assign another fd to SocketPort which already has a fd on deserialization
Otherwise, if a socket address is duplicated, then the previous fd is
closed.

Fixes #19843.
2021-06-08 18:23:47 +02:00
Lennart Poettering
fd5f48af5c
Merge pull request #19817 from keszybz/switch-root-serialization
Drop serialization of mounts and automounts over root switch
2021-06-08 18:22:58 +02:00
Allen Webb
c46c323385 tmpfiles: add '=' action modifier.
Add the '=' action modifier that instructs tmpfiles.d to check the file
type of a path and remove objects that do not match before trying to
open or create the path.

BUG=chromium:1186405
TEST=./test/test-systemd-tmpfiles.py "$(which systemd-tmpfiles)"

Change-Id: If807dc0db427393e9e0047aba640d0d114897c26
2021-06-08 17:23:26 +02:00
Peter Morrow
90a404f5d4 man: add details on overriding top level drop-ins
When using top level drop-ins it isn't immediately obvious that one can
make use of symlinking to disable a top-level drop in for a specific
unit.

Signed-off-by: Peter Morrow <pemorrow@linux.microsoft.com>
2021-06-08 17:03:03 +02:00
Zbigniew Jędrzejewski-Szmek
755021d434 core: do not serialize mounts and automounts for switch-root
When e.g. tmp.mount is present in the initrd, and we serialize it, switch root,
and deserialize, the new systemd is confused because it thinks /tmp is mounted.
In general, it doesn't make sense to serialize anything that refers to paths in
the old root file system.

This fixes two errors for me:

1. tmp.mount was not mounted properly before local-fs.target. It would be
mounted as some point (I guess when we re-read /proc/self/mountinfo for some
other reason). In effect systemd-tmpfiles-setup.service would see one fs, and
some other units started later a different one. In particular gdm.service would
fail because the pre-created /tmp/.X11-unix with proper permissions would not
exist at time it was started.

2. # systemd[1]: proc-sys-fs-binfmt_misc.automount: Got hangup/error on autofs pipe from kernel. Likely our automount point has been unmounted by someone or something else?
   # systemd[1]: proc-sys-fs-binfmt_misc.automount: Failed with result 'unmounted'.
   # systemd[1]: Mounting proc-sys-fs-binfmt_misc.mount...
   # systemd[1]: Mounted proc-sys-fs-binfmt_misc.mount.
   # systemd[1]: Starting systemd-binfmt.service...
   # systemd[1]: Finished systemd-binfmt.service.
   # systemd[1]: proc-sys-fs-binfmt_misc.automount: Path /proc/sys/fs/binfmt_misc is already a mount point, refusing start.
   # systemd[1]: Failed to set up automount proc-sys-fs-binfmt_misc.automount.
   # systemd[1]: proc-sys-fs-binfmt_misc.automount: Path /proc/sys/fs/binfmt_misc is already a mount point, refusing start.
   # systemd[1]: Failed to set up automount proc-sys-fs-binfmt_misc.automount.
   # systemd[1]: proc-sys-fs-binfmt_misc.automount: Path /proc/sys/fs/binfmt_misc is already a mount point, refusing start.
   # systemd[1]: Failed to set up automount proc-sys-fs-binfmt_misc.automount.
   # systemd[1]: Stopping systemd-binfmt.service...
   # systemd[1]: systemd-binfmt.service: Deactivated successfully.
   # systemd[1]: Stopped systemd-binfmt.service.

I couldn't understand the error here, but in retrospect the first line is entirely
correct: "someone or something else" was the old systemd unmounting the old root.
2021-06-08 16:04:38 +02:00
Luca Boccassi
587f2a5e56 coredump: check cgroups memory limit if storing on tmpfs
When /var/lib/systemd/coredump/ is backed by a tmpfs, all disk usage
will be accounted under the systemd-coredump process cgroup memory
limit.
If MemoryMax is set, this might cause systemd-coredump to be terminated
by the kernel oom handler when writing large uncompressed core files,
even if the compressed core would fit within the limits.

Detect if a tmpfs is used, and if so check MemoryMax from the process
and slice cgroups, and do not write uncompressed core files that are
greater than half the available memory. If the limit is breached,
stop writing and compress the written chunk immediately, then delete
the uncompressed chunk to free more memory, and resume compressing
directly from STDIN.

Example debug log when this situation happens:

systemd-coredump[737455]: Setting max_size to limit writes to 51344896 bytes.
systemd-coredump[737455]: ZSTD compression finished (51344896 -> 3260 bytes, 0.0%)
systemd-coredump[737455]: ZSTD compression finished (1022786048 -> 47245 bytes, 0.0%)
systemd-coredump[737455]: Process 737445 (a.out) of user 1000 dumped core.
2021-06-08 14:05:56 +01:00
Luca Boccassi
5b6f8e13ad compress: return uncompressed size to the caller
Useful when compressing anonymous FDs that cannot be rewund
2021-06-08 14:05:56 +01:00
Luca Boccassi
93ff34e44a core: add MemoryAvailable unit property
Try to infer the unused memory that a unit can claim before the
memory.max limit is reached, including any limit set on any parent
slice above the unit itself.
2021-06-08 14:05:56 +01:00
Emilio Herrera
d477a094e8 po: Translated using Weblate (Spanish)
Currently translated at 62.9% (119 of 189 strings)

Co-authored-by: Emilio Herrera <ehespinosa57@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/es/
Translation: systemd/main
2021-06-08 11:28:46 +01:00
Zbigniew Jędrzejewski-Szmek
f75420a43a man: explain ConditionNeedsUpdate a bit more
We were effectively doing all post-upgrade scripts twice in Fedora. We got this
wrong, so it's likely other people will get it wrong too. So let's explain
what is actually needed to make this work, but also when it's not useful.
2021-06-08 10:47:11 +02:00
Yu Watanabe
16e09d51a7 meson: do not share compiler flags except for emitting warnings
Follow-up for 6526736397.

Prompted by https://github.com/systemd/systemd/issues/19191#issuecomment-856312107.
2021-06-08 10:44:34 +02:00
alexlzhu
9f40351f77
man: update docs on systemd-system.conf logging (LogTime=) (#19846)
Updating documentation for systemd to reflect that logging is done in the console.
2021-06-08 15:54:07 +09:00
Yu Watanabe
50b9fa01ed
Merge pull request #19639 from yuwata/network-next
network: bunch of fixes and new features
2021-06-08 10:29:54 +09:00
Yu Watanabe
a7f07cbe34 network: wait for all set-link requests are processed 2021-06-08 06:39:48 +09:00
Yu Watanabe
29836c166d network: drop trivial aliases of link_set_state() 2021-06-08 06:39:48 +09:00
Yu Watanabe
1187fc3375 network: use link_request_to_set_master() or friends 2021-06-08 06:39:48 +09:00
Yu Watanabe
112a0972a2 network: introduce link_request_to_activate()
The request will be processed after all setlink requests are processed.
The function will be used in later commits.
2021-06-08 06:39:48 +09:00
Yu Watanabe
0e397560cc network: it is not necessary to call RTM_GETLINK when carrier is gained 2021-06-08 06:39:48 +09:00
Yu Watanabe
440d40dcc0 network: set bridge or bond properties after master ifindex is set 2021-06-08 06:39:48 +09:00
Yu Watanabe
1362bd6c64 network: sync link information after set-link request is processed
Some properties do not notify their changes. See do_setlink() in
net/core/rtnetlink.c of kernel.
2021-06-08 06:39:48 +09:00
Yu Watanabe
5a1860f761 network: use link_call_getlink() where applicable 2021-06-08 06:39:48 +09:00
Yu Watanabe
79c6e11456 network: introduce link_call_getlink() 2021-06-08 06:39:48 +09:00
Yu Watanabe
0d411b7f8f network: split link_update() into small pieces 2021-06-08 06:39:26 +09:00
Yu Watanabe
852a391605 network: shorten code a bit, and reduce indentation 2021-06-08 06:35:49 +09:00
Yu Watanabe
b156a95d4a network: update operational state or friends on reconfigure 2021-06-08 06:35:49 +09:00
Yu Watanabe
4b9a8c2b51 network: make link enter failed state when link_initialized() is failed 2021-06-08 06:35:49 +09:00
Yu Watanabe
0c9ee5d5e8 network: move functions
This changes no behavior. Preparation for later commits.
2021-06-08 06:35:49 +09:00
Yu Watanabe
813572853e network: introduce link_get_master() and use it where applicable 2021-06-08 06:35:49 +09:00
Yu Watanabe
8252fb4439 network: introduce link_request_to_set_bridge_vlan()
This will be used in later commits.
2021-06-08 06:35:45 +09:00
Yu Watanabe
bfd7fb09cf sd-netlink: add IFLA_BRIDGE_FLAGS and IFLA_BRIDGE_VLAN_INFO attributes 2021-06-08 06:34:41 +09:00
Yu Watanabe
5106ad00e6 network: expose bridge_vlan_append_info() 2021-06-08 06:34:38 +09:00
Yu Watanabe
5546870e7b network: introduce network_adjust_bridge_vlan() 2021-06-08 06:33:27 +09:00
Yu Watanabe
1a0e5ca2f3 network: rebreak arguments 2021-06-08 06:33:27 +09:00
Yu Watanabe
9670e45a6e network: rename networkd-brvlan.[ch] -> networkd-bridge-vlan.[ch] 2021-06-08 06:33:27 +09:00
Yu Watanabe
5062b8593a network: introduce link_request_to_set_bond()
This will be used in later commits.
2021-06-08 06:33:27 +09:00
Yu Watanabe
7d5b232f40 network: introduce link_request_to_set_bridge()
This will be used in later commits.
2021-06-08 06:33:27 +09:00
Yu Watanabe
71a754f70f network: introduce link_request_to_create_stacked_netdev()
This will be used in later commits.
2021-06-08 06:33:27 +09:00
Yu Watanabe
d24bf1b514 network: introduce link_request_to_set_master()
The function will be used later.
2021-06-08 06:33:27 +09:00
Yu Watanabe
8e00e24cc9 network: use request queue to set IPv6LL address generation mode 2021-06-08 06:33:27 +09:00
Yu Watanabe
cc4c8fb136 network: use request queue to set interface group 2021-06-08 06:33:27 +09:00
Yu Watanabe
a8e5e27c9f network: use request queue to set MAC address 2021-06-08 06:33:27 +09:00
Yu Watanabe
93fabc10fa network: use request queue to set link flags 2021-06-08 06:33:27 +09:00
Yu Watanabe
0fa8ee6c77 network: use request queue to set MTU 2021-06-08 06:33:27 +09:00
Yu Watanabe
fa28381202 network: merge link_configure() and link_configure_continue() again
It is not necessary to stop whole configuration process until MTU and
IPv6LL address generation mode are set. But it is enough just setting
IPv6 MTU again after MTU is set, and dropping IPv6LL address after
setting the address generation mode.
2021-06-08 06:33:27 +09:00
Yu Watanabe
793117b3fd network: drop meaningless condition about setting MTU
The condition does not fix infinite loop of interface reset, as the
interface is reset after netlink reply is received, thus setting_mtu is
false.

See also #18738.
2021-06-08 06:33:27 +09:00
Yu Watanabe
b9bf3f22a8 network: introduces link_drop_ipv6ll_addresses()
It is not necessary to parse whole message and store the address in
Link::addresses_foreign, as the address will be removed soon later.
2021-06-08 06:33:27 +09:00
Yu Watanabe
f0269653e9 network: make link enter failed state on failure in link_update() and link_reset_carrier()
Previously, several failures in link_carrier_gained() make link enter
failed state, and other errors are ignored. Now, all failures in
link_carrier_gained(), moreover, link_update() are critical.
2021-06-08 06:33:27 +09:00
Yu Watanabe
8566df791e network: rename link_acquire_conf() -> link_acquire_dynamic_conf()
To clarify it starts dynamic configuration engines e.g. DHCP clients.
2021-06-08 06:33:27 +09:00
Yu Watanabe
9710895378 network: request to configure static settings earlier
Now, all static configs should be ordered after the link gains its carrier.
So, it is not necessary to wait for that before queuing requests.
2021-06-08 06:33:27 +09:00
Yu Watanabe
40b12fa20d network: introduce request_hash_ops to dedup requests
If KeepConfiguration= or ConfigureWithoutCarrier= is set, then the same
requests may be queued.
2021-06-08 06:33:27 +09:00