Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Separate /usr partition
Date: Thu, 15 Sep 2022 10:00:34
Message-Id: bc3d9f4e-5b95-666a-d14b-6735e69f1acb@gmail.com
In Reply to: Re: [gentoo-user] Separate /usr partition by Peter Humphrey
1 Peter Humphrey wrote:
2 > On Wednesday, 14 September 2022 23:09:59 BST Neil Bothwick wrote:
3 >> On Wed, 14 Sep 2022 16:50:45 +0100, Peter Humphrey wrote:
4 >>> I'm thinking of separating /usr onto its own partition so that I can
5 >>> have it mounted read-only except while updating it. I'd prefer not to
6 >>> have to make an init thingy, not having needed one up to now. Besides,
7 >>> some machines have things like early-ucode or amd-uc.
8 >> Most of this has already been answered, except for your final point. You
9 >> can load more than one initrd at boot, so you can still apply microcode
10 >> updates. For example, with systemd-boot
11 >>
12 >> title Desktop
13 >> version 5.15.59-gentoo
14 >> linux /vmlinuz-5.15.59-gentoo
15 >> options root=LABEL=blah blah
16 >> initrd /amd-uc.img
17 >> initrd /initramfs-5.15.59-gentoo.img
18 >>
19 >> I use dracut to create the initrd, which is so straighforward even Dale
20 >> can't break it ;-)
21 > :)
22 >
23 > That seems to be the way to go then - even dinosaurs die out in the end.
24 > Perhaps Dale will show us the command he referred to.
25 >
26 > Thank you all for your help.
27 >
28
29
30 As I said, I do all mine by hand.  I don't use make install etc.  After
31 I build my kernel, I copy it and name it something like this, from /boot.
32
33
34 root@fireball / # ls -al /boot/kernel*
35 -rw-r--r-- 1 root root 11638944 Nov 30  2021 /boot/kernel-5.10.46-2
36 -rw-r--r-- 1 root root 11863664 Feb 18  2022 /boot/kernel-5.14.15-2
37 -rw-r--r-- 1 root root 11881040 Aug  6 18:00 /boot/kernel-5.14.15-3
38 -rw-r--r-- 1 root root 12128016 Jun 30 20:00 /boot/kernel-5.18.7-1
39 -rw-r--r-- 1 root root 11167744 Nov 30  2021 /boot/kernel-5.6.7-1
40 root@fireball / #
41
42 I basically put the version and at times a dash number on the end. 
43 Sometimes "-1" may work but I add a driver or something and the next is
44 -2, the next -3 etc.  For -3 above, I added a driver for a new network
45 card as a example.  Sometimes I clean out older dashed versions.  Point
46 is, it needs to start with kernel and go from there.  You may have a
47 different way of naming them.  I think grub just looks for it to start
48 with kernel. 
49
50 Once I get that done, I then build the init thingy.  This is Neil's
51 command that he posted.  From my understanding, the kernel symlink needs
52 to point to the correct kernel version. 
53
54 dracut --kver=$(cat include/config/kernel.release)
55
56 That gives a init thingy with a somewhat generic name.  I then rename it
57 to match the kernel, looks something like this from /boot.
58
59
60 root@fireball / # ls -al /boot/initramfs*
61 -rw------- 1 root root 9310818 Nov 30  2021 /boot/initramfs-5.10.46-2.img
62 -rw------- 1 root root 9093386 Nov 13  2021 /boot/initramfs-5.14.15-2.img
63 -rw------- 1 root root 9485412 Aug  6 18:01 /boot/initramfs-5.14.15-3.img
64 -rw------- 1 root root 9117155 Jun 30 22:57 /boot/initramfs-5.18.7-1.img
65 -rw------- 1 root root 9310789 Nov 30  2021 /boot/initramfs-5.6.7-1.img
66 root@fireball / #
67
68 Once you get the two things to match, kernel and initramfs, then when
69 you update grub, it will match them together and create the needed
70 entries.  I think at one point, I had one init for each kernel version
71 without the dash part.  I can't recall how I did that tho.  To update
72 grub, I use this command. 
73
74
75 grub-mkconfig -o /boot/grub2/grub.cfg
76
77 I actually put it in a file in /root and just run it.  I just named it
78 grub-update.  That way I don't have to remember the option part. ;-) 
79 When it runs, just make sure it sees the kernel and a matching
80 initramfs.  It usually lists them in order. 
81
82 I don't update kernels that often.  If you do it more often, others will
83 have more automated ways to do things.  They may use make install and
84 other things that makes it a lot faster.  I do it this way because it is
85 not something I have to do often and I always get a good result.  Plus,
86 I keep the ones I know work well. 
87
88 It's been a while but I think Neil may have a more automated process. 
89 Heck, if he shares his step by step, I may convert.  LOL 
90
91 I don't think I left anything out.  :/
92
93 Dale
94
95 :-)  :-) 

Replies

Subject Author
Re: [gentoo-user] Separate /usr partition Peter Humphrey <peter@××××××××××××.uk>
Re: [gentoo-user] Separate /usr partition Neil Bothwick <neil@××××××××××.uk>