grub2 interview questions
Top grub2 frequently asked interview questions
Im searching for grub.conf
file in CentOS 7. I cant find it with locate
(I called updatedb
before). Where does it stores?
In older versions of CentOS I could find it.
Source: (StackOverflow)
The outputs of the help
and/or vbeinfo
command of grub2 shell are massive. How to scroll up the output? I've tried PageUp、Shift+PageUp, but nothing happened.

Source: (StackOverflow)
On Ubuntu 10.4 LTS I want Grub to start the default OS after 5 Seconds. I'd like to see the output of the startup scripts.
Currently grub wait forever until I hit return and the output of the startup scripts isn't visible. Can someone tell me how I have to configure /etc/default/grub
or any other setups?
I tried to play with GRUB_TIMEOUT
and GRUB_DEFAULT
and did a sudo update-grub
afterwards, but nothing changed.
Any ideas?
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_SAVEDEFAULT=true
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
# GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
Source: (StackOverflow)
Just completed a new computer build. I installed Win7 on a 2-disk RAID0 fakeraid. I then unplugged those drives and installed linux mint on a separate drive. I did it this way because if I left the drives plugged in, linux would jack up the fakeraid for those drives and make windows unbootable, and installing linux to the fakeraid itself is just too much of a PITA. So basically, this is the disk configuration, and there's no chance of me changing it.
Right now, I can boot into either win7 or mint by pressing F12 for the boot menu, and then selecting the drive the os is installed on. It would be nice if I could just add an entry to the grub menu for win7. I've used the menu.lst file before, but apparently all that has changed with grub2.
I've checked out some of the grub2 docs and poked around in /etc/grub.d, but frankly, it seems to be orders of magnitude more complicated than it should be.
I'm hoping someone can point me in the right direction on what exactly I need to change to get this to work. Thanks.
Source: (StackOverflow)
I was trying to boot from CD on a new HP Pavilion dv6 a few days ago with much frustration due to the Linux distributions I tried not working with EFI.
Additionally, the EFI Bios is Insyde H20, which I read has some issues regarding Linux as it is.
Specifically this: http://askubuntu.com/questions/150174/sony-vaio-with-insyde-h2o-efi-bios-will-not-boot-into-grub-efi
However, this appears to be related to booting Linux from the hard drive. I would just like to know:
- What exactly do I need to be able to boot Linux from a CD/USB? Is it a kernel-dependant thing or do I just need a bootloader like ELILO or Grub2 that supports booting EFI?
- Are there any Linux distributions that are distributed with the ability to boot in EFI as they are? Or rather, what would the easiest way to boot into a live Linux environment be using EFI and without the Legacy Booting?
Source: (StackOverflow)
I installed Windows 8 and Ubuntu 12.10 on a 3TB GPT disk in UEFI mode.
Both can boot up OK.
Both operating systems created their ntries in the UEFI boot menu, there's an "ubuntu" and a "Windows 8" entry.
The boot order can be altered in the motherboard's UEFI setup.
I'd like to boot "ubuntu" first, because I set up GRUB 2 to be able to boot both systems.
But whenever I boot Windows 8, it changes the boot order so that it boots up first.
How can I prevent this?
Thanks a lot.
-- UPDATE --
I learned that bcdedit.exe can be used to manipulate the Boot Configuration Data in windows.
This is important because Windows synchronizes the BCD with the boot NVRAM, that stores the boot order.
Every time the {fwbootmgr} entry in the BCD is touched, the NVRAM is overwritten.
I modified this entry to load GRUB 2 first, and it did. However, after booting Windows 8, both the NVRAM and the {fwbootmgr} in the BCD reverted to the original order, that is, to boot Windows 8 first.
I'm really puzzled by this.
-- UPDATE 2 --
I managed to kinda fix the problem by creating a startup script at the group policy editor in Windows. The startup script issues a "bcdedit /set {fwbootmgr} DEFAULT {appropriate UUID}" command. This is BIG hack, and definitely NOT the soulution I want. I'd like Windows to feel OK at the second place after GRUB in the NVRAM.
So how can I do that?
Source: (StackOverflow)
Here is what happened:
- Don't have enough space on my Windows partition
- Delete the stock "recovery" partition to make space
- Enlarge the Win partition
- Software messes up the Windows boot
- Go under Ubuntu to fix the problem
- Try to fix the Win7 MBR with
ms-sys -7
- Upgrade to Natty at the same time
- Flush the old GRUB, in the process, put a new one
grub-mkconfig
doesn't detect Windows
- Make up a Windows booting entry
- Try booting Windows
- Receive error "Invalid partition table"
Now I don't have any OS CD/DVD (Windows, Linux), so I have to work with what I have.
Here is my Boot Info Script
My Windows partition is on /dev/sda1
, but probably messed up in some way, and my GRUB script says this:
menuentry "Windows 7 (loader)"{
set root=(hd0,1)
chainloader +1
boot
}
How do I make Windows 7 boot again?
Source: (StackOverflow)
In the process of setting up an encrypted Windows partition along with a dual booting Ubuntu, I have had to install the GRUB bootloader onto a partition /dev/sda1
instead of the MBR.
In this setup /dev/sda1
is a Dell recovery partition.
It actually works fine believe it or not. I have written basic pointers.
To a point. On the system I was testing this on, I ended up with GRUB installed on two partitions, sda1
and sda2
. Is there a way to remove the GRUB blockfiles from one of these?
Source: (StackOverflow)
I have recently acquired a second SSD, and decided I would utilize a multi-boot setup to increase my productivity. One drive is for "work" (only contains Windows 7 and software needed for work) and on is for "play" (contains Windows 7 and anything else, games, etc.).
I have my "Play" drive set to boot by default, and I can select my "Work" drive from by BIOS boot menu when needed, but I have been continually frustrated when I forget to press the boot menu key during boot!
I have done some research, and it looks as though there are boot-selector programs that run before any OS gets to start. The most popular one I found is GRUB.
Can I use GRUB for what I am trying to accomplish? I do not use Linux.
Source: (StackOverflow)
EDIT3
This might be quite the hopeless case, so I posted another method that is simpler, but still need some help with.
will this work? backup partition contents of both linux and windows
I've recently resized a partition (/sda2 to make another partition, /sda1) on a disk where Windows 8 and KDE Linux Mint are installed on. A whole lot of things went wrong.
First, the computer wouldn't boot past BIOS and gave me grub rescue. With a Live Linux USB I used the boot-repair app to reinstall grub (on /sda). Thankfully linux booted from the new grub2 menu, but windows would crash when trying to load. When looking into it more on linux I found that apps like KDE Partition Manager and GParted both couldn't read the partition on my /sda disk.
KDE Partition Manager gives me "No valid partition was found on this device".
GParted gives me the whole thing is unallocated, and "unable to satisfy all constraints on the partiton".
I then installed another app, FixParts. That gave me the following:
Warning: 0xEE partition doesn't start on sector 1. This can cause problems
in some OSes.
and
Disk size is 250069680 sectors (119.2 GiB)
MBR disk identifier: 0x0FB1A4FB
MBR partitions:
Can Be Can Be
Number Boot Start Sector End Sector Status Logical Primary Code
1 63 192779 primary Y Y 0x07
2 * 208839 134062424 logical Y Y 0x07
5 134066176 234067967 logical Y Y 0x83
6 234067968 250068991 primary Y 0x82
fdisk -l gave me this:
Disk /dev/sda: 128.0 GB, 128035676160 bytes
255 heads, 63 sectors/track, 15566 cylinders, total 250069680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0fb1a4fb
Device Boot Start End Blocks Id System
/dev/sda1 63 192779 96358+ 7 HPFS/NTFS/exFAT
/dev/sda2 * 208839 134062424 66926793 7 HPFS/NTFS/exFAT
/dev/sda3 134066175 250068991 58001408+ f W95 Ext'd (LBA)
/dev/sda5 134066176 234067967 50000896 83 Linux
/dev/sda6 234067968 250068991 8000512 82 Linux swap / Solaris
where sda1 is just an empty NTFS partition, sda2 contains my Windows 8, sda5 is Linux /(root). /home is on another disk.
I want to keep my data. And I want my Windows 8 and Linux to be on the same disk because it's an SSD. If possible I would also like both Grub and Windows boot files to be on the same disk, but that's a different issue.
EDIT
First I thought the problem was "0xEE partition doesn't start on sector 1", but now I'm not so sure. My other disks (i got 3) give the same error, but the partition apps can read them. However, I remember seeing the boot-repair app reinstalling grub2 on every disk, so maybe that's related. Also, now I see that Windows 8 partition (/dev/sda2) is logical??? Windows cannot boot from logical, so it couldn't have been before. How can I even change that without loosing the data on it?
EDIT2
Really detailed info from boot-repair app: http://paste.ubuntu.com/6805345/
Source: (StackOverflow)
On a Debian Linux box, I'm running into a very strange situation where after power-on, GRUB fails with the error "no such partition", but if I then hit the reset button, it boots normally. I'm trying to diagnose the situation, and I realized that I don't know which versions of what bootloaders are installed where? How can I find out? That is, how can I find out what bootloader is installed on the MBR of each of my disks, and how can I find out which second-stage bootloaders are installed on the various partitions?
If I can't find out exactly what I have, I'd settle for being able to find out just which version of GRUB is installed where.
Source: (StackOverflow)
Moving to GRUB2 my Arch Linux no longer resumes from hibernation, because the actual resuming is no longer set up. In GRUB legacy I'd write:
/boot/grub/menu.lst:
kernel /vmlinuz26 root=/dev/disk/by-uuid/X ro resume=/dev/disk/by-uuid/Y ro
But with GRUB2's new way of handling the boot menu, I no longer know how, where and in which form to add this. My guess is you'd add the entire menuentry to /etc/grub.d/40_custom/ and somehow set up the resuming there? Manually hardcoding menuentries into GRUB2 seems to go against its flexible menu generation approach, but whatever reenables me to use hibernate is gladly welcomed.
Thanks!
Source: (StackOverflow)
My parents' pc has windows 7's boot manager installed at MBR and grub2 is installed on /dev/sda2 (booting linux on /dev/sda2). I want to make a bootable cd so that when booted from it just chainloads into the boot manager on the second partition. I assume using grub rather than grub2 for this will be simpler, using the configuration
timeout=0
hiddenmenu
default=0
title grub2 (/dev/sda2)
rootnoverify (hd0,1)
chainloader (hd0,1)+1
I know I can make a bootable linux cd in various ways, but that is not what I want. I just want to put grub/grub2 on the cd, no kernels or programs.
The question is how do I make the iso file? I have found some references to installing on a floppy or usb disk, but all those assume the device is present when running the grub install commands. A iso file is different.
Source: (StackOverflow)
I have Windows 7 and Ubuntu 10.04 installed on my system.
I want to configure GRUB so that it automatically boots into the default OS without displaying the boot menu; it should only appear if I enter a predefined key like F6 at boot time.
How can I do that?
Source: (StackOverflow)
I am having trouble adding Windows 7 to my GRUB 2 boot menu. I know similar questions have been asked and answered on this site and others, but none of the answers seem to work for me.
My setup:
Two hard drives, sda with a Win 7 installation and sdb with a Debian installation and GRUB2.
In my BIOS, I can choose which hard drive to boot from, and if I boot from the first hard drive Windows starts so I know that it is working. Now I want to add a menu item to GRUB to boot Windows.
I downloaded bootinfoscript and ran it, here is the RESULTS.txt
:
Boot Info Script 0.61 [1 April 2012]
============================= Boot Info Summary: ===============================
=> Windows is installed in the MBR of /dev/sda.
=> Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 2048
of the same hard drive for core.img. core.img is at this location and
looks for (,gpt2)/boot/grub on this drive.
sda1: __________________________________________________________________________
File system:
Boot sector type: Windows Vista/7: NTFS
Boot sector info:
Mounting failed: mount: unknown filesystem type ''
sda2: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files: /Windows/System32/winload.exe
sdb1: __________________________________________________________________________
File system: BIOS Boot partition
Boot sector type: Grub2's core.img
Boot sector info:
sdb2: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Mounting failed: mount: unknown filesystem type ''
mount: /dev/sdb2 already mounted or sdb2 busy
sdb3: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
============================ Drive/Partition Info: =============================
Drive: sda _____________________________________________________________________
Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sda1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS
/dev/sda2 206,848 500,115,455 499,908,608 7 NTFS / exFAT / HPFS
Drive: sdb _____________________________________________________________________
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sdb1 1 4,294,967,295 4,294,967,295 ee GPT
GUID Partition Table detected.
Partition Start Sector End Sector # of Sectors System
/dev/sdb1 2,048 4,095 2,048 BIOS Boot partition
/dev/sdb2 4,096 2,605,768,703 2,605,764,608 Data partition (Windows/Linux)
/dev/sdb3 2,605,768,704 2,639,306,751 33,538,048 Swap partition (Linux)
"blkid" output: ________________________________________________________________
Device UUID TYPE LABEL
/dev/sda2 DCA04533A0451584 ntfs
/dev/sdb2 ea61c63c-0a93-44fb-894c-f652c28b67d0 ext4
/dev/sdb3 ca9c61ec-f99e-428c-bdf3-65fbbfc4b43b swap
================================ Mount points: =================================
Device Mount_Point Type Options
/dev/disk/by-uuid/ea61c63c-0a93-44fb-894c-f652c28b67d0 / ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
/dev/sda2 /mnt/win fuseblk (ro,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
=============================== StdErr Messages: ===============================
xz: (stdin): Compressed data is corrupt
OS-prober does not seem to be able to detect my Win7 installation. If I run update-grub2
(which I believe in turn runs OS-prober) it will output:
Generating grub.cfg ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
done
I have tried some variations on GRUB menu entries (by modifying /etc/grub.d/40_custom
and then running update-grub2
). Here are some of them:
The first one is simple, inspired by (for instance) this link: http://technologytales.com/2010/11/21/manually-adding-an-entry-for-windows-7-to-an-ubuntu-grub2-menu/
menuentry 'Windows 7' {
set root='(hd0,2)'
chainloader +1
}
This will not boot, and results in the following output from GRUB:
Booting a command list
error: invalid signature.
Press any key to continue...
Then I tried this:
menuentry 'Windows 7' --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,2)'
search --no-floppy --fs-uuid --set=root DCA04533A0451584
chainloader +1
}
which results in:
BOOTMGR is missing
Press Ctrl+Alt+Del to restart
and then I tried:
menuentry 'Windows 7' --class windows --class os {
insmod part_msdos
insmod ntfs
insmod ntldr
set root='(hd0,2)'
search --no-floppy --fs-uuid --set=root DCA04533A0451584
ntldr ($root)/Windows/System32/winload.exe
}
which does not work either (goes to an empty screen with a blinking cursor).
I am really at a loss here. Any help would be greatly appreciated!
Update: I ran boot-repair-disk (as suggested by moses in comments) with default settings. It did not add a Win7 entry to the boot menu. Maybe it failed to detect the Win7 installation since it overwrote its MBR with GRUB. Here is a link to the boot-repair-disk log.
Source: (StackOverflow)