<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Learning Spatial Data</title><link>https://fliquidy.github.io</link><description>This is where I keep what I learned</description><copyright>Learning Spatial Data</copyright><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><image><url>https://github.githubassets.com/favicons/favicon.svg</url><title>avatar</title><link>https://fliquidy.github.io</link></image><lastBuildDate>Thu, 30 May 2024 05:23:37 +0000</lastBuildDate><managingEditor>Learning Spatial Data</managingEditor><ttl>60</ttl><webMaster>Learning Spatial Data</webMaster><item><title>Booting from Grub Shell</title><link>https://fliquidy.github.io/post/Booting%20from%20Grub%20Shell.html</link><description>After installing Ubuntu 20.04 on my server, my PC does not automatically boot into the system. Instead, it boots into a grub shell. &#13;
&#13;
Some commands that help me to boot from the grub shell are as follows.&#13;
&#13;
## `ls` command&#13;
&gt; Command: ls [arg …]&#13;
&gt; List devices or files.&#13;
&gt; With no arguments, print all devices known to GRUB.&#13;
&#13;
&gt; If the argument is a device name enclosed in parentheses (see [Device syntax](https://www.gnu.org/software/grub/manual/grub/html_node/Device-syntax.html#Device-syntax)), then print the name of the filesystem of that device.&#13;
&#13;
&gt; If the argument is a directory given as an absolute file name (see [File name syntax](https://www.gnu.org/software/grub/manual/grub/html_node/File-name-syntax.html#File-name-syntax)), then list the contents of that directory.&#13;
&#13;
In my case, it should be&#13;
```&#13;
grub&gt; ls&#13;
(proc) (memdisk) (hd0) (hd0,msdos5) (hd0,msdos1)&#13;
```&#13;
&#13;
```&#13;
grub&gt; ls  (hd0,msdos5)&#13;
Partition hd0,msdos5: Filesystem type ext* ......&#13;
```&#13;
&#13;
## `set` command&#13;
&gt; Command: set [envvar=value]&#13;
&gt; Set the environment variable envvar to value. If invoked with no arguments, print all environment variables with their values. For the list of environment variables currently used by GRUB itself see the relevant section see [Environment](https://www.gnu.org/software/grub/manual/grub/html_node/Environment.html#Environment).&#13;
&#13;
In my case, as my system is installed in (hd0,msdos5), it should be&#13;
```&#13;
grub&gt; set root=(hd0,msdos5)&#13;
```&#13;
&#13;
## `linux` command&#13;
&gt; Command: linux file …&#13;
&gt; Load a Linux kernel image from file. The rest of the line is passed verbatim as the kernel command-line. Any initrd must be reloaded after using this command (see [initrd](https://www.gnu.org/software/grub/manual/grub/html_node/initrd.html#initrd)).&#13;
&gt; On x86 systems, the kernel will be booted using the 32-bit boot protocol. Note that this means that the ‘vga=’ boot option will not work; if you want to set a special video mode, you will need to use GRUB commands such as ‘set gfxpayload=1024x768’ or ‘set gfxpayload=keep’ (to keep the same mode as used in GRUB) instead. GRUB can automatically detect some uses of ‘vga=’ and translate them to appropriate settings of ‘gfxpayload’. The linux16 command (see [linux16](https://www.gnu.org/software/grub/manual/grub/html_node/linux16.html#linux16)) avoids this restriction.&#13;
&#13;
In my case, it should be&#13;
```&#13;
grub&gt; linux /boot/vmlinuz-5.15.0-67-genericr root=/dev/nvme0n1p5&#13;
```&#13;
&#13;
Note that (1) After typing `vmlinuz`, you can press `tab` to auto-complete the name, and (2) `/dev/nvme0n1p5' should be the device where the root directory is on. To find this device, you can use the following command:&#13;
```&#13;
grub&gt; cat /etc/fstab&#13;
...&#13;
# / was on /dev/nvme0n1p5 during installation&#13;
...&#13;
```&#13;
&#13;
## `initrd` command&#13;
&gt;Command: initrd file [file …]&#13;
&gt; Load, in order, all initrds for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory. This may only be used after the linux command (see [linux](https://www.gnu.org/software/grub/manual/grub/html_node/linux.html#linux)) has been run. See [GNU/Linux](https://www.gnu.org/software/grub/manual/grub/html_node/GNU_002fLinux.html#GNU_002fLinux) for more info on booting GNU/Linux. For more information on initrds see the GNU/Linux kernel [documentation](https://docs.kernel.org/filesystems/ramfs-rootfs-initramfs.html).&#13;
&gt; A new-style initrd (for kernels newer than 2.6) containing one file with leading path components can also be generated at run time. This can be done by prefixing an argument with newc: followed by the path of the file in the new initrd, a :, and then the GRUB file path to the file data to be be included.&#13;
&#13;
In my case, it should be&#13;
```&#13;
grub&gt; initrd /boot/initrd.img-5.15.0-67-generic&#13;
```&#13;
&#13;
## `boot` command&#13;
&gt; Command: boot&#13;
&gt; Boot the OS or chain-loader which has been loaded. Only necessary if running the fully interactive command-line (it is implicit at the end of a menu entry).&#13;
&#13;
In my case, it should be&#13;
```&#13;
grub&gt; boot&#13;
```&#13;
&#13;
&#13;
Putting all these together, the commands that boot the system from the grub shell would be&#13;
```&#13;
grub&gt; set root=(hd0,msdos5)&#13;
grub&gt; linux /boot/vmlinuz-5.15.0-67-genericr root=/dev/nvme0n1p5&#13;
grub&gt; initrd /boot/initrd.img-5.15.0-67-generic&#13;
grub&gt; boot&#13;
```&#13;
&#13;
&#13;
。</description><guid isPermaLink="true">https://fliquidy.github.io/post/Booting%20from%20Grub%20Shell.html</guid><pubDate>Thu, 30 May 2024 04:37:32 +0000</pubDate></item></channel></rss>