Commit Graph

59 Commits (c8ebb80590be2dbe0cb63c9696903889b51efc75)

Author SHA1 Message Date
Harald Hoyer 16efdfa25c fix: revise all module checks
1. no module checks for modules which are in depends()
2. no `derror` for optional (255) modules checking for dependencies
3. fix dbus meta module
2021-02-10 13:29:17 +01:00
Zoltán Böszörményi 18d36fabf5 feat(dracut.sh): allow overriding the systemctl command for sysroot
Allow overriding the systemctl command for sysroot with $SYSTEMCTL
Modified every modules' module-setup.sh to use the envvar instead
of the hardcoded command name.

Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
2021-02-09 07:09:28 +00:00
Jóhann B. Guðmundsson bf1a2262ea fix(1007): adding shared keyring mode to type unit
Fixes: https://github.com/dracutdevs/dracut/issues/1007
2021-01-26 18:05:18 +00:00
Daniel Molkentin 1ec85e5232 Remove uses of bash (and bash specific syntax) in runtime scripts
dracutinstall picks up interpreters and includes bash despite
the users' wishes or expectations, as modules should not require
bashisms at runtime.

Fixes #951
2020-11-14 16:36:38 +01:00
Jonathan Lebon 512c51d267 98dracut-systemd: don't wait for root device if remote cryptsetup active
This is a plain and simple hack around dependency issues between dracut
and systemd.

When using Tang-pinned LUKS root devices, we want to rely on
`systemd-cryptsetup@.service` to unlock it. However, that service only
runs `After=remote-fs-pre.target`, while `dracut-initqueue.service` has
`Before=remote-fs-pre.target` (which makes sense because we don't want
to attempt networked root devices before networking is up).

However, the rootfs-generator here wants to make sure that the root
device exists *before* exiting the initqueue via an initqueue/finished
"devexists" hook. This will never work though because by design
`systemd-cryptsetup@.service`, which unlocks the root device, won't run
until after we exit.

So we have a dependency cycle:

    initqueue -> devexists hook -> root device ->
        systemd-cryptsetup@.service -> remote-fs-pre.target -> initqueue

There's no clean way to break this. The root issue is that there's no
way right now to split sequencing of systemd services across the
initqueue/online and initqueue/finished events because it's all bundled
in a single service. (The deeper root issue of course is that we have
two init systems. :) ).

Here we do a tactical fix: if there's a `systemd-cryptsetup@.service`
instance, let's assume it's for the root device and skip waiting for it
to show up if it depends on `remote-fs-pre.target`.
2020-10-12 11:07:41 +02:00
Kairui Song dc9596155d dracut-initqueue: Print more useful info in case of timeout
Currently when initqueue timeout, it span the console with
"dracut-initqueue timeout - starting timeout scripts", which isn't very
helpful as we still don't know what actually happened. Try to improve
this by print what is actually being waited.

Besides, only print "starting timeout scripts" when there are
actual timeout scripts to use.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-08-04 14:00:06 +02:00
Jóhann B. Guðmundsson 8cb5ac1b30 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson d9149c6ca7 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson c437933cb0 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson e1130a8340 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 0c1bd016ec As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 317d841c78 As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Jóhann B. Guðmundsson 5cb2a4004d As of v246 of systemd "syslog" and "syslog-console" switches have been deprecated 2020-07-31 17:11:25 +02:00
Kairui Song 2a61132865 Remove cleanup_trace_mem calls
In commit 49c4172 all shell based memory tracing functions are removed,
there are some left over. Remove them as well.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-05-27 16:51:52 +02:00
Kairui Song 49c4172f4e Remove memtrace-ko and rd.memdebug=4 support in dracut
This feature could be off loaded to memstrack, which have better
accurecy, better performance, and have more detailed tracing features.

Also simplify make_trace_mem a bit.

And currently rd.memdebug=4 is unstable, fails from time to time.
2020-04-20 20:22:37 +02:00
Jan Macku 70b19acf94 Replace ln with systemctl 2020-01-14 09:29:51 +01:00
Böszörményi Zoltán 0d08f43d71 Fix 98dracut-systemd/dracut-emergency.sh
/dev/consoles does not exist. It's /proc/consoles.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-02-12 14:56:12 +01:00
Daniel Molkentin 32f68c1f9a emergency mode: use sulogin
- allow emergency login on every console
  specified in the kernel cmdline
- require password for hostonly images
- emergency mode: Manually multiplex emergency infos

This will bring all vital information to all ttys specified
as console devices, regardless of wether they hold the C flag.

Reference: FATE#325386
Reference: #449
2019-01-10 10:16:15 +01:00
Pedro Monreal f18d069d46 Fixed some SUSE specific typos and outputs 2018-11-08 14:43:08 +01:00
Daniel Molkentin e9a84e0a21 98dracut-systemd: Start systemd-vconsole-setup before dracut-cmdline-ask
This is what happened before this patch (edited for brevity):

  dracut-cmdline-ask.service in modules.d/98dracut-systemd, which invokes
  dracut-cmdline-ask.sh. This script and systemd-vconsole-setup are
  started in parallel for the same console (tty1).

  Then dracut-cmdline-ask quits immediately without doing anything (unless
  rd.cmdline=ask is given). As this is a bash script and it gets tty as
  stdin as specified in its *.service, this triggers the hangup of tty1 at
  its exit.

  Meanwhile systemd-vconsole-setup continues and tries some ioctls after
  that, but they fail because of the hung up tty1.

The usual culprit for starting systemd-vconsole-setup early on is
plymouth-start.service, even if plymouth.enable=0 is set.

A popular (and annoying) symptom of this as reported by users was
the inability use their configured keyboard layout in plymouth when
unlocking their crypted block devices.

Reference: boo#1055834
2018-09-05 13:20:36 +02:00
Harald Hoyer 6ccb77e19a dracut-systemd/dracut-pre-udev.service: also run for /etc/cmdline
Fixes #117
2018-01-12 09:32:45 +01:00
Mark Fasheh 1f8a7ae799 dracut-emergency: optionally print fs help
Allow filesystem modules to install a fs-specific text file with
instructions on what to do when mount fails. This is printed when we go into
an emergency shell.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
2018-01-08 14:14:05 +01:00
Daniel Molkentin 649619f6a5 Set TaskMax=inifinite for the emergency shell
Certain rescue/recovery operations, e.g. xfs_repair need
that liberty (bsc#1019938).
2017-12-15 22:00:41 +01:00
Lidong Zhong df96cccc8f Fix task limit in emergency.service (the same change as in dracut-emergency.service) (bsc#1019938) 2017-12-14 13:37:44 +01:00
Martin Wilck 4c2d98c75b emergency.service: use Type=idle
Type=oneshot, as currently set in dracut's emergency service file,
causes an awkward situation if emergency mode is entered e.g. because
of a root device timeout, and the root device appears later because it
just has taken longer than the timeout. In that situation, my
expectation (backed by past positive experience) is that the user should
be able to simply exit the emergency shell and resume normal boot.

:/# systemctl status sysroot.mount
● sysroot.mount - /sysroot
   Loaded: loaded (/proc/cmdline; bad; vendor preset: enabled)
   Active: active (mounted) since Mon 2017-10-09 14:32:15 CEST; 16s ago
    Where: /sysroot
     What: /dev/mapper/3600601600a30200024fbbaf3f500e411-part5
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 1873 ExecMount=/usr/bin/mount /dev/disk/by-uuid/63751805-6abc-46a3-a66f-427920dece4d /sysroot -o ro (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 512)

:/# systemctl list-jobs
JOB UNIT              TYPE  STATE
 56 emergency.target  start waiting
 57 emergency.service start running

2 jobs listed.
:/# exit
logout
Failed to start default.target: Transaction is destructive.

(system keeps idling from this point on, user has no chance to
do anything).

This results from the combination of two effects:
1) initrd-root-fs.target sets "OnFailureJobMode=replace-irreversibly",
2) emergency.service's Type=oneshot causes the start jobs for both
emergency.service and emergency.target to persist while the user is in
the emergency shell.

When the shell is exited, systemd tries to isolate "initrd.target"
again, but this fails with "the transaction is destructive" error
because of the still pending jobs.

This patch fixes this by changing the Type of "emergency.service" from
"oneshot" to "idle".
2017-10-09 14:51:45 +02:00
Michal Sekletar 28401778c4 systemd: fix setting of timeouts for device units
JobRunningTimeoutSec now affects how long can start jobs for device
units stay in the "running" state. Disabling default job timeout via
JobTimeoutSec=0 doesn't disable running state timeout. We need to set
running state timeout as well.

Note that doing this the other way around has effect on generic timeout,
i.e. disabling running state timeout disables generic timeout. But doing
it this way we would create implicit dependency on fairly new
systemd-234. However, by setting both options we don't create dependency
on specific systemd version.
2017-10-06 10:05:25 +02:00
Harald Hoyer b1ae591945 dracut-systemd: add back missing dependencies
otherwise TEST-20-NFS fails
2017-07-28 11:57:07 +02:00
Harald Hoyer f24d205537 dracut-systemd: fixed dependencies
try to break an ordering cycle.

https://github.com/dracutdevs/dracut/issues/259
2017-07-28 10:19:26 +02:00
Harald Hoyer 85ed04e0cf dracut-systemd/*.service: fix copyright message and comment 2017-07-28 10:17:06 +02:00
Daniel Molkentin e3189ab123 98dracut-systemd: Fix module force loading with systemd
This used to work only when specified via the command line
or if systemd was not being used. However, the exisistence of
20_force_driver.conf also requires dracut-pre-udev.service
to be run.

Reference: bsc#986216
2017-06-16 16:58:12 +02:00
Xunlei Pang 52c295c161 99base: apply kernel module memory debug support
Extend "rd.memdebug" to "4", and "make_trace_mem" to "4+:komem".
Add new "cleanup_trace_mem" to cleanup the trace if active.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
2016-11-27 12:09:10 +08:00
Harald Hoyer 86eb0b1b83 dracut-systemd/dracut-mount.service: add DefaultDependencies=no 2016-09-02 07:51:55 +02:00
Harald Hoyer e168eeef67 systemd/dracut-cmdline.sh: unset "UNSET" $root
https://bugzilla.redhat.com/show_bug.cgi?id=1365667
caused by commit 9aa224cc

(cherry picked from commit fc77aca7dd)
2016-08-19 15:49:33 +02:00
Harald Hoyer c45e856a65 add rd.emergency=[reboot|poweroff|halt]
specifies what action to execute in case of a critical failure
2016-07-22 14:51:03 +02:00
Harald Hoyer c000a21c25 dracut-systemd/*.service: conflict with shutdown target
make reboot/poweroff/halt work

also conflict with emergency.target
2016-06-23 16:37:53 +02:00
Harald Hoyer 8fce2c4d5e dracut-systemd/dracut-emergency.sh: call shutdown-emergency hooks
if no rd.shell is given
2016-06-07 14:47:27 +02:00
Alexander Kurtz 016613c774 dracut-systemd/dracut-cmdline.sh: Don't error out if there is no root= argument.
Thanks to systemd's gpt-auto-generator [0] (which implements the Discoverable
Partitions Specification [1]), it is no longer necessary to always specify the
root= argument.

However, dracut would still refuse to boot if there was no root= argument (or
if it was set to the special value "gpt-auto" [2]). This commit stops dracut
from aborting the boot process in these cases and simply lets systemd do its
magic.

[0] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator
[1] https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
[2] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator/gpt-auto-generator.c#L928
2016-05-06 17:53:36 +02:00
Harald Hoyer 556ff7c76a dracut-systemd/dracut-pre-pivot.sh: Break at switch_root only for bare rd.break
similar to commit ddfea6b54c

Previously, any rd.break=breakpoint would cause a break at the
given breakpoint and also at switch_root.
2016-03-07 12:38:23 +01:00
Evgeny Vereshchagin eddca3c9c2 dracut-systemd/dracut-cmdline-ask: fix dracut --kernel-cmdline=rd.cmdline=ask
How to reproduce:

host# dracut --kernel-cmdline='rd.cmdline=ask' initramfs.img
host# qemu-system-x86_64 -initrd initramfs.img ... -append root=/dev/sda1 ...
...

qemu-host# journalctl -b | grep dracut-cmdline-ask
...
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Installed new job dracut-cmdline-ask.service/start as 42
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: ConditionKernelCommandLine=rd.cmdline=ask failed.
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Starting requested but condition failed. Not starting unit.
Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Job dracut-cmdline-ask.service/start finished, result=done
...

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2016-02-15 08:47:47 +00:00
dyoung@redhat.com 6870007674 Revert "Let user specify the action after fail"
This reverts commit 9d787df196

action_on_fail is useless thus remove the commits for it one by one.

Signed-off-by: Dave Young <dyoung@redhat.com>
2015-11-13 13:22:34 +01:00
dyoung@redhat.com 946722e465 Revert "dracut-emergency.service: do not start for "action_on_fail=continue""
This reverts commit b78e6ac2c3.

action_on_fail is useless thus remove the commits for it one by one.

Signed-off-by: Dave Young <dyoung@redhat.com>
2015-11-13 13:22:34 +01:00
dyoung@redhat.com a95a727fdc Revert "systemd/emergency.service: do not run for action_on_fail=continue"
This reverts commit dcae873414.

action_on_fail is useless thus remove the commits for it one by one.

Signed-off-by: Dave Young <dyoung@redhat.com>
2015-11-13 13:22:34 +01:00
dyoung@redhat.com 74c9fb947b Revert "Change the implementation of action_on_fail"
This reverts commit d2765b5175.

action_on_fail is useless thus remove the commits for it one by one.

Signed-off-by: Dave Young <dyoung@redhat.com>
2015-11-13 13:22:34 +01:00
Harald Hoyer 35a666d02a dracut-systemd/rootfs-generator.sh: s/RequiresOverridable/Requires
RequiresOverridable will be deprecated
2015-11-13 10:13:08 +01:00
Harald Hoyer db7d739818 systemd/dracut-cmdline.sh: print out cmdline in one line
(cherry picked from commit 93a5a3d3ca)
2015-11-11 15:57:36 +01:00
Harald Hoyer 64c34f3459 dracut-systemd/module-setup.sh: remove duplicate vconsole wants
Adding the dependency on vconsole is already done in the 00systemd
module and the rescue.service has this already in the unit file.
2015-11-11 12:16:13 +01:00
Harald Hoyer 8ba684be1c dracut-systemd/dracut-initqueue.sh: be verbose about timeout
Issue a warning, if timeout scripts are executed
2015-08-12 14:27:39 +02:00
Harald Hoyer e47907cc6b dracut-systemd/dracut-initqueue: only start service if really needed
Only start the dracut-initqueue.service, if the dracut_need_initqueue
command was issued on creation or later on set.
2015-07-13 10:51:47 +02:00
Harald Hoyer e860ef0e30 dracut-pre-mount.service should run before systemd-fsck-root.service 2015-07-07 13:45:19 +02:00
Andrei Borzenkov 6c9484f614 ensure pre-mount (and resume) run before root fsck
References:
https://bugzilla.suse.com/show_bug.cgi?id=906592
Signed-off-by: Thomas Renninger <trenn@suse.de>
2015-07-07 13:44:24 +02:00