View previous topic :: View next topic |
Author |
Message |
raddaqii Tux's lil' helper
Joined: 27 Mar 2005 Posts: 110 Location: Berlin, Old Europe
|
Posted: Sun May 13, 2018 9:03 pm Post subject: Cleaning up unused rEFInd boot entries |
|
|
So, installing Gentoo on my new optane NUC went smoothly, with one exception: I picked UEFI boot. Finishing that bit almost drove me mad, because it mad me feel.. exhilarated and clueless. Still does. Basically I have a working machine, can boot it, but am at a loss when it comes to clean up the UEFI boot config bit.
Because in order to boot I need to navigate my way around a dozen or so entries within that graphical -efibootmgr- rEFInd interface and find the only one working entry in the 2nd hierarchy level under a terribly boring name and manually select it. Each and every time I reboot. Practical workaround: rebuild kernels and reboot much less often. How silly is that.
In an attempt to be conceptually clear, I think I did understand
* efibootmgr is a management tool only, i.e. I can use it to add a boot entry, to, erm, the UEFI firmware, right? And it is not used afterwards and I could in theory delete it when everything is fine some time in the future?
* Sakaki's instructions are exceptionally clear, but on this machine I didn't use them (discovered them afterwards really)
* rEFInd UI shows a configuration (boot entries) I just did not find yet, nor does the wiki entry help me
* the Intel UEFI ("BIOS") GUI shows me nothing of the stuff I want to change by way of this post
So this is what I see when I try to diagnose things:
Code: | langsett ~ # efibootmgr -v
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0002,0000
Boot0000* Windows Boot Manager VenHw(99e275e7-75a0-4b37-a2e6-c5385e6c00cb)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...e................
Boot0002* UEFI : Built-in EFI Shell VenMedia(5023b95c-db26-429b-a648-bd47664c8012)..BO
Boot0003* UEFI : SATA : PORT 0 : Crucial_CT275MX300SSD1 : PART 1 : OS Bootloader PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,65535,0)/HD(2,GPT,9d32a1fe-8384-4c7e-8361-15e99222ef80,0x1800,0x3d000)..BO |
sys-apps/efibootmgr does show something, but not what I'd expect. Still, the above loads a rEFInd UI. What I had hoped for is a command that might come with rEFInd that could read everything I configured like in a tree view. Sadly this tree view I get won't show what I'd expect it to.
Code: | langsett ~ $ tree -L 3 /boot
/boot
├── config-4.12.12-gentoo
├── refind_linux.conf
├── System.map-4.12.12-gentoo
└── vmlinuz-4.12.12-gentoo
0 directories, 4 files
|
I don't run a 4.12.12 kernel but 4.14.26. Of course, /boot/refind_linux.conf shows me unused boot entries only.
Code: | # cat /proc/cmdline
root=UUID=71280dd1-018f-48fd-b351-177d8d5a4685 noraiddetect rootfstype=btrfs \vmlinuz-4.14.26.efi root=UUID=71280dd1-018f-48fd-b351-177d8d5a4685 noraiddetect rootfstype=btrfs \vmlinuz-4.14.12.efi \vmlinuz-4.12.12-gentoo rw root=PARTUUID=b6b21444-836d-491b-8a34-50172024ad9f rootfstype=btrfs noraiddetect dobtrfs dokeymap keymap=de locale=de_DE console=tty1 |
That cmdline looks terrible but it does boot me a nicely customized 4.14.26-gentoo kernel. And I am not entirely sure how those obsolete 4.14.12 and 4.12.12 got to stay in there except for me not knowing what I was doing. Meh.
The PARTUUIDs don't match up. Boot0003 has /dev/sda2 configured. But I thought I use the NVMe drive. Oh this is such I cannot even...
The system and user data is on an SSD:
Code: | langsett ~ # gdisk /dev/sda
Command (? for help): p
Disk /dev/sda: 537234768 sectors, 256.2 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 986AF03F-C6C9-4DB1-9AB4-3D5AA55A22D5
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 537234734
Partitions will be aligned on 2048-sector boundaries
Total free space is 3341 sectors (1.6 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 6143 2.0 MiB EF02 grub
2 6144 255999 122.0 MiB EF00 boot
3 256000 5371903 2.4 GiB 8300 swap
4 5371904 537233407 253.6 GiB 8300 primary
|
Code: | langsett ~ # blkid /dev/sda1
/dev/sda1: PARTLABEL="grub" PARTUUID="15d40708-5dc9-4642-96d0-9415eaddb458"
langsett ~ # blkid /dev/sda2
/dev/sda2: UUID="B534-F7D1" TYPE="vfat" PARTLABEL="boot" PARTUUID="9d32a1fe-8384-4c7e-8361-15e99222ef80"
langsett ~ # blkid /dev/sda3
/dev/sda3: UUID="983ac3f8-1dbb-4039-9157-c6f7d2e0378d" TYPE="swap" PARTLABEL="swap" PARTUUID="5566ec29-4e08-4920-96bc-292859d44406"
langsett ~ # blkid /dev/sda4
/dev/sda4: UUID="71280dd1-018f-48fd-b351-177d8d5a4685" UUID_SUB="5577ff45-5f62-4099-87dc-04cc2a633f49" TYPE="btrfs" PARTLABEL="primary" PARTUUID="b6b21444-836d-491b-8a34-50172024ad9f" |
The NUC has an optane/NVMe drive in which I would use as boot drive. I took on using this because I couldn't get it right using the SSD only, or so I thought. Apparently this device is not used atm; still does show in dmesg
Code: | langsett ~ # dmesg | grep -i nvme
[ 0.745766] nvme nvme0: pci function 0000:3c:00.0
[ 0.969511] nvme0n1: p1 p2 p3
[ 6651.453207] nvme0n1: p1 p2 p3
[ 6651.464088] nvme0n1: p1 p2 p3
|
Code: | langsett ~ # gdisk /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.1
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p
Disk /dev/nvme0n1: 28131328 sectors, 13.4 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): C5E1EEED-26B0-47B7-8E90-4217D97E5303
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 28131294
Partitions will be aligned on 2048-sector boundaries
Total free space is 23936957 sectors (11.4 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 1050623 512.0 MiB 8300 unused
2 1050624 2099199 512.0 MiB EF00 efi
3 2099200 4196351 1024.0 MiB 8300 boot
|
Code: | langsett ~ # blkid /dev/nvme0n1p1
/dev/nvme0n1p1: UUID="73b5a705-ace1-4d9e-80db-b38f87b03b1f" TYPE="ext2" PARTLABEL="unused" PARTUUID="c8adf56f-cba2-4bad-90fb-f57ad41ba9ee"
langsett ~ # blkid /dev/nvme0n1p2
/dev/nvme0n1p2: UUID="2335-E5D7" TYPE="vfat" PARTLABEL="efi" PARTUUID="e94b0c6b-2bf5-4871-8730-4946664fdcd6"
langsett ~ # blkid /dev/nvme0n1p3
/dev/nvme0n1p3: UUID="7506d8dc-ae67-4cd9-85b4-ffd6144fc246" TYPE="ext2" PARTLABEL="boot" PARTUUID="1d24b3e6-01b1-4b07-8fdc-02bbb80895a4"
|
Initially I thought to go SSD only and play around with the NVMe drive later as seen in an early test over at phoronix, i.e. using it for a EFI FAT32 boot partition to speed up booting because I can. Then it all got confused.
When I mount /dev/nvme0n1p2 it does give me boot entries in refind.conf, alas all default. None of those match those useless 4.12.12 entries that won't boot. Only meaningful file I find is a vmlinuz-4.14.26-gentoo.efi.
Code: | langsett ~ # tree -L 2 /mnt/nvme/
/mnt/usb/
├── EFI
│ ├── refind
│ └── tools
├── refind
│ ├── icons
│ ├── keys
│ └── refind.conf
├── tools
├── vmlinuz-4.12.12-gentoo.efi
├── vmlinuz-4.14.12-gentoo.efi
├── vmlinuz-4.14.26-gentoo.efi
└── vmlinuz-4.8.17-hardened-r2.efi
7 directories, 5 files
|
That vmlinuz-4.8.17-hardened-r2.efi is from the ill-fated attempt to use the old live dvd image that had hardened enabled and which of course wouldn't work all the way through in an install because hardened kernel inherent restrictions. With the kerfuffle above I'm not even sure if the vmlinuz-4.14.26-gentoo.efi I see here is the one being booted because the partition which it resides on has a PARTUUID which isn't to be found elsewhere. But datewise they sort of match.
So by the way of not mumbling about how easy the olden GRUB 0.97 config handling was I want to find a way to remove all the non-useful boot entries I see in the rEFInd pre-boot UI but which I couldn't display here. Can't see the wood for the trees. How to go about display what boot entries I don't need from the given config and delete those entries? _________________ --
Gentoo from 2004.3
Oh, took a new home in the fediverse: find me in the stream on pluspora.com: https://pluspora.com/tags/gentoo |
|
Back to top |
|
|
DONAHUE Watchman
Joined: 09 Dec 2006 Posts: 7651 Location: Goose Creek SC
|
Posted: Sun May 13, 2018 10:57 pm Post subject: |
|
|
rEFInd leaves kernel install and removal to the user.
You need to mount every partition on your computer run find / -name *vmlinuz* to locate all those kernels and then get to work with rm to remove the extras.
When you have only one kernel remaining rEFInd will find and show only one kernel icon and pressing insert with that icon selected will list only one kernel version with 2 modes.
Default rEFInd settings are described at /EFI/refind/refind.conf-sample on your ESP. _________________ Defund the FCC. |
|
Back to top |
|
|
saboya Guru
Joined: 28 Nov 2006 Posts: 552 Location: Brazil
|
Posted: Sun May 13, 2018 11:12 pm Post subject: |
|
|
You have to configure rEFInd correctly. Mount the ESP partition and edit the config manually. Remove autodiscover (or whatever the name of the feature is) and explicitly set the menu entries you'd like listed. |
|
Back to top |
|
|
DONAHUE Watchman
Joined: 09 Dec 2006 Posts: 7651 Location: Goose Creek SC
|
Posted: Sun May 13, 2018 11:54 pm Post subject: |
|
|
Disagree. The problem is not that rEFInd finds all the kernels installed. That is the greatness of rEFInd. The problem is not removing the cruft. There may be a crowd of configs and system maps laying around also. _________________ Defund the FCC. |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3664
|
Posted: Mon May 14, 2018 5:31 am Post subject: Re: Cleaning up unused rEFInd boot entries |
|
|
raddaqii wrote: | So by the way of not mumbling about how easy the olden GRUB 0.97 config handling was I want to find a way to remove all the non-useful boot entries I see in the rEFInd pre-boot UI but which I couldn't display here. Can't see the wood for the trees. How to go about display what boot entries I don't need from the given config and delete those entries? |
Why at all do you think you need rEFInd? Can't you leave it all to the EFI stub kernel? No rEFInd, no grub, ... |
|
Back to top |
|
|
bammbamm808 Guru
Joined: 08 Dec 2002 Posts: 548 Location: Hawaii
|
Posted: Mon May 14, 2018 9:06 am Post subject: |
|
|
I set;
scan_all_linux_kernels "false"
in refind.conf. It is trivial to add the extension to newly compliled and installed kernels and that way instead of automatically displaying an option for every kernel it finds, you can choose which it will present to you on boot with a very quick 'mv' command. _________________ MSI MAG B550 Tomahawk
Ryzen 3900x
32Gb Samsung B-die (16GB dual rank x2) DDR4 @ 3200MHz, cl14
Geforce RTX 2070S 8GB
Samsung m.2 NVME pcie-3.0
Etc.... |
|
Back to top |
|
|
raddaqii Tux's lil' helper
Joined: 27 Mar 2005 Posts: 110 Location: Berlin, Old Europe
|
Posted: Mon May 14, 2018 9:58 am Post subject: |
|
|
Thank you for the replies. Btw, typing up the above was an exercise in thougt and incentive to read the docs again.
Quote: | You need to mount every partition on your computer run find / -name *vmlinuz* to locate all those kernels and then get to work with rm to remove the extras. |
Totally agree. So I did and found more kernels, embarrassingly in like 3 places altogether where I had put some in order to make booting work. Funny though this detail from rEFInd documentation at rodsbooks.com had escaped me
Quote: | A common complaint among rEFInd users is that rEFInd displays too many boot options. This problem is getting worse as OS vendors deliver more and more tools in the form of EFI programs installed on the ESP. It's difficult for me to keep up with this flood, and what one person considers a necessary program another may consider pointless clutter, making it hard to set useful defaults. Fortunately, rEFInd provides several ways to hide OSes—or to make them appear, if they don't by default. Methods to do this include:
* Hiding entries dynamically ... To use it, highlight a tag and hit the Delete (on PCs) or minus (-) key. ...
* Move, deleting, or renaming files ... By default, rEFInd scans all the filesystems it can read for boot loaders. ...
|
Missing from the docs there ofc is the hint that "more and more boot options show up precisely because users don't remoce kernel cruft." :lol: Will reboot when I'll next be hands-on with this host, but have now both removed obsolete kernels (this should minify the boot options presented on reboot) and in doing so checked which PARTUUIDs show up in /proc/cmdline (those were fine). Guess this is the biggest step away from static grub: rEFInd on every boot scans whats there and shows that, reminding you to remove cruft as soon as the second next reboot after this one. Old grub OTOH would just ignore files on purpose and if that is a mistake you could have grub shell find the missing kernel, no manual intervention now!
Btw, does app-admin/eclean-kernel actually see those partitions where .efi kernels are stored and used, but which may never be mounted when eclean-kernel is run, because that is when sth like /boot is mounted? If not, how could that work? Hook eclean into kernel make install? How does sys-kernel/buildkernel (from Sakaki overlay) / sys-kernel/genkernel handle that?
Quote: | Why at all do you think you need rEFInd? Can't you leave it all to the EFI stub kernel? No rEFInd, no grub, ... |
Aye, guess I understood that bit. Would want to boot directly from UEFI firmware (as one of the ways of doing it). Judging from the number of related forum questions here though apparently documentation is lacking here and there, and or not everyone's quite ready for that yet, where "everyone" encompasses vendors and users. Personally, I'd happily get rid of intermediate steps whereas the feasibility of which was lacking made me post here in the first place. ;-) _________________ --
Gentoo from 2004.3
Oh, took a new home in the fediverse: find me in the stream on pluspora.com: https://pluspora.com/tags/gentoo |
|
Back to top |
|
|
P.Kosunen Guru
Joined: 21 Nov 2005 Posts: 309 Location: Finland
|
Posted: Mon May 14, 2018 2:02 pm Post subject: |
|
|
saboya wrote: | Remove autodiscover (or whatever the name of the feature is) and explicitly set the menu entries you'd like listed. |
And you can use symlinks, just link newest kernel to /boot/latest-kernel or whatever, no need to edit config after every update. |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3664
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|