Commit graph

26625 commits

Author SHA1 Message Date
Lennart Poettering fcd30826d4 Populate NEWS a bit, in preparation for v231
(Note complete yet.)
2016-07-22 20:18:34 +02:00
Lennart Poettering 5bd7342617 man: rework resolved.conf's Cache= documentation
Let's not mention the supposed security benefit of turning off caching. It is
really questionnable, and I#d rather not create the impression that we actually
believed turning off caching would be a good idea.

Instead, mention that Cache=no is implicit if a DNS server on the local host is
used.
2016-07-22 20:17:23 +02:00
Lennart Poettering 1137c73b40 mailmap: add a few more names
Let's do something about my OCD and map a numbre of commiters to proper names.
2016-07-22 20:16:58 +02:00
Lennart Poettering c907cba919 Merge pull request #3783 from poettering/fix-3285
coredump: make sure to handle crashes of PID 1 and journald special
2016-07-22 18:37:42 +02:00
Lennart Poettering 5157879b75 coredump: turn off coredump collection entirely after journald or PID 1 crashed
Safe is safe, let's turn off the whole logic if we can, after all it is
unlikely we'll be able to process further crashes in a reasonable way.
2016-07-22 18:01:50 +02:00
Lennart Poettering 78f043f77b coredump: make sure to handle crashes of PID 1 and journald special
Fixes: #3285
2016-07-22 18:01:38 +02:00
Lennart Poettering 5052c4eadd Merge pull request #3753 from poettering/tasks-max-scale
Add support for relative TasksMax= specifications, and bump default for services
2016-07-22 17:40:12 +02:00
Lennart Poettering fec603eb6c coredump: truncate overly long coredump metadata fields (#3780)
Fixes: #3573
Replaces: #3588
2016-07-22 17:39:47 +02:00
Lennart Poettering e08ab37902 systemctl: never check inhibitors if -H or -M are used (#3781)
Don't check inhibitors when operating remotely. The interactivity inhibitors
imply can#t be provided anyway, and the current code checks for local sessions
directly, via various sd_session_xyz() APIs, hence bypass it entirely if we
operate on remote systems.

Fixes: #3476
2016-07-22 17:39:21 +02:00
Lennart Poettering 8a18507c55 Merge pull request #3779 from kinvolk/alessandro/nspawn-inaccessible-devs
cgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy
2016-07-22 17:37:54 +02:00
Alessandro Puccetti 0d9e799102 cgroup: whitelist inaccessible devices for "auto" and "closed" DevicePolicy.
https://github.com/systemd/systemd/pull/3685 introduced
/run/systemd/inaccessible/{chr,blk} to map inacessible devices,
this patch allows systemd running inside a nspawn container to create
/run/systemd/inaccessible/{chr,blk}.
2016-07-22 16:08:31 +02:00
Alessandro Puccetti 54cd6556b3 nspawn: set DevicesPolicy closed and clean up duplicated devices 2016-07-22 16:08:26 +02:00
Alessandro Puccetti b3d1d51603 namespace: ensure to return a valid inaccessible nodes (#3778)
Because /run/systemd/inaccessible/{chr,blk} are devices with
major=0 and minor=0 it might be possible that these devices cannot be created
so we use /run/systemd/inaccessible/sock instead to map them.
2016-07-22 15:59:14 +02:00
Lennart Poettering d82047bef5 update TODO 2016-07-22 15:53:45 +02:00
Lennart Poettering 409093fe10 nss: add new "nss-systemd" NSS module for mapping dynamic users
With this NSS module all dynamic service users will be resolvable via NSS like
any real user.
2016-07-22 15:53:45 +02:00
Lennart Poettering 6f3e79859d core: enforce user/group name validity also when creating transient units 2016-07-22 15:53:45 +02:00
Lennart Poettering 29206d4619 core: add a concept of "dynamic" user ids, that are allocated as long as a service is running
This adds a new boolean setting DynamicUser= to service files. If set, a new
user will be allocated dynamically when the unit is started, and released when
it is stopped. The user ID is allocated from the range 61184..65519. The user
will not be added to /etc/passwd (but an NSS module to be added later should
make it show up in getent passwd).

For now, care should be taken that the service writes no files to disk, since
this might result in files owned by UIDs that might get assigned dynamically to
a different service later on. Later patches will tighten sandboxing in order to
ensure that this cannot happen, except for a few selected directories.

A simple way to test this is:

        systemd-run -p DynamicUser=1 /bin/sleep 99999
2016-07-22 15:53:45 +02:00
Lennart Poettering 66dccd8d85 core: be stricter when parsing User=/Group= fields
Let's verify the validity of the syntax of the user/group names set.
2016-07-22 15:53:45 +02:00
Lennart Poettering e4631b48e1 sysusers: move various user credential validity checks to src/basic/
This way we can reuse them for validating User=/Group= settings in unit files
(to be added in a later commit).

Also, add some tests for them.
2016-07-22 15:53:45 +02:00
Lennart Poettering b3785cd5e6 core: check for overflow when handling scaled MemoryLimit= settings
Just in case...
2016-07-22 15:33:13 +02:00
Harald Hoyer 2424b6bd71 macros.systemd.in: add %systemd_ordering (#3776)
To remove the hard dependency on systemd, for packages, which function
without a running systemd the %systemd_ordering macro can be used to
ensure ordering in the rpm transaction. %systemd_ordering makes sure,
the systemd rpm is installed prior to the package, so the %pre/%post
scripts can execute the systemd parts.

Installing systemd afterwards though, does not result in the same outcome.
2016-07-22 09:33:13 -04:00
Lennart Poettering 79baeeb96d core: change TasksMax= default for system services to 15%
As it turns out 512 is max number of tasks per service is hit by too many
applications, hence let's bump it a bit, and make it relative to the system's
maximum number of PIDs. With this change the new default is 15%. At the
kernel's default pids_max value of 32768 this translates to 4915. At machined's
default TasksMax= setting of 16384 this translates to 2457.

Why 15%? Because it sounds like a round number and is close enough to 4096
which I was going for, i.e. an eight-fold increase over the old 512

Summary:

            | on the host | in a container
old default |         512 |           512
new default |        4915 |          2457
2016-07-22 15:33:13 +02:00
Lennart Poettering c06eec15d5 logind: change TasksMax= value for user logins to 33%
Let's change from a fixed value of 12288 tasks per user to a relative value of
33%, which with the kernel's default of 32768 translates to 10813. This is a
slight decrease of the limit, for no other reason than "33%" sounding like a nice
round number that is close enough to 12288 (which would translate to 37.5%).
(Well, it also has the nice effect of still leaving a bit of room in the PID
space if there are 3 cooperating evil users that try to consume all PIDs...
Also, I like my bikesheds blue).

Since the new value is taken relative, and machined's TasksMax= setting
defaults to 16384, 33% inside of containers is usually equivalent to 5406,
which should still be ample space.

To summarize:

               | on the host | in the container
   old default |       12288 |            12288
   new default |       10813 |             5406
2016-07-22 15:33:13 +02:00
Lennart Poettering 84af7821b6 main: simplify things a bit by moving container check into fixup_environment() 2016-07-22 15:33:12 +02:00
Lennart Poettering f7903e8db6 core: rename MemoryLimitByPhysicalMemory transient property to MemoryLimitScale
That way, we can neatly keep this in line with the new TasksMaxScale= option.

Note that we didn't release a version with MemoryLimitByPhysicalMemory= yet,
hence this change should be unproblematic without breaking API.
2016-07-22 15:33:12 +02:00
Lennart Poettering 83f8e80857 core: support percentage specifications on TasksMax=
This adds support for a TasksMax=40% syntax for specifying values relative to
the system's configured maximum number of processes. This is useful in order to
neatly subdivide the available room for tasks within containers.
2016-07-22 15:33:12 +02:00
Lennart Poettering 487ddeb8bc machine-id-setup: add new --print switch
If specified we'll simply output the used machine ID.
2016-07-22 12:59:36 +02:00
Lennart Poettering 4b1afed01f core: rework machine-id-setup.c to use the calls from id128-util.[ch]
This allows us to delete quite a bit of code and make the whole thing a lot
shorter.
2016-07-22 12:59:36 +02:00
Lennart Poettering 9ca8d43479 sd-id128: handle NULL return parameter in sd_id128_from_string() nicer
If the return parameter is NULL, simply validate the string, and return no
error.
2016-07-22 12:59:36 +02:00
Lennart Poettering e042eab720 main: make sure set_machine_id() doesn't clobber arg_machine_id on failure 2016-07-22 12:59:36 +02:00
Lennart Poettering 15b1248a6b machine-id-setup: port machine_id_commit() to new id128-util.c APIs 2016-07-22 12:59:36 +02:00
Lennart Poettering 317feb4d9f nspawn: rework /etc/machine-id handling
With this change we'll no longer write to /etc/machine-id from nspawn, as that
breaks the --volatile= operation, as it ensures the image is never considered
in "first boot", since that's bound to the pre-existance of /etc/machine-id.

The new logic works like this:

- If /etc/machine-id already exists in the container, it is read by nspawn and
  exposed in "machinectl status" and friends.

- If the file doesn't exist yet, but --uuid= is passed on the nspawn cmdline,
  this UUID is passed in $container_uuid to PID 1, and PID 1 is then expected
  to persist this to /etc/machine-id for future boots (which systemd already
  does).

- If the file doesn#t exist yet, and no --uuid= is passed a random UUID is
  generated and passed via $container_uuid.

The result is that /etc/machine-id is never initialized by nspawn itself, thus
unbreaking the volatile mode. However still the machine ID configured in the
machine always matches nspawn's and thus machined's idea of it.

Fixes: #3611
2016-07-22 12:59:36 +02:00
Lennart Poettering 2a6736ddd0 systemctl: fix format string for uint64_t field 2016-07-22 12:59:36 +02:00
Lennart Poettering 1089dcd469 systemctl: fix output alignment in "systemctl status"
If we show both a control and a main PID for a service fix this line in the
output of "systemctl status":

 Main PID: 19670 (sleep);         : 19671 (sleep)

to become this:

 Main PID: 19670 (sleep); Control PID: 19671 (sleep)
2016-07-22 12:59:36 +02:00
Lennart Poettering 691675ba9f nspawn: rework machine/boot ID handling code to use new calls from id128-util.[ch] 2016-07-22 12:59:36 +02:00
Lennart Poettering 910fd145f4 sd-id128: split UUID file read/write code into new id128-util.[ch]
We currently have code to read and write files containing UUIDs at various
places. Unify this in id128-util.[ch], and move some other stuff there too.

The new files are located in src/libsystemd/sd-id128/ (instead of src/shared/),
because they are actually the backend of sd_id128_get_machine() and
sd_id128_get_boot().

In follow-up patches we can use this reduce the code in nspawn and
machine-id-setup by adopted the common implementation.
2016-07-22 12:59:36 +02:00
Lennart Poettering 3bbaff3e08 tree-wide: use sd_id128_is_null() instead of sd_id128_equal where appropriate
It's a bit easier to read because shorter. Also, most likely a tiny bit faster.
2016-07-22 12:38:08 +02:00
Martin Pitt bf3dd08a81 Merge pull request #3762 from poettering/sigkill-log
log about all processes we forcibly kill
2016-07-22 09:18:30 +02:00
Martin Pitt 5c3c778014 Merge pull request #3764 from poettering/assorted-stuff-2
Assorted fixes
2016-07-22 09:10:04 +02:00
Alessandro Puccetti 31d28eabc1 nspawn: enable major=0/minor=0 devices inside the container (#3773)
https://github.com/systemd/systemd/pull/3685 introduced
/run/systemd/inaccessible/{chr,blk} to map inacessible devices,
this patch allows systemd running inside a nspawn container to create
/run/systemd/inaccessible/{chr,blk}.
2016-07-21 17:39:38 +02:00
Alessio Igor Bogani 4d07c8d386 missing_syscall: add __NR_copy_file_range for powerpc architecture (#3772) 2016-07-21 11:40:35 +02:00
Lennart Poettering 7ba25ab561 gpt-generator: relax EFI check a bit
Previously, we'd not mount the ESP except on EFI boots, and only when the ESP
used for booting matches the ESP we found.

With this change on non-EFI boots we'll mount a discovered ESP anyway, and on
EFI boots we'll only mount it if it matches the ESP we booted from.
2016-07-21 11:37:59 +02:00
Lennart Poettering 5b8411a2aa kernel-install: when searching for location to place kernel consider /efi
With this change kernel-install will now first look for an existing kernel
installation in /efi, /boot and /boot/efi. If none is found, /efi is used if it
is a mount point, otherwise /boot/efi if it is one. If nothing of that worked
/boot is used without further checking.

This means /boot should be the default unless something was installed before or
something else was explicitly mounted.
2016-07-21 11:37:59 +02:00
Lennart Poettering d5ff6d6d34 bootctl: modernize install_loader_config()
let's the proper APIs to read the machine ID, and properly check for all
errors.
2016-07-21 11:37:59 +02:00
Lennart Poettering f939cff715 bootctl: various coding style updates 2016-07-21 11:37:58 +02:00
Lennart Poettering db6d9faeb0 bootctl: clean up get_file_version()
Make sure that we always initialize the return parameter on success, and that
all errors result in an error message, not just some.
2016-07-21 11:37:58 +02:00
Lennart Poettering 5fa6c13c7b bootctl: use F_TYPE_EQUAL() to compare statfs' .f_type field
After all, the field is kinda borked.
2016-07-21 11:37:58 +02:00
Lennart Poettering 846b8fc30d bootctl: move toupper() implementation to string-util.h
We already have tolower() calls there, hence let's unify this at one place.
Also, update the code to only use ASCII operations, so that we don't end up
being locale dependant.
2016-07-21 11:37:58 +02:00
Lennart Poettering fdc1af0a8a man: add missing whitespace to bootctl command lines 2016-07-21 11:37:58 +02:00
Lennart Poettering 617eec3452 man: use <filename> in bootctl man page where appropriate 2016-07-21 11:37:58 +02:00