Commit Graph

790 Commits

Author SHA1 Message Date
Lennart Poettering 49d7fc99b9 units: explicitly require /var, /tmp and /var/tmp to be mounted before basic.target
We support /var, /tmp and /var/tmp on NFS. NFS shares however are by
default ordered only before remote-fs.target which is a late-boot
service. /var, /tmp, /var/tmp need to be around earlier though, hence
explicitly order them before basic.target.

Note that this change simply makes explicit what was implicit before,
since many early-boot services pulled in parts of /var anyway early.
2015-04-03 14:32:32 +02:00
Lennart Poettering efb3e19be9 units: explicitly order systemd-user-sessions.service after nss-user-lookup.target
We should not allow logins before NIS/LDAP users are available.
2015-04-03 14:31:35 +02:00
Lennart Poettering d8f0930eec units: move After=systemd-hwdb-update.service dependency from udev to udev-trigger
Let's move the hwdb regeneration a bit later. Given that hwdb is
non-essential it should be OK to allow udev to run without it until we
do the full trigger.

http://lists.freedesktop.org/archives/systemd-devel/2015-April/030074.html
2015-04-03 14:27:16 +02:00
Dimitri John Ledkov defa8e675b resolved: Do not add .busname dependencies, when compiling without kdbus. 2015-03-19 17:27:39 +01:00
Jan Pazdziora 1b41981d9a console-getty.service: don't start when /dev/console is missing
Create minimal image which runs systemd

   FROM rhel7.1
   RUN yum install -y /usr/bin/ps
   ENV container docker
   CMD [ "/usr/sbin/init" ]

When you run the container without -t, the process

   /sbin/agetty --noclear --keep-baud console 115200 38400 9600

is not happy and checking the journal in the container, there is a stream of

Mar 13 04:50:15 11bf07f59fff agetty[66]: /dev/console: No such file or directory
Mar 13 04:50:25 11bf07f59fff systemd[1]: console-getty.service holdoff time over, scheduling restart.
Mar 13 04:50:25 11bf07f59fff systemd[1]: Stopping Console Getty...
Mar 13 04:50:25 11bf07f59fff systemd[1]: Starting Console Getty...
Mar 13 04:50:25 11bf07f59fff systemd[1]: Started Console Getty.
Mar 13 04:50:25 11bf07f59fff agetty[67]: /dev/console: No such file or directory
Mar 13 04:50:35 11bf07f59fff systemd[1]: console-getty.service holdoff time over, scheduling restart.
Mar 13 04:50:35 11bf07f59fff systemd[1]: Stopping Console Getty...
Mar 13 04:50:35 11bf07f59fff systemd[1]: Starting Console Getty...
Mar 13 04:50:35 11bf07f59fff systemd[1]: Started Console Getty.
Mar 13 04:50:35 11bf07f59fff agetty[74]: /dev/console: No such file or directory
Mar 13 04:50:45 11bf07f59fff systemd[1]: console-getty.service holdoff time over, scheduling restart.
Mar 13 04:50:45 11bf07f59fff systemd[1]: Stopping Console Getty...
Mar 13 04:50:45 11bf07f59fff systemd[1]: Starting Console Getty...
2015-03-17 12:40:56 +01:00
Kay Sievers 4b16233e59 timesyncd: enable timesyncd in virtual machines
On Fri, Mar 13, 2015 at 8:25 PM, Michael Marineau <michael.marineau@coreos.com> wrote:
> Currently systemd-timesyncd.service includes
> ConditionVirtualization=no, disabling it in both containers and
> virtual machines. Each VM platform tends to deal with or ignore the
> time problem in their own special ways, KVM/QEMU has the kernel time
> source kvm-clock, Xen has had different schemes over the years, VMware
> expects a userspace daemon sync the clock, and other platforms are
> content to drift with the wind as far as I can tell.
>
> I don't know of a robust way to know if a platform needs a little
> extra help from userspace to keep the clock sane or not but it seems
> generally safer to try than to risk drifting. Does anyone know of a
> reason to leave timesyncd off by default? Otherwise switching to
> ConditionVirtualization=!container should be reasonable.
2015-03-15 19:44:59 +01:00
Zbigniew Jędrzejewski-Szmek d99ce93383 units: there is no systemd-udev-hwdb-update.service 2015-03-14 23:03:21 -04:00
Lennart Poettering 35682f425f fsckd: make sure unprivileged clients cannot play games with fsckd 2015-03-09 19:38:23 +01:00
Lennart Poettering 4f3c168202 units: add missing unit file 2015-02-24 18:46:49 +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
Didier Roche a80170f55c Add man page and references to it.
Add man page explaining the plymouth theme protocol, usage of the daemon
as well as the socket activation part.
Adapt existing fsck man page.
2015-02-18 16:33:46 +01:00
Didier Roche 66f2ff06ca Add fsckd service and socket, retarget systemd-fsck
systemd-fsckd can be socket-activated by systemd-fsck process. Reflect that
in the different unit files.
2015-02-18 16:33:46 +01:00
Lennart Poettering 90adaa25e8 machined: move logic for bind mounting into containers from machinectl to machined
This extends the bus interface, adding BindMountMachine() for bind
mounting directories from the host into the container.
2015-02-17 17:49:21 +01:00
Lennart Poettering 7d5fed66a6 units: turn on --network-veth by default for systemd-nspawn@.service
Given the recent improvements in networkd, it's probably the better
default now.
2015-02-13 14:35:50 +01:00
Lennart Poettering 93391a8bad units: fix systemd-networkd.service in containers lacking CAP_NET_ADMIN 2015-02-13 14:30:05 +01:00
Lennart Poettering a24111cea6 Revert "units: add SecureBits"
This reverts commit 6a716208b3.

Apparently this doesn't work.

http://lists.freedesktop.org/archives/systemd-devel/2015-February/028212.html
2015-02-11 18:28:06 +01:00
Topi Miettinen 6a716208b3 units: add SecureBits
No setuid programs are expected to be executed, so add
SecureBits=noroot noroot-locked
to unit files.
2015-02-11 17:33:36 +01:00
Tom Gundersen 30ae637af3 units: networkd - fix busname to work on kdbus 2015-02-06 12:12:13 +01:00
Tom Gundersen a97dcc12e4 networkd: exit on idle
We will be woken up on rtnl or dbus activity, so let's just quit if some time has passed and that is the only thing that can happen.

Note that we will always stay around if we expect network activity (e.g. DHCP is enabled), as we are not restarted on that.
2015-02-05 12:04:19 +01:00
Tom Gundersen e331e24649 networkd: add basic dbus API
Only the very basics, more to come.

For now:

$ busctl tree org.freedesktop.network1
└─/org/freedesktop/network1
  └─/org/freedesktop/network1/link
    ├─/org/freedesktop/network1/link/1
    ├─/org/freedesktop/network1/link/2
    ├─/org/freedesktop/network1/link/3
    ├─/org/freedesktop/network1/link/4
    ├─/org/freedesktop/network1/link/5
    ├─/org/freedesktop/network1/link/6
    ├─/org/freedesktop/network1/link/7
    ├─/org/freedesktop/network1/link/8
    └─/org/freedesktop/network1/link/9

$ busctl introspect org.freedesktop.network1 /org/freedesktop/network1
NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.network1.Manager    interface -         -            -
.OperationalState                   property  s         "carrier" emits-change

$ busctl introspect org.freedesktop.network1 /org/freedesktop/network1/link/1
NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS
org.freedesktop.network1.Link       interface -         -            -
.AdministrativeState                property  s         "unmanaged" emits-change
.OperationalState                   property  s         "carrier" emits-change
2015-02-05 11:50:34 +01:00
Lennart Poettering 75f709fbf2 units: so far we defaulted to 90s as default timeout for most things, let's do so for our oneshot services too
Fewer surprises, and stuff...
2015-02-02 21:34:32 +01:00
Tom Gundersen 5544ee8516 networkd: support socket activation
Still keep the non-socket activation code around for starting from the commandline, but
will likely drop that too in the future.
2015-02-02 11:57:52 +01:00
Zbigniew Jędrzejewski-Szmek 0775b9b611 units: set TimeoutSec on some oneshot services
Services which are not crucial to system bootup, and have Type=oneshot
can effectively "hang" the system if they fail to complete for whatever
reason. To allow the boot to continue, kill them after a timeout.

In case of systemd-journal-flush the flush will continue in the background,
and in the other two cases the job will be aborted, but this should not
result in any permanent problem.
2015-02-01 12:44:03 -05:00
Lennart Poettering 0ef403877a units: turn on watchdog for resolved 2015-01-27 14:31:44 +01:00
Lennart Poettering e87bc3ef67 units: fix all TTY paths for container gettys
Spotted by Christian Seiler:

http://lists.freedesktop.org/archives/systemd-devel/2015-January/027441.html
2015-01-27 14:31:44 +01:00
Cristian Rodríguez 66b0e0e0e3 build-sys: lookup for sulogin, it might not be in /sbin 2015-01-23 19:09:37 +01:00
Lennart Poettering e57565dd5b importd: run daemon at minimal capabilities 2015-01-22 18:55:08 +01:00
Lennart Poettering 3d7415f43f import: introduce new mini-daemon systemd-importd, and make machinectl a client to it
The old "systemd-import" binary is now an internal tool. We still use it
as asynchronous backend for systemd-importd. Since the import tool might
require some IO and CPU resources (due to qcow2 explosion, and
decompression), and because we might want to run it with more minimal
priviliges we still keep it around as the worker binary to execute as
child process of importd.

machinectl now has verbs for pulling down images, cancelling them and
listing them.
2015-01-22 04:02:07 +01:00
David Herrmann a8a1a43f48 bus-proxy: turn into multi-threaded daemon
Instead of using Accept=true and running one proxy for each connection, we
now run one proxy-daemon with a thread per connection. This will enable us
to share resources like policies in the future.
2015-01-17 14:00:19 +01:00
Lennart Poettering de45d72603 journal: bump RLIMIT_NOFILE when journal files to 16K (if possible)
When there are a lot of split out journal files, we might run out of fds
quicker then we want. Hence: bump RLIMIT_NOFILE to 16K if possible.

Do these even for journalctl. On Fedora the soft RLIMIT_NOFILE is at 1K,
the hard at 4K by default for normal user processes, this code hence
bumps this up for users to 4K.

https://bugzilla.redhat.com/show_bug.cgi?id=1179980
2015-01-08 03:20:45 +01:00
Lennart Poettering 78ad7cf1b9 units: make resolved pull in its own .busname unit, but only on kdbus systems
The daemon requires the busname unit to operate, since it contains the
policy that allows it to acquire its service name.
2015-01-07 23:44:08 +01:00
Lennart Poettering 1535ef321f units: improve Description= for systemd's own busname unit 2015-01-07 23:44:08 +01:00
Lennart Poettering 13790add4b journald: allow restarting journald without losing stream connections
Making use of the fd storage capability of the previous commit, allow
restarting journald by serilizing stream state to /run, and pushing open
fds to PID 1.
2015-01-06 03:16:39 +01:00
Lennart Poettering 6a140df004 units: rework systemd-nspawn@.service unit
- Unescape instance name so that we can take almost anything as instance
  name.

- Introduce "machines.target" which consists of all enabled nspawns and
  can be used to start/stop them altogether

- Look for container directory using -M instead of harcoding the path in
  /var/lib/container
2014-12-29 17:00:05 +01:00
Lennart Poettering 8fa844dccf units: make graphical.target dependencies more complete and similar to those of multi-user.target 2014-12-29 17:00:05 +01:00
Lennart Poettering cd61c3bfd7 machined/machinectl: add logic to show list of available images
This adds a new bus call to machined that enumerates /var/lib/container
and returns all trees stored in it, distuingishing three types:

        - GPT disk images, which are files suffixed with ".gpt"
        - directory trees
        - btrfs subvolumes
2014-12-19 19:19:29 +01:00
Tom Gundersen 65eb4378c3 systemd-hwdb: introduce new tool
This pulls out the hwdb managment from udevadm into an independent tool.

The old code is left in place for backwards compatibility, and easy of
testing, but all documentation is dropped to encourage use of the new
tool instead.
2014-12-18 15:37:27 +01:00
Mantas Mikulėnas cf5a899751 build-sys: remove commented-out m4 from user@.service
Otherwise this actually remains in the generated unit in /usr/lib.

If you want to keep it commented out, a m4-compatible way would be:

    m4_ifdef(`HAVE_SMACK',
    dnl Capabilities=cap_mac_admin=i
    dnl SecureBits=keep-caps
    )
2014-12-14 12:54:16 -05:00
Lennart Poettering 1f3ba2bb4f build-sys: turn off SMACK capabilities stuff for now, since it is incompatible with nspawn 2014-12-10 22:14:19 +01:00
Lennart Poettering 795bc7e791 gitignore: hide some more files 2014-12-10 00:49:35 +01:00
Przemyslaw Kedzierski dd5ae4c36c bus-proxy: cloning smack label
When dbus client connects to systemd-bus-proxyd through
Unix domain socket proxy takes client's smack label and sets for itself.

It is done before and independent of dropping privileges.

The reason of such soluton is fact that tests of access rights
performed by lsm may take place inside kernel, not only
in userspace of recipient of message.

The bus-proxyd needs CAP_MAC_ADMIN to manipulate its label.

In case of systemd running in system mode, CAP_MAC_ADMIN
should be added to CapabilityBoundingSet in service file of bus-proxyd.

In case of systemd running in user mode ('systemd --user')
it can be achieved by addition
Capabilities=cap_mac_admin=i and SecureBits=keep-caps
to user@.service file
and setting cap_mac_admin+ei on bus-proxyd binary.
2014-12-09 18:23:24 +01:00
Lennart Poettering 68ac53e62f units: make sure container-getty@.service stops restarting when the pts device it is bound to is gone
We only want to restart the getty as long as the pts device is still
around. As soon as it is gone, the service should be removed to.

http://lists.freedesktop.org/archives/systemd-devel/2014-December/026048.html
2014-12-09 02:12:11 +01:00
WaLyong Cho c18c2a0ea1 gitignore: ignore generated systemd-bootchart.service 2014-12-04 20:43:28 +01:00
Michal Sekletar fe0b9cd3ba units: skip mounting /dev/hugepages if we don't have CAP_SYS_ADMIN
Preparation for allowing systemd to run gracefully in containers lacking
CAP_SYS_ADMIN.
2014-12-04 02:43:02 +01:00
WaLyong Cho da64a1fc41 bootchart: add standalone bootchart service 2014-12-04 01:55:01 +01:00
Didier Roche a1405db67c machine-id-commit: add unit file
The unit file only active the machine-id-commit helper if /etc is mounted
writable and /etc/machine-id is an independant mount point (should be a tmpfs).
2014-12-03 03:41:19 +01:00
Lennart Poettering 92ac127007 rc-local: drop SysVStartPriority= field which is now obsolete 2014-12-02 13:23:04 +01:00
Lennart Poettering 2e43ad9ca6 bus-proxy: automatically detect scope of bus and derive which XML snippets to load from that 2014-11-28 16:18:17 +01:00
Martin Pitt 574edc9006 nspawn: Add try-{host,guest} journal link modes
--link-journal={host,guest} fail if the host does not have persistent
journalling enabled and /var/log/journal/ does not exist. Even worse, as there
is no stdout/err any more, there is no error message to point that out.

Introduce two new modes "try-host" and "try-guest" which don't fail in this
case, and instead just silently skip the guest journal setup.

Change -j to mean "try-guest" instead of "guest", and fix the wrong --help
output for it (it said "host" before).

Change systemd-nspawn@.service.in to use "try-guest" so that this unit works
with both persistent and non-persistent journals on the host without failing.

https://bugs.debian.org/770275
2014-11-21 14:27:26 +01:00
Lennart Poettering 812bd1e6ab units: make sure rfkill service is bount to the actual hardware 2014-11-21 01:20:57 +01:00