Gentoo Archives: gentoo-user

From: Kai Krakow <hurikhan77@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Kernel did not finding root partition
Date: Tue, 30 May 2017 19:28:32
Message-Id: 20170530212805.5f7cc7f9@jupiter.sol.kaishome.de
In Reply to: Re: [gentoo-user] Re: Kernel did not finding root partition by Peter Humphrey
1 Am Tue, 30 May 2017 09:26:03 +0100
2 schrieb Peter Humphrey <peter@××××××××××××.uk>:
3
4 > On Monday 29 May 2017 21:42:28 Kai Krakow wrote:
5 > > Am Mon, 29 May 2017 19:16:11 +0100
6 > >
7 > > schrieb Neil Bothwick <neil@××××××××××.uk>:
8 > > > On Mon, 29 May 2017 15:07:48 -0300, Raphael MD wrote:
9 > [...]
10 > [...]
11 > > >
12 > > > You said you were using rEFInd, why have you got GRUB as well.
13 > > > rEFInd can work without a config, GRUB cannot.
14 > >
15 > > This puzzles me, too... Maybe rEFInd was installed to sda and grub
16 > > installed to sda1, so rEFInd would chain-boot through grub.
17 > >
18 > > Grub, however, won't work without a config file. I'd also suggest to
19 > > skip grub completely and use just one loader.
20 >
21 > Not only that, but for some reason I couldn't get grub to work at all
22 > on my Asus UEFI system. I use systemd-boot only, with a separate
23 > config file for each kernel I might want to boot. (I do not have the
24 > rest of systemd in this openrc system; just its boot program.)
25 >
26 > It might not help the OP but this is my script for compiling a kernel:
27 >
28 > # cat /usr/local/bin/kmake
29 > #!/bin/bash
30 > mount /boot
31 > cd /usr/src/linux
32 > time (make -j12 && make modules_install && make install &&\
33 > /bin/ls -lh --color=auto /boot &&\
34 > echo &&\
35 > cp -v ./arch/x86/boot/bzImage /boot/EFI/Boot/bootX64.efi
36 > ) &&\
37 > echo; echo "Rebuilding modules..."; echo &&\
38 > emerge --jobs --load-average=48 @module-rebuild @x11-module-rebuild
39 >
40 > He may be missing the copying step; that would explain his inability
41 > either to boot or to supply the info you asked him for.
42
43 I hooked into the install hook infrastructure of the kernel instead:
44
45 $ cat /etc/kernel/postinst.d/70_rebuild-modules
46 #!/bin/bash
47 exec env -i PATH=$PATH /usr/bin/emerge -1v --usepkg=n @module-rebuild
48
49 $ cat /etc/kernel/postinst.d/90_systemd
50 #!/bin/bash
51 /usr/bin/kernel-install remove $1 $2
52 /usr/bin/kernel-install add $1 $2
53
54 This takes care of everything and the kernel-install script from
55 systemd also rebuilds the dracut initrd (because it installed hooks
56 to /usr/lib/kernel/install.d).
57
58 eclean-kernel can then be used to properly clean up obsolete kernel
59 versions. I'm running it through cron to keep only the most recent 5
60 kernels at weekly intervals.
61
62 For the hooks to properly execute at the right time, it is important to
63 give the "make install" target last:
64
65 $ cd /usr/src/linux
66 $ make oldconfig
67 # make -j9
68 # make modules_install firmware_install install
69
70 The "install" target triggers the hooks, so modules have to be already
71 installed at that time.
72
73 Additionally I have a script to rebuild dracut easily on demand (e.g.,
74 when early boot components were updated or changed):
75
76 $ cat /usr/local/sbin/rebuild-dracut.sh
77 #!/bin/bash
78 set -e
79 if [ "$1" == "-a" ]; then
80 versions=$(cd /boot && ls vmlinuz-* | fgrep -v .old | sed 's/vmlinuz-//')
81 else
82 versions="$@"
83 fi
84 versions=${versions:=$(uname -r)}
85 for hook in $(ls /etc/kernel/postinst.d/*_{dracut,grub,systemd} 2>/dev/null); do
86 for version in $versions; do
87 ${hook} ${version%.old} /boot/vmlinuz-${version}
88 done
89 done
90
91
92 --
93 Regards,
94 Kai
95
96 Replies to list-only preferred.