Gentoo Archives: gentoo-user

From: Andrew Barchuk <andrew@×××××××.io>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] fsck check of /usr on a separate partition fails during boot
Date: Sun, 14 Jan 2018 11:06:32
Message-Id: 1515927983.1011572.1234761720.1A5ED2DB@webmail.messagingengine.com
In Reply to: Re: [gentoo-user] fsck check of /usr on a separate partition fails during boot by David Haller
1 Thanks everyone, I've nailed it \o/ A more detailed story follows.
2
3 After taking the approach of offloading / and /usr checks to Dracut I've
4 disabled fsck for those partitions in /etc/fstab so OpenRC fsck wouldn't
5 attempt to check /usr (and fail) by setting passno (the last column to
6 0). It turned out that Dracut honours fstab for fsck too (root get
7 special treatment and is checked anyways). After enabling fsck in fstab
8 for / and /usr Dracut started to check /usr - a small win already. No
9 the only thing left to do was to _not_ check / and /usr by the init fsck
10 which was natural to do by setting fsck_passno=">1" in /etc/conf.d/fsck.
11
12 Now all the filesystems are checked during the boot: the ones having
13 passno 1 (root and /usr) by the initramfs and passno 2 (/var, /home,
14 /data) by the init. The relevant excerpts from the final configuration
15 are below.
16
17 /etc/fstab:
18 /dev/MacVg/gentoo-root / ext4 defaults 0 1
19 /dev/MacVg/gentoo-usr /usr ext4 defaults 0 1
20 /dev/MacVg/gentoo-var /var ext4 nodev,nosuid 0 2
21 /dev/MacVg/gentoo-home /home ext4 nodev,nosuid 0 2
22 /dev/MacVg/data /data ext4 nodev,nosuid,noexec 0 2
23
24 /etc/dracut.conf:
25 hostonly="yes"
26 use_fstab="yes"
27 no_fsck="no"
28
29 Note that the two latter Dracut options are not required and applied by
30 default in my installation but showing explicitly what configuration is
31 used.
32
33 /etc/conf.d/fsck:
34 fsck_passno=">1"
35
36 As can be seen from logs / and /usr are checked by Dracut and /var,
37 /home and /data by OpenRC.
38
39 /var/log/dmesg:
40
41 [ 2.607796] dracut: luksOpen /dev/sdb3 luks-2acb7668-fff1-492d-b46e-f05ead26d153
42 [ 5.930575] random: crng init done
43 [ 11.017574] dracut: Scanning devices dm-0 for LVM logical volumes MacVg/swap MacVg/gentoo-root MacVg/gentoo-usr
44 [ 11.028712] dracut: inactive '/dev/MacVg/arch-root' [10.00 GiB] inherit
45 [ 11.031019] dracut: inactive '/dev/MacVg/arch-var' [6.00 GiB] inherit
46 [ 11.033121] dracut: inactive '/dev/MacVg/swap' [8.00 GiB] inherit
47 [ 11.035193] dracut: inactive '/dev/MacVg/arch-home' [6.00 GiB] inherit
48 [ 11.037305] dracut: inactive '/dev/MacVg/data' [48.00 GiB] inherit
49 [ 11.039686] dracut: inactive '/dev/MacVg/gentoo-root' [1.00 GiB] inherit
50 [ 11.042072] dracut: inactive '/dev/MacVg/gentoo-var' [1.00 GiB] inherit
51 [ 11.044452] dracut: inactive '/dev/MacVg/gentoo-home' [2.00 GiB] inherit
52 [ 11.046791] dracut: inactive '/dev/MacVg/gentoo-usr' [12.00 GiB] inherit
53 [ 11.131447] dracut: Scanning devices dm-0 for LVM volume groups MacVg
54 [ 11.137382] dracut: Reading all physical volumes. This may take a while...
55 [ 11.146511] dracut: Found volume group "MacVg" using metadata type lvm2
56 [ 11.187955] dracut: 9 logical volume(s) in volume group "MacVg" now active
57 [ 11.198562] PM: Starting manual resume from disk
58 [ 11.200830] PM: Image not found (code -22)
59 [ 11.211669] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: data=ordered
60 [ 11.244303] dracut: Checking ext4: /dev/disk/by-uuid/199bb83d-c783-4254-a6eb-fdbb83c33144
61 [ 11.248218] dracut: issuing e2fsck -a /dev/disk/by-uuid/199bb83d-c783-4254-a6eb-fdbb83c33144
62 [ 11.264264] dracut: /dev/disk/by-uuid/199bb83d-c783-4254-a6eb-fdbb83c33144: clean, 2477/65536 files, 33012/262144 blocks
63 [ 11.267463] dracut: Mounting /dev/disk/by-uuid/199bb83d-c783-4254-a6eb-fdbb83c33144 with -o rw,relatime,data=ordered
64 [ 11.278896] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: data=ordered
65 [ 11.286288] dracut: Mounted root filesystem /dev/mapper/MacVg-gentoo--root
66 [ 11.302264] dracut: Checking ext4: /dev/MacVg/gentoo-usr
67 [ 11.305391] dracut: issuing e2fsck -a /dev/MacVg/gentoo-usr
68 [ 13.144541] dracut: /dev/MacVg/gentoo-usr: recovering journal
69 [ 13.146699] dracut: /dev/MacVg/gentoo-usr: clean, 439895/1572864 files, 2264868/3145728 blocks
70 [ 13.148865] dracut: Mounting /usr with -o defaults
71 [ 13.167299] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: (null)
72 [ 13.226192] dracut: Switching root
73
74 /var/log/rc.log:
75
76 * Checking local filesystems [passno >1] ...
77 /dev/mapper/MacVg-gentoo--home: clean, 6057/131072 files, 211958/524288 blocks
78 /dev/mapper/MacVg-data: clean, 5831/3145728 files, 10243129/12582912 blocks
79 /dev/mapper/MacVg-gentoo--var: clean, 22475/65536 files, 61158/262144 blocks
80 [ ok ]
81
82 P. S. A bonus point is I no longer have to patch genkernel to support
83 custom keymaps and fonts.
84
85 ---
86 Andrew

Replies