Grub

From 太極
Jump to navigation Jump to search

Resources

Repair/update Grub2

Rescue shell/prompt

How to Use GRUB Rescue to Fix Linux

Recovery mode

I Couldn’t Boot Ubuntu! Here’s How I Fixed It (And You Can Too) 2025

  • Simply hold Shift or Esc immediately after the BIOS/UEFI logo disappears (don’t be surprised if you need a few tries to get the timing right).
  • Once GRUB appears, choose Advanced options for Ubuntu, then select one of the Recovery Mode entries.

Ubuntu: Boot Repair

https://help.ubuntu.com/community/Boot-Repair from a live USB

Not see Grub after re-install/upgrade Windows

Fix Grub Not Showing For Windows 10 Linux Dual Boot

Not see Windows in Grub menu: os-prober

sudo apt install os-prober

echo 'GRUB_DISABLE_OS_PROBER=false' | sudo tee -a /etc/default/grub

sudo os-prober
sudo update-grub

Add a new entry to boot an ISO

Pop_OS! does not use Grub, but rather systemd-boot

How to install grub menu on pop os?

Configuration - /etc/default/grub

How to Configure the GRUB2 Boot Loader’s Settings

Configuration options:

  • Scripts in /etc/grub.d
  • Configuration file at /etc/default/grub

Incorporating changes:

  • grub2-mkconfig (or grub-mkconfig for Grub v1) reads configurations and generates a new configuration for /boot/grub2 (or /boot/grub)

Show the grub2 screen

To show the grub2 screen, run sudo nano /etc/default/grub and comment out the line GRUB_HIDDEN_TIMEOUT=0 and change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="". Remember to run 'sudo update-grub' after any change to grub.

Change theme

How To Change GRUB Theme In Linux

Set Screen Resolution

Set Screen Resolution using Kernel Boot Parameter on Linux. I try "vga=ask" and "vga=341" and both do not work.

How do I set the grub timeout and the grub default boot entry?

https://askubuntu.com/questions/148095/how-do-i-set-the-grub-timeout-and-the-grub-default-boot-entry

  1. gksudo gedit /etc/default/grub
  2. Change as you like. Save and closed the file.
    • You can change the default from 0 to any number
    • You can change the "hidden timeout" (no menu)
    • You can force the grub menu to show by commenting out the two GRUB_HIDDEN lines with a # at the beginning of the line
    • set the grub menu timeout (default is 10 seconds)
  3. sudo update-grub
  4. Reboot

Grub Customizer - GUI program

Tips

Add a splash image

Follow the instruction at https://help.ubuntu.com/community/Grub2/Displays. Note that Grub2 will search the image based on some priority and there are also some minor requirements on the images. To test

sudo apt-get install grub2-splashimages
sudo cp /usr/share/images/grub/Moraine_Lake_17092005.tga /boot/grub/
sudo update-grub

Boot into command line

http://www.linuxandubuntu.com/home/how-to-boot-into-linux-command-line

  1. Highlight the first item (default) and press 'e' in the GRUB menu
  2. Navigate to the line that starts with ‘linux’, change the runlevel to 3 (at the end of the line). Level 3 means multi-user, command-line only system
  3. Press Ctrl+x or F10 to boot into

To switch back to GUI, type sudo init 5. Level 5 is the default.

Where is the GRUB menu

DietPi and triple boot experience

  • DietPi is very lightweight and it includes GRUB2 but the timeout is 0 seconds. Run nano /etc/default/grub and update-grub.
  • Tested in Virt-manager (DietPi + Lubuntu)
    1. Create dietpi OS first (512MB is enough but I increase it to 2GB for testing the 2nd OS/Lubuntu)
    2. Create Virtual disk (20GB by default)
    3. Mount Lubuntu to SATA CDROM 1 in Virt-manager. Change Boot Options so SATA CDROM 1 is the top.
    4. Put /dev/vdb as the top boot device. Run Lubuntu installation.
      • Pay attention in the "Partitions" step. Select /dev/vdb as the storage device and /dev/sdb for the Bootloader location (Master Boot Record of vdb (/dev/vdb)). Finish the installation process.
    5. Run Lubuntu at least once.
      • Method 1: VM Boot Options. Uncheck SATA CDROM 1 and put VirtIO Disk 2 (i.e. /dev/vdb) as the 1st boot device.
      • Method 2 (seems better): VM Boot Options. Uncheck SATA CDROM 1 and check VirtIO Disk 2 and check Enable boot menu (3 seconds delay). Follow the screen info, press ESC for boot menu (created by Virt-manager). Then choose "2. Virtio disk PCI".
    6. Change DietPi as the 1st boot device. Now we are ready to update the GRUB menu.
      apt update
      apt install os-prober
      nano /etc/default/grub # Uncomment the row: #GRUB_DISABLE_OS_PROBER=false
      update-grub
      reboot
    7. Now we are free to boot from either DietPi or Lubuntu.
    8. For some reason, if I try to add antiX Core as the 3rd boot option (/dev/vdc), the "update-grub" command from DietPi does not detect it. antiX Core only allows to repartition the disk /dev/vda, not /dev/vdc. So even I can install antiX Core on /dev/vdc, "update-grub" command from DietPi cannot detect it. Change to use antiX Base. Now I can choose "/dev/vdc" and choose create a new partition (/dev/vdc1). Going back to DietPi, the "update-grub" utility can find antiX Linux.

Windows + Linux

Tested on Virt-manager

  • Install Windows first (Virt-manager automatically selected SATA Disk 1)
  • Add a hardware. Both "SATA Disk 2" (Bus type = SATA) and "VirtIO Disk 1" (Bus type = VirtIO) work.
  • Install antiX Base (GUI install, quick to install) to "SATA Disk 2" or "VirtIO Disk 1".
    • antiX does not ask the location of bootloader.
    • antiX Linux auto reboots after installation is finisehd. So I need to force off and then put Linux as the 1st boot device.

A note about the Bus type:

  • Consideration: Compatibility, Performance, Scalability, and Features.
  • For Linux guests (Debian, Ubuntu, antiX):
    • VirtIO (VirtIO Block) is usually the easiest and most performant choice. VirtIO Drivers are paravirtualized drivers for kvm/Linux. Linux has excellent native support, so you rarely need to load extra drivers.
  • For Windows guests (Windows 10, 11, Server):
    • SCSI (connected to a VirtIO SCSI Controller) is the strongly recommended option. This provides the best performance, scalability, and feature set. You MUST load the vioscsi drivers from virtio-win.iso during installation.
    • If you choose VirtIO (VirtIO Block) for Windows, you'll need to load the viostor drivers from virtio-win.iso. It works, but vioscsi is generally preferred for Windows.
    • SATA is a fallback for Windows if you absolutely cannot get VirtIO drivers to load, but it comes with a performance penalty. Emulated hardware often has more overhead than paravirtualized drivers.

Triple boot

MBR and GPT

Share files between OSes

Create a completely separate partition using a suitable filesystem, such as NTFS that both can read.

Run Live Linux on Ram Disk

Increase root partition in Live session

  • For Ubuntu/Mint, the "toram" option in boot can get about 3.9GB root partition. So I cannot test the "dd" command to back up a DVD disk since it requires more than 3.9GB space for the final iso file.
  • How to adjust the size of the root partition on live Arch Linux system?
  • How To Adjust The Size Of The Root Partition On Live Arch Linux. When you boot the Arch Linux livecd, press e or hit tab key to edit the kernel parameters. Go to the end of the line that says ".... linux=... initrd=...." something like that and append cow_spacesize=1G at the end to get 1GB size root partition or whatever space left from RAM. It seems that cow_spacesize is specific to Arch Linux and its derivatives.

Systemd

Legacy BIOS

Fedora 37 Looks To Deprecate Legacy BIOS Support

BIOS, CMOS, UEFI, AHCI

AHCI vs RAID

  • Installing Linux alongside Windows is usually fairly painless – for many installs, you don’t need to disable Secure Boot now as most distros are signed. However, sometimes, the installer runs but you can’t see your hard disk. This can be resolved by switching the hard disk mode from RAID to AHCI – provided you aren’t specifically using RAID features, this should cause no ill effects. You will need to give Windows a heads-up or you’ll get a blue screen!
  • Dual boot - Preparation

Accessed remotely while it's off

Can Your Computer Be Accessed Remotely While It’s Off?

Ventoy

Bootable DOS USB Drive for BIOS update

How to Create a Bootable DOS USB Drive

Dell Optiplex

rEFInd