These two functions were a real mess, and the cure is painful.
${REAL_ROOT} setup code and ${REAL_ROOT} init code are now cleaner
and easier to read. ZFS support should have been preserved but
I may have caused new regressions. These changes should be tested.
tuxonice is almost dead. Last update was in 2011 and they're now
trying to resurrect this ugly and non-upstream friendly thing.
Moreover, the tuxonice genkernel code is the ugliest thing I have
ever seen in it. Well no, unionfs was even worse.
So please, let's forget about tuxonice for now and focus on the
good looking code. I am willing to accept patches that restore
tuxonice support if they're good quality ones.
Burn tuxonice init code, burn in hell.
The crazy function should only return to stdout valid devices in
case of UUID= or LABEL=. Other cases are just ignored and not checked
as it was before.
Before trying to mount a filesystem, check if it's already mounted first.
This way we can call ensure_initramfs_mounts multiple times during
the pivot root initialization.
Commit 3a054014e8 replaced our modprobe
with busybox's modprobe. Unfortunately, busybox's modprobe appears to be
unable to properly load modules with more than 1 level of dependencies.
The zfs and zpool commands will invoke modprobe if /dev/zvol is missing,
which concealed this problem. However, this caused problems because some
invocations would fail and under certain circumstances, init would be
killed, causing a kernel panic. This issue was made clear by commit
c812c35100771bb527f6b03853fa6d8ef66a48fe, which ensured that the zpool
and zfs commands were not run until the ZFS module was loaded.
busybox modprobe's failure to load module dependencies correctly appears
to occur because busybox modprobe does not wait until until a module is
loaded before loading a module that depends on it, which is a race. It
would be best to correct this race by waiting until the module has
properly loaded, but it is not clear that the race is the only thing
going wrong and developer time is a premium.
We implement a workaround by modifying the busy loop added in the
previous commit to explicit call `modprobe zfs` on each iteration. While
the first few calls fail due to bugs in busybox modprobe, it will
eventually work, after which each call is a noop. This lets us keep
looping until either the loop exit condition that /dev/zvol exist is
reached or the 5 second timeout is reached.
Once the busybox modprobe issue is fixed, this workaround should be safe
to revert.
Signed-off-by: Richard Yao <ryao@gentoo.org>
There is a race between ZFS module initialization and our attempt to
import pools. We address this by doing a busy wait for the /dev/zfs
device to appear. We wait a maximum of 5 seconds for the device to
appear.
We also slightly alter output messages to be more readable.
Signed-off-by: Richard Yao <ryao@gentoo.org>
Conflicts:
defaults/initrd.scripts
call_func_timeout permits us to call a helper function and kill it
should it exceed some timeout. This is derived from example code posted
on Stack Overflow:
http://stackoverflow.com/a/11056286
Signed-off-by: Richard Yao <ryao@gentoo.org>
Conflicts:
defaults/initrd.scripts
At least one kernel configuration generates an addition module that we
need to load for USB 3.0 support, so lets load it.
Reported-by: Robin Johnson <robbat2@gentoo.org>
Signed-off-by: Richard Yao <ryao@gentoo.org>
udev may still be processing rules and this can cause very bad
things. For instance, modules_load may have loaded an usb host
controller driver and we must wait for the udev rules to terminate.
However, this may lead to other race conditions, but we have
observed that adding scandelay=n where n >= 5 actually fixes the
issue of booting off USB under certain scenarios.
"quiet" is already used by the kernel to avoid printing messages on the
console unless they are errors or warnings. Genkernel should do the same
wrt its initramfs initialization code.
This has also the advantage of improving the boot speed.
scandelay=<secs> should be always preferred. Moreover, nowadays
automatically sleeping waiting for USB storage to come up in
the way we were used to do it doesn't work as one expects, because
USB is very common and USB storage devices are very likely to be
present on a system.
Furthermore, the initialization code after setup_slowusb is already
waiting for devices to come up.
While this makes out of the box booting a bit harder on some ancient CD/DVD
drives, it really speeds up the common use case by not sleeping for 3 seconds.
Our modprobe is an ancient heritage from the past, probably dating to
a time where busybox's modprobe features were limited. There is no reason
at all to keep using our own version instead of the busybox one.
This commit also makes modules_scan 15% faster.
Nearly every general documentation including the one in the
kernel tree and the scripts for GRUB2 all expects this flag
to work.
Signed-off-by: Peter Hjalmarsson <xake@rymdraket.net>
If INIT_OPTS='' is not specified before the argument loop, scoping rules
will prevent it from being seen by the switch_root invocation.
Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Clean up documentation and functionality of "part" argument to
initramfs. It is meant to imitate the same option to the kernel.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
The default value of ${ZPOOL_USAGE} is unset, quoting it would result into
a "" argument passed to zpool. The workaround to this is to use "dozfs=force"
boot argument.
Signed-off-by: Richard Yao <ryao@gentoo.org>
LUKS keydevs now support mount by UUID/LABEL.
X-Gentoo-Bug: 378105
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=378105
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
We do not support ramdisk, only initramfs nowdays.
So init= is a dead command, and we may as well have it do the same as
it does for dracut and in the Linux kernel documentation.
(Use rdinit to choose the initramfs init file)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Somewhere in the mists of time we lost part of the multipath patch, so
we were bundling the userspace, but not the kernel modules, or ever
using it.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
The old driver is problematic, as even with the pata_amd module loaded,
it will not release the device. Disable the old driver on remaining
platforms, add pata_amd where missing & needed (not alpha).
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Running `mdev -s` will ensure that device nodes are properly initialized.
It does not function as a netlink hotplug daemon. We must run it after
the modules are loaded to ensure that /dev/zfs has been created before
userland programs attempt to use it.
Effective for genkernel's modprobe script or busybox "not small"
modprobe.
Signed-off-by: Dzianis Kahanovich <mahatma@eu.by>
Updated-by: Richard Yao <ryao@cs.stonybrook.edu>