1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00
Commit Graph

27769 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
e697dfef64 share/log: change log_syntax from "[a:b] " to "a🅱️ "
Those square brackets don't fit how our other messages look like; we use colons
everywhere else. The "[a:b]" format was originally added in
ed5bcfbe3c, and remained unchanged for 7 years,
but in the meantime other conventions evolved.

The new version is also one character shorter.

[/etc/systemd/system/systemd-networkd.service.d/override.conf:2] Failed to parse sec value, ignoring: ...
  ↓
/etc/systemd/system/systemd-networkd.service.d/override.conf:2: Failed to parse sec value, ignoring: ...
2016-12-11 15:43:16 -05:00
Zbigniew Jędrzejewski-Szmek
c2dec70292 basic/log: merge two big log_struct_internal invocations into one
We can take advantage of the fact a NULL argument terminates the list.
2016-12-11 15:43:16 -05:00
Zbigniew Jędrzejewski-Szmek
ba9534535e tools/catalog-report.py: a script to scour the journal for bad catalog entries
I think it can be a useful tool to find such issues.

SD_MESSAGE_UNIT_STARTING 7d4958e842da4a758f6c1cdc7b36dcc5: no field UNIT
../src/core/unit.c:1239 unit_status_log_starting_stopping_reloading
    Starting Paths.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6
    USER_UNIT=paths.target

SD_MESSAGE_UNIT_STARTED 39f53479d3a045ac8e11786248231fbf: no field UNIT
../src/core/job.c:721 job_log_status_message
    Reached target Paths.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6
    RESULT=done
    USER_UNIT=paths.target

SD_MESSAGE_STARTUP_FINISHED b07a249cd024414a82dd00cd181378ff: no field KERNEL_USEC
../src/core/manager.c:2532 manager_check_finished
    Startup finished in 19ms.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6
    USERSPACE_USEC=19670

SD_MESSAGE_STARTUP_FINISHED b07a249cd024414a82dd00cd181378ff: no field INITRD_USEC
../src/core/manager.c:2532 manager_check_finished
    Startup finished in 19ms.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6
    USERSPACE_USEC=19670

unknown 0ce153587afa4095832d233c17a88001: no catalog entry
gsm-manager.c:1366 start_phase
    Entering running state
    SYSLOG_IDENTIFIER=gnome-session
    PRIORITY=5

SD_MESSAGE_UNIT_STOPPING de5b426a63be47a7b6ac3eaac82e2f6f: no field UNIT
../src/core/unit.c:1239 unit_status_log_starting_stopping_reloading
    Stopping Default.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6
    USER_UNIT=default.target

SD_MESSAGE_UNIT_STOPPED 9d1aaa27d60140bd96365438aad20286: no field UNIT
../src/core/job.c:729 job_log_status_message
    Stopped target Default.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6
    RESULT=done
    USER_UNIT=default.target

SD_MESSAGE_TIME_CHANGE c7a787079b354eaaa9e77b371893cd27: no field REALTIME
src/core/manager.c:2049 manager_dispatch_time_change_fd
    Time has been changed
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=6

unknown f3ea493c22934e26811cd62abe8e203a: no catalog entry
shell-global.c:1375 shell_global_log_structured
    GNOME Shell started at Sat Jun 11 2016 12:37:46 GMT-0400 (EDT)
    SYSLOG_IDENTIFIER=gnome-shell

SD_MESSAGE_UNIT_FAILED be02cf6855d2428ba40df7e9d022f03d: no field UNIT
src/core/job.c:803 job_log_status_message
    Failed to start GNOME Terminal Server.
    SYSLOG_FACILITY=3
    SYSLOG_IDENTIFIER=systemd
    RESULT=failed
    PRIORITY=3
    USER_UNIT=gnome-terminal-server.service

SD_MESSAGE_LID_CLOSED b72ea4a2881545a0b50e200e55b9b070: no catalog entry
src/login/logind-button.c:198 button_dispatch
    Lid closed.
    SYSLOG_FACILITY=4
    SYSLOG_IDENTIFIER=systemd-logind
    PRIORITY=6

SD_MESSAGE_LID_OPENED b72ea4a2881545a0b50e200e55b9b06f: no catalog entry
src/login/logind-button.c:219 button_dispatch
    Lid opened.
    SYSLOG_FACILITY=4
    SYSLOG_IDENTIFIER=systemd-logind
    PRIORITY=6

SD_MESSAGE_SUSPEND_KEY b72ea4a2881545a0b50e200e55b9b072: no catalog entry
src/login/logind-button.c:177 button_dispatch
    Suspend key pressed.
    SYSLOG_FACILITY=4
    SYSLOG_IDENTIFIER=systemd-logind
    PRIORITY=6

SD_MESSAGE_CONFIG_ERROR c772d24e9a884cbeb9ea12625c306c01: no catalog entry
src/shared/conf-parser.c:469 config_parse_sec
    [/etc/systemd/system/systemd-networkd.service.d/override.conf:2] Failed to parse sec value, ignoring:
    UNIT=systemd-networkd.service
    SYSLOG_FACILITY=3
    ERRNO=22
    SYSLOG_IDENTIFIER=systemd
    PRIORITY=3
    CONFIG_LINE=2
    CONFIG_FILE=/etc/systemd/system/systemd-networkd.service.d/override.conf

unknown 10dd2dc188b54a5e98970f56499d1f73: no catalog entry
gsm-manager.c:308 on_display_server_failure
    Unrecoverable failure in required component org.gnome.Shell.desktop
    PRIORITY=3
    SYSLOG_IDENTIFIER=gnome-session-binary

unknown 52fb62f99e2c49d89cfbf9d6de5e3555: no catalog entry
src/journal/test-journal-send.c:85 main
    Hello World!
    PAGE_SIZE=4096
    TERM=xterm-256color
    SYSLOG_IDENTIFIER=lt-test-journal-send
    PRIORITY=5
    N_CPUS=2
    HOME=/home/zbyszek

unknown 9348174c5cc74001a71ef26bd79d302e: no catalog entry
/usr/lib/python3.5/site-packages/dnf-plugins/system_upgrade.py:422 log_status
    Download finished.
    SYSLOG_IDENTIFIER=python3
    DNF_VERSION=1.1.10
    TARGET_RELEASEVER=25
    SYSTEM_RELEASEVER=24
    PRIORITY=5

unknown fef1cc509d5047268b83a3a553f54b43: no catalog entry
/usr/lib/python3.5/site-packages/dnf-plugins/system_upgrade.py:422 log_status
    Rebooting to perform upgrade.
    SYSLOG_IDENTIFIER=python3
    DNF_VERSION=1.1.10
    TARGET_RELEASEVER=25
    SYSTEM_RELEASEVER=24
    PRIORITY=5

unknown 3e0a5636d16b4ca4bbe5321d06c6aa62: no catalog entry
/usr/lib/python3.5/site-packages/dnf-plugins/system_upgrade.py:422 log_status
    Starting system upgrade. This will take a while.
    SYSLOG_IDENTIFIER=python3
    DNF_VERSION=1.1.10
    SYSTEM_RELEASEVER=24
    PRIORITY=5
    TARGET_RELEASEVER=25

unknown 0123456789abcdef0123456789abcdef: no catalog entry
<doctest systemd.journal.JournalHandler[9]>:1 <module>
    Message with ID
    SYSLOG_IDENTIFIER=/usr/lib/python2.7/site-packages/py/test.py
    LOGGER=custom_logger_name
    PRIORITY=4
    THREAD_NAME=MainThread
2016-12-11 15:43:16 -05:00
Zbigniew Jędrzejewski-Szmek
5a1d6cb19d pid1,catalog: use a different MESSAGE_ID for user manager startup
This add a new message id for the end of user instance startup.
User manager startup is a different beast then the system startup.
Their descriptions are completely different too. Let's just separate
them.

Partially fixes #3351.

Also remove "successful" from the description, since we don't know if
the startup was successful or not.
2016-12-11 12:41:23 -05:00
AsciiWolf
cb8ac9646f Added Debian config for mkosi (#4865) 2016-12-11 00:14:19 -05:00
Lennart Poettering
86bcce5f1f Merge pull request #4844 from hadess/sensor-quirks
udev: Add rules for accelerometer orientation quirks
2016-12-10 16:28:50 +01:00
Zbigniew Jędrzejewski-Szmek
fe2a2a4f46 hwdb_parser: make sure that our patterns match the full property
We would catch stuff like:
 ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0.0., 0
but not
 ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 0.0.
because the match would stop at the next-to-last char. Fix that
by requiring a line end.
2016-12-10 02:28:24 -05:00
Zbigniew Jędrzejewski-Szmek
7fdc73afe4 hwdb_parser: add support for ACCEL_MOUNT_MATRIX
We test that we have exactly three rows of three reals separated by two
semicolons.
2016-12-10 02:26:37 -05:00
Bastien Nocera
1f886b50f6 udev: Add rules for accelerometer orientation quirks
This commit adds a rules file to extract the properties from hwdb
to set on i2c IIO devices. This is used to set the ACCEL_MOUNT_MATRIX
property on IIO devices, to be consumed by iio-sensor-proxy or
equivalent daemon.

The hwdb file contains documentation on how to write quirks. Note
however that mount information is usually exported in:
- the device-tree for ARM devices
- the ACPI DSDT for Intel-compatible devices
but currently not extracted by the kernel.

Also note that some devices have the framebuffer rotation that changes
between the bootloader and the main system, which might mean that the
accelerometer is then wrongly oriented. This is a missing feature in the
i915 kernel driver: https://bugs.freedesktop.org/show_bug.cgi?id=94894
which needs to be fixed, and won't require quirks.
2016-12-10 02:25:11 -05:00
Zbigniew Jędrzejewski-Szmek
1ac7a93574 Merge pull request #4835 from poettering/unit-name-printf
Various specifier resolution fixes.
2016-12-10 01:29:52 -05:00
Zbigniew Jędrzejewski-Szmek
4a5567d5d6 Merge pull request #4795 from poettering/dissect
Generalize image dissection logic of nspawn, and make it useful for other tools.
2016-12-10 01:08:13 -05:00
Wim de With
2e1f244efd nspawn: add missing -E to getopt_long (#4860) 2016-12-10 07:33:58 +03:00
Reverend Homer
8fb3f00997 tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853) 2016-12-09 10:04:30 +01:00
Zbigniew Jędrzejewski-Szmek
9258a1cae3 Merge pull request #4686 from poettering/machine-id-app-specific
Add new "khash" API and add new sd_id128_get_machine_app_specific() function
2016-12-08 23:24:28 -05:00
David Michael
1aa68db1ae network: fix const qualifier (#4849)
Follow up for #4809.
2016-12-07 16:42:17 -05:00
Franck Bui
5367354dae nspawn: resolv.conf might not be created initially (#4799)
This might happen that resolv.conf is missing in a minimal rootfs and in this
case the following warning is emitted:

 Failed to mount n/a on /mnt/etc/resolv.conf (MS_BIND ""): No such file or directory

This patch fixes this case.
2016-12-07 21:36:39 +01:00
Lennart Poettering
e332833f07 Merge pull request #4843 from joukewitteveen/protocol
Go through stop_post on failure (#4770)
2016-12-07 21:35:07 +01:00
David Michael
618b196e9d network: support negation in matching patterns (#4809) 2016-12-07 19:12:10 +01:00
Lennart Poettering
03fc9c723c core: add a note clarifying that we should be careful when adding new specifiers 2016-12-07 19:10:04 +01:00
Lennart Poettering
1b89b0c499 core: deprecate %c, %r, %R specifiers
%c and %r rely on settings made in the unit files themselves and hence resolve
to different values depending on whether they are used before or after Slice=.
Let's simply deprecate them and drop them from the documentation, as that's not
really possible to fix. Moreover they are actually redundant, as the same
information may always be queried from /proc/self/cgroup and /proc/1/cgroup.

(Accurately speaking, %R is actually not broken like this as it is constant.
However, let's remove all cgroup-related specifiers at once, as it is also
redundant, and doesn't really make much sense alone.)
2016-12-07 18:58:09 +01:00
Lennart Poettering
6a9cd374e0 update TODO 2016-12-07 18:47:32 +01:00
Lennart Poettering
ea9cfad1d7 tests: let's make function tables static/const 2016-12-07 18:47:32 +01:00
Lennart Poettering
7b07e99320 core: add specifier expansion to ReadOnlyPaths= and friends
Expanding specifiers here definitely makes sense.

Also simplifies the loop a bit, as there's no reason to keep "prev" around...
2016-12-07 18:47:32 +01:00
Lennart Poettering
744bb5b1be core: add specifier expansion to RequiresMountsFor=
This might be useful for some people, for example to pull in mounts for paths
including the machine ID or hostname.
2016-12-07 18:47:32 +01:00
Lennart Poettering
d107589cd2 core: turn on specifier expansion for more unit file settings
Let's permit specifier expansion at a numbre of additional fields, where
arbitrary strings might be passed where this might be useful one day. (Or at
least where there's no clear reason where it wouldn't make sense to have.)
2016-12-07 18:47:32 +01:00
Lennart Poettering
18913df9a2 core: use unit_full_printf() at a couple of locations we used unit_name_printf() before
For settings that are not taking unit names there's no reason to use
unit_name_printf(). Use unit_full_printf() instead, as the names are validated
anyway in one form or another after expansion.
2016-12-07 18:47:32 +01:00
Lennart Poettering
b1801e6433 core: resolve more specifiers in unit_name_printf()
unit_name_printf() is usually what we use when the resulting string shall
qualify as unit name, and it hence avoids resolving specifiers that almost
certainly won't result in valid unit names.

Add a couple of more specifiers that unit_full_printf() resolves also to the
list unit_name_printf() resolves, as they are likely to be useful in valid unit
names too. (Note that there might be cases where this doesn't hold, but we
should still permit this, as more often than not they are safe, and if people
want to use them that way, they should be able to.)
2016-12-07 18:47:32 +01:00
Lennart Poettering
13e40f5a4c man: drop reference to %U being useless
This paragraph was a missed left-over from
79413b673b. Drop it now.
2016-12-07 18:47:32 +01:00
Lennart Poettering
5125e76243 core: move specifier expansion out of service.c/socket.c
This monopolizes unit file specifier expansion in load-fragment.c, and removes
it from socket.c + service.c. This way expansion becomes an operation done exclusively at time of loading unit files.

Previously specifiers were resolved for all settings during loading of unit
files with the exception of ExecStart= and friends which were resolved in
socket.c and service.c. With this change the latter is also moved to the
loading of unit files.

Fixes: #3061
2016-12-07 18:47:32 +01:00
Lennart Poettering
58abb66f4b man: update the nspawn man page, and document what kind of dissection features we now support 2016-12-07 18:38:41 +01:00
Lennart Poettering
4623e8e6ac nspawn/dissect: automatically discover dm-verity verity partitions
This adds support for discovering and making use of properly tagged dm-verity
data integrity partitions. This extends both systemd-nspawn and systemd-dissect
with a new --root-hash= switch that takes the root hash to use for the root
partition, and is otherwise fully automatic.

Verity partitions are discovered automatically by GPT table type UUIDs, as
listed in
https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
(which I updated prior to this change, to include new UUIDs for this purpose.

mkosi with https://github.com/systemd/mkosi/pull/39 applied may generate images
that carry the necessary integrity data. With that PR and this commit, the
following simply lines suffice to boot up an integrity-protected container image:

```
 # mkdir test
 # cd test
 # mkosi --verity
 # systemd-nspawn -i ./image.raw -bn
```

Note that mkosi writes the image file to "image.raw" next to a a file
"image.roothash" that contains the root hash. systemd-nspawn will look for that
file and use it if it exists, in case --root-hash= is not specified explicitly.
2016-12-07 18:38:41 +01:00
Lennart Poettering
4827ab4854 nspawn: when generating a machine name from an image name, truncate .raw suffix
Let's prettify the machine name we generate for image-based containers: let's
chop off the .raw suffix before using it as machine name.
2016-12-07 18:38:41 +01:00
Lennart Poettering
18b5886e56 dissect: add support for encrypted images
This adds support to the image dissector to deal with encrypted images (only
LUKS). Given that we now have a neatly isolated image dissector codebase, let's
add a new feature to it: support for automatically dealing with encrypted
images. This is then exposed in systemd-dissect and nspawn.

It's pretty basic: only support for passphrase-based encryption.

In order to ensure that "systemd-dissect --mount" results in mount points whose
backing LUKS DM devices are cleaned up automatically we use the DM_DEV_REMOVE
ioctl() directly on the device (in DM_DEFERRED_REMOVE mode). libgcryptsetup at
the moment doesn't provide a proper API for this. Thankfully, the ioctl() API
is pretty easy to use.
2016-12-07 18:38:41 +01:00
Lennart Poettering
cf139e6025 minor code beautifications 2016-12-07 18:38:41 +01:00
Lennart Poettering
a2ea3b2fc8 dissect: add small "systemd-dissect" tool as wrapper around dissect-image.c
This adds a small tool that may be used to look into OS images, and mount them
to any place. This is mostly a friendlier version of test-dissect-image.c. I am
not sure this should really become a proper command of systemd, hence for now
do not install it into bindir, but simply libexecdir.

This tool is already pretty useful since you can mount image files with it,
honouring the various partitions correctly. I figure this is going to become
more interesting if the dissctor learns luks and verity support.
2016-12-07 18:38:41 +01:00
Lennart Poettering
9f3c7fc1ad util-lib: drop unnecessary NULL check
DEFINE_TRIVIAL_CLEANUP_FUNC() already does that check, no need to duplicate it.
2016-12-07 18:38:41 +01:00
Lennart Poettering
9153b02bb5 machined: add API for querying the OS release of a machine image
This adds a bus call GetImageOSRelease() to the Manager interface that
retrieves the /etc/os-release file of a machine image. It matches the existing
GetMachineOSRelease() call, however operates on a disk image rather than a
running container.

The backend for this call on .raw images is implemented via the generalized
image dissector, which makes this scheme relatively easy to implement.
2016-12-07 18:38:41 +01:00
Lennart Poettering
676bcb0fc0 util-lib: add easy helpers for temporary directories that rmdir()ed via _cleanup_
This adds mkdtemp_malloc() that is a combination of mkdtemp() plus strdup(). It
initializes its return paremeter only if the temporary directory could be
created successfully, so that the parameter is exactly non-NULL when the
directory exists.

rmdir_and_free() and rmdir_and_freep() are also added, and the latter may be
used inside of _cleanup_ for such a directory string variable, to automatically
rmdir() the directory if it is non-NULL when the scope exits.

rmdir_and_free() is similar to the existing rm_rf_and_free() however, is only
removes a single directory and does not operate recursively.
2016-12-07 18:38:41 +01:00
Lennart Poettering
2d8457851b nspawn: port nspawn to new generalized image dissection code
Let's make use of the new internal API. This mostly doesn't change anything for
the caller, however, "systemd-nspawn --image=/dev/sda7" works now as the new
code can handle disk images with no partition tables, and make any detected
images directly the root.
2016-12-07 18:38:40 +01:00
Lennart Poettering
8c1be37e5b util-lib: split out image dissecting code and loopback code from nspawn
This adds two new APIs to systemd:

- loop-util.h is a simple internal API for allocating, setting up and releasing
  loopback block devices.

- dissect-image.h is an internal API for taking apart disk images and figuring
  out what the purpose of each partition is.

Both APIs are basically refactored versions of similar code in nspawn.  This
rework should permit us to reuse this in other places than just nspawn in the
future. Specifically: to implement RootImage= in the service image, similar to
RootDirectory=, but operating on a disk image; to unify the gpt-auto-discovery
generator code with the discovery logic in nspawn; to add new API to machined
for determining the OS version of a disk image (i.e. not just running
containers). This PR does not make any such changes however, it just provides
the new reworked API.

The reworked code is also slightly more powerful than the nspawn original one.
When pointing it to an image or block device with a naked file system (i.e. no
partition table) it will simply make it the root device.
2016-12-07 18:38:40 +01:00
Lennart Poettering
9e70a49dc7 libudev: set errno if udev_new() fails
All other constructors in libudev do that, let's also do this for udev_new().
2016-12-07 18:38:40 +01:00
27o
3e7b9f76f5 dhcp: bind udp sockets to interfaces (#4822) 2016-12-07 02:00:05 +01:00
Peter Hutterer
73e383cc62 Merge pull request #4841 from hadess/oke-barcode-reader
hwdb: Add fixed layout for a few devices
2016-12-07 07:12:13 +10:00
Doug Christman
c0df71fa36 calendarspec: always interpret missing seconds as :00 (#4813)
"*:*" should be equivalent to "*-*-* *:*:00" (minutely)
rather than running every microsecond.

Fixes #4804
2016-12-06 20:41:15 +01:00
Jouke Witteveen
c3fda31da3 service: go through stop_post on failure (#4770) 2016-12-06 14:02:36 +01:00
Jouke Witteveen
a4e26faf33 man: fix $SERVICE_RESULT/$EXIT_CODE/$EXIT_STATUS documentation
Note that any exit code is available through $EXIT_STATUS and not through
$EXIT_CODE. This mimics siginfo.
2016-12-06 13:37:14 +01:00
Susant Sahani
9c77d1079d networkd: Use dhcp correct type for IP port (#4840)
Fixes: #4839
2016-12-06 12:22:33 +01:00
Susant Sahani
10452f7c93 core: introduce parse_ip_port (#4825)
1. Listed in TODO.
2. Tree wide replace safe_atou16 with parse_ip_port incase
   it's used for ports.
2016-12-06 12:21:45 +01:00
Bastien Nocera
993980075f hwdb: Add fixed layout for another Yubikey 2016-12-06 12:14:40 +01:00
Bastien Nocera
f8a4ea9fe8 hwdb: Add fixed layout for OKE barcode reader 2016-12-06 11:55:22 +01:00