Commit Graph

59 Commits (c31a80c9edf8603cbdc5d2fe4465571a2ffcdff0)

Author SHA1 Message Date
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 db7d61cff7 base/init.sh: don't mount /run with noexec, if the initramfs lives there
If the initramfs was built with prefix=/run/... /run can't be mounted
with noexec, otherwise no binary can be run.

Guard against it by looking where /bin/sh is really located.
2016-04-14 14:58:34 +02:00
Evgeny Vereshchagin 4ab6447c2a base/init.sh: don't remove 99-cmdline-ask on 'hostonly' cleanup
How to reproduce:
host# ./dracut.sh -o 'dracut-systemd systemd systemd-initrd' --local -f ./initramfs.img

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

Enter additional kernel command line parameter (end with ctrl-d or .)
> rd.break
> .
...
There is no "Break before switch_root"
...

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2016-02-15 13:57:27 +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
Mike Gilbert 5899f2f516 Replace echo -n with printf in code with a /bin/sh shebang
POSIX does not mandate that echo support the -n parameter.
printf has more well-defined behavior.
2015-07-14 22:22:14 -04:00
Nikoli c4184b5cf1 Mount /dev, /dev/shm and /run noexec 2015-06-02 11:46:59 +02:00
Harald Hoyer 6d58fa27a4 change "while read x" to cope with EOF without newline
while read x || [ -n "$x" ]

should do the trick
2015-04-28 11:39:15 +02:00
Thomas Renninger 517d27a75f 99base: Increase initqueue timeout in non systemd case
In case of systemd is used the timeout already is set to 180s, compare
with file: modules.d/98systemd/dracut-initqueue.sh

Do the same if systemd is not used, e.g. in kdump case.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2014-12-16 13:29:36 +01:00
Tom Gundersen ca4108b78e initrd-release: move from /etc to /usr/lib
This mimicks the similar move of os-release which was done in systemd. These
files are not configuration, but part of the OS.

Still symlinks are in place for compatibility, but those should probably be
dropped eventually.
2014-12-01 17:02:16 +01:00
Harald Hoyer fa45d0d9c9 base/init.sh: ignore exclamation mark for kmod static-nodes
newer versions add an exclamation mark for the type, to mark it to be
created on boot only.
2014-12-01 11:50:00 +01:00
Colin Guthrie af67d62151 base: Set udevd log level via environment var to cover early startup.
udevd will these days default to 'info' logging and thus will
often print out the 'starting version nnn' message (which is
logged at level 'info'), thus spamming the console, even on
'quiet' boots.

We generally expect a udev log level of err (the old default
from pre-October 2013) so we should set that explicilty before
launching udevd in order to suppress the spurious 'info' message.

As we are using the environment variable approach anyway, we
may as well use this method rather than setting the log level
later via udevadm control commands when rd.udev.info/debug are
given on the kernel command line.

The enviroment variable has been around since udev 6b493a20e1
around 2005 so should be safe to use in all cases without version
checks.
2014-11-12 13:25:27 +01:00
Harald Hoyer 967cc19ab1 remove all vim and emacs code format comments 2014-08-29 13:38:47 +02:00
Harald Hoyer 6525182bfc base/init.sh: use loop counter with unique varname
$i can be polluted too easily
2014-06-30 12:03:12 +02:00
Harald Hoyer f232f6623d Add "rd.cmdline=ask" kernel command line parameter
prompts the user for additional kernel command line parameters
2014-06-30 12:03:12 +02:00
Harald Hoyer 5a57582050 Add rd.hostonly kernel command line parameters
rd.hostonly=0 will remove all configuration compiled in the initramfs
from the host on which it was build
2014-06-27 13:59:44 +02:00
Chapman Flack ddfea6b54c Break at switch_root only for bare rd.break
Previously, any rd.break=breakpoint would cause a break at the
given breakpoint and also at switch_root.
2014-04-03 08:56:52 +02:00
Harald Hoyer 56903458d7 mkdir basic dirs in /run
for systemd initramfs, /run is also mounted
for non-systemd the contents of /run is copied over, when mounting /run
2013-10-16 11:49:57 +02:00
Harald Hoyer ab2676d291 base/init.sh: also mkdir /run/lock 2013-10-09 08:20:39 +02:00
Harald Hoyer d27cd4dfdd Revert "base: setup correct system time and time zone in initrd"
This reverts commit 77364fd6bb.

Too many problems with adjtime in the initramfs

https://bugzilla.redhat.com/show_bug.cgi?id=981617
2013-07-31 15:55:22 +02:00
Harald Hoyer 904a76376f base/init.sh: create static device nodes with kmod 2013-07-30 16:20:05 +02:00
Harald Hoyer bc6eae15ab init.sh: don't check for systemd-udevd in lower version branch 2013-07-23 12:26:06 +02:00
Harald Hoyer 16addb86fc base: remove RD_TIMESTAMP 2013-07-17 11:26:55 +02:00
Harald Hoyer 32bd2fbb4c use "rm --" to guard against filenames beginning with "-" 2013-06-28 10:31:18 +02:00
WANG Chao 77364fd6bb base: setup correct system time and time zone in initrd
Currently in initrd, hardware clock is always considered to use UTC time
format and system time zone is also UTC. Thus system time isn't correct
if hw clock is localtime or we're using other time zone in real root.

To fix this, install /etc/adjtime and /etc/localtime to initrd. If not
using systemd, install /usr/sbin/hwclock for dracut init to setup system
time.

[harald: combined the two hostonly if's]

Signed-off-by: WANG Chao <chaowang@redhat.com>
Signed-off-by: Harald Hoyer <harald@redhat.com>
2013-06-06 12:10:50 +02:00
Baoquan He 9d787df196 Let user specify the action after fail
Currently the default action is emergency_shell when failure happened
during system boot. In kdump, this default may not be expected. E.g,
if dump target is not rootfs, it does not matter if mount root failed.
Adding an action which allow dracut always go ahead though failure
happens is needed by kdump.

So here add a function action_on_fail() and cmdline parameter
action_on_fail=<shell | continue>. Use action_to_fail() to replace
emergency_shell which was called after failure. By $(getarg action_on_fail=),
decide to drop into shell, or to leave away the failure and go ahead.

v3->v4:
add handling of selinux policy loaded failure, and change code format to
be consitent

Signed-off-by: Baoquan He <bhe@redhat.com>

[Edited by harald@redhat.com]
2013-04-09 11:14:08 +02:00
Harald Hoyer cc6f0925df base/init.sh: fix version output 2013-04-02 13:29:24 +02:00
Harald Hoyer 6c6d805765 use systemd*dir variables everywhere 2013-03-26 16:19:00 +01:00
dyoung@redhat.com bbfff3e58b Add memdebug at different points in 99base/init.sh
Previously I added several trace point to the begin of several
init hooks of systemd, old init script also need this debug info.

Doing same here as what's added in the systemd service scripts:
At cmdline hooks adding trace of "1+:mem 1+:iomem 3+:slab"
For other hooks adding trace of "1:shortmem 2+:mem 3+:slab"

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-03-13 13:12:57 +01:00
Harald Hoyer 500861cd05 base/init.sh: reset main loop counter, if work is in initqueue 2013-03-06 17:29:12 +01:00
Harald Hoyer f62f3a2191 reset initqueue loop counter only if new uevents exist 2013-03-02 13:19:20 +01:00
Stefan Reimer a005c47763 base/init.sh: create /run/log
If the systemd module is not used /run/log is not created which results
in dangeling softlink from /var/log which causes stuff to fail.
2013-02-18 12:05:23 +01:00
Colin Guthrie cd9072d342 Mount /proc before including dracut-lib.sh.
When dracut-lib.sh is sourced it checks the command line (when not using systemd)
as part of the check_quiet() call.

Therefore mount /proc earlier in init.

Avoids the error:

init: 77: /lib/dracut-lib.sh: /proc/cmdline: No such file or directory
2013-02-06 13:52:30 +01:00
Amadeusz Żołnowski 579238a3ac Fallback to external blkid and path_id in udev rules for <udev-176.
Starting with commit 24a38bc1cb dracut
uses udev builtins but still depends on >=udev-166 in dracut.spec.  This
patch makes dracut work with older udev again.

All credits go to Alexander Tsoy <alexander@tsoy.me>; see

  https://bugs.gentoo.org/show_bug.cgi?id=437700
2012-12-14 09:04:56 +01:00
Harald Hoyer 0fc0dcff60 bye bye iscsi_wait_scan ... officially gone for kernel 3.6 2012-09-18 13:39:54 +02:00
Harald Hoyer bdf1f472b4 add back scsi_wait_scan 2012-08-17 09:22:12 +02:00
Harald Hoyer 5cd7c104bd document rd.retry and change the default value to 30s
Also start the timeout scripts after 2/3 of the time.
2012-07-31 12:37:35 +02:00
Harald Hoyer 68e7661ca7 deprecate old command line options 2012-07-25 10:32:42 +02:00
Harald Hoyer c204501e3e base/init.sh: error out early, if /dev, /proc or /sys cannot be mounted 2012-07-03 13:14:12 +02:00
Harald Hoyer 5bccc94598 no more "mknod" in the initramfs!! 2012-06-29 12:41:26 +02:00
Harald Hoyer fbaf1517c3 s/Unable to process initqueue/Could not boot/g 2012-06-08 10:29:35 +02:00
Harald Hoyer ecc6da6bf5 99base/init.sh: kill systemd-udevd instead of udevd 2012-06-04 10:04:19 +02:00
Harald Hoyer 0363998d0a base/init.sh: use info() instead of vinfo() for version info
Thanks to Cong Wang for the hint
2012-05-29 10:19:02 +02:00
Juan RP cfede42fc3 modules.d/99base/init.sh: check for a valid init in case INIT is a symlink.
Obviously we have to test if it's executable with the PATH to NEWROOT.
2012-05-29 09:15:34 +02:00
Harald Hoyer 982d59afea drop 10rpmversion module and introduce /etc/initrd-release 2012-05-22 15:22:35 +02:00
Harald Hoyer cad10a7f80 base/init.sh: set DRACUT_QUIET only in dracut-lib.sh 2012-05-09 13:15:32 +02:00
Harald Hoyer eef7649e71 merge "cleanup" and "pre-pivot-cleanup" hooks 2012-04-23 11:32:45 +02:00
Harald Hoyer 476eb1b345 base: add export_n() function
resembles export -n for dash
2012-04-23 11:32:45 +02:00
Harald Hoyer c32908cee3 base: add debug_on() and debug_off() functions 2012-04-23 11:32:45 +02:00
Dave Young 2e7257a2e3 add pre-pivot-cleanup hook
Sometimes some hook script will need to be before the cleanup hook scripts
For example dhclient killing, nfs cleanup, etc. must not happen before kdump
because it will use their fuctionalities.

So here introduce a new hook pre-pivot-cleanup, all cleanup scripts will go there.
that means pre-pivot hook is splited to two hooks pre-pivot and pre-pivot-cleanup

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-04-19 11:59:45 +02:00
Harald Hoyer 7f217d7726 base/init.sh: mount tmpfs with strictatime 2012-04-19 11:59:38 +02:00