Gentoo Archives: gentoo-dev

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Need design help/input for eclean-kernel
Date: Fri, 01 Jul 2016 02:04:49
Message-Id: pan$2851c$749050c7$48bd1cf$18b8b3e0@cox.net
In Reply to: [gentoo-dev] Need design help/input for eclean-kernel by "Michał Górny"
1 Michał Górny posted on Thu, 30 Jun 2016 14:38:26 +0200 as excerpted:
2
3 > [P]lease reply to this thread with
4 > a specific /boot layout that you think needs to be handled, with as much
5 > helpful information as possible -- including possible distinctive
6 > features and pitfalls.
7
8 This is surely more info than you need, but I imagine it's one of the
9 more unique and complex layouts you'll see and thus might need additional
10 explanation for some bits. Trouble is I don't know which bits, so...
11
12 I have never used eclean-kernel and probably won't as I have my own
13 scripts to handle things (as I was doing even back over a decade ago on
14 mandrake, before I switched to gentoo), but here's the layout, in case
15 you find it useful (or a fun challenge? =:^) to support.
16
17 So what I have for boot:
18
19 /boot itself is a symlink, normally pointing at /bt, the mountpoint for
20 my working boot partition, but setup with /boot as a symlink so I can
21 point it at /bk/bt, where I can mount my backup boots on other devices,
22 when I want to install grub to them.
23
24 /bt, LABEL=bt0238gcn1+35l0 : working boot mountpoint and filesystem when
25 mounted, where the /boot symlink normally points. Filesystem is btrfs
26 mixed-blockgroup dup mode. This is a partition on one of a pair of 238
27 GiB (256 GB) Corsair Neutron SSDs.
28
29
30 /bk/bt: mountpoint for my backup boots. The /boot symlink can be
31 adjusted to point here when I want to install grub to one of the backup
32 boots.
33
34 LABEL=bt0238gcn0+35l1 : primary backup boot filesystem, also btrfs mixed-
35 blockgroup dup, a partition on the other one of the pair of 238 GiB SSDs.
36
37 LABEL=bt0465gsg0+47f0 : secondary backup boot filesystem, reiserfs on a
38 partition on a 465 GiB spinning rust seagate.
39
40 Various other removable drives and their labels for further backups...
41
42 All bootable storage (including removable) is GPT partitioned with both a
43 legacy-BIOS partition to which grub2 is installed and an EFI partition
44 reserved for future use. Each installed grub points at the /bt boot
45 partition on that device, so I can at least get both a grub prompt and a
46 bootable kernel on any of them, even with all other storage
47 disconnected. From there it's up to where I point the kernel using root=
48 on the kernel commandline, but FWIW, each grub is configured with a menu
49 from which I can choose any of my working or primary or secondary backup
50 root.
51
52 On each of these boot partitions the filesystem layout is:
53
54 amd64/
55 64-bit kernels, configs, system-maps, symlinks...
56
57 boot -> .
58
59 grub/
60
61 [x86/]
62 [when I had the 32-bit netbook, this was its kernels, etc.]
63
64 [A single zero-length file named working, backup, backup2, etc, so I can
65 easily confirm which one I actually booted to when testing an updated
66 grub install or the like.]
67
68
69 The kernel dirs are laid out as...
70
71 $$ ls -1 /bt/amd64
72
73 config@
74 config-4.5.0-dirty
75 config-4.6.0-dirty
76 config-4.6.0-rc7-00096-g685764b10-dirty
77 config.old@
78 config.stable@
79 System.map@
80 System.map-4.5.0-dirty
81 System.map-4.6.0-dirty
82 System.map-4.6.0-rc7-00096-g685764b10-dirty
83 System.map.old@
84 System.map.stable@
85 vmlinuz@
86 vmlinuz-4.5.0-dirty
87 vmlinuz-4.6.0-dirty
88 vmlinuz-4.6.0-rc7-00096-g685764b10-dirty
89 vmlinuz.old@
90 vmlinuz.stable@
91
92
93 That's three symlinks for each of the map, config and kernel. They point
94 to current, old (previous) and stable. Since I often test/run and
95 occasionally bisect git kernels, current and old often point to git and
96 perhaps bisect-bad kernels, and during a bisect I may have nearly a dozen
97 kernels and associated files, tho my scripts only maintain the current/
98 old symlinks. I update the stable symlink manually, when I consider a
99 released version tested well enough locally to be confident doing so.
100
101 Only the working boot gets the git kernels. I update the primary backup
102 with the new release-stables each kernel cycle, and only update the
103 secondary backup every few kernel cycles.
104
105 The git kernel testing and bisects are why I prefer to do my own kernel
106 cleanups. That way I can keep the first git kernel I saw the problem in
107 around until I get around to doing a bisect, if the problem hasn't been
108 caught and fixed upstream by then, making the bisect easier than it would
109 be if I kept updating to see if the problem was fixed, losing track of
110 the first bad kernel I saw in the process and thus perhaps forcing
111 another round or two of bisection to track down the problem.
112
113 And for sure I don't want anything touching the stable symlinks but me,
114 manually, when I am sufficiently confident I can do so and won't be left
115 in a hole without an easy way to dig myself out as a result.
116
117 I use a dracut-built initr*, compressed and appended as an initramfs to
118 each kernel built and tested, so once I know the kernel/initramfs
119 combination work, I don't have to worry about a buggy initr* update
120 breaking older kernels as they have their initramfs builtin. The dracut-
121 built initr* is kept on a different filesystem in ordered to leave more
122 room in the boot and backups for kernels.
123
124
125 More detailed explanation of likely unique characteristics, and why...:
126
127 Most of my primary filesystems are btrfs raid1 (and were on mdraid1
128 before that), with a working copy and a primary and secondary backup, all
129 on similarly sized partitions, working and primary backup on a pair of
130 SSDs, secondary backup on spinning rust.
131
132 That doesn't work for /boot, since grub1 (where I originally setup the
133 scheme) can only point at one with no way to point at the backup instead,
134 and while grub2 can manually load a different /boot, it's extra trouble,
135 and I already had the scheme setup and working by then, so I kept what
136 worked.
137
138 In ordered to facilitate all this, /boot itself is a symlink, that points
139 to /bt normally, or to /bk/bt, where I mount the backups if I want to
140 install grub to them. (I simply copy-backup /boot to the backups as
141 appropriate, but grub has to be installed to the legacy bios partition on
142 each device separately, so I need to switch the /boot symlink temporarily
143 when I'm installing grub to the backup devices.)
144
145 And I keep track of all working and backups of the various filesystems
146 via standardized 15-character LABEL (which I list in fstab to mount by)
147 that looks something like this:
148
149 bt0238gcn1+35l0
150
151 bt=boot (rt=root, hm=home, etc)
152
153 0238g=0238 gig
154
155 cn=corsair neutron (brand)
156
157 1=second 238-gig corsair neutron (0-base)
158
159 +=workstation permanent installed (it's also a visual separator)
160
161 35l=2013 (last repartitioning), May (5th month), l=day-of-month
162
163 0=working copy (on that device at least).
164
165 FWIW, filesystem and gpt partition labels are kept in sync (but for the
166 device number on raid, of course) so I can uniquely ID within my own
167 storage inventory on sight by either one.
168
169 bt0238gcn0+35l1 is the backup boot (the tailing 1) on the other 238-gig
170 corsair neutron ssd. (Yes, I did put the working boot on device 1, the
171 first backup on device 0, oh, well...) bt0465gsg0+47f0 is the secondary
172 backup boot, on the first spinning rust 465-gig seagate, last
173 repartitioned in July of 2014. FWIW, the three roots are rt0238gcnx+35l0
174 (working, x in the device number slot as it's a pair-device btrfs raid1),
175 rt0238gcnx+35l1 (primary backup), and rt0465gsg0+47f0 (secondary backup,
176 but the first rt on the first 465-gig seagate, thus the trailing 0).
177
178 Additionally, given the 32-bit netbook I had at one point, and the fact
179 that I wanted a standardized /boot layout that would work with both 32-
180 bit and 64-bit kernels, on both permanently installed drives and USB
181 devices that might be used to boot either one, my boot layouts have the
182 kernels in dedicated subdirs, in my case, /boot/amd64, and when I had the
183 netbook, /boot/x86. (I used the 64-bit machine with a 32-bit chroot as
184 the 32-bit build, so my kernel build scripts had logic/config that looked
185 at $HOSTTYPE, IIRC, to decide which kernel to build, which working output
186 dir to use, and where to install the kernel.)
187
188 --
189 Duncan - List replies preferred. No HTML msgs.
190 "Every nonfree program has a lord, a master --
191 and if you use the program, he is your master." Richard Stallman