Booting the operating system from the grub command line
I decided to rearrange Grub , or rather upgrade to Grub2 . (I heard the opinion that in the spirit of Linux it is customary to keep the latest version of the package ... Grub2 is well written about the changes here .)
Well, as a result of the “hasty” installation, the system stopped loading. The only thing that could catch on was the command line prompt:
grub>By pressing Tab, a list of possible commands falls out. They are significantly smaller than on the Linux command line, but they are enough to boot the system. After reading about grub here, I decided to boot Windows, yet here I still feel more confident. To do this, it was necessary to indicate where the OS loader is located and pass control to it:
grub> root (hd0,2) [Устанавливаем корневой раздел и монтируем. Тут главное помнить, на каком разделе стоит операционная система]Record (hd0,2) means the disk device number 0 (master), partition number 2.
which corresponds to the device / dev / sda2 (in my case). You can have it either / dev / hd2, or something else, depending on the distribution. The numbering of devices goes in order and starts with (hd0,1) or / dev / sda1.
Next, enter: NTLDR is the Windows boot loader. The system began to load, and since this gave the result, you can dig further (after all, not Windows is now the subject of study). Reboot and enter again. Here it is necessary to distinguish between the root command (hd0,6) and the root = / dev / sda6 parameter. The first mounts the partition to the runtime. And the second indicates where the root of the bootable OS is. In my case, the kernel and root were on the same partition, although this may not be the case. It helped me, I hope you don’t come in handy, and if it comes in handy, it will help. By the way, if it is incorrect to specify root, the boot process will fail and an invitation will appear like: You can type: and see the list of devices (if you suddenly forgot it like me).
grub> chainloader +1 [пробел перед "+" важен. сhainloader - передает управление загрузкой по цепочке другому загрузчику. В моем случае это был NTLDR]
grub> boot grub> root (hd0,6)
grub> linux /boot/vmlinuz26 root=/dev/sda6 [Загружает указанное linux-ядро (/boot/vmlinuz26) с параметрами(root=/dev/sda6)]grub> initrd /boot/kernel26.img [Загружает указанный initrd-образ]
grub> boot[ramfs /]#[ramfs /]# ls /devMy problem with installing gurb2 was that during the installation I erased the grub menu file (usually it is located /boot/grub/menu.lst), but did not create a new file. To create the configuration file, grub-mkconfig had to be run.
If you have lost grub settings, then the differences in the commands will be minimal:
- To boot Windows, instead of root (h d0,2), type rootnoverify (hd0,1). Device numbering starts with (hd0,0), not (hd0,1). And with the rootnoverify command, you install the root device, but don’t mount it.
- To boot Linux, another command will change: instead of linux, you will need the kernel command (full analogue, even the same parameters).
UPD: I wrote about the differences between boot from grub and grub2. Thanks bliznezz