Adjusting Boot Options in rEFInd

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
drpeppercan
Level 3
Level 3
Posts: 186
Joined: Fri Dec 15, 2017 8:10 pm

Adjusting Boot Options in rEFInd

Post by drpeppercan » Tue Oct 08, 2019 11:01 pm

Original post: https://www.reddit.com/r/unixporn/comme ... in_refind/
I am trying to follow the instructions from the above post 4 years ago.

I need to adapt them to Mint.
Where do I get the following entries:

loader - The one I entered below it's just a guess.
initrd - The one I entered below it's just a guess.
options - Where do I get all the IDs numbers here from?

Code: Select all

menuentry Mint { icon EFI/refind/icons/os_linuxmint.png ostype Linux
volume boot
loader /vmlinuz-4.15.0-65-generic
initrd /initrd.img-4.15.0-65-generic
options "rw root=UUID=33bfccef-ae34-4044-a74a-9d8f9e4fde53 quiet elevator=bfq 
}
Thanks guys
Last edited by drpeppercan on Thu Oct 10, 2019 8:30 pm, edited 2 times in total.

User avatar
pbear
Level 8
Level 8
Posts: 2161
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Adjusting Boot Options in rEFInd

Post by pbear » Wed Oct 09, 2019 1:00 am

I've never gotten this deep into rEFInd, but I expect you'll find what you seek at the developer's website. His name is Rod Smith.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

drpeppercan
Level 3
Level 3
Posts: 186
Joined: Fri Dec 15, 2017 8:10 pm

Re: Adjusting Boot Options in rEFInd

Post by drpeppercan » Wed Oct 09, 2019 11:33 am

Thank you pbear :)

DPC

fabien85
Level 7
Level 7
Posts: 1558
Joined: Tue Mar 11, 2014 4:30 pm

Re: Adjusting Boot Options in rEFInd

Post by fabien85 » Thu Oct 10, 2019 9:46 am

Making manual boot options is like dropping a hammer to kill a fly.
What is it you want to do exactly ?

If you want to hide some boot options, there are options in refind.conf do blacklist some files or volumes. That's how I do it and it allows to keep the magic of refind. For instance:

Code: Select all

$ cat /booot/efi/EFI/refind/refind.conf
[..]
dont_scan_files shimx64.efi,grubx64.efi,MokManagerx64.efi,fbx64.efi,fwupx64.efi,mmx64.efi
[..]
you can also look at the options "dont_scan_dirs" and "dont_scan_volumes"

For a manual entry, here is a (disabled) option I have :

Code: Select all

menuentry "Manual Mint" {
    icon     /EFI/refind/icons/os_linuxmint.png
    volume   "LinuxMint"
    loader   /vmlinuz
    initrd   /initrd.img
    options  "ro root=UUID=blabla"
    disabled
}
where my root partition has name "LinuxMint" and has uuid blabla. You can find the uuid with blkid or lsblk.
If you want to put a resume=.. option to the kernel for hibernation (which may or may not work), you need to provide the uuid of the swap partition. I dont know about the resume_offset kernel parameter, I have never needed it. Anyway, hibernation is disabled by default in Mint 19.

drpeppercan
Level 3
Level 3
Posts: 186
Joined: Fri Dec 15, 2017 8:10 pm

Re: Adjusting Boot Options in rEFInd

Post by drpeppercan » Thu Oct 10, 2019 8:42 pm

Thank you so much for your valuable info fabien85 :)

I thought I had to put the actual complete file names for these 2 entries below

Code: Select all

loader /vmlinuz-4.15.0-65-generic
initrd /initrd.img-4.15.0-65-generic
And what about these options: quiet elevator=bfq

fabien85
Level 7
Level 7
Posts: 1558
Joined: Tue Mar 11, 2014 4:30 pm

Re: Adjusting Boot Options in rEFInd

Post by fabien85 » Fri Oct 11, 2019 8:18 am

vmlinuz on the / partition is a symlink to the latest kernel (same goes for /initrd.img which is a symlink to the initial ram disk of that latest kernel). For instance on my laptop

Code: Select all

$ ls -l /vmlinuz
lrwxrwxrwx 1 root root 30 Oct  1 16:32 /vmlinuz -> boot/vmlinuz-4.15.0-65-generic
So writing the option that way, you are sure that you will always boot the latest kernel.
Small caveat is that the symlink might get broken (I have never had the case, but conceivably this could happen during a failed kernel update, if you reboot before fixing the update).

"quiet" (usually used in conjunction with "splash" which displays a splash screen) is an option to tell the kernel to be mostly silent. i.e. it will not show on screen all the messages that it normally shows to inform where you are in the booting process. It will only display error messages if any.
I dont know what the "elevator=bfq" option is. Maybe a bit of search on the net will inform you better. It has been put by hand by the writer of the reddit post you linked to. I have never used it and doubt you will need it unless you have a particular problem to solve. For a standard Linux Mint install, the only options passed to the kernel are "quiet splash".

But again, why do you need to make a manual entry ?
(except for satisfying a geeky desire to understand the boot process, which I perfectly understand)
You will get rid of some of refind's goodness : the automatic detection of the kernel (and initrd), the easiness of maintenance, and the option to easily boot older kernels.
If it's to get rid of some of the other booting options present on the refind screen (like in the reddit post), it's much more easily achieved via the dont_scan_files etc options in refind.conf.
If it's to pass on some specific kernel options, an easier and maintenance-free way is to have a /boot/refind_linux.conf as explained here. There is a refind script (mkrlconf) that can automatically create this file.

drpeppercan
Level 3
Level 3
Posts: 186
Joined: Fri Dec 15, 2017 8:10 pm

Re: Adjusting Boot Options in rEFInd

Post by drpeppercan » Fri Oct 11, 2019 5:33 pm

That was great!
You are the most rEFInd knowledgeable guy I have come across!

To respond to your question, I was under the impression that making myself these manual entries was a requirement. But after learning from what you told me, I'll just use these filters:

Code: Select all

dont_scan_volumes
dont_scan_dirs
dont_scan_files
I am just trying to accomplish a cleaner list of choices. Sure I value having older kernels available too, but I very very rarely come to need them. I figured if I ever need them, I can always but from a USB drive and reedit the refind.conf file.

Thanks a lot.

DPC

drpeppercan
Level 3
Level 3
Posts: 186
Joined: Fri Dec 15, 2017 8:10 pm

Re: Adjusting Boot Options in rEFInd

Post by drpeppercan » Sat Oct 12, 2019 4:32 pm

Btw, how come every line of text/code starts with "#". Sometimes there is a space between the 1st character of the next word.
I thought this symbol was making the line a comment.
------------------------------------------------------------------

Update:
Well, after some investigation I learnt that rEFInd is written in C programming language.
According to what I found comments are made with "// blah blah", and "/* blah blah */".
The only example I found using the "#" symbol was this one:

Code: Select all

#include <stdio.h>
int main() {
/* in main function
I can write my principal code
And this in several comments line */
int x = 42; //x is a integer variable
printf("%d", x);
return 0;} 
So then, what's the use of this "#" symbol?

fabien85
Level 7
Level 7
Posts: 1558
Joined: Tue Mar 11, 2014 4:30 pm

Re: Adjusting Boot Options in rEFInd

Post by fabien85 » Mon Oct 14, 2019 9:53 am

You are asking about the # characters in /boot/efi/EFI/refind/refind.conf , right ?
If so, it's just a text file not a program. So refind can parse it however it likes. So the refind maintainer chose to parse the file ignoring every line which starts with a #. That's a design choice, one that is quite common in Linux (for a closely related example you can look at /etc/default/grub where you will also see comments after a #).

Post Reply

Return to “Installation & Boot”