From the course: Advanced Linux: The Linux Kernel
Configuring GRUB - Linux Tutorial
From the course: Advanced Linux: The Linux Kernel
Configuring GRUB
- [Instructor] GRUB is the most popular bootloader for Linux for servers and desktops. Embedded Linux devices often have a different bootloader, but GRUB is valuable to know about. There have been, of course, different versions of GRUB, just like everything else. For GRUB, there's some important config files underneath etc, so you can configure GRUB there and add new entries for example. A lot of this happens automatically through the way packages work. If you install a new kernel, generally your GRUB will get updated to boot your new kernel. But you can create new entries, you can customize things. If you want to add a new one, generally you'll edit 40_custom underneath etc/grub.d. When you make changes to GRUB configuration, you need to generate its config file it's going to use, so you'll run grub2-mkconfig. One of the nice features of GRUB is when your system starts booting, it's going to run GRUB, and then GRUB can pause briefly before it starts the kernel. And that can give you time to interrupt it so that you can temporarily change the kernel command line. If you're experimenting with things and you have a typo and you give it the path to a kernel that doesn't exist or something, then your system won't boot. So being able to interactively fix that is kind of nice. So GRUB has a bunch of interactive commands like B to boot and so forth, and there's a little bit of documentation that tell you, use B or use Control + X. Now the challenge here is you might not be able to get to a system console. If you have the system at your desk and you have a monitor and keyboard and all hooked up to it, then you can get the system console. But these days, most of your systems are probably in data centers or they're Vms, getting the system console might be difficult, but it could be handy. I've done it many, many times. So the generated GRUB config file should be boot/grub/grub.cfg, and that's still kind of hard to read, but if you read through it, you'll see lines for booting the kernel, you'll see the kernel command line. For example, you might see something like this, Linux, and then name of a Linux kernel file, and then where the root file system's supposed to come from. And ro is usually there, telling the kernel to mount the root file system read-only. That's kind of curious. Your root file system isn't read-only. Well, it is when GRUB boots it, that lets the system check it for consistency while nothing's writing to it. And then after everything checks out, the system daemons will remount your file system read-write, and it's not till after that's done that you can actually log in. So might be valuable to know. You could mount it read-write to start with, but don't do a file system check with it writeable.
Contents
-
-
-
-
(Locked)
Understanding the bootloader GRUB1m 41s
-
Configuring GRUB3m 24s
-
(Locked)
Kernel command line parameters3m 38s
-
(Locked)
Demo kernel command line args1m 54s
-
(Locked)
Process 1 and start-up services2m 49s
-
(Locked)
Challenge: GRUB, command line parameters, boot sequence1m 1s
-
(Locked)
Solution: GRUB, command line parameters, boot sequence1m 59s
-
(Locked)
-
-
-
-