There are many reasons I prefer Linux. Near the top of the list is that I’m a tweaker. Someone who enjoys making changes and having things “My Way”, like the song by Frank Sinatra.
Linux has many configuration files, most of which “lurk” in the “/etc” folder. These files are used to configure the mounting of drives, network lists like what IP address goes with what computer name, passwords and admin access, application configuration and even what the boot menu looks like. “Under the Hood” Linux is highly customizable.
Boot menus are a necessary evil until computers are smart enough to either obey voice commands or read our minds after an instant-on. The bootloader is the first interactive function of a system with more than one Operating System
I will use editing my bootloader as an easily visualized example
of what can be done by getting “Under the hood” in Linux
Knowing what the GRUB (my system’s bootloader) configuration files do is essential. In the
/boot/grub directory there is the
grub.cfg file, which is generated by the system and is not to be edited. You can completely crash your system by leaving out one little “. From experience I know this is true. The grub.cfg even states at the top in capital letters “DO NOT EDIT THIS FILE”.
What GRUB configuration files can you edit? The ones in the “/etc” folder are editable, with a few exceptions.
There are two places within the “/etc” directory where GRUB configuration files “lurk”, the “defaults” subdirectory and the “grub.d“ subdirectory.
It really is essential to know what these config files do and what the syntax for editing them are. There are often differences in syntax for files that are all part of the same system function. As usual on Google you will find the information, you just need to be very specific. The bootloader for Ubuntu Linux (my GNU/Linux) is GRUB 1.99 which has a thorough but somewhat hard to understand manual on-line at GRUB 1.99 Manual
All these edits have to be done with root privileges. One simple method is using the “
sudo” command in the terminal and the file browser’s name, in Ubuntu’s case – “
nautilus”. Typing “
sudo nautilus” (without the quotes) into the terminal will open up a file manager with root access. Any program you start from the file manager will also have root access.
I wanted to change three things in my boot menu:
- Put the Windows OS first on the list so the “Up” arrow will select it
- Make Linux the default boot OS
- Eliminate an unwanted memory test entry
To put the Windows OS on the top of the list I went to the
/etc/grub.d folder and simply renamed the os-prober script from
08_os-prober, a number less than
10_linux. When updating the main configuration file:
update-grub script goes through the scripts in the
/ect/grub.d directory and executes them in numerical order. So changing
08_os-prober will put OS (Windows) before the Linux entries on the boot list. Simple enough once you figure out how the
update-grub script works
To make Linux the default boot Operating System you have to edit the “
grub” configuration file in the
/etc/defaults folder. The list of Operating Systems that GRUB displays in the starting menu are numbered 0, 1, 2 etcetera. After moving Windows to the top of the list in the last step, you must change the “GRUB_DEFAULT=” entry from 0 to 1.
The default GRUB boot menu has one menu item I have no need for, the built in memtest86+ function. Selecting it will – test your memory. Being the type of person who doesn’t need unnecessary clutter in my life, I wanted to take the memtest86+ listing out of the boot menu.
Which, once you know the trick, is incredibly simple. Just make the
20_memtest86+ script in the
/etc/grub.d folder not executable, which causes the
update-grub script to ignore it. Just right-click the script and select “properties”
I’ve mentioned the
update-grub script several times. It’s one of the files you don’t edit. This is the script that edits the
/boot/grub.cfg file I first mentioned, the one that’s marked at the top “DO NOT EDIT THIS FILE” You run the
update-grub script in your terminal with root permissions. A
sudo command preceeding it will get that done.
And here’s the result. Notice that Windows is first on the list, the default (highlighted selection) is Linux, and the memtest86+ is not on the list ?
I’ve used both “configuration files” and “scripts” in this article but they are not interchangeable. A “configuration file”, like the “grub” file in the /etc/defaults folder is meant to be read and edited by humans. A “script” is a file that’s machine readable. “Scripts” can be edited by hand but the chance (and consequences) of making an error go way up, unless you really know what you are doing.
This has been a short introduction to getting “Under the Hood” in Linux. Perhaps a good analogy would be in the automotive world – you can sit behind the wheel to Start and Drive a car but you need to get “Under the Hood” to adjust the carburetor. With a little bit of work you can too have it “Your Way”, beyond what the control panels and configuration utilities in your Distro’s Desktop Manager allow.
Be cautious but enjoy playing “Under the Hood”
- None Found