Commit graph

10670 commits

Author SHA1 Message Date
Lennart Poettering 160e3793ad machined/machinectl: when "machinectl image-status" is used without arguments show statistics about pool 2015-02-24 18:46:49 +01:00
Cristian Rodríguez 3f7f1fad76 shared: fix wrong assertion in barrier_set_role()
assert(b->pipe[0] >= 0 && b->pipe[0] >= 0);

Test the same condition twice, pretty sure we mean

 assert(b->pipe[0] >= 0 && b->pipe[1] >= 0);
2015-02-24 18:30:59 +01:00
Lennart Poettering 72c3897f77 machined: actually open up methods to unprivileged clients on dbus1
Many of machined's operations are now opened up to unprivileged clients
via PolicyKit. Open up the dbus policy so that we can actually make
these calls.

kdbus doesn't reuqire this, hence this wasn't noticed before.
2015-02-24 17:27:53 +01:00
Lennart Poettering 113b3fc1a8 importd: create a loopback btrfs file system for /var/lib/machines, if necessary
When manipulating container and VM images we need efficient and atomic
directory snapshots and file copies, as well as disk quota. btrfs
provides this, legacy file systems do not. Hence, implicitly create a
loopback file system in /var/lib/machines.raw and mount it to
/var/lib/machines, if that directory is not on btrfs anyway.

This is done implicitly and transparently the first time the user
invokes "machinectl import-xyz".

This allows us to take benefit of btrfs features for container
management without actually having the rest of the system use btrfs.

The loopback is sized 500M initially. Patches to grow it dynamically are
to follow.
2015-02-24 17:27:53 +01:00
Lennart Poettering 15e80c7b75 id128: add new sd_id128_is_null() call 2015-02-24 17:27:53 +01:00
Lennart Poettering ce06fdfb3d import: print nice warning if we need btrfs but /var/lib/machines is not btrfs 2015-02-24 17:27:53 +01:00
Daniel Mack 4b3eff6164 test-hashmap: fix gcc5 warning
gcc5 spits out a warning about test-hashmap.c:

  CC       src/test/test-hashmap.o
src/test/test-hashmap.c: In function ‘test_string_compare_func’:
src/test/test-hashmap.c:76:79: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
2015-02-24 16:26:30 +01:00
Daniel Mack f9bf3e260c shared/unit-name: fix gcc5 warning
Fix the following gcc5 warning:

  CC       src/shared/libsystemd_shared_la-unit-name.lo
src/shared/unit-name.c: In function 'unit_name_is_valid':
src/shared/unit-name.c:102:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
                 if (!template_ok == TEMPLATE_VALID && at+1 == e)
                                  ^
2015-02-24 16:26:30 +01:00
Zbigniew Jędrzejewski-Szmek 95d383ee47 systemctl: bump NOFILE only for systemctl_main
It is not necessary when running as telinit, etc.

https://bugzilla.redhat.com/show_bug.cgi?id=1184712
2015-02-24 10:11:06 -05:00
Martin Pitt a804d849b3 bootchart: fix default init path
Commit 6e1bf7ab99 used the wrong directory; we need rootlibexecdir, not
rootlibdir, as the latter is something like /lib/x86_64-linux-gnu/ on
multi-arch systems.

https://launchpad.net/bugs/1423867
2015-02-24 14:31:45 +01:00
Daniel Mack def3f524a1 sd-bus: test-bus-kernel-benchmark: don't rely on fixed unique names
The kernel part of kdbus does not allow userspace to make any assumption on
which unique address the first user on the bus will get.

Instead, use sd_bus_get_unique_name() to get the server's address.
2015-02-24 14:01:36 +01:00
Daniel Mack fdd30a1530 test-time: test "infinity" parsing in nanoseconds 2015-02-24 13:27:10 +01:00
Daniel Mack 8e8933ca0f shared/time-util: fix gcc5 warning
CC       src/shared/libsystemd_shared_la-time-util.lo
src/shared/time-util.c: In function 'parse_nsec':
src/shared/time-util.c:789:25: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
                 if (!*s != 0)
                         ^
2015-02-24 13:26:47 +01:00
Daniel Mack 6ad4a4fc43 sd-bus: sync kdbus.h
Follow two small changes in the kdbus API:

 * Flags are now returned in cmd->return_flags by KDBUS_CMD_NAME_ACQUIRE

 * struct kdbus_item_list has been dropped. The information stored in
   this struct was redundant since awhile already, as all commands
   report their returned slice size anyway.
2015-02-24 12:10:13 +01:00
Zbigniew Jędrzejewski-Szmek 8527b07be1 systemctl: support auditd.service better
We would print the filename header before trying to open the file. But since
the header was printed to stdout, and the error to stderr, the error would appear
on the terminal before the header. It is cleaner to open the file first, then
and only then print the header.

Also exit on first error. We shouldn't report success if we were unable to open
a file.
2015-02-23 23:38:31 -05:00
Zbigniew Jędrzejewski-Szmek d028e01814 systemctl: check validity of PID we received 2015-02-23 23:38:30 -05:00
Zbigniew Jędrzejewski-Szmek 657dbed29a resolved: use == for comparing unsigned against zero 2015-02-23 23:38:30 -05:00
Zbigniew Jędrzejewski-Szmek 1c73f3bc29 tmpfiles: avoid creating duplicate acl entries
https://bugs.freedesktop.org/show_bug.cgi?id=89202
https://bugs.debian.org/778656

Status quo ante can be restored with:
  getfacl -p /var/log/journal/`cat /etc/machine-id`|grep -v '^#'|sort -u|sudo setfacl --set-file=- /var/log/journal/`cat /etc/machine-id`
2015-02-23 23:34:06 -05:00
Zbigniew Jędrzejewski-Szmek e410b07d2a libsystemd: revert one hunk of duplicate ifdef removal
This change exposed a bug in kernel headers:

/usr/include/linux/if_bridge.h:184:20: error: field 'ip6' has incomplete type
    struct in6_addr ip6;
                    ^
/usr/include/linux/if_tunnel.h:76:19: error: field 'prefix' has incomplete type
  struct in6_addr  prefix;
                   ^
2015-02-23 20:08:05 -05:00
Daniel Mack 2c35d880de sd-bus, shared: fix includes
Include <sys/socket.h> from util.h and bus-message.h in order to
build errors like the ones below on kdbus enabled systems.

./src/shared/util.h:976:32: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from src/libsystemd/sd-bus/bus-kernel.c:37:0:
./src/shared/util.h:1081:28: warning: 'struct msghdr' declared inside parameter list
 void cmsg_close_all(struct msghdr *mh);
                            ^
  CC       src/libsystemd/sd-bus/libsystemd_la-bus-creds.lo
In file included from src/libsystemd/sd-bus/bus-creds.c:25:0:
./src/shared/util.h:976:32: warning: 'struct ucred' declared inside parameter list
 int getpeercred(int fd, struct ucred *ucred);
                                ^
2015-02-24 00:42:13 +01:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Jan Synacek 4aab5d0cbd nspawn: fix whitespace and typo in partition table blurb 2015-02-23 15:26:58 +01:00
Piotr Drąg 6be9b36068 logind: fix a typo in a polkit description 2015-02-21 14:02:23 +01:00
Kay Sievers 11d63aea3a build-sys: update gitignore 2015-02-20 15:42:32 +01:00
Michal Schmidt 710708a54c shared: handle unnamed sockets in socket_address_equal()
Make sure we don't inspect sun_path of unnamed sockets.
Since we cannot know if two unnamed sockets' adresses refer to the same
socket, just return false.
2015-02-20 03:35:12 +01:00
Michal Schmidt 02233928a5 shared: avoid semi-duplicating socket_address_equal()
Just call socket_address_equal() from socket_address_matches_fd()
instead of implementing similar comparing of addresses.
2015-02-20 03:35:11 +01:00
Michal Schmidt dbafedacba shared: use SocketAddress in socket_address_matches_fd()
Cleanup. No behavior change.
2015-02-20 03:35:11 +01:00
Michal Schmidt c78e47a61f core, shared: in deserializing, match same files reached via different paths
When dbus.socket is updated like this:
-ListenStream=/var/run/dbus/system_bus_socket
+ListenStream=/run/dbus/system_bus_socket
... and daemon-reload is performed, bad things happen.
During deserialization systemd does not recognize that the two paths
refer to the same named socket and replaces the socket file with a new
one. As a result, applications hang when they try talking to dbus.

Fix this by finding a match not only when the path names are equal, but
also when they point to the same inode.
In socket_address_equal() it is necessary to move the address size
comparison into the abstract sockets branch. For path name sockets the
comparison must not be done and for other families it is redundant
(their sizes are constant and checked by socket_address_verify()).

FIFOs and special files can also have multiple pathnames, so compare the
inodes for them as well. Note that previously the pathname checks used
streq_ptr(), but the paths cannot be NULL.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1186018
2015-02-20 03:35:04 +01:00
David Herrmann 00d053d3ca bus: sync with kdbus.git (ABI break)
This syncs up the new KDBUS_CMD_CONN_INFO behavior:
 - attach-flags are passed in .attach_flags, instead of directly merged
   with the command flags.
2015-02-19 20:02:40 +01:00
Lennart Poettering 6278cf6048 nspawn: chown basic device nodes to userns root 2015-02-19 12:03:39 +01:00
Lennart Poettering d15d65a01f nspawn: fix build on non-selinux systems 2015-02-19 12:03:12 +01:00
Lennart Poettering 6dac160c0a nspawn: add basic user namespacing support
(This is incomplete, /proc and /sys are still owned by root from outside
the container, not inside)
2015-02-19 11:31:08 +01:00
Martin Pitt 4e5589836c sysv-generator: fix wrong "Overwriting existing symlink" warnings
Fix result testing of is_symlink() to ignore negative results, which happen if
the file name does not exist at all. In this case we do not want a warning and
unlink the non-existing link.

https://bugs.debian.org/778700
2015-02-19 11:06:24 +01:00
Lennart Poettering 9c857b9d16 nspawn: when connected to pipes for stdin/stdout, pass them as-is to PID 1
Previously we always invoked the container PID 1 on /dev/console of the
container. With this change we do so only if nspawn was invoked
interactively (i.e. its stdin/stdout was connected to a TTY). In all other
cases we directly pass through the fds unmodified.

This has the benefit that nspawn can be added into shell pipelines.

https://bugs.freedesktop.org/show_bug.cgi?id=87732
2015-02-18 23:36:20 +01:00
Thomas Hindoe Paaboel Andersen 04155c6713 systemd-boot: fix alignment of version in table 2015-02-18 22:19:17 +01:00
Lennart Poettering d5d8429a12 everywhere: remove configurability of sysv runlevel to target mapping
With this change runlevel 2, 3, 4 are mapped to multi-user.target for
good, and 5 to graphical.target. This was already the previous mapping
but is now no longer reconfigurable, but hard-coded into the core.

This should generally simplify things, but also fix one bug: the
sysv-generator previously generated symlinks to runlevel[2-5].target
units, which possibly weren't picked up if these aliases were otherwise
only referenced by the real names "multi-user.target" and
"graphical.target".

We keep compat aliases "runlevel[2345].target" arround for cases where
this target name is explicitly requested.
2015-02-18 20:20:14 +01:00
Lennart Poettering 8962620e5e run: if we fail to set a property assignment then really fail 2015-02-18 19:42:25 +01:00
Lennart Poettering f36933fef6 nspawn: add support for --property= to set scope properties
This is similar to systemd-run's --property= setting.
2015-02-18 19:42:24 +01:00
Lennart Poettering 1c8da04446 shared: introduce cmsg_close_all() call
The call iterates through cmsg list and closes all fds passed via
SCM_RIGHTS.

This patch also ensures the call is used wherever appropriate, where we
might get spurious fds sent and we should better close them, then leave
them lying around.
2015-02-18 19:42:24 +01:00
Lennart Poettering 6e646d22f6 systemctl: allow interactive authorization for all bus calls
Make use of the new sd_bus_set_allow_interactive_authorization() call to
globally enable interactive authorization. Also, turn on PK agent for
more calls.

This allows us to make use of the sd_bus_call_method() convencience
helper at more places.
2015-02-18 18:56:27 +01:00
Lennart Poettering 1cfa9a4cbb systemctl: let's make use of FOREACH_STRING() where we can 2015-02-18 18:56:27 +01:00
Lennart Poettering 1d22e9068c core: rework policykit hookup
- Always issue selinux access check as early as possible, and PK check
  as late as possible.

- Introduce a new policykit action for altering environment

- Open most remaining bus calls to unprivileged clients via PK
2015-02-18 18:56:27 +01:00
Didier Roche b0d9246486 Translate fsckd messages for plymouth
For plymouth themes not supporting i18n (like .script), send translated
messages to display to user, which is equivalent to the sent machine
readable data.
2015-02-18 16:33:46 +01:00
Didier Roche 20f56fddcd Add gettext support 2015-02-18 16:33:46 +01:00
Didier Roche 07f9a21b6d Connect to plymouth and support cancellation of in progress fsck
Try to connect and send to plymouth (if running) some checked report progress,
using direct plymouth protocole.

Update message is the following:
fsckd:<num_devices>:<progress>:<string>
* num_devices corresponds to the current number of devices being checked (int)
* progress corresponds to the current minimum percentage of all devices being
  checked (float, from 0 to 100)
* string is a translated message ready to be displayed by the plymouth theme
  displaying the information above. It can be overriden by plymouth themes
  supporting i18n.

Grab in fsckd plymouth watch key Control+C, and propagate this cancel request
to systemd-fsck which will terminate fsck.

Send a message to signal to user what key we are grabbing for fsck cancel.

Message is: fsckd-cancel-msg:<string>
Where string is a translated string ready to be displayed by the plymouth theme
indicating that Control+C can be used to cancel current checks. It can be
overriden (matching only fsckd-cancel-msg prefix) for themes supporting i18n.
2015-02-18 16:33:46 +01:00
Didier Roche 19e887e709 systemd-fsck: always connect to systemd-fsckd
Remove the plymouth running or show-status checks from systemd-fsck. Instead,
always connect to systemd-fsckd socket, and let this one decide if we display
progress or not.
2015-02-18 16:33:46 +01:00
Didier Roche ac6e2f0dfc fsckd daemon for inter-fsckd communication
Add systemd-fsckd multiplexer which accepts multiple systemd-fsck
instances to connect to it and sends progress report. systemd-fsckd then
computes and writes to /dev/console the number of devices currently being
checked and the minimum fsck progress. This will be used for interactive
progress report and cancelling in plymouth.

systemd-fsckd stops on idle when no systemd-fsck is connected.

Make the necessary changes to systemd-fsck to connect to the systemd-fsckd
socket.
2015-02-18 16:33:46 +01:00
Tom Gundersen 502184de0f test: utf8 - fix utf16 tests on BE machines 2015-02-18 15:23:23 +01:00
Tom Gundersen e7dd673d1e gummiboot/sd-boot/systemd-boot: rename galore
What used to be gummiboot, was renamed sd-boot when it was merged into
systemd. Let's try to be a bit more consistent with the rest of systemd
and rename it again as follows:

The EFI bootloader is now called 'systemd-bootx64.efi', and its sources are in
'src/boot/efi/'. The drop-in directory where bootctl will find EFI loaders
is now /usr/lib/systemd/boot/efi/.
2015-02-18 15:23:23 +01:00
Lennart Poettering c529695e7a logind: open up most bus calls for unpriviliged processes, using PolicyKit
Also, allow clients to alter their own objects without any further
priviliges. i.e. this allows clients to kill and lock their own sessions
without involving PK.
2015-02-18 12:55:25 +01:00