Laboratorium Komputerowe Progmar
Marcin Załęczny

We are using cookies in the page. If you use the page you agree for the cookies.      Close

Useful Grub commands

Setting default option in Grub select-system menu:
We edit /etc/default/grub file and enter default option as GRUB_DEFAULT: GRUB_DEFAULT=option_number - number starting from 0. We save the file and enter following command for changes take place: update-grub

To install Grub as a bootmanager we steps through the following list of commands:

  1. Boot from the live CD of our distribution.
  2. Open terminal and issue the command: sudo fdisk -l to see which partition is our Linux installed on.
  3. Issue command: sudo mount /dev/sdaX /mnt where X is the number of partition found above, to mount the partition in /mnt directory.
  4. Issue command: sudo grub-install --root-directory=/mnt /dev/sda to install Grub in the /dev/sda disk's boot-sector.
  5. Issue command: sudo update-grub to update the Grub's configuration.
  6. Reboot.
  7. If during booting the system we see some errors (references to non-existing files), we have to repeat Grub installation process after system startup. So after logging in open the teminal and execute commands: sudo grub-install --root-directory=/ /dev/sda
    sudo update-grub

To set background image for Grub's system menu, we edit following file: /etc/grub.d/05_debian_theme and in the line before last line (before line containing: set_default_theme) we enter following lines: # If we haven't found a background image yet, use the default from desktop-base.
if set_background_image "/boot/grub/_b1ocean.tga"; then
exit 0
fi
And next we issue command: update-grub.

After each changing Grub settings we must enter following command for changes to take place: update-grub

How to make GRUB menu to show each time computer is rebooted on the machine with single operating system (Linux)

  1. Install GRUB: sudo grub-install --recheck --no-floppy --root-directory=/ /dev/sda
  2. Open /etc/default/grub file in your favourite text editor and comment out line GRUB_HIDDEN_TIMEOUT=0 by inserting '#' character on the very first position in the line.
  3. Apply the change by issuing command: sudo update-grub
  4. Reboot and enjoy with GRUB menu at the system start.