1 |
commit: 6b3e3dfbc265ef47c2c2e008ad31ae79041225b6 |
2 |
Author: Richard Yao <ryao <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Sep 21 01:44:36 2015 +0000 |
4 |
Commit: Richard Yao <ryao <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 21 13:13:30 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=6b3e3dfb |
7 |
|
8 |
Cleanup logic to find rootfs on ZFS |
9 |
|
10 |
We no longer support root=ZFS. Only root=ZFS=$dataset is supported. |
11 |
GRUB2 never used that syntax and users never liked it, so that should be |
12 |
okay. |
13 |
|
14 |
We also handle the case where the root pool is missing from the |
15 |
cachefile or the cachefile itself is missing by informing users of how |
16 |
to repair the system. We inform them rather than do it ourselves because |
17 |
a step is required after the pool is imported and while we can do it for |
18 |
them, the heuristics are unlikely to be right 100% of the time and we |
19 |
really should not be making changes to the rootfs from the initramfs. |
20 |
|
21 |
Signed-off-by: Richard Yao <ryao <AT> gentoo.org> |
22 |
|
23 |
defaults/linuxrc | 48 +++++++++++++++++++++++------------------------- |
24 |
1 file changed, 23 insertions(+), 25 deletions(-) |
25 |
|
26 |
diff --git a/defaults/linuxrc b/defaults/linuxrc |
27 |
index 877d845..dc129ce 100644 |
28 |
--- a/defaults/linuxrc |
29 |
+++ b/defaults/linuxrc |
30 |
@@ -523,11 +523,27 @@ do |
31 |
fi |
32 |
;; |
33 |
ZFS*) |
34 |
- if [ "${USE_ZFS}" = '0' ]; then |
35 |
+ zpool list -H -o name | grep -q "${ZFS_POOL}" |
36 |
+ if [ $? -ne 0 ] |
37 |
+ then |
38 |
+ if [ ! -e /etc/zfs/zpool.cache ] |
39 |
+ then |
40 |
+ bad_msg "${ZFS_POOL} not imported due to missing zpool.cache file." |
41 |
+ |
42 |
+ else |
43 |
+ bad_msg "${ZFS_POOL} absent from zpool.cache file." |
44 |
+ fi |
45 |
+ bad_msg "Provided that ${ZFS_POOL} exists, you can correct this by:" |
46 |
+ bad_msg |
47 |
+ bad_msg "1. Dropping to a shell." |
48 |
+ bad_msg "2. Running \`zpool import -d /dev/disk/by-id -N ${ZFS_POOL}\`" |
49 |
+ bad_msg "3. Pressing Cntl+D to exit." |
50 |
+ bad_msg "4. Running \`zpool set cachefile= ${ZFS_POOL}\` (space after equal sign)" |
51 |
+ bad_msg " as root after system has booted." |
52 |
prompt_user "REAL_ROOT" "root block device" |
53 |
+ got_good_root=0 |
54 |
continue |
55 |
fi |
56 |
- |
57 |
ROOT_DEV="${REAL_ROOT#*=}" |
58 |
if [ "${ROOT_DEV}" != 'ZFS' ] |
59 |
then |
60 |
@@ -543,29 +559,11 @@ do |
61 |
continue |
62 |
fi |
63 |
else |
64 |
- BOOTFS=$(/sbin/zpool list -H -o bootfs) |
65 |
- if [ "${BOOTFS}" != '-' ] |
66 |
- then |
67 |
- |
68 |
- for i in ${BOOTFS} |
69 |
- do |
70 |
- |
71 |
- zfs get type ${i} > /dev/null |
72 |
- retval=$? |
73 |
- |
74 |
- if [ ${retval} -eq 0 ]; then |
75 |
- got_good_root=1 |
76 |
- REAL_ROOT=${i} |
77 |
- ROOTFSTYPE=zfs |
78 |
- break |
79 |
- fi |
80 |
- |
81 |
- done; |
82 |
- |
83 |
- else |
84 |
- got_good_root=0 |
85 |
- fi |
86 |
- |
87 |
+ bad_msg "root=ZFS is no longer supported." |
88 |
+ bad_msg "Please specify root=ZFS=\$DATASET:" |
89 |
+ prompt_user "REAL_ROOT" "root block device" |
90 |
+ got_good_root=0 |
91 |
+ continue |
92 |
fi |
93 |
|
94 |
if [ ${got_good_root} -ne 1 ]; then |