Grub: Difference between revisions
(24 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
* [https://itsfoss.com/update-grub/ How to Update Grub on Ubuntu and Other Linux Distributions]. Good instruction. Two disks; each with its own Linux distribution. The second disk won't install Grub. So the Linux on the 1st disk needs to update its grub so it can see the Linux on the 2nd disk. | * [https://itsfoss.com/update-grub/ How to Update Grub on Ubuntu and Other Linux Distributions]. Good instruction. Two disks; each with its own Linux distribution. The second disk won't install Grub. So the Linux on the 1st disk needs to update its grub so it can see the Linux on the 2nd disk. | ||
* [https://youtu.be/r7meKJsjqfY GRUB Rescue | Repairing GRUB] (arch linux) Apr 2019 | * [https://youtu.be/r7meKJsjqfY GRUB Rescue | Repairing GRUB] (arch linux) Apr 2019 | ||
== Ubuntu: Boot Repair == | |||
https://help.ubuntu.com/community/Boot-Repair from a live USB | |||
== Not see Grub after re-install/upgrade Windows == | == Not see Grub after re-install/upgrade Windows == | ||
[https://itsfoss.com/no-grub-windows-linux/ Fix Grub Not Showing For Windows 10 Linux Dual Boot] | [https://itsfoss.com/no-grub-windows-linux/ Fix Grub Not Showing For Windows 10 Linux Dual Boot] | ||
== Not see Windows in Grub menu == | |||
<pre> | |||
sudo apt install os-prober | |||
echo 'GRUB_DISABLE_OS_PROBER=false' | sudo tee -a /etc/default/grub | |||
sudo os-prober | |||
sudo update-grub | |||
</pre> | |||
== Add a new entry to boot an ISO == | == Add a new entry to boot an ISO == | ||
Line 34: | Line 47: | ||
== Show the grub2 screen == | == 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. | 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 == | |||
[https://ostechnix.com/change-grub-theme-in-linux/ How To Change GRUB Theme In Linux] | |||
== Set Screen Resolution == | |||
[https://linuxhint.com/set_screen_resolution_linux_kernel_boot/ 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? == | == How do I set the grub timeout and the grub default boot entry? == | ||
Line 71: | Line 90: | ||
= Dual boot = | = Dual boot = | ||
[https://steamforge.net/wiki/index.php/How_to_setup_a_Windows_10,_Linux_Mint_19.1_Dual_Boot_with_Encrypted_Partitions_on_a_Dell_XPS_15_9560 How to setup a Windows 10, Linux Mint 19.1 Dual Boot with Encrypted Partitions on a Dell XPS 15 9560] | [https://steamforge.net/wiki/index.php/How_to_setup_a_Windows_10,_Linux_Mint_19.1_Dual_Boot_with_Encrypted_Partitions_on_a_Dell_XPS_15_9560 How to setup a Windows 10, Linux Mint 19.1 Dual Boot with Encrypted Partitions on a Dell XPS 15 9560] | ||
= Triple boot = | |||
* [https://itsfoss.com/triple-boot-windows-linux/ Complete Guide To Triple Boot Windows, Lubuntu And Debian] | |||
* [https://www.reddit.com/r/batocera/comments/108g856/comment/j3s11g0/?utm_source=share&utm_medium=web2x&context=3 Adding Batocera on dual boot]. Essentially, I had to install each while only their drive was in the computer. I did '''Xubuntu last''', then added the other two drives and did a bunch of fiddling with Grub for it to pick up the OS's. | |||
= Where is grub installed = | = Where is grub installed = | ||
Line 85: | Line 108: | ||
** https://en.wikipedia.org/wiki/Master_boot_record | ** https://en.wikipedia.org/wiki/Master_boot_record | ||
** [https://techterms.com/definition/mbr MBR] | ** [https://techterms.com/definition/mbr MBR] | ||
** MBR only supports up to 4 primary partitions. If you want more, you have to make one of your primary partitions an '''extended partition''' and create logical partitions inside it. Cf. GPT also allows for a nearly unlimited number of partitions. | |||
* [https://www.howtogeek.com/193669/whats-the-difference-between-gpt-and-mbr-when-partitioning-a-drive/ What's the Difference Between GPT and MBR When Partitioning a Drive?] | |||
* [https://www.howtogeek.com/245610/how-to-check-if-a-disk-uses-gpt-or-mbr-and-how-to-convert-between-the-two/ How to Check if a Disk Uses GPT or MBR, and Convert Between the Two] (Windows) | * [https://www.howtogeek.com/245610/how-to-check-if-a-disk-uses-gpt-or-mbr-and-how-to-convert-between-the-two/ How to Check if a Disk Uses GPT or MBR, and Convert Between the Two] (Windows) | ||
** On Linux, type '''sudo fdisk -l'''. The '''Disklabel type''' will show the type (e.g. dos, gpt, ...). | ** On Linux, type '''sudo fdisk -l'''. The '''Disklabel type''' will show the type (e.g. dos, gpt, ...). | ||
* [https://linuxize.com/post/fdisk-command-in-linux/ Fdisk Command in Linux (Create Disk Partitions)] | * [https://linuxize.com/post/fdisk-command-in-linux/ Fdisk Command in Linux (Create Disk Partitions)] | ||
* [https://www.makeuseof.com/tag/convert-mbr-gpt-windows/ How to Convert MBR to GPT Without Losing Data in Windows] | * [https://www.makeuseof.com/tag/convert-mbr-gpt-windows/ How to Convert MBR to GPT Without Losing Data in Windows] | ||
* [https://www.slax.org/starting.php slax] Linux asks your disk uses msdos partition scheme (use MBR, not 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 = | = Run Live Linux on Ram Disk = | ||
Line 100: | Line 129: | ||
*# Press Enter. You will see the LED on USB drive flashes. It took 7 minutes on my USB 2 port to enter the XFCE Desktop. | *# Press Enter. You will see the LED on USB drive flashes. It took 7 minutes on my USB 2 port to enter the XFCE Desktop. | ||
*# Eject & unplug the USB drive. | *# Eject & unplug the USB drive. | ||
== 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. | |||
* [https://superuser.com/questions/753134/how-to-adjust-the-size-of-the-root-partition-on-live-arch-linux-system-dev-ma How to adjust the size of the root partition on live Arch Linux system?] | |||
* [https://ostechnix.com/adjust-size-root-partition-live-arch-linux/ 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 = | |||
* [https://opensource.com/article/20/9/systemd-startup-configuration Analyze Linux startup performance] | |||
* [https://youtu.be/Kzpm-rGAXos Systemd Deep-Dive: A Complete, Easy to Understand Guide for Everyone] (video) | |||
* [https://www.theregister.com/2023/07/18/linux_desktop_debate/ Linux has nearly half of the desktop OS Linux market]. ChromeOS doesn't have systemd. It has '''[https://en.wikipedia.org/wiki/Upstart_(software) upstart]''', which was one of the most widespread init systems. | |||
= Legacy BIOS = | |||
[https://www.phoronix.com/scan.php?page=news_item&px=Fedora-37-Deprecate-BIOS Fedora 37 Looks To Deprecate Legacy BIOS Support] | |||
= BIOS, CMOS, UEFI, AHCI = | |||
* [https://youtu.be/LGz0Io_dh_I BIOS, CMOS, UEFI - What's the difference?] (video) | |||
== 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|Dual boot - Preparation]] | |||
= Accessed remotely while it's off = | |||
[https://www.makeuseof.com/can-computer-be-accessed-while-its-off/ Can Your Computer Be Accessed Remotely While It’s Off?] | |||
= Bootable DOS USB Drive for BIOS update = | |||
[https://www.howtogeek.com/136987/how-to-create-a-bootable-dos-usb-drive/ How to Create a Bootable DOS USB Drive] | |||
== Dell Optiplex == | |||
* [https://youtu.be/n6unGwtpbEc How To Fix A Dell With A No Bootable Device Or No Boot Device Found Problem] | |||
* [https://youtu.be/dupH2YrD6OY How To Fix Dell Computer Hard Drive Not Detected / Hard Drive Not Found / Hard Drive Not Installed] | |||
* To have a one-time boot up. Hit '''F12''' | |||
* In my case, I don't need to upgrade BIOS (mine is 1.18 from 2019). I've used USB to install Ubuntu 22.04 on my SSD. However I cannot boot into it. | |||
** Hit '''F2''' to go to BIOS. | |||
** Boot Sequence: Check ubuntu. Boot List Option: '''UEFI''' | |||
** Advanced Boot Options: Checked both options. | |||
** System Configuration: SATA Operation - '''AHCI'''. | |||
** Security Boot: Uncheck 'Secure Boot Enable' |
Latest revision as of 19:05, 12 October 2024
Resources
- http://www.gnu.org/software/grub/
- https://en.wikipedia.org/wiki/GNU_GRUB
- https://help.ubuntu.com/community/Grub2
- https://wiki.gentoo.org/wiki/GRUB2
- https://www.dedoimedo.com/computers/grub-2.html
- Linux Jargon Buster: What is Grub in Linux? What is it Used for?
Repair/update Grub2
- Repair Grub2
- How to Update Grub on Ubuntu and Other Linux Distributions. Good instruction. Two disks; each with its own Linux distribution. The second disk won't install Grub. So the Linux on the 1st disk needs to update its grub so it can see the Linux on the 2nd disk.
- GRUB Rescue | Repairing GRUB (arch linux) Apr 2019
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
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
- UBUNTU Using GRUB2 to boot to ISO (kind of outdated)
- Custom Grub Boot Menu Feb 2019
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
- gksudo gedit /etc/default/grub
- 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)
- sudo update-grub
- Reboot
Grub Customizer - GUI program
- How To Change The GRUB Boot Order Or Default Boot Entry In Ubuntu, Linux Mint, Debian, Or Fedora With Grub Customizer
- How to Edit GRUB with GRUB Customizer
- Add a live ISO boot to GRUB menu
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
- Highlight the first item (default) and press 'e' in the GRUB menu
- 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
- Press Ctrl+x or F10 to boot into
To switch back to GUI, type sudo init 5. Level 5 is the default.
Dual boot
How to setup a Windows 10, Linux Mint 19.1 Dual Boot with Encrypted Partitions on a Dell XPS 15 9560
Triple boot
- Complete Guide To Triple Boot Windows, Lubuntu And Debian
- Adding Batocera on dual boot. Essentially, I had to install each while only their drive was in the computer. I did Xubuntu last, then added the other two drives and did a bunch of fiddling with Grub for it to pick up the OS's.
Where is grub installed
- Where is grub installed and do I need a new one for a separate linux installation?
- https://askubuntu.com/a/30347 which suggests Boot info script. Very useful. We can run it using live USB.
- The boot files in each partition will be discovered.
- After running sudo ./bootinfoscript, the result is saved in a text file "RESULTS.TXT".
- On my system it shows Grub2 is installed in the MBR of /dev/sda. My setup is /dev/sda for Windows 10, /dev/sdb for a backup disk and /dev/sdc for Ubuntu.
- The RESULTS.txt shows /sdc/boot/grub/grub.cfg contains the boot menu I saw when the system boots up.
- https://help.ubuntu.com/community/Boot-Repair
MBR and GPT
- MBR
- https://en.wikipedia.org/wiki/Master_boot_record
- MBR
- MBR only supports up to 4 primary partitions. If you want more, you have to make one of your primary partitions an extended partition and create logical partitions inside it. Cf. GPT also allows for a nearly unlimited number of partitions.
- What's the Difference Between GPT and MBR When Partitioning a Drive?
- How to Check if a Disk Uses GPT or MBR, and Convert Between the Two (Windows)
- On Linux, type sudo fdisk -l. The Disklabel type will show the type (e.g. dos, gpt, ...).
- Fdisk Command in Linux (Create Disk Partitions)
- How to Convert MBR to GPT Without Losing Data in Windows
- slax Linux asks your disk uses msdos partition scheme (use MBR, not GPT).
Create a completely separate partition using a suitable filesystem, such as NTFS that both can read.
Run Live Linux on Ram Disk
- How to Get to the GRUB menu at boot time & change the GRUB menu timeout at boot?
- Can I boot a Live USB fully to RAM, allowing me to remove the disk? (tested on Ubuntu 20.04)
- F11 - boot from USB on my old PC
- Hold Shift (or ESC on UEFI boot) in order to show GRUB menu
- Select English, Enter
- F6, followed by ESC to close the little popup
- Using the arrow key to add 'toram' (no quotes) after 'quiet splash'.
- Press Enter. You will see the LED on USB drive flashes. It took 7 minutes on my USB 2 port to enter the XFCE Desktop.
- Eject & unplug the USB drive.
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
- Analyze Linux startup performance
- Systemd Deep-Dive: A Complete, Easy to Understand Guide for Everyone (video)
- Linux has nearly half of the desktop OS Linux market. ChromeOS doesn't have systemd. It has upstart, which was one of the most widespread init systems.
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?
Bootable DOS USB Drive for BIOS update
How to Create a Bootable DOS USB Drive
Dell Optiplex
- How To Fix A Dell With A No Bootable Device Or No Boot Device Found Problem
- How To Fix Dell Computer Hard Drive Not Detected / Hard Drive Not Found / Hard Drive Not Installed
- To have a one-time boot up. Hit F12
- In my case, I don't need to upgrade BIOS (mine is 1.18 from 2019). I've used USB to install Ubuntu 22.04 on my SSD. However I cannot boot into it.
- Hit F2 to go to BIOS.
- Boot Sequence: Check ubuntu. Boot List Option: UEFI
- Advanced Boot Options: Checked both options.
- System Configuration: SATA Operation - AHCI.
- Security Boot: Uncheck 'Secure Boot Enable'