Commit Graph

11 Commits

Author SHA1 Message Date
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Lennart Poettering b89f5f7b03 units: downgrade Requires= to Wants=
Combining Requires= with Before= doesn't really make sense, since this
means we are requiring something that runs after us, which logically
cannot be fulfilled.

Let's hence downgrade Requires= to Wants= so that the ordering is kept
but no failure propagation implied.
2020-07-29 16:32:45 +02:00
Lennart Poettering 78490efca3 units: upgrade initrd check Conditions to Asserts
It's a bug if an initrd unit is run on the host. Hence let's upgrade the
conditions to asserts.
2020-07-29 16:32:03 +02:00
Franck Bui e2c7c94ea3 units: make sure initrd-cleanup.service terminates before switching to rootfs
A follow-up for commit a8cb1dc3e0.

Commit a8cb1dc3e0 made sure that initrd-cleanup.service won't be stopped
when initrd-switch-root.target is isolated.

However even with this change, it might happen that initrd-cleanup.service
survives the switch to rootfs (since it has no ordering constraints against
initrd-switch-root.target) and is stopped right after when default.target is
isolated. This led to initrd-cleanup.service entering in failed state as it
happens when oneshot services are stopped.

This patch along with a8cb1dc3e0 should fix issue #4343.

Fixes: #4343
2019-01-28 13:41:28 +01:00
Zbigniew Jędrzejewski-Szmek a7df2d1e43 Add SPDX license headers to unit files 2017-11-19 19:08:15 +01:00
Yu Watanabe a8cb1dc3e0 units: add Wants=initrd-cleanup.service to initrd-switch-root.target (#4345)
`systemctl isolate initrd-switch-root.target` called by initrd-cleanup.service
kills initrd-cleanup.service itself. Then, initrd-cleanup.service failed and
system goes to emergency shell.
To prevent this problem, this commit adds `Wants=initrd-cleanup.service` to
initrd-switch-root.target.

fixes: #4343.
2016-10-11 14:36:14 +02:00
Harald Hoyer 9e5f0f9291 Make initrd.target the default target in the initrd
First, rename root-fs.target to initrd-root-fs.target to clarify its usage.

Mount units with "x-initrd-rootfs.mount" are now ordered before
initrd-root-fs.target. As we sometimes construct /sysroot mounts in
/etc/fstab in the initrd, we want these to be mounted before the
initrd-root-fs.target is active.

initrd.target can be the default target in the initrd.

                             (normal startup)
                                    :
                                    :
                                    v
                              basic.target
                                    |
             ______________________/|
            /                       |
            |                  sysroot.mount
            |                       |
            |                       v
            |             initrd-root-fs.target
            |                       |
            |                       v
            |            initrd-parse-etc.service
(custom initrd services)            |
            |                       v
            |            (sysroot-usr.mount and
            |             various mounts marked
            |               with fstab option
            |                x-initrd.mount)
            |                       |
            |                       v
            |                initrd-fs.target
            |                       |
            \______________________ |
                                   \|
                                    v
                               initrd.target
                                    |
                                    v
                          initrd-cleanup.service
                               isolates to
                         initrd-switch-root.target
                                    |
                                    v
             ______________________/|
            /                       |
            |        initrd-udevadm-cleanup-db.service
            |                       |
(custom initrd services)            |
            |                       |
            \______________________ |
                                   \|
                                    v
                        initrd-switch-root.target
                                    |
                                    v
                        initrd-switch-root.service
                                    |
                                    v
                               switch-root
2013-03-15 00:49:37 +01:00
Harald Hoyer 700e07ffd5 add initrd-fs.target and root-fs.target
Instead of using local-fs*.target in the initrd, use root-fs.target for
sysroot.mount and initrd-fs.target for /sysroot/usr and friends.

Using local-fs.target would mean to carry over the activated
local-fs.target to the isolated initrd-switch-root.target and thus in
the real root. Having local-fs.target already active after
deserialization causes ordering problems with the real root services and
targets.

We better isolate to targets for initrd-switch-root.target, which are
only available in the initrd.
2013-03-13 08:11:17 +01:00
Harald Hoyer fdf1848d1d Revert "units/initrd-*: require initrd-fs.target rather than local-fs.target"
This reverts commit 7d89ce303f.
2013-03-06 11:03:39 +01:00
Harald Hoyer 7d89ce303f units/initrd-*: require initrd-fs.target rather than local-fs.target 2013-03-04 19:33:50 +01:00
Tom Gundersen cf84347794 initrd: add unit files needed for basic systemd-in-initrd support
This will:
 * mount all configured filesystems (typically the rootfs on /sysroot)
 * reload the configuration to pick up anything from the mounted fs (typically
   /sysroot/etc/fstab)
 * mount any newly configured filesystems (typically /usr on /sysroot/usr, if
   applicable)
 * shut-down and clean-up any daemons running in the initramfs (typically udevd)
 * switch-root to /sysroot and start the real init

For an example of what files should be included in an initramfs based on this
see
<https://mailman.archlinux.org/pipermail/arch-projects/2013-February/003628.html>.

Cc: Harald Hoyer <harald.hoyer@gmail.com>
Cc: Dave Reisner <d@falconindy.com>
2013-03-01 22:52:36 +01:00