Harald Hoyer [Thu, 5 Mar 2009 13:47:00 +0000 (14:47 +0100)]
make crypt more failsafe
Harald Hoyer [Thu, 5 Mar 2009 13:21:59 +0000 (14:21 +0100)]
kill udev before switch_root and bail out after 10 seconds of mount tries
Harald Hoyer [Thu, 5 Mar 2009 13:21:20 +0000 (14:21 +0100)]
only react to "add" to prevent duplicate /cryptroot lines
Harald Hoyer [Thu, 5 Mar 2009 13:20:48 +0000 (14:20 +0100)]
use dash instead of underscore for udev control commands
Harald Hoyer [Thu, 5 Mar 2009 13:20:27 +0000 (14:20 +0100)]
serialize lvm calls with a subshell
Harald Hoyer [Thu, 5 Mar 2009 13:20:05 +0000 (14:20 +0100)]
testimage target fixes
Harald Hoyer [Thu, 5 Mar 2009 13:19:41 +0000 (14:19 +0100)]
add dmraid
Harald Hoyer [Thu, 5 Mar 2009 10:28:09 +0000 (11:28 +0100)]
fixed rpm building on Fedora 11
"Only dest dir longer than base dir not supported"
Harald Hoyer [Thu, 5 Mar 2009 10:07:52 +0000 (11:07 +0100)]
add compile phase to testimage and force overwrite
Harald Hoyer [Thu, 5 Mar 2009 10:05:35 +0000 (11:05 +0100)]
do not get GITTAG, if there is no .git
Harald Hoyer [Thu, 5 Mar 2009 09:57:49 +0000 (10:57 +0100)]
fixed dirs in specfile
Harald Hoyer [Thu, 5 Mar 2009 09:48:18 +0000 (10:48 +0100)]
added tar.bz2 target for the rpm and archive target
Harald Hoyer [Thu, 5 Mar 2009 09:38:03 +0000 (10:38 +0100)]
define gittag for rpm target
Harald Hoyer [Thu, 5 Mar 2009 09:36:08 +0000 (10:36 +0100)]
add sample dracut.conf
Harald Hoyer [Thu, 5 Mar 2009 09:34:09 +0000 (10:34 +0100)]
install console udev rules and helper apps
Harald Hoyer [Thu, 5 Mar 2009 09:33:42 +0000 (10:33 +0100)]
allow dracut.conf to be local if -l is set
Harald Hoyer [Thu, 5 Mar 2009 09:33:18 +0000 (10:33 +0100)]
add testimage target
Harald Hoyer [Thu, 5 Mar 2009 09:17:29 +0000 (10:17 +0100)]
renamed archive file and convenience target for rpm
Harald Hoyer [Thu, 5 Mar 2009 09:16:50 +0000 (10:16 +0100)]
small corrections and obsolete mkinitrd only when defined in specfile
Harald Hoyer [Thu, 5 Mar 2009 08:54:58 +0000 (09:54 +0100)]
fix modules.d install
Harald Hoyer [Wed, 4 Mar 2009 16:49:19 +0000 (17:49 +0100)]
add \n to switch_root
Harald Hoyer [Wed, 4 Mar 2009 16:48:20 +0000 (17:48 +0100)]
kill udevd before switching root
Harald Hoyer [Wed, 4 Mar 2009 16:36:55 +0000 (17:36 +0100)]
also run ldconfig on /lib64
Harald Hoyer [Wed, 4 Mar 2009 16:35:14 +0000 (17:35 +0100)]
only run ldconfig on /lib and /usr/lib with -n
This also suppresses error messages about missing ld.so.conf
Harald Hoyer [Wed, 4 Mar 2009 16:29:42 +0000 (17:29 +0100)]
merge fix, find_binary
Harald Hoyer [Wed, 4 Mar 2009 13:23:02 +0000 (14:23 +0100)]
fixes for specfile and Makefile
Harald Hoyer [Wed, 4 Mar 2009 12:54:55 +0000 (13:54 +0100)]
replace switch_root shell script with binary
The switch_root shell script did not work with bash-4.0-2, because
"exec" gets the real path of the executable which is then
"/sysroot/lib/ld-linux.so.2" instread of "./lib/ld-linux.so.2".
Also the required chroot binary might live in /usr/bin, which can
be mounted later.
Here is the switch_root code from nash, which can be stripped down
further, but which works.
>From
f1b1e4f8694104f007e4483c36b0bf40a5760167 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Wed, 4 Mar 2009 13:41:07 +0100
Subject: [PATCH] replace switch_root shell script with binary
The switch_root shell script did not work with bash-4.0-2, because
"exec" gets the real path of the executable which is then
"/sysroot/lib/ld-linux.so.2" instead of "./lib/ld-linux.so.2".
Also the required chroot binary might live in /usr/bin, which can
be mounted later.
Here is the switch_root code from nash, which can be stripped down
further, but which works.
Harald Hoyer [Wed, 4 Mar 2009 12:45:21 +0000 (13:45 +0100)]
strip "init=" from INIT
Victor Lowther [Wed, 4 Mar 2009 00:21:19 +0000 (16:21 -0800)]
Fix several inst functions.
Move file existence checking into the individual inst functions. This makes
things a bit easier to understand and maintain.
Victor Lowther [Wed, 4 Mar 2009 00:21:17 +0000 (16:21 -0800)]
Steal rules we need from the latest udev package.
This should arguably be done by importing the udev git repo as a submodule,
but I am too lazy to figure out how to do that right now.
I suppose this could also be done by rewriting the 95udev-rules.sh module
for each distribution, but that is something best left to the distro
maintainers once we acheive some sort of widespread adoption. Until then,
stealing rules from upstream udev seems like the most portable solution.
Victor Lowther [Wed, 4 Mar 2009 00:21:13 +0000 (16:21 -0800)]
Get rid of some RedHat specific modules and udev rules
They are not needed to boot with dracut, so away they go.
Also rewrite inst_rules to automatically search likely rule locations when
installing udev rules.
Victor Lowther [Wed, 4 Mar 2009 00:21:10 +0000 (16:21 -0800)]
Modify instmods to not rely on the existence of modules.* files
This patch series aims to make dracut more distro-independent. It includes
some of the functionality that Seewer Philippe posted to the list to make
dracut work on Ubuntu.
depmod does not create these files on all distros (Debian, specifically),
so modify instmods to use pathname components and find to do what we want.
As a bonus, this removes the special-case for =ata.
Seewer Philippe [Fri, 27 Feb 2009 14:45:53 +0000 (15:45 +0100)]
Create directories for symlinked libraries if needed
Sometimes symlinks for libraries reside in weird places. Create those
weird places if necessary.
--
dracut-functions | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Seewer Philippe [Fri, 27 Feb 2009 14:37:47 +0000 (15:37 +0100)]
Canonicalize symlinks
When handling links sometimes one readlink isn't enough. Dracut doesn't
need to clone a whole link series, so just use readlink -f
--
dracut-functions | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
Seewer Philippe [Fri, 27 Feb 2009 14:16:36 +0000 (15:16 +0100)]
Make bash regexes behave
On some systems with newer or unpatched bash versions the whole right
portion of =~ is considered part of the regex. Means we need to get rid
of enclosing ''.
This patch fixes this.
--
dracut-functions | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
Seewer Philippe [Fri, 27 Feb 2009 13:28:40 +0000 (14:28 +0100)]
Fix find_binary always succeeding
find_binary inside dracut-functions always succeeds. Independent of
whether the file actually exists or not.
This patch fixes this.
And since we're using the function not only to find binaries at little
enhancement there shouldn't be that bad either.
--
dracut-functions | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
Seewer Philippe [Fri, 27 Feb 2009 12:25:38 +0000 (13:25 +0100)]
Fix instmods recursing indefinitely
the instmod function inside dracut-functions starts to recurses indefinitely
if modprobe --show-depends is used and the output contains module options.
Example:
#modprobe --show-depends libata
insmod /lib/modules/2.6.27-11-generic/kernel/drivers/acpi/dock.ko
insmod /lib/modules/2.6.27-11-generic/kernel/drivers/scsi/scsi_mod.ko
insmod /lib/modules/2.6.27-11-generic/kernel/drivers/ata/libata.ko ignore_hpa=1
This patch fixes this.
--
dracut-functions | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Seewer Philippe [Fri, 27 Feb 2009 10:41:21 +0000 (11:41 +0100)]
Fix Makefile installing in wrong directories
rules, hooks and modules are installed in $(DESTDIR)/usr/libexec/dracut/
instead of their corresponding sub-directories.
This patch fixes this.
--
Makefile | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
Victor Lowther [Fri, 27 Feb 2009 00:02:52 +0000 (16:02 -0800)]
Add documentation on how to write a dracut module.
Also some minor cleanups to the dracut script.
Victor Lowther [Fri, 27 Feb 2009 00:02:50 +0000 (16:02 -0800)]
Modify Makefile to understand the new module structure.
Victor Lowther [Fri, 27 Feb 2009 00:02:47 +0000 (16:02 -0800)]
Create a self-contained structure for dracut modules
All modules now live in a subdirectory /modules.d. Each module is
self-contained -- it should contain everything that it will install
on the initrd. All modules must include a script named install, which
will be sourced by dracut. This script should do the actual file installation
using inst methods. The moddir variable will point to the full path to the
module dracut is currently working on.
As usual, this patch series applies on top of my previous patch series,
and is available as normalize-modules from http://git.fnordovax.org/dracut.
Victor Lowther [Thu, 26 Feb 2009 02:42:14 +0000 (18:42 -0800)]
Do not run dhclient if the interface is already up.
Victor Lowther [Thu, 26 Feb 2009 02:42:11 +0000 (18:42 -0800)]
Move running dhclient on DHCP interfaces into a pre-mount hook.
Static interfaces are still configured on the fly as we add them, but
discussions on the mailing list have suggested that we need to have finer
control over bringing up dhcp interfaces.
The default hook just runs all the requested dhclients in parallel and waits
for them to all return. If you need something more complicated than this, or
need to have more control over bringing interfaces up, you will probably need
to override some stuff in the 40network hook.
Victor Lowther [Thu, 26 Feb 2009 02:42:09 +0000 (18:42 -0800)]
Save any dhcp options we did not handle to net.$interface.dhcpopts
Victor Lowther [Thu, 26 Feb 2009 02:42:07 +0000 (18:42 -0800)]
Update scripts to make things a little easier to read
Victor Lowther [Thu, 26 Feb 2009 02:42:05 +0000 (18:42 -0800)]
We now know how to configure the network interfaces.
Provided that you are configuring them via DHCP. RARP, BOOTP, and static
configuration are not written yet.
Also, adding nic drivers really bloats the initrd.
I am looking for feedback on these patches from people who actually implement
booting over the network. This patch series does not include support for that
yet -- you will not find nfsroot= handling, or booting to a fs supplied by
dhcp yet. I do want to make it as easy as possible to add support for booting
over the network, as well as making it easy for people to customize things to
meet their site requirements.
This patch series is also available as the network-configurability branch at
http://git.fnordovax.org/dracut. It may be rebased without warning to keep
it in sync with the rest of dracut.
Victor Lowther [Thu, 26 Feb 2009 02:32:46 +0000 (18:32 -0800)]
Add some predefined break points.
We now have a breakpoint just before each of the hook invocations, and one
just before we switch to the real root.
Victor Lowther [Thu, 26 Feb 2009 02:32:43 +0000 (18:32 -0800)]
Trim out device nodes we do not have to actually create.
If plymouth needs more, it can add them back in the hooks.
Victor Lowther [Thu, 26 Feb 2009 02:32:40 +0000 (18:32 -0800)]
Modify getarg to be slightly more useful.
If the last character in the argument to search for is "=", then
getarg will echo all the text after the = as well as returning 0 or 1 depending
on whether or not the arg is found.
Otherwise, getarg will jsut return 0 if the exact test of the argument is found,
1 otherwise.
Victor Lowther [Thu, 26 Feb 2009 02:32:36 +0000 (18:32 -0800)]
Move actually mounting the root filesystem into its own series of hooks.
We now have mount hooks. They are sourced in an infinite loop until one of
them actually mounts the real root filesystem.
This makes it easier to add support for arbitrarily complex schemes to find
the root filesystem without having to patch the init script.
This patch series is also avaialble ass the hookify-finding-root branch at
http://git.fnordovax.org/dracut
Victor Lowther [Sun, 22 Feb 2009 06:22:36 +0000 (00:22 -0600)]
cryptsetup does not like running in a while read loop.
Add some additional manglage to ensure that stdin/stdout is always pointing
the right thing. A more elegant way of doing this would be much appreciated
Victor Lowther [Sat, 21 Feb 2009 16:24:39 +0000 (08:24 -0800)]
Make cryptroot handling act as a real producer/consumer.
This should handle the case of having more than one encrypted
block device on the system as best we can right now.
Victor Lowther [Sat, 21 Feb 2009 16:24:35 +0000 (08:24 -0800)]
Support rootflags and rootfstype kernel parameters.
This also folds in support for ro and rw flags.
Victor Lowther [Sat, 21 Feb 2009 16:24:30 +0000 (08:24 -0800)]
We now support mounting the rootfs rw.
Victor Lowther [Sat, 21 Feb 2009 16:24:25 +0000 (08:24 -0800)]
We now support the noresume kernel parameter.
Victor Lowther [Sat, 21 Feb 2009 16:24:20 +0000 (08:24 -0800)]
tiny fixup to getarg to make handling more arguments slightly easier
This patch series adds support for some common mount arguments that have to be
handled in the initramfs.
It is also available at
http://git.fnordovax.org/dracut/log/?h=handle-more-parameters
Victor Lowther [Fri, 20 Feb 2009 17:24:26 +0000 (09:24 -0800)]
Make exec failure not kill init or switch_root.
If exec fails, then the shell will die unless the next command
is part of a command list. So, exec $whatever || onoes is the way to go
There are also some minor cleanups that were leftovers from splitting
out switch_root in its current form.
Victor Lowther [Fri, 20 Feb 2009 17:24:18 +0000 (09:24 -0800)]
Hooks and modules have a .sh extension
This makes it trivial to filter out temporary files, editor backups,
package management leftovers, etc. Thanks, Kay for the idea.
Dave Jones [Wed, 18 Feb 2009 18:00:59 +0000 (13:00 -0500)]
Fix typo in hook installation.
Spotted by Fatih Aşıcı <fatih@pardus.org.tr>
Victor Lowther [Tue, 17 Feb 2009 03:16:31 +0000 (19:16 -0800)]
Goodbye, nash. We won't miss you.
This supercedes my previous switch_root patches, and applies on top of davej's
repo at git.kernel.org.
Nash is gone. In its place we have a reasonable switch_root implementation.
Of course, this switch_root is written in some rather hideous shell script,
and relies on some rather dodgy hacks. Rewriting in C would help things out.
However, it should be distro-independent, and it gets the job done.
Victor Lowther [Fri, 13 Feb 2009 12:43:31 +0000 (04:43 -0800)]
[PATCH 50/50] Some documentation updates
Victor Lowther [Fri, 13 Feb 2009 12:43:29 +0000 (04:43 -0800)]
[PATCH 49/50] Modify hook loading to make it slightly easier to script.
Modules are now responsible for loading their hooks into the initrd.
This should be all the structure we need to make it easy for things
to integrate with dracut -- now to document and test it all.
Victor Lowther [Fri, 13 Feb 2009 12:43:26 +0000 (04:43 -0800)]
[PATCH 48/50] Shift some functionality around, make modules maskable.
Most of our functionality is now in scripts that we source rather than in the
main dracut script.
Victor Lowther [Fri, 13 Feb 2009 12:43:24 +0000 (04:43 -0800)]
[PATCH 47/50] Split out the various things we load into their own modules.
This should make it easier for distros to customize things according to
their preferences.
Victor Lowther [Fri, 13 Feb 2009 12:43:21 +0000 (04:43 -0800)]
[PATCH 46/50] fixed library-matching regex
Forgot about /lib64
Victor Lowther [Fri, 13 Feb 2009 12:43:19 +0000 (04:43 -0800)]
[PATCH 45/50] Really die if a library is not found.
Also explain how to find it.
Victor Lowther [Fri, 13 Feb 2009 12:43:16 +0000 (04:43 -0800)]
[PATCH 44/50] Get rid of echoer script
We can use sh -c to accomplish the same goal
Also move cat back on to the list of debugging tools -- all the files we were
using it on in the initrd can use read to accomplish the same goal.
Victor Lowther [Fri, 13 Feb 2009 12:43:14 +0000 (04:43 -0800)]
[PATCH 43/50] Use ldd to find shared library deps.
This replaces the eu-readelf and ld-linux.so.2 hackery.
As a bonus it will keep working if we (for some bizzare reason) need
to load a non-elf executable or shared library on the initrd.
Victor Lowther [Fri, 13 Feb 2009 12:43:12 +0000 (04:43 -0800)]
[PATCH 42/50] Add very basic module functionality to dracut.
Move the i18n stuff to it.
Victor Lowther [Fri, 13 Feb 2009 12:43:09 +0000 (04:43 -0800)]
[PATCH 41/50] dracut will now search for files in the usual binary locations if a
Victor Lowther [Fri, 13 Feb 2009 12:43:07 +0000 (04:43 -0800)]
[PATCH 40/50] Rearranged dracut script to make it easier to split things out for
Victor Lowther [Fri, 13 Feb 2009 12:43:04 +0000 (04:43 -0800)]
[PATCH 39/50] Prefer /bin/dash as /bin/sh on the initrd if it is available.
This is mainly for testing purposes -- if something non-POSIX is added to the
on initrd scripts, dash will die horribly.
Victor Lowther [Fri, 13 Feb 2009 12:43:02 +0000 (04:43 -0800)]
[PATCH 38/50] Missed some non-POSIX substitution in root filesystem label parsing.
Victor Lowther [Fri, 13 Feb 2009 12:42:59 +0000 (04:42 -0800)]
[PATCH 37/50] Try to install file as scripts before installing them as binaries
This ensures that scripts will ahve their interpreter isntalled before
they get installed.
Also included a minor fixup that skips library checking if the binary
we are testing is already installed.
Victor Lowther [Fri, 13 Feb 2009 12:42:57 +0000 (04:42 -0800)]
[PATCH 36/50] Move cat into the list of required executables
Victor Lowther [Fri, 13 Feb 2009 12:42:55 +0000 (04:42 -0800)]
[PATCH 35/50] POSIX-ize all the shell scripts that get installed to the initramfs.
Also install all the scripts using inst, so that we can install the right
shell interpreter for our scripts. We still install bash as well.
Victor Lowther [Fri, 13 Feb 2009 12:42:52 +0000 (04:42 -0800)]
[PATCH 34/50] Use inst to install hooks.
This will ensure that pathname mangling is handled correctly, and that
whatever interpreter is handling /bin/sh is installed as /bin/sh
Victor Lowther [Fri, 13 Feb 2009 12:42:50 +0000 (04:42 -0800)]
[PATCH 33/50] We now have a simple hook structure and 3 defined hook points.
Any script placed in /pre-udev will be sourced just before udev starts
device scanning and loading.
Any script placed in /pre-mount will be sourced just before we try to
mount a root filesystem.
Any script placed in /pre-pivot will be sourced just before we switch to the
new root filesystem.
These hooks should be the minimum needed to add back plymouth and deal with
more advanced filesysem mounting needs (multipath, iscsi, nfs, nbd, etc.)
Victor Lowther [Fri, 13 Feb 2009 12:42:48 +0000 (04:42 -0800)]
[PATCH 32/50] Created pre-mount hook directory
This is for tasks that should run after device discovery, but before
mounting the new rootfs. Things like cryptoroot and resume from hibernate
should go here.
Hooks are sourced, not executed as separate scripts.
Victor Lowther [Fri, 13 Feb 2009 12:42:45 +0000 (04:42 -0800)]
[PATCH 31/50] We no longer require plymouth. Remove it from the spec.
Victor Lowther [Fri, 13 Feb 2009 12:42:43 +0000 (04:42 -0800)]
[PATCH 30/50] We no longer need plymouth.
init will ask for a passphrase directly if an encrypted root is detected.
Also, use udevadm settle with a 30 second timeout instead of a hardcoded
30 count loop.
Victor Lowther [Fri, 13 Feb 2009 12:42:40 +0000 (04:42 -0800)]
[PATCH 29/50] Add echoer script
Victor Lowther [Fri, 13 Feb 2009 12:42:38 +0000 (04:42 -0800)]
[PATCH 28/50] Remove dependency on plymouth for getroot, pass 1.
Victor Lowther [Fri, 13 Feb 2009 12:42:36 +0000 (04:42 -0800)]
[PATCH 27/50] Don't leave cruft behind in /tmp
Victor Lowther [Fri, 13 Feb 2009 12:42:33 +0000 (04:42 -0800)]
[PATCH 26/50] Make init less noisy and load fs modules for all mounted filesystems
Victor Lowther [Fri, 13 Feb 2009 12:42:31 +0000 (04:42 -0800)]
[PATCH 25/50] Add dmesg to the list of debugging tools
Victor Lowther [Fri, 13 Feb 2009 12:42:28 +0000 (04:42 -0800)]
[PATCH 24/50] Replace inst function with a family of specialized functions
This makes things shorter and easier to read.
Victor Lowther [Fri, 13 Feb 2009 12:42:25 +0000 (04:42 -0800)]
[PATCH 23/50] Rip out old recursive module loading, replace with something simpler
bash allows unlimited recursion and several other tricks to make
finding all the dependencies of a kernel module much simpler.
This nukes about 130 lines, most of it in dracut-functions.
This diff also touches some cleanups made in the inst function.
Victor Lowther [Fri, 13 Feb 2009 12:42:22 +0000 (04:42 -0800)]
[PATCH 22/50] Bashify inst function where ot makes things easier to read.
Victor Lowther [Fri, 13 Feb 2009 12:42:20 +0000 (04:42 -0800)]
[PATCH 21/50] Simplified get_dso_deps
This takes advantage of several bash specific constructs to make
get_dso_deps easier to read and understand.
Victor Lowther [Fri, 13 Feb 2009 12:42:18 +0000 (04:42 -0800)]
[PATCH 20/50] set_verbose is not used anywhere. Buh-bye.
Victor Lowther [Fri, 13 Feb 2009 12:42:15 +0000 (04:42 -0800)]
[PATCH 19/50] The function keyword is deprecated. Get rid of it.
Victor Lowther [Fri, 13 Feb 2009 12:42:13 +0000 (04:42 -0800)]
[PATCH 18/50] outfile processing can fit all on one line, so make it.
Victor Lowther [Fri, 13 Feb 2009 12:42:11 +0000 (04:42 -0800)]
[PATCH 17/50] Tighten up the font installation case statement as well.
Victor Lowther [Fri, 13 Feb 2009 12:42:08 +0000 (04:42 -0800)]
[PATCH 16/50] $MNTIMAGE? I thought the install dir was $initdir.
Victor Lowther [Fri, 13 Feb 2009 12:42:06 +0000 (04:42 -0800)]
[PATCH 15/50] Tighten up the keymap installation case statement in dracut.
Victor Lowther [Fri, 13 Feb 2009 12:42:04 +0000 (04:42 -0800)]
[PATCH 14/50] Tighten up conditional checking a bit more.
Use bash-style conditionals where ever it makes things shorter
and easier to read.
Victor Lowther [Fri, 13 Feb 2009 12:42:02 +0000 (04:42 -0800)]
[PATCH 13/50] Missed an instance of $initdir not being quoted.
Victor Lowther [Fri, 13 Feb 2009 12:41:59 +0000 (04:41 -0800)]
[PATCH 12/50] Get rid of some redundancy when sourcing our functions.
Victor Lowther [Fri, 13 Feb 2009 12:41:57 +0000 (04:41 -0800)]
[PATCH 11/50] Quote variable expansion where needed.
Otherwise, spaces in some filenames may make things interesting some fine day.