196 Commits

Author SHA1 Message Date
Alkis Georgopoulos
b938c7ef37 configure_networking() wait for udev to populate available nics
Been seeing that since Karmic, and just reproduced it with Natty.

In /usr/share/initramfs-tools/scripts/functions, function
configure_networking() is called from the initramfs to setup a network
connection for e.g. diskless booting.  This function doesn't call `udevadm
settle` or anything similar to wait until the NICs are made available by udev.
So many times booting fails with messages like "ipconfig: no devices to
configure" etc.

Attaching a screenshot that displays the problem. configure_networking tried to
call ipconfig before the NIC was available, so booting failed. After a couple
of secs udev initialized the NIC.

Adding a call to `wait_for_udev 10` inside the configure_networking() function
solves the problem.

Tested in 3 different PCs and 1 vbox VM, they all experienced the problem
previously and they worked fine after applying the patch.

LP: #682445
Reviewed-by: Michael Prokop <mika@debian.org>
Signed-off-by: maximilian attems <max@stro.at>
2011-07-30 12:57:19 +02:00
Timo Juhani Lindfors
cd1981e084 panic: Load modules for highly probable USB keyboard
USB modules are not normally loaded at break=top time but since USB
keyboards are very common we should take the effort to try to load
extra kernel modules at break (=panic) time. This patch closes #615831
and has been adapted from comments mentioned in

https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/229732

and tested on a HP ProLiant MicroServer that lacks a PS2 port
completely.

[ Removed the check for an eventual PS2 driver as it might be running
  mice and not a keyboard -maks ]

Closes: #615831
Reviewed-by: Michael Prokop <mika@debian.org>
Signed-off-by: maximilian attems <max@stro.at>
2011-07-29 22:16:02 +02:00
Timo Juhani Lindfors
63932ccc83 panic(): print the name of each module before loading it
Loading a kernel module can crash the system so it is useful that the
user sees which module might be causing trouble.

Signed-off-by: maximilian attems <max@stro.at>
2011-06-01 10:52:31 +02:00
Michael Prokop
ee16a4ebfa set_initlist: redirect warning messages to stderr.
When running update-initramfs in verbose mode
stdout leaks into the environment and the behaviour
is different from running without the verbose option.

Closes: #601319
Reviewed-by: maximilian attems <max@stro.at>
Signed-off-by: Michael Prokop <mika@debian.org>
2011-05-16 20:55:46 +02:00
Evan Broder
ad1a59456b initramfs-tools: Fix handling of numeric root= arguments to be udev-friendly
If you pass a root= argument with a numeric device number
(i.e. root=0806), that's currently resolved by running mknod to create
a /dev/root device with an appropriate major/minor number and setting
ROOT=/dev/root (the parse_numeric function in scripts/functions).

However, this /dev/root device is completely unknown to udev. On
Ubuntu, this leads to problems because we use udev to wait for the
root device to appear. Since /dev/root isn't in udev's database, the
boot hangs forever (well, it hangs until rootdelay passes).

udev's standard configuration creates /dev/block/N:N symlinks for
every block device in its database (see the first non-comment line of
/lib/udev/rules.d/50-udev-default.rules). Setting ROOT to the
/dev/block/N:N symlink instead of creating a new /dev/root device and
setting ROOT to that solves Ubuntu's problem.

See https://bugs.launchpad.net/bugs/576429 for more discussion.

I think I actually want to take a different approach in order to
maintain the current semantics of setting root=X:Y.

In particular, if the user passes in a value that has a prefixed 0,
that will get passed directly to mknod, which would treat the number
as octal. So root=010:0 would actually create a device with major
number 8. Instead of trying to resolve this directly, we can use the
shell's arithmetic expansion to get a decimal number back.

Closes: #606806

[ change condition from specific udev script to udevd availability. ]
Signed-off-by: maximilian attems <max@stro.at>
Reviewed-by: Michael Prokop <mika@debian.org>
2011-03-30 11:35:20 +02:00
Timo Juhani Lindfors
2525b00812 initramfs-tools: Inform the user about reboot on panic=
Currently if a system administrator uses "panic=60 break=top" boot
options initramfs prints

Spawning shell within the initramfs

but does not actually spawn the shell since panic= disallows
that. This patch explicitely informs the user about the reboot and
hints that by reminving panic= he/she can get break= debugging to
work.

Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
[ small wording change -maks ]
Signed-off-by: maximilian attems <max@stro.at>
2011-02-28 11:24:44 +01:00
Timo Juhani Lindfors
871ffe7aef initramfs-tools: Make panic message visible even if panic= is used
The purpose of panic= is to make the system reboot automatically on
panic but also give the interactive user some time to see what went
wrong.

Signed-off-by: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Signed-off-by: maximilian attems <max@stro.at>
2011-02-28 11:22:41 +01:00
maximilian attems
6cab0eccd0 initramfs-tools: cleanup any usplash traces
usplash is not released in Squeeze and is no longer in Debian unstable.
Thus nuke usplash calls and any ref to it.

Signed-off-by: maximilian attems <max@stro.at>
Reviewed-by: Michael Prokop <mika@debian.org>
2011-02-23 18:08:53 +01:00
maximilian attems
6c144d00e4 fix path to nfsroot documentation
gained another dir in current linux-2.6.

Signed-off-by: maximilian attems <max@stro.at>
2010-11-04 19:40:47 +01:00
Vagrant Cascadian
85fbb23edd configure_networking(): Look for presence of /tmp/net-*.conf files
when $DEVICE is not set (which is now default), otherwise ipconfig may
receive a valid DHCP response, but fails to break out of the loop and is
called repeatedly.

thanks to Petter Reinholdtsen, i think i've figured out the
initramfs-tools portion of this problem (there may still be outstanding
issues with ipconfig).

tested the attached patch, which seems to address the issue for me at
least.

Closes: #584583

Signed-off-by: maximilian attems <max@stro.at>
2010-08-25 21:37:22 +02:00
maximilian attems
a4e1a9ea73 initramfs-tools: only allow hook scripts to errexit on mkinitramfs
version is "the" essential exported variable by mkinitramfs.
Use it's string length to determine that we are on mkinitramfs stage
and not trying to boot a not precached initramfs image.

hook scripts on boot can exit due to random failures and shouldn't
interrupt boot there.

Signed-off-by: maximilian attems <maks@debian.org>
2010-08-07 00:03:32 +02:00
maximilian attems
0b5ce7cd3e initramfs-tools: output name of script that errexits.
this should make bug reports concerning bogus hook scripts easier to
handle, like the *loooong* iscan story.

Closes: 586554

Signed-off-by: maximilian attems <maks@debian.org>
2010-07-06 12:48:56 +02:00
maximilian attems
837f2614f7 mkinitramfs: set nounset and errexit
Better catch both early than stupid mistakes cropping in.

Signed-off-by: maximilian attems <maks@debian.org>
2010-06-22 11:25:07 +02:00
Michael Prokop
7faeb32bd8 fix typos in manpage, scripts/functions and conf/initramfs.conf - thanks lintian
* paramater -> parameter
* adress -> address
* adress -> address
* overriden -> overridden
* correponds -> corresponds
* correponds -> corresponds
* Overriden -> Overridden
* usualy -> usually

Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-18 15:45:51 +02:00
maximilian attems
6147641d91 nfsmount: more small cleanups
code up the nfs rootdelay in a more efficient way.
here people need the time it takes, so stay on 180s.

Signed-off-by: maximilian attems <maks@debian.org>
2010-06-18 11:43:37 +02:00
Ferenc Wagner
1d66ae1f03 scripts/nfs: cleanup retry logic
The condition of log_end_msg was always true.
Calling do_nfsmount before the loop lets us drop two other checks.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: maximilian attems <maks@debian.org>
2010-06-18 11:43:37 +02:00
Michael Prokop
74f71c9697 scripts/functions: fix another sh -n usage and fix typo
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-17 16:16:07 +02:00
Michael Prokop
2ff4ba20c4 scripts/functions: fix usage of test for script execution
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-17 15:00:50 +02:00
maximilian attems
ae02e4b51c scripts/functions: beautify a bit reduce_satisfied()
shorten code, no code change. function easier to read.

Signed-off-by: maximilian attems <maks@debian.org>
2010-06-17 14:34:23 +02:00
maximilian attems
68c87cd042 mkinitramfs: check syntax of boot and hook scripts
only run them when sytax is good. Idea from LP: #570243.

important now that we have errexit on for them.

Signed-off-by: maximilian attems <maks@debian.org>
2010-06-17 14:32:13 +02:00
maximilian attems
38563fedd5 scripts/functions: On panic change to tty1 if chvt around
To make sure the user can read any error messages displayed. (LP: #243226)
usplash and other may cause the user to land somewhere,
where nothing is displayed.

merge from Ubuntu with adding conditional chvt invocation,
as it may not be around.

Thanks: Luke Yelavich <themuso@ubuntu.com>
Thanks: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: maximilian attems <maks@debian.org>
2010-06-17 11:26:52 +02:00
maximilian attems
eb93a7e7d1 pre_mountroot(): reduce timeout to 30 seconds
giant disk arrays, clusters will need to provide their own rootdelay=
boot arg, they should have capable admins.

3 minutes wait is just too long for regular users.

sync from ubuntu 0.96.1ubuntu1.

Acked-by: Michael Prokop <mika@debian.org>
Signed-off-by: maximilian attems <maks@debian.org>
2010-06-17 11:24:07 +02:00
maximilian attems
b9de5de1a5 Merge branch 'master' of git+ssh://git.debian.org/srv/git.debian.org/git/kernel/initramfs-tools 2010-06-16 17:31:14 +02:00
maximilian attems
b1f74e6978 get_fstype: reference blkid in comment
the removal of vol_id compat code as requested in #585419
is to early as we need it for Lenny upgrades.
Nevertheless have the comment point to the newer tool. :)

Thanks: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: maximilian attems <maks@debian.org>
2010-06-16 17:29:11 +02:00
Martin Michlmayr
bb66fc2a8b hook-functions/init/scripts/local: add support for ubifs.
MODULES=dep fails when / is ubifs. This patch adds support for
something like root=ubi0:rootfs when ubi is modular.

Quoting Martin:

    It essentially does three things:
     - adds the correct modules to the ramdisk (for MODULES=dep and MODULES=most)
     - reads ubi.mtd= from the command line
     - loads ubi with the ubi.mtd info and ignores the "Waiting for root" check

    I've successfully tested this with a kernel with modular ubi and with
    the following boot variants:
      console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs
      console=ttyS0,115200 ubi.mtd=2 root=ubi0_0 rootfstype=ubifs

    With
      console=ttyS0,115200 ubi.mtd=2 root=/dev/ubi0_0 rootfstype=ubifs
    I get an error that it cannot mount root but I suspect this is an
    ubifs error and has nothing to do with i-t (since at this point I can
    manually mount it with -t ubifs ubi0_0 whereas the /dev/ variant
    doesn't work).

    Tested with MODULES=dep and MODULES=most as well as with a kernel that
    has ubifs built in.

Closes: #582858
Thanks: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Reviewed-by: Michael Prokop <mika@debian.org>
2010-06-16 16:48:06 +02:00
Michael Prokop
5b565beaea scripts/functions: allow hooks to abort build
Execute call_scripts() under "set -e" so hook
scripts can exit initrd build iff necessary.

Closes: #396388
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-16 11:09:40 +02:00
Michael Prokop
60afd2a944 code cleanup: drop trailing whitespaces.
Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-14 12:10:28 +02:00
Michael Prokop
90d76d566f Support dashes inside scripts names.
[Closes: #566056]

Signed-off-by: Michael Prokop <mika@debian.org>
2010-06-08 11:10:01 +02:00
maximilian attems
2487528907 configure_networking(): work with empty DEVICE string
initramfs-tools currently requires a device to be hard-coded, but this
is not much use if the network device is not known ahead of time.  If
the device specified in either /etc/initramfs-tools/initramfs.conf or
on the ip=xxx kernel command line.

usefull for multiple net devices.

Based on patch by Tim Small <tim@seoss.co.uk>

Closes: #566295, #575766

Reviewed-by: Vagrant Cascadian <vagrant@freegeek.org>
Signed-off-by: maximilian attems <maks@debian.org>
2010-04-10 15:57:30 +02:00
Vagrant Cascadian
5db5becc85 configure_networking: pxelinux BOOTIF fixes
looks like i missed a few things on implementing BOOTIF support properly.

somehow i managed to get the order of the mac address backwards. i know i
tested it many times..

Signed-off-by: maximilian attems <maks@debian.org>
2010-04-10 06:33:19 +02:00
maximilian attems
f9db3f7bcb mkinitramfs: Fix several unbound variables
might not be all, but a first go in stricter mkinitramfs.
as bonus remove old amusing unused varialbe from day 2..

Signed-off-by: maximilian attems <maks@debian.org>
2010-04-07 07:25:06 +02:00
Scott James Remnant
553aa3742c mkinitramfs: generate pre-cached boot order file
if tsort is available, use it instead of custom sorting code
if a pre-cached order file is available, use that instead

[ move cache_run_scripts from scripts/functions to hook-scripts
  as only used on mkinitramfs build and not on boot ]

Signed-off-by: maximilian attems <maks@debian.org>
2010-04-05 04:09:43 +02:00
maximilian attems
9d6567169e scripts/functions: add get_fstype() from scripts/local
allows wider usage.

(closes: #487409)

Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: maximilian attems <maks@debian.org>
2010-04-04 05:31:49 +02:00
maximilian attems
7ea605d62c Use ata_generic driver on all_generic_ide bootarg
[ merge from 0.92bubuntu1 ]
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: maximilian attems <maks@debian.org>
2010-04-04 02:16:39 +02:00
maximilian attems
c713fd9872 panic: quote variable
Reported-by: Loïc Grenié <loic.grenie@gmail.com>
Signed-off-by: maximilian attems <maks@debian.org>
2010-03-26 20:36:39 +01:00
Anna Jonna Armannsdottir
40b99bb35a configure_networking: Try repeatedly ipconfig with increasing timeout
Here is a bug description and a patch. Please consider it.
The patch solves a an LTSP client problem that arises when
the clients are connected to Cisco switches that have
spanning-tree calculations enabled.

Also related to:
http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=9c3ec61b1a5e2feaa8d9c6de737eaa00eb446a9c
And
http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=115134f07a0dd042355a2a6fb5a5ca987b000f5d

Here in an extensive explaination:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/181258
Also in the following:

I can report the same problem. A number of diskless clients go
flawlessly through a PXE boot, then the net interface is brought down
when the Linux kernel boots and suddenly, dhcp does not work anymore.

Background research on the network: The clients are connected to Cisco
switches. The configuration of the switches makes them run spanning-tree
calculations. This usually takes some seconds but for large networks it
can take up to 30 40 seconds.
The network port on the switch is turned on, when this calculation has
been finished. This is primarily a security measure.
See also: http://networkers-online.com/blog/2008/08/what-is-bpdu-filter/
If this security measure is turned off, the client boots without
problems. :)

To debug the problem, the following boot line was used:

  kernel amd64/vmlinuz
  append ro initrd=amd64/initrd.img nbdport=2000 debug=100 break=1
ip=dhcp

In my case, this causes a timeout as can be seen on the attached
screenshots. The kernel loads the NIC module e1000e and reports the type
of NIC et.c. The kernel time reported is 5.927 .

The debug shows the following:

configure_networking
[ -n eth0 ]
 [-e /tmp/net-eth0.conf ]
ipconfig -t 60 eth0

At about 6.4 in kernel time, the NIC module reports further about it's
IRQ configuration.
Two seconds (2 sec) later at about 8.56 the NIC module reports that the
Link is up at 100 Mbps full duplex.
Some milliseconds later it signals ADDRCONF(NETDEV_CHANGE): eth0: link
becomes ready .

At this point in time, ipconfig is just waiting for an answer to the
DHCP-discover that really was choked by the switch.
Now this is an obvious flaw in the script. It would be much more
reasonable to try repeatedly with increasing timouts. This would also
be much more efficent.

may I suggest the following timeouts:
4
8
16
30
60

The sum of this timeout is about 120 seconds.

I did some testing with exponential timeout with 1 2 4 8 16 30 ...
and it solved the problem, but it seems that ipconfig runs once
additionally after it has actually done the job.

I am running tests now with an exponent of n/1.5 instead of n.
That would give a sequence of (ca)
2 3 4 6 9 16 25 36 64 100

Attached are a jpeg screenshot of the boot sequence and of
course the patch. The patch is relative to the present git
snapshot.

--
Kindest Regards, Anna Jonna Ármannsdóttir,       %&   A: Because people read from top to bottom.
Unix System Aministration, Computing Services,   %&   Q: Why is top posting bad?
University of Iceland.

Signed-off-by: maximilian attems <maks@debian.org>
2010-03-25 02:14:33 +01:00
maximilian attems
df43f67500 scripts/local: fix blkid invocation
49337bd looks bogus. It adds the test "[
            command ... ]" but I think that should be just "command ..."

Reporte-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: maximilian attems <maks@debian.org>
2010-02-25 00:57:13 +01:00
Vagrant Cascadian
673abb7782 configure_networking: support BOOTIF variable set by pxelinux
updated patch against current master, using only shell, and with a cleaner
method to convert BOOTF to a typical mac address.

(closes: #567540)

Signed-off-by: maximilian attems <maks@debian.org>
2010-02-24 18:13:02 +01:00
maximilian attems
1bf31aaa5b blacklist earlier at init-top stage
as udev will start earlier, care to blacklist before it loads.

Signed-off-by: maximilian attems <maks@debian.org>
2010-02-22 23:37:29 +01:00
Ferenc Wagner
323005e4b8 initramfs-tools: make the panic argument available in the rescue shell
Sometimes one misses the error message printed by the panic helper function,
for example when attaching a serial console after the fact, or if kernel
messages resulting from udev activity obscure or scroll it away.

Please consider adding some facility like the attached patch.

Thanks,
Feri.

(closes: #569033)


Signed-off-by: maximilian attems <maks@debian.org>
2010-02-22 22:35:58 +01:00
maximilian attems
49337bdc94 scripts/local: Use blkid as backup fstype detection
if blkid is on initramfs use it.

Thanks to Joey Hess <joeyh@debian.org> for calling syntax.

Signed-off-by: maximilian attems <maks@debian.org>
2010-01-30 19:54:13 +01:00
Joey Hess
90c19d7bac scripts/local: avoid mount -t unknown
Since fstype does not support btrfs (#548047),
and since udev 150, vol_id no longer exists,
get_fstype sets FSTYPE to "unknown", and
then the root filesystem is mounted using
"mount -t unknown /dev/hda2 /root".

Of course, that fails, and with a really unhelpful error message
("mount: device doesnot exist")

Why not just skip the -t parameter if FSTYPE=unknown?
Mounting the root fs was going to fail, so letting
mount autodetect the fs type can't be worse.

Attached patch does that and got my root on btrfs working.

Workaround: boot with rootfstype=btrfs

Signed-off-by: maximilian attems <maks@debian.org>
2010-01-30 19:44:24 +01:00
Tormod Volden
919c099e12 blacklist boot hook write to /etc/modprobe.d/initramfs.conf
Newer modprobe will only look at .conf files.

(closes: #541864)

Signed-off-by: maximilian attems <maks@debian.org>
2009-09-25 02:02:26 +02:00
maximilian attems
db24ed6ec7 nuke framebuffer boot script
fb should be loaded after initramfs by init to have a beautiful
userland. allows faster boot not to try parsing crazy things
with only posix sh at our hands.

this will need a README.DEBIAN section as noone is now currently
loading fbcon.

Signed-off-by: maximilian attems <maks@debian.org>
2009-07-29 15:48:15 +02:00
maximilian attems
c5e39cd1cb nuke thermal hooks
thrive for a smaller initramfs,
were loading of the modules is so fast that acpi should be loaeded
by udev after init(8) call.

Signed-off-by: maximilian attems <maks@debian.org>
2009-07-29 15:06:56 +02:00
Aaron M. Ucko
4a4dda7aff scripts/init-top/framebuffer: i915 needs intel-agp too
The i915 DRM module doubles as a framebuffer of sorts, at least in kernel
mode-setting setups; like its cousins intelfb and i810fb, it effectively
requires intel-agp despite not actually using any of its symbols.  As
such, could you please arrange for scripts/init-top/framebuffer to give
it the same treatment, per the following patch?:

(closes: #533258)

Signed-off-by: maximilian attems <maks@debian.org>
2009-06-16 18:57:23 +02:00
maximilian attems
d703b8ca26 cleanup LABEL handling code
make it more concise:
* use POSIX ${parameter:+word}
* replace *[/]*) by just */*)
* test exit code of command -v rather then running test -x on it

while we are at it fix another command -v usage in scripts/functions.

Reviewed-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: maximilian attems <maks@debian.org>
2009-04-03 14:52:20 +02:00
maximilian attems
97f26c6e0d mkinitramfs: Allow dots in boot and script filenames.
the regex was overly severe not allowing dots althoug they are
useful as word ending.

based on a patch in launchpad, that didn't get all occurences right,
but was a good start.

(LP: #305837)
2009-04-02 12:41:17 +02:00
maximilian attems
f3049298fe init-top/framebuffer: syntax fix.
fix wrong merge of e184c8c2a9ad4520cf0cf4536301c6ae6206e911
scripts/init-top/framebuffer: 84: Syntax error: ")" unexpected (expecting ";;")
2009-04-02 01:54:46 +02:00
Maik Zumstrull
e184c8c2a9 init-top/framebuffer: Load intel-agp for intelfb
After further experimentation, I discovered additional problems that my
first patch did not address, namely that

1) Some FB drivers need the AGP subsystem up and running before they
   are loaded and
2) intelfb needs intel-agp.ko, but does not have a dependency on it.

intelfb does not actually *work* on my testsystem after this (it
crashes), but unlike with plain initramfs-tools, it loads (and prints
something useful if loaded with the probeonly option). I'll try to find
out why it fails to work tomorrow; it's probably an unrelated issue.

[ make the patch applyable, probably whitespace damaged, fix comments,
  no need to pass -q to modprobe that is set globaly -maks ]

(closes: #416063, #455876)

Signed-off-by: maximilian attems <maks@debian.org>
2009-03-31 16:00:05 +02:00