rEFInd is awesome to dual-boot Ubuntu (primary) and OSX (way secondary). But every now and then I screw something up, and I miss the Grub2 option of booting into "recovery mode" and then dropping into a root shell that has access to my Ubuntu system.
Is there any way to do something similar in rEFInd when using an iMac (I mention this because this seems to imply that shell doesn't play nice with Macs)? I tried calling the shell
option on the showtools
line of local.conf,
but nothing shows up in rEFInd.
I also tried to use rEFInd'sInsert or F2 for more options
option, but there was no shell option there either.
NOTE:
When using an Mac, to access rEFInd's Insert or F2 for more options
, you need to press the fn key
(which is where the Insert key
is on a Windows keyboard) and the f2 key
simultaneously. This brings up the boot options, which are set (on a Linux system) at /boot/refind_linux.conf
.
First, understand that when booting Linux, various options are passed to the kernel to modify how it acts. In most cases it's necessary to pass a
root=
option to identify where the root (/
) filesystem resides. It's common to pass other options, too, although the details vary from one distribution and installation to another. Boot managers, including both GRUB and rEFInd, provide menus that enable you to pass different collections of options by selecting them from menus. For simplicity, the menus seldom show you the details of the options; instead, they summarize the options with names, like "boot 4.2.0 normally" or "boot 4.2.3 in recovery mode." You must examine the boot loader's configuration file to decipher what options any given menu entry passes. Thus, the GRUB "recovery mode" option isn't a GRUB feature per se; it's just a menu entry that boots Linux with extra (and/or omitted) options.I just checked the GRUB entry for a (pre-release) Xenial installation I happen to have running, and its "recovery" entry specifies, in addition to a
root=
option,ro recovery nomodeset
. To duplicate this in rEFInd, you can do either of two things:ro recovery nomodeset
is present. Depending on the configuration, you might want to remove thequiet splash
options, too. You should not modify theroot=
option or theinitrd=
option, though./boot/refind_linux.conf
and create a new entry (or modify an existing one) that makes equivalent changes to the boot options. This entry will then become available when you hit F2 or Insert once at the rEFInd menu.The first approach is usable on any system using rEFInd and launching Linux kernels directly (unless the relevant features have been disabled in
refind.conf
); but manually entering the options is a nuisance. The second option is more convenient if you want to enter this mode even remotely frequently.Unfortunately, recovery features vary greatly from one distribution to another, which is why this isn't part of rEFInd's standard configuration. rEFInd does provide a "single-user" option in its default menu. This option passes
single
to the kernel, which tells it to boot into single-user mode. This is more standard than the Ubuntu-specific "recovery mode," but I doubt if it does the same thing. (I honestly have never used Ubuntu's "recovery mode.")Oh, and rEFInd's shell feature launches an EFI shell; but the shell is a separate EFI binary that you must install yourself. The EFI shell enables you to run arbitrary EFI programs, edit files, etc.
Incidentally, the keyboard issues you note represent quirks of some Macs' (and some other computers') keyboards; the function keys on some keyboards do double duty as something else, such as to control volume, screen brightness, etc. Such keyboards have a "Fn" key to toggle between use as a traditional function key and to control the media (or whatever). This type of setup is most common on laptops, but I've seen a few USB keyboards with similar setups. On some keyboards the function key is the default and other times the media-control function is the default.