Harald Hoyer [Thu, 3 Apr 2014 06:54:27 +0000 (08:54 +0200)]
lvm:module-setup.sh: check for existance of 69-dm-lvm-metad.rules
Before modifying 69-dm-lvm-metad.rules, we should check for the
existance first. Otherwise this results in error messages on
distributions (debian), which do not ship these rules.
WANG Chao [Tue, 1 Apr 2014 07:20:49 +0000 (15:20 +0800)]
fstab: do not mount and fsck from fstab if using systemd
If using systemd in initramfs, we could run into a race condition when
dracut and systemd both are trying to mount and run fsck for the same
filesystem, and mount or fsck could be a failure.
To fix such failure, we should use systemd to mount/fsck from /etc/fstab
only.
v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy
Harald Hoyer [Thu, 27 Mar 2014 08:27:53 +0000 (09:27 +0100)]
lsinitrd.sh: prevent < <$() construct
Running dracut in a chroot environment, which has /dev not correctly
setup will result in errors like:
/usr/bin/lsinitrd: line 164: /dev/fd/62: No such file or directory
cpio: Malformed number �5�OK��
cpio: Malformed number 5�OK��
cpio: Malformed number �OK��
This is because bash wants /dev/fd/<num> for constructs like:
foo < <$(bar)
Dave Young [Thu, 27 Feb 2014 02:44:23 +0000 (10:44 +0800)]
add default values in fstab_lines
It's useful for passing a full fstab line including like fs_passno so fsck
can take effect.
Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
so original code just append "0 0" at the end of each fstab lines.
Improve this issue by assign default value in case they are not passed in.
Three field are handled here:
fs_mntops: default to "defaults"
fs_freq: default to "0"
fs_passno: default to "2"
Colin Guthrie [Wed, 5 Feb 2014 10:06:51 +0000 (10:06 +0000)]
dracut.sh: Fix variable name typo.
This caused the root_dev variable not to be set which in turn meant that
the root device was not whitelisted in 99base/module-setup.sh when injecting
compile-time devexists hooks in hostonly initrds. This ties the generated
initrd to the root fs device (typically the UUID) rather than relying solely
only the root= kernel command line.
While it is hostonly, not hardcoding e.g. UUIDs is still desirable. Any
swap partition on the host device is still added however.
Brian C. Lane [Wed, 5 Feb 2014 20:10:39 +0000 (12:10 -0800)]
new_dhcp_next_server is really new_next_server
The variable that dhclient sets doesn't have dhcp in the name. This
could cause problems with setups where the server is not the same as the
dhcp server.
Harald Hoyer [Thu, 6 Feb 2014 15:45:20 +0000 (16:45 +0100)]
Factor out all the "type -V" commands
Add new functions require_binaries() and require_any_binary() to be used
in the check() section of module-setup.sh.
These functions print a warning line telling the user, which binary is
missing for the specific dracut module.
This unifies the way of checking for binaries and makes the life of an
initramfs creator easier, if he wants to find out why a specific dracut
module is not included in the initramfs.
Harald Hoyer [Thu, 30 Jan 2014 15:11:40 +0000 (16:11 +0100)]
dracut.sh: only set the owner of files to 0:0, if generated as non-root
If the root user generates the initramfs image, preserve the ownership
of the files. This of course cannot be done for non-root users
generating an initramfs image.
Stig Telfer [Mon, 16 Dec 2013 15:17:47 +0000 (15:17 +0000)]
url-lib: extend to enable TFTP support
Libcurl has wider capabilities than those assigned to it by Dracut.
In this patch to url-lib I've added registration for TFTP URLs,
which I've found to be useful.
Stig Telfer [Fri, 24 Jan 2014 15:19:11 +0000 (15:19 +0000)]
dracut-lib.sh: bugfix for pidof function
It appears there is a simple substitution error in the pidof shell function which causes it to fail to find processes. In my case, processes started by 95nfs are not terminated in the cleanup hook. This causes knock-on effects disturbing the root filesystem service dependencies.
Harald Hoyer [Tue, 28 Jan 2014 11:12:43 +0000 (12:12 +0100)]
network/dhclient-script.sh: set lease time
The dracut dhclient-script.sh should set address lifetimes to the DHCP
lease time, so that other stuff (like NetworkManager!) knows that the
address is temporary and was created by DHCP.
Hari Bathini [Thu, 16 Jan 2014 06:41:27 +0000 (12:11 +0530)]
Dracut: Add a new argument "--rebuild"
Add "rebuild" option to dracut to append the current arguments
to those with which the input initramfs image was built. This
option helps in incrementally building initramfs for testing.
Usage: dracut [output_file] --rebuild input_file
If optional output file is not provided, input file provided to
rebuild will be used as output file.
This patch alters the creation of the initramfs image by adding
the file "/tmp/params.txt" to the image. Command line parameters
excluding "--rebuild", input & output image names and "kernel
version" are stored in this file. In case "--rebuild" parameter
is specified, "/tmp/params.txt" file, if present in input image,
is read and its contents "prepend"ed to the current command line
parameters, that is if such a file is already present. Also, it
stores the cumulative parameters to the file "/tmp/params.txt",
in the new image. This patch has been tested successfully on a
PowerBox with f19. It does not alter the behaviour of any of the
existing options.
Signed-off-by: Manik Bajpai <manibajp@linux.vnet.ibm.com> Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
[Edited-by: Harald Hoyer]
Simplified the cpio extraction process by using 'lsinitrd'.
Colin Guthrie [Fri, 27 Dec 2013 13:00:48 +0000 (13:00 +0000)]
crypt: Prevent asking for password multiple times if non-default crypt name is used.
If a non-default device mapper name is used for an encrypted partion is
used, (i.e. not luks-$UUID) due to parsing of /etc/crypttab, then the
short-circuits put in place to prevent asking the password twice do not
work.
This would not normally be an issue as the settled job itself should be
removed after it has run and thus cannot be run again. Sadly, due to
the corresponding udev rule using ACTION="add|changed", and the fact
that trying to unlock the device (whether successful or not) seems to
trigger a changed event, it means the settled job is recreated with
each itteration thus causing the whole loop to run again.
It is this situation that the short-circuit exits would normally come
into play but sadly do not work when non-standard names are used.
By the time the /tmp/cryptroot-asked-$2 file is written near the end of
the script, the value of $2 has already been lost due to the argument
parsing code's use of 'shift'. So while on systems where the default
name is used are protected by checking /dev/mapper/xxxx, the
/tmp/cryptroot-asked-$2 file didn't help on systems where this was not
used due to this bug.
So this commit shuffles things around somewhat such that:
1. The /dev/mapper/xxxx device is checked *after* resolving $2 (which
contains the default name) to whatever /etc/crypttab specifies.
2. The cryptroot-asked-xxxx file also uses the translated name both
for the initial check and to flag when it's written.
As a separate fix, it might make sense to change the udev rule to only
act on add events rather than add|change events, but I'm not sure of the
ramifications of such a change and there may be cases where the add
event is missed and thus the change event needs to be included.