Outils pour utilisateurs

Outils du site


issue217:tutoriel1

Ceci est une ancienne révision du document !


As we skipped a few issues due to me not having employment and attending lots of interviews, let us quickly recap. In the very first article of this series, we looked at getting more information about your system, or a system that you may have connected to. Sometimes you need to know. We looked at all the ls-commands that you will find in Ubuntu. In the next article, we looked at basic logging and how to read users and groups. Then we moved over to storage, but we got a bit lost in the weeds getting another drive attached to a VM, so we could do more. In the third instalment we faffed with understanding how block devices work and how to get a disk ready via the command-line and a little bit about how Linux uses UUIDs to identify drives. Now that we are on the drive topic, let’s look at how a system boots, and maybe even shuts down. This has nothing to do with the horrible book above, but I was reading up on UEFI/EFI and the boot process, by a guy who forked rEFIt to handle multiple operating systems on one drive (Multi-boot). Now if you are ancient, like me , you may know that there used to be another bootloader, named LiLo, and GRUB wasn’t the only game in town (there was syslinux too, but it is defunct). It was very simple and you did not need to configure anything. GNU GRUB is the GRand Unified Bootloader, lovingly known as just GRUB.

When Ubuntu starts up, GRUB is the first program that runs. It loads the kernel and then the kernel loads the rest of the operating system, including the shell, the desktop environment, and other operating system features. GRUB is also a boot manager. The boot loader is the part of GRUB that loads the kernel into memory. The ‘boot selector’ part of GRUB is the menu that allows you to select different operating system kernels to load. GRUB is also very configurable and has lots of options. Let’s look at a boot selector on one of my VM’s: Have you encountered a screen like this before? They do not all look the same and the first interaction most newbies have with this screen is when things go wrong. I say that they do not all look the same, as yours may show a list of previous kernels to boot from and mine does not. If you dual-boot with Windows, you may see that here too. You usually just select what you want and press enter, hence why it is called the boot selection screen. You can, should you want to, do the thing that is mentioned at the bottom of my screenshot, and hit “e” to edit the entries – usually when things go wrong, otherwise, you may never interact with it. Here we can see the output in edit mode. The changes you make when hitting “e” is temporary, only for this next boot (when you press F10 or type boot).

Let’s break it down, oomph, oomph, oh, not that way. OK then, the first line, “setparams”, is which entry in the list we are working with, most of the time there will be more than one. The usual suspect and a recovery option. If we look at the block following that, up to the if-statement, that is usually where all the modules and variables are. The if-statement that has feature_platform_search_hint = xy is where your system determines where to boot from. This is where those UUIDs come into play that we discussed. You can see that it says “search” and it will do just that, with parameters like “–no-floppy” to skip searching for floppy drives. We can see my drive’s UUID, starting with 58de…, yours will be different. That is why Linux is so “smart” compared to Windows. You see, with Windows I could add another drive, and that may become the “C” drive, and it will fail to boot. This is precisely the reason Linux does not rely on booting from sda1. So you could swap the cables on your drives and Linux will still boot. If you were to page down on that screen, after the UUID, you will see which kernel is being loaded and where root is, and how to mount it – usually it reads “ro” for read only, and you should not change this unless you are recovering your drive. I usually like removing the “quiet” option on my slow machines, then I get to see the boot messages scroll by. This works only on spinning rust really, as with SSDs it will just flash by and there is no point looking as it will scroll too fast.

That “initrd” that you see is the initial ram disk, that gets loaded into memory to start your daemons. If you make changes, you need to press CRTL+c to cancel and boot normally, or CTRL+x, to boot with the temporary changes. There is also the option to use the GRUB console, by pressing just “c”. This is a shell, but it is not bash, more like a GRUB-shell. When you type “help”, you will see commands that are not available in bash, and even the commands that you may be familiar with, will not operate in the way you expect. I would encourage you to enter the GRUB-shell and use the “ls” command. If you have never used this shell before, I suggest running the help command followed by the listed command to see what it actually does. If you use logical volumes, I would suggest paying attention, maybe even taking a picture with your phone, before attempting anything. If you roll your own kernel, this would be where you go to boot from it. As always, misc@fullcirclemagazine.org if there are mistakes.

issue217/tutoriel1.1748841968.txt.gz · Dernière modification : 2025/06/02 07:26 de d52fr