1 |
Barry Schwartz posted on Tue, 23 Sep 2014 00:50:51 -0500 as excerpted: |
2 |
|
3 |
> Expanding on this: |
4 |
>> From: Barry Schwartz <chemoelectric@×××××××××××××.org> |
5 |
>> Date: Tue, 23 Sep 2014 00:42:44 -0500 |
6 |
>> |
7 |
>> Antoine Martin <antoine@××××××××××.uk> skribis: |
8 |
>>> "Simple" and the large collection of scripts that is grub2 is not |
9 |
>>> something I often hear in the same sentence ;) |
10 |
>> |
11 |
>> I don’t use any of the scripts, and just have a very simple, hand |
12 |
>> edited grub config file. |
13 |
> |
14 |
> See http://exherbo.org/docs/install-guide.html for how simple it can be |
15 |
> to use GRUB 2, if you just ignore the hoopla. My own config is more |
16 |
> complicated; it installs some fonts and has entries for memtest; but |
17 |
> these are minor niceties. |
18 |
|
19 |
When I installed grub2 I was running four drives in (mdraid) raid1 mode. |
20 |
While most of the system was 4-way raid1, I already had my /boot as two- |
21 |
way raid1, with a backup /boot on a second two-device raid1. That |
22 |
allowed me to update one grub and/or /boot at a time, leaving the other |
23 |
one in place and changing much more slowly. I run git kernels and |
24 |
normally load another git kernel on the "working" /boot every few days, |
25 |
updating the backup only with the .0 stable kernel releases. (I don't |
26 |
usually bother with the stable-series .1, and usually switch to the new |
27 |
development kernel about the time stable .2 or .3 comes out, so the .0 |
28 |
releases are my "stable" kernels.) |
29 |
|
30 |
Between that and the fact that I was already running GPT partitions and |
31 |
had already reserved a BIOS partition for grub2's usage when I switched |
32 |
to GPT, made the switch to grub2 reasonably easy. |
33 |
|
34 |
But I too don't use the scripts, and indeed, have the primary scripted |
35 |
installer install-masked, so there's no way anything could /possibly/ run |
36 |
it accidentally, as it simply doesn't exist /to/ run! |
37 |
|
38 |
And my grub2 native scripted config is probably one of the more complex |
39 |
ones here. My grub.cfg is a short stub that primarily sets up the main |
40 |
grub menu and exports a few vars, with only the primary boot and a couple |
41 |
submenus listed on the initial boot menu. |
42 |
|
43 |
The first submenu is backups. This loads another config file that lets |
44 |
me choose from several kernels (primary, backup, stable, all set in grub |
45 |
vars and I simply assign the appropriate one to the bootkernel var), |
46 |
choose which root I'm going to boot (working, primary backup, secondary |
47 |
backup on another device, again, all set in vars so selecting one simply |
48 |
loads the rootselect var from the appropriate one), choose whether I'm |
49 |
going to boot systemd or bash as pid1/init (again via vars, with the |
50 |
default of course openrc previously, and with both openrc and systemd |
51 |
available for awhile when I switched), and yet another choice that gives |
52 |
me a prompt to fill in additional kernel-commandline options if I want to |
53 |
(again assigned to a grub var, that's normally null). Finally, there's a |
54 |
reset option that resets all these choices back to the defaults, if I |
55 |
screw up on one of them. |
56 |
|
57 |
Actual booting, whether the default boot as chosen from the initial menu, |
58 |
or from the backups submenu, loads yet another config file, that simply |
59 |
loads all those vars into the appropriate place in the kernel command and |
60 |
runs it. Additionally, it detects (via another var) whether I'm loading |
61 |
it from the backups submenu/config, or the default boot, from the main |
62 |
menu/config. If it's the default it simply runs it, if it's loaded from |
63 |
the backups submenu, it loads all the vars and displays what it's going |
64 |
to do, asking me if that's correct, before actually running it. If I |
65 |
tell it no, it loads the backups menu/config again and lets me try again. |
66 |
|
67 |
The second submenu/config available from the primary menu is utils. This |
68 |
contains built-in grub-command choices such as reboot/halt, a command |
69 |
that loads all my partitions into various vars so I can switch to grub- |
70 |
command mode and browse arbitrary files from them (using the vars) if |
71 |
need be (good for loading the kernel dir to read about kernel commandline |
72 |
options if I'm troubleshooting! =:^), an entry that cats out (with the |
73 |
grub-pager activated) my grub-notes files with various useful grub and |
74 |
kernel-commandline options I've discovered over the years, etc. |
75 |
|
76 |
Of course I could switch to grub-commandline mode and do most of these |
77 |
same things, including directly editing the kernel commandline that grub |
78 |
will hand off, but it's nice to have the choices all setup in a nice menu- |
79 |
based system so I can simply select the appropriate ones, instead. =:^) |
80 |
|
81 |
And because it's all grub-var based, with many of the basic choices |
82 |
already preset in grubenv, changing many of the settings is simply a |
83 |
matter of mounting /boot and running grub-editenv from a terminal. =:^) |
84 |
|
85 |
> (Completely avoiding initrd by simply putting / and /usr on one |
86 |
> filesystem is another of those measures you wouldn’t think existed if |
87 |
> your experience were entirely Ubuntu, etc.) |
88 |
|
89 |
That's how my system is setup, not to avoid an initr* altho it's nice for |
90 |
that, but rather, so that everything installed by portage is on the same |
91 |
partition as the portage installation database (/var/db/pkg). I learned |
92 |
to do that the hard way, after having a drive die and having to recover |
93 |
from backups, but with the backup for /, /var, and /usr, being three |
94 |
different backups created at different times, so when I had finished |
95 |
restoring from backup, the installed-package database didn't match what |
96 |
was actually on / and /usr! I was still cleaning up from that fiasco, |
97 |
finding stale files that hadn't been updated because portage lost track |
98 |
of them due to all this, over a year later! |
99 |
|
100 |
I vowed never again! So now most of /var along with most of /usr, pretty |
101 |
much everything portage installs, is on /, along with the database |
102 |
tracking it. That way, whatever backup I end up booting to and restoring |
103 |
from, the installed-package database will match it, because it's on the |
104 |
same backup! =:^) |
105 |
|
106 |
-- |
107 |
Duncan - List replies preferred. No HTML msgs. |
108 |
"Every nonfree program has a lord, a master -- |
109 |
and if you use the program, he is your master." Richard Stallman |