Commit Graph

451 Commits

Author SHA1 Message Date
Harald Hoyer
549442cc2a base/dracut-lib.sh: check for /proc/cmdline existance 2013-07-30 15:28:46 +02:00
Harald Hoyer
45ef8eb723 base: provide pidof() shell function 2013-07-23 12:56:20 +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
c33488feb1 rename sosreport to rdsosreport
Renamed sosreport to rdsosreport to differ from the sosreport tool on
the real root.
2013-07-17 14:31:59 +02:00
Harald Hoyer
16addb86fc base: remove RD_TIMESTAMP 2013-07-17 11:26:55 +02:00
Harald Hoyer
85231e1ff3 base/module-setup.sh: do not add devs to initqueue/finished
when need-initqueue is not set in systemd mode
2013-07-12 10:15:10 +02:00
Harald Hoyer
88396c383c base/module-setup.sh: do not include systemd-timestamp
when using systemd in the initramfs
2013-07-12 10:14:15 +02:00
Harald Hoyer
1e057b352a add PARTLABEL and PARTUUID 2013-07-05 15:32:38 +02:00
Harald Hoyer
b093aa2dc7 beautified shell code
checked with shellcheck http://www.shellcheck.net/about.html
2013-07-04 12:31:15 +02:00
Harald Hoyer
32bd2fbb4c use "rm --" to guard against filenames beginning with "-" 2013-06-28 10:31:18 +02:00
Harald Hoyer
391d605790 rename kernel command line param action_on_fail to rd.action_on_fail 2013-06-12 13:16:33 +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
Harald Hoyer
62cb52f431 base/dracut-lib.sh: export DRACUT_SYSTEMD and NEWROOT 2013-05-30 08:32:18 +02:00
WANG Chao
b6f2e05819 _emergency_shell: Show current working directory correctly in shell.
When dropped to emergency shell, for example, use rd.break=pre-pivot,
the PS1 won't correctly show current directory we're in:

pre-pivot:/# cd /sysroot/
pre-pivot:/#
(still shows "/")

Let's take a look at PS1 variable:

(I'm adding prefix/suffix 'x' to make it clear):
pre-pivot:/# echo x${PS1}x
xpre-pivot:/# x
(PS1 isn't dynamic)

Regarding the current dracut code, it should be:

pre-pivot:/# cd /sysroot/etc
pre-pivot:/sysroot/etc#

With this patch:

pre-pivot:/# echo x${PS1}x
xpre-pivot:${PWD}# x
(Now PS1 is dynamic, it will show the directory correctly)

I tested for both normal boot and kdump boot.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2013-04-30 12:13:56 +02:00
Harald Hoyer
6f4c2dada4 fixed fips mode
- preserve timestamps
- copy /lib*/hmaccalc files
- run sha512hmac after kernel module loading
- add more fips kernel modules
2013-04-25 19:44:01 +02:00
Harald Hoyer
2b125c69cc base/dracut-lib.sh: do not setdebug, if not in initramfs 2013-04-18 12:54:30 +02:00
Harald Hoyer
ca2c693679 Do not call plymouth with full path 2013-04-11 16:08:26 +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
6db8c5a5fe base/dracut-lib.sh:wait_for_dev()/cancel_wait_for_dev() set systemd timeouts
Set systemd unit timeouts for the devices we wait for. The systemd
default is 90 seconds, which is way too low for complicated setups.
2013-04-05 08:32:17 +02:00
Harald Hoyer
c4b572b5ca base/dracut-lib.sh: add dev_unit_name()
add helper function to convert device path to systemd unit names
2013-04-04 12:52:53 +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
Harald Hoyer
e42c7a980c sosreport: mkdir /run/initramfs, if it does not exist yet 2013-03-16 10:34:20 +01:00
Harald Hoyer
7e9bfdde14 sosreport.sh: use -o short-monotonic for the journal output 2013-03-15 10:41:41 +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
dyoung@redhat.com
dff9a66c44 print memdebug to stderr
memory usage tracing outputs are debug info, so it should be moved to
stderr instead of stdout.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-03-13 13:12:57 +01:00
Harald Hoyer
c85cda9e2f systemd: local-fs.target is now root-fs.target and initrd-fs.target
Also rename dracut.target to initrd.target

see also systemd commit 700e07f
http://cgit.freedesktop.org/systemd/systemd/commit/?id=700e07f
2013-03-13 09:34:47 +01:00
Harald Hoyer
ca36b9b8f8 base: save host_devs which we need bring up and process them with wait_for_dev 2013-03-06 17:29:12 +01:00
Harald Hoyer
a9c7dc74c4 base: in systemd mode parse-root-opts.sh is in the services 2013-03-06 17:29:12 +01:00
Harald Hoyer
ce862de624 base/dracut-lib.sh: reset /etc/profile 2013-03-06 17:29:12 +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
44d26d9209 base/dracut-lib.sh: extend wait_for_dev() for systemd 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
Dave Young
7bd8f23303 Add memory usage trace to diffrent hook points
Hi, Here is an update of this patch, fixed the local variable issue.
2013-01-23 15:24:27 +01:00
dyoung@redhat.com
a08ea34aba add function getargnum
For cmdline argument with numeric value, add a new function getargnum
It will get proper value with default value as $1, min value as $2,
max value as $3, and param name as $4. valid result will be echo to stdout.
for nul or value not valid it will just echo the default value.
Note: The values should be >=0

[v1->v2]: add arg <minval>
[v2->v3]: do not use bash string match =~

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Harald Hoyer
551c2dd71f shutdown: kill all processes and report remaining ones 2013-01-22 15:31:45 +01:00
Harald Hoyer
5b68300899 dracut-lib.sh: force hide plymouth in shutdown emergency shell 2013-01-22 15:31:19 +01:00
dyoung@redhat.com
efa5eb424d Move wait for if functions to net lib
net-lib.sh are created for net related functions, move the wait_for_if* to
net-lib.sh naturally.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +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
64d144aece Add sosreport script and generate /run/initramfs/sosreport.txt 2012-11-21 14:17:43 +01:00
Harald Hoyer
600c876968 consistently lowercase "dracut" 2012-10-10 14:15:11 +02:00
Harald Hoyer
2242cd92ee systemd: rename emergency.service to dracut-emergency.service for rd.shell 2012-10-04 13:24:07 -04:00
Harald Hoyer
a6c718ce8e systemd: improve the emergency shell 2012-10-03 16:39:27 -04:00
Harald Hoyer
8ea8d6de80 base/dracut-lib.sh: better error message for deprecated cmdline options 2012-09-28 15:29:53 +02:00
Harald Hoyer
4211605000 fallback to old ismounted, if findmnt is not installed 2012-09-20 10:36:13 +02:00
Dave Young
d9a7ea5b43 ismounted fix
ismounted handles both find-by-dev and find-by-mnt, but there's two issues:
1. for find-by-dev, it use readlink to get the canonical dev name, but
   lvm is different with other devices, the canonical name for lvm devices
   are symlinks like /dev/mapper/vg-lv00
2. for nfs mounting, just use [ -b $dev ] is not enough, it need being handled
   seperately.

Per Karel Zak's suggestion, findmnt util is suitable for this purpose, it
handles these cases well, so just use findmnt instead of implement all the
logic by ourselves. Thanks, Karel.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-19 18:37:07 +02:00
Harald Hoyer
0fc0dcff60 bye bye iscsi_wait_scan ... officially gone for kernel 3.6 2012-09-18 13:39:54 +02:00
Dave Young
ff0636635a move get_persistent_dev to dracut-functions.sh
kdump module also need to convert dev name to udev symlinks.
So better to move function get_persistent_dev() to dracut-functions.sh

Also in this patch improvement and fix the original function:
a) use udevadm info --query=name to get the kernel name.
   This will fix the issue caused by passing symbolic link of a device.
b) fix a bug to compare $_tmp instead of $i with $_dev. Really sorry,
   should have tested more carefully.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-10 15:50:36 +02:00