Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

systemd: 238 -> 239 #21

Closed
wants to merge 8,234 commits into from
Closed

systemd: 238 -> 239 #21

wants to merge 8,234 commits into from

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Aug 1, 2018

DO NOT MERGE YET.

Status:

  • works for me
  • user-runtime-dir@.service needs to be installed in our nixos module -> I will make a pull request for that.
  • we should take a look if interface renaming still works, there were updates in systemd-udevd for net-id builtin

keszybz and others added 30 commits June 11, 2018 17:06
Jun 11 14:29:12 krowka systemd[1]: /etc/systemd/system/workingdir.service:6: = path is not normalizedWorkingDirectory: /../../etc
   ↓
Jun 11 14:32:12 krowka systemd[1]: /etc/systemd/system/workingdir.service:6: WorkingDirectory= path is not normalized: /../../etc
../src/test/test-sizeof.c: In function ‘main’:
../src/test/test-sizeof.c:70:24: error: result of ‘1 << 31’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Werror=shift-overflow=]
                 X = (1 << 31),
                        ^~
cc1: some warnings being treated as errors

Follow-up for b05ecb8.
We document the rule that return values >= 0 of functions are supposed
to indicate success, and that in case of success all return parameters
should be initialized. Let's actually do so.

Just a tiny coding style fix-up.
… into function of its own

That way we can use it in code that already acquired a dev_t from some
source.
Let's chase block devices through btrfs and LUKS like we do elsewhere.
This drops needless safety checks that ensure we only reference block
devices for blockio/io settings. The backing code was already able to
accept regular file system paths too, in which case the backing device
node of that file system would be used. Hence, let's drop the artificial
restrictions and open up this underlying functionality.
Let's make sure we don't validate "char-*" and "block-*" expressions as
paths.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Pass the partial name of the unit file to list-unit-files and
list-units. This allows for faster completion, since systemctl does
not need to list all the unit files.

For reference:
 - time systemctl list-unit-files -> ~200ms
 - time systemctl list-unit-files netctl* -> ~15ms
 - time systemctl list-units -> ~5ms
 - time systemctl list-units netctl* -> ~5ms

While the list-units time itself is unaffected, now a shorter list is
produced. Thus as we pass it to `systemctl show' (via
__filter_units_by_properties) the execution time will be decreased even
further.

v2: Update list-units hunk in commit message, add quotes around $2*
v3: Remove funky indentation, quote all $cur instances

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Using a leading * and $SUFFIX produces misleading results. Let's imagine
that one mistypes nect instead of netc, they will get a rather
misleading completion like:  sys-fs-fuse-connections.mount

Not to mention that the execution time is up by ~1/3.
time systemctl list-unit-files netctl* -> ~12ms
time systemctl list-unit-files *netctl* -> ~17ms

Furthermore more units are matched, leading to greater execution time
of `systemctl show' in _filter_units_by_property

Use only $PREFIX*, removing the leading * and trailing $SUFFIX*.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
This effectively ports over b1bdb64
from the bash completion to zsh.

Modulo the new function, since it's unrelated perf. improvement.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Earlier patch added the current word to the performance critical paths.
Here we add it to every place, for consistency sake.

Suggested-by: Yu Watanabe (yuwata)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
…egation

Fixes systemd#8364.

Reproducer:
$ sudo systemd-run -t -p Delegate=yes bash
# mkdir /sys/fs/cgroup/system.slice/run-u6958.service/supervisor
# echo $$ > /sys/fs/cgroup/system.slice/run-u6958.service/supervisor/cgroup.procs
# echo +memory > /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control
# cat /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control
memory
# systemctl daemon-reload
# cat /sys/fs/cgroup/system.slice/run-u6958.service/cgroup.subtree_control
(empty)

With patch, the last command shows 'memory'.
Template units lacking DefaultInstance cannot be enabled/disabled or
started/restarted.

By adding DefaultInstance the unit can be enabled/disabled but it
still cannot be started/restarted.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Currently the completion adds template units for commands such as
is-active, is-failed, is-enabled, status, show and others.

At the same time systemctl barfs at us, since an instanced template unit
is needed. Follow the example list from bash-completion as to which
commands should not list template units.

Note: The above is observed regardless of DefaultInstance.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Keep DNS over TCP connection open until it's closed by the server or after a timeout.
Add suport for TCP fast open connection to reduce latency for successive DNS request over TCP
Add support for DNS-over-TLS using GnuTLS. To reduce latency also TLS False Start and TLS session resumption is supported.
Like with DNSSec, make PrivateDNS configurable per link, so you can have trusted and untrusted links.
No additions, just moving stuff around and wording cleanups.
NEWS followup and a small man addition
edolstra and others added 20 commits August 1, 2018 09:25
systemd-tmpfiles-setup.service pulls in local-fs.target, which
interferes with NixOps' send-keys feature (since sshd.service depends
indirectly on sysinit.target). Since in NixOS we don't use
systemd-tmpfiles for creating files (that's done by activation scripts
and preStart scripts), it's not a problem to start it a bit later.
Look in /nix/var/nix/profiles/default/lib/systemd for units provided
by packages in the default (system-wide) profile, and in
/etc/systemd-mutable/system for persistent, mutable units (not
recommended).

Also, remove /usr and /lib as these don't exist on NixOS.
Namely lots of variants of

  Unit nix-var-nix-db.mount is bound to inactive unit dev-disk-by\x2dlabel-nixos.device. Stopping, too.

in containers.
Patch by vcunat.
Similar to MemoryMax=, MemorySwapMax= limits swap usage. This controls
controls "memory.swap.max" attribute in unified cgroup.

(cherry picked from commit 96e131e)
NixOS has an option to link the xkb data files to /etc/X11, but not to
/usr/share/X11.
Setting concrete is not covered in configuration.nix.
This action is similar to `date -s`, so there is no
good reason to disallow this. This option
was disabled in ce02fb7
Unless the NIXOS_STATIC_TIMEZONE environment variable exists, this
undoes the prohibition introduced by
f65b136.

This change is part of work on NixOS/nixpkgs#26469.
By default systemd should read all its configuration from /etc. Therefor
we rely on -Dsysconfdir=/etc in meson as default value. Unfortunately
this would also lead to installation of systemd's own configuration
files to `/etc` whereas we are limited to /nix/store. To counter that
this commit introduces two new configuration variables `factoryconfdir`
and `factorypkgconfdir` to install systemd's own configuration into nix
store again, while having executables looking up files in /etc.
@Mic92 Mic92 mentioned this pull request Aug 1, 2018
@Mic92 Mic92 changed the title systemd: v238 -> v239 systemd: 238 -> 239 Aug 1, 2018
@Mic92
Copy link
Member Author

Mic92 commented Aug 3, 2018

I tested this on my machine. @fpletz or @globin please merge this, then I will iterate over the tests.

@fpletz
Copy link
Member

fpletz commented Aug 3, 2018

Pushed to https://github.com/NixOS/systemd/tree/nixos-v239. Thanks!

@fpletz fpletz closed this Aug 3, 2018
@Mic92 Mic92 deleted the nixos-v239 branch August 3, 2018 22:15
@dtzWill
Copy link
Member

dtzWill commented Aug 6, 2018

The note in systemd's default.nix says to follow stable, "not development". Is a stable v239 expected soon?

@Mic92
Copy link
Member Author

Mic92 commented Aug 8, 2018

@dtzWill systemd-stable is just meant to be for backports that happen after the release. There seems no such backports yet for v239 either required or nobody has bothered doing so. The version v239 is already released though.

Mic92 pushed a commit that referenced this pull request Feb 22, 2019
This function returns 0 on success and a negative value on failure. On success,
it writes the parsed action to the address passed in its third argument.

`bus_set_transient_emergency_action` does this:

 r = parse_emergency_action(s, system, &v);
 if (v < 0)
     // handle failure

However, `v` is not updated if the function fails, and this should be checking
`r` instead of `v`.

The result of this is that if an invalid failure (or success) action is
specified, systemd ends up creating the unit anyway and then misbehaves if it
tries to run the failure action because the action value comes from
uninitialized stack data. In my case, this resulted in a failed assertion:

 Program received signal SIGABRT, Aborted.
 0x00007fe52cca0d7f in raise () from /snap/usr/lib/libc.so.6
 (gdb) bt
 #0  0x00007fe52cca0d7f in raise () from /snap/usr/lib/libc.so.6
 #1  0x00007fe52cc8b672 in abort () from /snap/usr/lib/libc.so.6
 #2  0x00007fe52d66f169 in log_assert_failed_realm (realm=LOG_REALM_SYSTEMD, text=0x56177ab8e000 "action < _EMERGENCY_ACTION_MAX", file=0x56177ab8dfb8 "../src/core/emergency-action.c", line=33, func=0x56177ab8e2b0 <__PRETTY_FUNCTION__.14207> "emergency_action") at ../src/basic/log.c:795
 #3  0x000056177aa98cf4 in emergency_action (m=0x56177c992cb0, action=2059118610, options=(unknown: 0), reboot_arg=0x0, exit_status=1, reason=0x7ffdd2df4290 "unit run-u0.service failed") at ../src/core/emergency-action.c:33
 #4  0x000056177ab2b739 in unit_notify (u=0x56177c9eb340, os=UNIT_ACTIVE, ns=UNIT_FAILED, flags=(unknown: 0)) at ../src/core/unit.c:2504
 #5  0x000056177aaf62ed in service_set_state (s=0x56177c9eb340, state=SERVICE_FAILED) at ../src/core/service.c:1104
 #6  0x000056177aaf8a29 in service_enter_dead (s=0x56177c9eb340, f=SERVICE_SUCCESS, allow_restart=true) at ../src/core/service.c:1712
 #7  0x000056177aaf9233 in service_enter_signal (s=0x56177c9eb340, state=SERVICE_FINAL_SIGKILL, f=SERVICE_SUCCESS) at ../src/core/service.c:1854
 #8  0x000056177aaf921b in service_enter_signal (s=0x56177c9eb340, state=SERVICE_FINAL_SIGTERM, f=SERVICE_SUCCESS) at ../src/core/service.c:1852
 #9  0x000056177aaf8eb3 in service_enter_stop_post (s=0x56177c9eb340, f=SERVICE_SUCCESS) at ../src/core/service.c:1788
 #10 0x000056177aaf91eb in service_enter_signal (s=0x56177c9eb340, state=SERVICE_STOP_SIGKILL, f=SERVICE_SUCCESS) at ../src/core/service.c:1850
 #11 0x000056177aaf91bc in service_enter_signal (s=0x56177c9eb340, state=SERVICE_STOP_SIGTERM, f=SERVICE_FAILURE_EXIT_CODE) at ../src/core/service.c:1848
 #12 0x000056177aaf9759 in service_enter_running (s=0x56177c9eb340, f=SERVICE_FAILURE_EXIT_CODE) at ../src/core/service.c:1941
 #13 0x000056177ab005b7 in service_sigchld_event (u=0x56177c9eb340, pid=112, code=1, status=1) at ../src/core/service.c:3296
 #14 0x000056177aad84b5 in manager_invoke_sigchld_event (m=0x56177c992cb0, u=0x56177c9eb340, si=0x7ffdd2df48f0) at ../src/core/manager.c:2444
 #15 0x000056177aad88df in manager_dispatch_sigchld (source=0x56177c994710, userdata=0x56177c992cb0) at ../src/core/manager.c:2508
 #16 0x00007fe52d72f807 in source_dispatch (s=0x56177c994710) at ../src/libsystemd/sd-event/sd-event.c:2846
 #17 0x00007fe52d730f7d in sd_event_dispatch (e=0x56177c993530) at ../src/libsystemd/sd-event/sd-event.c:3229
 #18 0x00007fe52d73142e in sd_event_run (e=0x56177c993530, timeout=18446744073709551615) at ../src/libsystemd/sd-event/sd-event.c:3286
 #19 0x000056177aad9f71 in manager_loop (m=0x56177c992cb0) at ../src/core/manager.c:2906
 #20 0x000056177aa7c876 in invoke_main_loop (m=0x56177c992cb0, ret_reexecute=0x7ffdd2df4bff, ret_retval=0x7ffdd2df4c04, ret_shutdown_verb=0x7ffdd2df4c58, ret_fds=0x7ffdd2df4c70, ret_switch_root_dir=0x7ffdd2df4c48, ret_switch_root_init=0x7ffdd2df4c50, ret_error_message=0x7ffdd2df4c60) at ../src/core/main.c:1792
 #21 0x000056177aa7f251 in main (argc=2, argv=0x7ffdd2df4e78) at ../src/core/main.c:2573

Fix this by checking the correct variable.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet