Commit Graph

48174 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek e5d5edc3ff nss-mymachines: initialize logging
No logging is done directly by nss-mymachines.c code, but we call into sd-bus,
which will log.
2020-12-10 20:52:03 +01:00
Zbigniew Jędrzejewski-Szmek 3339381f22 nss-systemd: initialize logging 2020-12-10 20:51:59 +01:00
Zbigniew Jędrzejewski-Szmek 55679e291c nss-resolve: initialize logging, log json errors
When the .so module is loaded, it gets a separate copy of stuff in src/basic,
including the log level variables. So any logging settings are unaffected by
the loading program calling log_parse_environment() or such. Let's also parse
the environment here so that we can have nice logging.

Initialization is done from each exported function, and pthread_once_t is used
to avoid duplicate initialization. I didn't merge PROTECT_ERRNO into
NSS_ENTRYPOINT_BEGIN because UNPROTECT_ERRNO is called in a bunch of places
and it would feel strange to have PROTECT_ERRNO hidden, but not UNPROTECT_ERRNO.

The most interesting stuff in this module is the varlink messages, and any
potential errors in json. So let's enable json logging when debug messages are
enabled.

With those changes, figuring out the issue in
https://github.com/systemd/systemd/pull/17823 is trivial:

$ LD_LIBRARY_PATH=build/ SYSTEMD_LOG_COLOR=1 SYSTEMD_LOG_LOCATION=1 SYSTEMD_LOG_LEVEL=debug getent hosts mirrors.fedoraproject.org
src/shared/varlink.c:237: n/a: varlink: setting state idle-client
src/shared/varlink.c:1240: n/a: Sending message: {"method":"io.systemd.Resolve.ResolveHostname","parameters":{"name":"mirrors.fedoraproject.org","family":10}}
src/shared/varlink.c:240: n/a: varlink: changing state idle-client → calling
src/shared/varlink.c:588: n/a: New incoming message: {"parameters":{"addresses":[{"ifindex":0,"family":10,"address":[42,5,208,20,0,16,120,3,247,116,77,124,226,119,164,87]},{"ifindex":0,"family":10,"address":[42,5,208,28,12,106,204,3,38,58,132,9,185,97,126,2]},{"ifindex":0,"family":10,"address":[38,32,0,82,0,3,0,1,222,173,190,239,202,254,254,215]},{"ifindex":0,"family":10,"address":[38,5,188,128,48,16,6,0,222,173,190,239,202,254,254,217]},{"ifindex":0,"family":10,"address":[38,4,21,128,254,0,0,0,222,173,190,239,202,254,254,209]},{"ifindex":0,"family":10,"address":[38,32,0,82,0,3,0,1,222,173,190,239,202,254,254,214]},{"ifindex":0,"family":10,"address":[38,16,0,40,48,144,48,1,222,173,190,239,202,254,254,211]},{"ifindex":0,"family":10,"address":[32,1,65,120,0,2,18,105,0,0,0,0,0,0,254,210]}],"name":"wildcard.fedoraproject.org","flags":1}}
src/shared/varlink.c:240: n/a: varlink: changing state calling → called
src/shared/varlink.c:240: n/a: varlink: changing state called → idle-client
src/nss-resolve/nss-resolve.c:84: (string):1:40: JSON field 'ifindex' is out of bounds for an interface index.
2020-12-10 20:50:01 +01:00
Zbigniew Jędrzejewski-Szmek 1f568ba13f basic/static-destruct: fix grammar in comment 2020-12-10 13:00:14 +01:00
Zbigniew Jędrzejewski-Szmek d401a5e411 json: log location also when there is no file
E.g. in nss-resolve it is still useful to print the location of the error:
src/test/test-nss.c:231: dlsym(0x0x1dc6fb0, _nss_resolve_gethostbyname2_r) → 0x0x7fdbfc53f626
(string):1:40: JSON field ifindex is out of bounds for an interface index.

I opted to use a partially duplicated if condition to avoid nesting. It's nice
to have the log calls vertically aligned. The compiler will optimize this nicely.
2020-12-10 13:00:02 +01:00
Yu Watanabe 9e36b885b8 unit: make systemd-networkd.service support reload command 2020-12-09 12:55:51 +09:00
Yu Watanabe 84f9a68060 mount-util: fix typo 2020-12-09 12:55:14 +09:00
Pavel Hrdina 35e7a62ca3 cgroup: Also set blkio.bfq.weight
Commit [1] added a workaround when unified cgroups are used but missed
legacy cgroups where there is the same issue.

[1] <2dbc45aea7>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2020-12-08 18:15:26 +00:00
Zbigniew Jędrzejewski-Szmek a6e5ad8925
Merge pull request #17871 from yuwata/sd-device-issue-17772
sd-device: keep escaped strings in DEVLINK= property
2020-12-08 10:14:43 +01:00
Daan De Meyer ee2812da8f mkosi: Enable --qemu-headless option for all distros
--qemu-headless configures the generated image and mkosi's qemu
command to connect to the VM via the serial port. This allows
spawning a qemu VM within the user's terminal instead of spawning
a graphical GTK GUI. --qemu-headless sets TERM, COLUMNS and LINES
in serial-getty@ttyS0.service in the container which makes the
terminal in the VM behave almost equivalent to the one on the host.

This change makes testing changes to systemd using mkosi + QEMU a
lot easier compared to before as commands can be executed in the VM
from the comfort of one's terminal compared to the Linux console
available when running via the GTK GUI.
2020-12-08 10:03:25 +01:00
l4gfcm fc5dcf9697
hwdb: add funcional keys for MSI Modern series (tested on Modern 14) (#17880) 2020-12-08 09:57:17 +01:00
Yu Watanabe 78bc702503 man: synthetize(d) -> synthesize(d) 2020-12-08 09:24:11 +01:00
Yu Watanabe e6f8828715 test: add tests for device_new_from_nulstr() 2020-12-08 12:35:51 +09:00
Yu Watanabe 31063db0b4 sd-device: keep escaped strings in DEVLINK= property
This fixes a bug introduced by 87a4d416e5.

Fixes #17772.
2020-12-08 12:35:47 +09:00
Yu Watanabe 6f3ac0d517 sd-device: use set_strjoin()
This slightly changes TAGS= and CURRENT_TAGS= properties:

Before
E: TAGS=:aaa:bbb:

After
E: TAGS=aaa:bbb
2020-12-08 12:28:58 +09:00
Yu Watanabe 4dbce71787 set: introduce set_strjoin() 2020-12-08 12:28:54 +09:00
Luca Boccassi 77613416e0
Merge pull request #17855 from poettering/more-socktops
socket-util: some helpers for various sockopts
2020-12-07 21:15:28 +00:00
Torsten Hilbrich 88fc9c9bad systemd-nspawn: Allow setting ambient capability set
The old code was only able to pass the value 0 for the inheritable
and ambient capability set when a non-root user was specified.

However, sometimes it is useful to run a program in its own container
with a user specification and some capabilities set. This is needed
when the capabilities cannot be provided by file capabilities (because
the file system is mounted with MS_NOSUID for additional security).

This commit introduces the option --ambient-capability and the config
file option AmbientCapability=. Both are used in a similar way to the
existing Capability= setting. It changes the inheritable and ambient
set (which is 0 by default). The code also checks that the settings
for the bounding set (as defined by Capability= and DropCapability=)
and the setting for the ambient set (as defined by AmbientCapability=)
are compatible. Otherwise, the operation would fail in any way.

Due to the current use of -1 to indicate no support for ambient
capability set the special value "all" cannot be supported.

Also, the setting of ambient capability is restricted to running a
single program in the container payload.
2020-12-07 19:56:59 +01:00
Zbigniew Jędrzejewski-Szmek bf20d93750
Merge pull request #17766 from weblate/weblate-systemd-master
Translations update from Weblate
2020-12-07 19:56:13 +01:00
Zbigniew Jędrzejewski-Szmek 7e0079f95f Make support for nscd flushing optional
Fedora will deprecate support for nscd in the upcoming release [1] and plans to
drop it in the next one [2]. At that point we might as well build systemd
without that support too, since there'll be nothing to talk too.

[1] https://fedoraproject.org/wiki/Changes/DeprecateNSCD
[2] https://fedoraproject.org/wiki/Changes/RemoveNSCD
2020-12-07 19:46:02 +01:00
Lennart Poettering 52975f8672 socket-util: add common API for querying socket MTU 2020-12-07 13:46:35 +01:00
Lennart Poettering 4e25d4cf0f socket-util: add getsockopt_int() helper 2020-12-07 13:46:35 +01:00
Lennart Poettering 00ed2fff1a socket-util: add sockopt helper for controlling IP_RECVFRAGSIZE 2020-12-07 13:46:35 +01:00
Zbigniew Jędrzejewski-Szmek e0f90ad988
Merge pull request #17874 from DaanDeMeyer/mkosi-build-verbosity
Reduce mkosi build script verbosity
2020-12-07 10:12:33 +01:00
Yu Watanabe 3c229a9afb nss-resolve: varlink_call() set error_id only when r >= 0
Fixes #17870.
2020-12-07 09:25:39 +01:00
Yu Watanabe a7b6e29c1f network: mtu is neither a boolean nor a pointer 2020-12-07 08:59:21 +01:00
Matt Turner d6c0fdf492 missing: Define several syscall numbers for Alpha arch 2020-12-07 09:22:45 +09:00
Daan De Meyer 09422f9a28 meson: Respect MESON_INSTALL_QUIET
MESON_INSTALL_QUIET is set when --quiet is passed to meson install.
Make sure we check the variable in our custom install scripts and
don't output anything if it is set.
2020-12-06 22:11:11 +00:00
Daan De Meyer 5e577e1737 mkosi: Silence locale checking in mkosi.build
Avoid warning and error logs from locale charmap and export LC_CTYPE
by piping to dev/null and checking if locales are available before
using them.
2020-12-06 22:11:11 +00:00
Daan De Meyer 3dab2a4697 mkosi: Remove explicit default_hierarchy=unified option from mkosi.build
default_hierarchy is set to unified in meson_options already so
we can remove it from mkosi.build.
2020-12-06 22:11:11 +00:00
Daan De Meyer fe2b7631ad mkosi: Add --quiet and --no-rebuild options to meson install in mkosi.build
By default, meson install prints a line for every file it installs.
This is verbose and doesn't provide much value. Let's silence the
meson install step to remove this output from the mkosi build step.

The --no-rebuild option removes some additional duplicate output
by the meson install step.

Ubuntu Focal still has meson 0.53.0 so we add a version check and
only use the new feature if the meson version supports it.
2020-12-06 22:11:11 +00:00
Daan De Meyer 1394a3ec35 mkosi: Remove bash -x option from mkosi.build
-x is for debugging purposes. During regular usage, using -x mostly
prints useless output when building the mkosi image.
2020-12-06 22:11:11 +00:00
Daan De Meyer 06ac1b1f2c mkosi: Use meson install instead of ninja install in build script
Allows using extra options not available when using ninja.
2020-12-06 22:11:11 +00:00
Luca Boccassi bf2d8c03c1
Merge pull request #17760 from mrc0mmand/revert-semaphore-timedated
Revert "semaphore: temporarily disable the timedated test suite"
2020-12-05 11:12:35 +00:00
Daan De Meyer 77f16dbd6d Don't assume /run/systemd exists when creating unit-root
When running tests in a mkosi container, /run/systemd might not
exist yet in the container which causes test-execute to fail.

Fixes #17842.
2020-12-05 11:11:58 +00:00
Luca Boccassi f1027d7c28
Merge pull request #17787 from DaanDeMeyer/mkosi-boot-tests
CI: Add mkosi boot tests
2020-12-04 23:38:29 +00:00
Daan De Meyer 448d3462b0 CI: Add mkosi boot tests
Using the new mkosi Github Action, we can add some simple boot tests
for the systemd mkosi configs. This makes sure these keep working
as expected.
2020-12-04 22:24:12 +00:00
Daan De Meyer 8f2c4c5e93 mkosi: Add findutils to Fedora config
find is needed by test_exec_dynamicuser.
2020-12-04 22:24:12 +00:00
Daan De Meyer 8d036c446a mkosi: Add rpm to Fedora BuildPackages as it's needed by pkg-config 2020-12-04 20:06:03 +00:00
Frantisek Sumsal 6df7d18090 Revert "semaphore: temporarily disable the timedated test suite"
This reverts commit ed9192bb55.
2020-12-04 18:47:12 +01:00
Lennart Poettering 62ea0ed08d dissect: don't declare unused variables on archs that have no GPT discovery
Fixes: #17839
2020-12-04 17:50:18 +01:00
Yu Watanabe 402506cea5 socket-util: make several socket_set_xxx() functions inline 2020-12-04 17:49:55 +01:00
Lennart Poettering da2268f9d7 cryptsetup: give command line parameters proper names
It's highly confusing to reference the command line parameters via
argv[] indexes. Let's clean this up, and introduce properly named local
variables that make this easier to follow.

No actualy code changes, just some renaming of variables.
2020-12-04 17:49:34 +01:00
Lennart Poettering fea909c1b9
Merge pull request #17854 from poettering/dns-domain-ret-fix
dns-domain: fix some coding style issues
2020-12-04 17:49:05 +01:00
Luca Boccassi 32c7f02bb4
Merge pull request #17829 from anitazha/testoomdfix
test: fix TEST-56-OOMD thresholds for linux 5.9 changes
2020-12-04 12:22:46 +00:00
Zbigniew Jędrzejewski-Szmek a2c2421a05
Merge pull request #17834 from yuwata/network-ipv6-reject-type-route
network: handle IPv6 routes with reject type correctly
2020-12-04 12:19:35 +01:00
Vito Caputo 3a595c597a mmap-cache: replace stats accessors with log func
In preparation for logging more mmap-cache statistics get rid of this
piecemeal stats accessor api and just have a debug log output function
for producing the stats.

Updates the one call site using these accessors, moving what that site
did into the new log function.  So the output is unchanged for now,
just a trivial refactor.
2020-12-04 12:09:35 +01:00
Lennart Poettering ffac398613
Merge pull request #17843 from poettering/dlfcn-dlsym-arg
add DLSYM_ARG() macro helper
2020-12-04 12:00:53 +01:00
Lennart Poettering dcbe4a6860 dns-domain: initialize return param on success 2020-12-04 11:52:22 +01:00
Lennart Poettering cb3714d100 dns-domain: follow coding style, initialize ret params on success 2020-12-04 11:07:06 +01:00