bootloader interview questions
Top bootloader frequently asked interview questions
- I was wondering what differences are
between firmware and software?
- What differences are
between firmware and OS?
- Are boot-loaders firmware? Bios is.
How about GNU grub? Is grub software or firmware?
Source: (StackOverflow)
When I got a new computer, I installed Ubuntu and Windows XP on it. When I turn it on, GRUB shows up and lets me choose between the OSes. All right so far.
A while later, I decided I don't want Ubuntu anymore (Linux fanboys, refrain). I deleted its partition, but I realized too late that GRUB depended on it, so the computer wouldn't boot. I installed Ubuntu again and it's working fine. So how do I tell the computer that I want it to boot directly into Windows?
Source: (StackOverflow)
After the BIOS, or something similar that serves as a firmware, is started, the control is passed to the bootloader, as far as I know.
Why can't the BIOS load the OS kernel directly?
Also, the GRUB manual says: briefly, a boot loader is the first software program that runs when a computer starts. Isn't the BIOS the first program that runs?
Source: (StackOverflow)
I installed Windows 7 and Windows 8 in EFI mode on a hard disk some days ago. Today, the bootloader got missing/corrupted.
I currently have the Windows 8 installer on a flash drive and tried using the Automatic Repair option to repair the bootloader but it didn't do anything. The Startup Repair option is also missing in the Windows 8 installer.
How I can repair/recreate the EFI bootloader from the Command Prompt?
BCDEDIT
returns the following message:
The requested system device cannot be found.
Source: (StackOverflow)
Which OSes can be put into the new bootloader that Windows 8 provides?
It seems to be quite pretty and consistent with the rest of the new Windows 8 design, so it would be cool to put Linux (Ubuntu) into it instead of using GRUB or BURG. Besides on my personal system, Linux will be put on a hard drive and not the SSD, so it would be a bit faster.
Source: (StackOverflow)
I am looking to create a USB flash drive that I can put multiple live CD ISO images on and select which boots from startup. The ideal candidate supports Linux and Windows-based ISO images, and is relatively simple. It also must have some reasonable process for adding and removing an ISO image from the drive/list.
Things that I'm not looking for in this specific question:
- UBCD4Win or other swiss-army knife live CDs. The point is to boot any one of multiple CDs, not to boot a (certainly useful) utility CD.
- Installing a single live CD to a USB drive. I'd like to have multiple ISO images, selectable at startup.
I don't have a specific purpose in mind, possibilties include a single drive with a Knoppix variant, Ubuntu desktop, UBCD4Win for DOS, the Offline NT Password Cracker, etc.
Flexible and easy to use are the name of the game!
Source: (StackOverflow)
I needed to resize my Boot Camp partition so I used Gparted to move and resize it. This seemed to work, except that now I can't boot into Windows.
I can boot into OS X just fine. OS X can recognize the Boot Camp partition and view its contents. When I try to reboot into Windows, however I get the message:
No bootable device -- insert boot disk and press any key
The only solutions I've been able to find online suggest that the only way to fix this is to either clone the drive or remove the Windows partition and re-install it.
Is there any way to fix my Windows partition so that I don't have to reinstall Windows again?
Source: (StackOverflow)
I currently work in a technology help desk for my college, where we fix the personal computers of all the students. We have hundreds of DVD's and CD's that we use to boot into all kinds of different things to troubleshoot. Among them are:
- Various Linux distros
- Windows PE environments
- hard drive Regen
- Windows recovery consoles (all versions)
- Windows installation disks (all versions)
This means that we spend a ton of money on CD's and DVD's as they get lost, scratched, etc. It is becoming quite a hassle to manage them! I have been considering toying with a PXE server that could allow us to boot to these things over the network and reduce the clutter.
Some of these disks have special boot information such that you can't simply copy the files to a blank disc. And some of them are incompatible with each other on multi-boot CD's I've made. For example, I haven't been able to make a multi-boot CD with Ubuntu 11.04 and Hiren's boot CD.
- Is it possible to have one PXE server that can allow devices to "boot to" many different environments?
- Is it possible for the PXE server to have bootable disk images (ISO's) that it simply 'emulates' for the connected computers to boot to?
- If the answer to #2 is 'no', how can one set up a PXE server to boot to multiple things?
Ultimately, I would like to boot to a PXE server that just gives a numbered menu of items that we can boot to. Like 1) Ubuntu, 2) hard drive Regen, 3) Windows 7 Home, etc. Is this possible?
Where can I start?
Source: (StackOverflow)
When I installed Windows 7 on my new SSD it seems I messed some parts up during the partition selection, and now I have my system partition with the boot sector on another harddrive, and the boot partition containing Windows on my SSD.
How can I move the boot sector from my hard drive to my SSD, so that the system and boot partition are both the SSD and I don't need the hard drive to boot anymore?
I'm a bit lost on how to do this, as I don't have any idea how I split them in the first place. When I had to repair the boot sector using BootRec.exe I could only put it back on the hard drive, I saw no option to create one somewhere else.
I also want to keep all content on my SSD, so reinstalling Windows is not an option.
Here's a screenshot of my current disk layout (in german, but most terms should be easily recognizable):
Source: (StackOverflow)
I have a system which dual-boots Gentoo Linux and Windows 7 using GRUB2. The computer has four drives, and Windows is installed on the third (last) partition of drive #2. The drive layout looks like this:
|boot|-----------------home-----------------|-------------windows-------------|
(boot
and home
are Linux partitions) It's an odd setup but it always worked, until I decided to shrink the Windows partition using Gparted. The new layout is:
|boot|-----------------------home-----------------------|-------windows-------|
After making these partition changes, when I select the Windows option in GRUB2 and it hands off control to the Windows bootloader, I get the error message:
Windows Boot Manager
Windows failed to start. A recent hardware or software change might be the cause.
To fix the problem:
1. Insert your Windows installation disc and restart your computer.
2. Choose your language settings, and then click "Next."
3. Click "repair your computer."
If you don't have this disc, contact your system administrator or computer
manufacturer for assistance.
Status: 0xc0000225
Info: The boot selection failed because a required device is inaccessible.
I'm not particularly surprised that this happens, but I'm wondering if I can fix this without reinstalling Windows.
I've tried booting the computer using the Windows installation DVD (specifically, a Windows 7 upgrade DVD). After I choose the language and keyboard and click "Repair this computer", the System Recovery Options screen doesn't detect my Windows partition. I can click "Next" anyway and then use Startup Repair, which fails to fix the problem, or try command-line tools, namely bootrec
(suggested by several websites), sfc
, and chkdsk
. None of them made a difference; I still get the same error message. (See below for detailed output.)
Also as suggested in similar questions, I tried using the "Rebuild BS" (rebuild boot sector) functionality in TestDisk, running under Linux, acting on the Windows partition. That also did not change the error I get.
I haven't seen any signs of data corruption on either partition, and the drives haven't suffered any physical damage, so it seems fairly certain that the change in partition layout is the cause of this error. I suppose Windows must have the starting sector and/or partition size stored somewhere within its filesystem (the registry?), suggesting that it should in principle be possible to fix this by twiddling a couple bytes in a file somewhere. But which file? Or is there something more complicated?
If it helps, here is the GRUB2 configuration section corresponding to Windows:
menuentry 'Windows 7 (loader) (on /dev/sdb3)' --class windows --class os $menuentry_id_option 'osprober-chain-1F9948EB30A986A0' {
insmod part_msdos
insmod ntfs
set root='hd1,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos3 --hint-efi=hd1,msdos3 --hint-baremetal=ahci1,msdos3 1F9948EB30A986A0
else
search --no-floppy --fs-uuid --set=root 1F9948EB30A986A0
fi
chainloader +1
}
Again, what I'm looking for is, ideally, a way to fix this without reinstalling Windows. If that's not possible, then reinstallation is an acceptable plan B, but I can handle that myself.
Here's a transcript of my command prompt sessions while booted into the repair environment using the Windows 7 installation DVD. I've removed some blank lines for readability. The following is with all other drives disconnected:
>bootrec /fixmbr
The operation completed successfully,
>bootrec /fixboot
The volume does not contain a recognized file system.
Please make sure that all required file system drivers are loaded and that the volume is not corrupted.
>bootrec /scanos
Scanning all disks for Windows installations.
Please wait, since this may take a while...
Successfully scanned Windows installations.
Total identified Windows installations: 1
[1] C:\Windows
The operation completed successfully.
>bootrec /rebuildbcd
Scanning all disks for Windows installations.
Please wait, since this may take a while...
Successfully scanned Windows installations.
Total identified Windows installations: 1
[1] C:\Windows
Add installation to boot list? Yes(Y)/No(N)/All(A):y
The volume does not contain a recognized file system.
Please make sure that all required file system drivers are loaded and that the volume is not corrupted.
>sfc /verifyonly /offwindir=C:\Windows /offbootdir=C:\
Beginning system scan. This process will take some time.
Windows Resource Protection did not find any integrity violations.
>chkdsk C: /F
The type of the file system is NTFS.
Volume label is windows.
CHKDSK is verifying files (stage 1 of 3)...
313344 file records processed.
File verification completed.
1684 large file records processed.
0 bad file records processed.
2 EA records processed.
158 reparse records processed.
CHKDSK is verifying indexes (stage 2 of 3)...
416370 index entries processed.
Index verification completed.
0 unindexed files scanned.
0 unindexed files recovered.
CHKDSK is verifying security descriptors (stage 3 of 3)...
313344 file SDs/SIDs processed.
Security descriptor verification completed.
51514 data files processed.
CHKDSK is verifying Usn journal...
35406088 USN bytes processed.
Usn Journal verification completed.
Windows has checked the file system and found no problems.
207510871 KB total disk space.
104134880 KB in 251224 files.
137304 KB in 51514 indexes.
0 KB in bad sectors.
423075 KB in use by the system.
65536 KB occupied by the log file.
102815612 KB available on disk.
4096 bytes in each allocation unit.
51877717 total allocation units on disk.
25703903 allocation units available on disk.
Failed to transfer logged messages to the event log with status 50.
>diskpart
Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: MININT-P92LVUL
DISKPART>list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 596 GB 0 B
DISKPART>select disk 0
Disk 0 is now the selected disk.
DISKPART>list part
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 62 MB 31 KB
Partition 2 Primary 398 GB 62 MB
Partition 3 Primary 197 GB 398 GB
When I run the same commands with all drives connected, the output is the same, except that diskpart
correctly shows all the drives, and the drive letter for the Windows partition in question is D
instead of C
(because I have an NTFS data partition on drive #1).
I would note that bootrec /fixmbr
overwrites the MBR of drive #2, replacing the MBR put there by GRUB2. When I then try to boot from that disk, I simply get the message "Missing operating system" instead of the 0xc0000225 error. I can then boot into Linux and use grub-install
to put back the GRUB2 MBR, and then choosing the Windows option in GRUB2 gives 0xc0000225 again.
Source: (StackOverflow)
I have no idea how to do this.
I have 7 iso's that I want to be able to easily boot from using a USB Stick and they are:
- Windows 7 Ultimate x86
- Windows 7 Ultimate x64
- Windows 8.1 x64
- Hirens BootCD
- Ultimate BootCD
- Windows XP Professional
- Ubuntu
Basically, I want to be able to boot my USB stick and instead of it just loading a single OS (like it does at the moment) I want a list of options ^ like above that I can choose and it will load that OS/ISO.
Any ideas how this can be achieved?
Source: (StackOverflow)
I installed rEFInd on my new Macbook Air which I planned on using to do a dual boot to Linux, but prior to installing Linux, I decided to encrypt my drive. I knew I was going to do this, so I had already installed rEFInd with the --esp
option.
When I rebooted after this however, it seemed to have deselected rEFInd for boot. I reinstalled, but when I did and rebooted, my Mac partition would not show up in the bootloader (only the recovery partition). I ended up needing to hold Command+Options+P+R to get it to boot again.
Any help getting these two to work together would be much appreciated.
Source: (StackOverflow)
When I move a bootable NTFS partition with Windows on it to a different block offset, what needs updating to make it bootable again?
Background: I plan to write a program that performs the necessary actions, that's why I am not seeking for guides how to use Microsoft's tools by booting from a Windows DVD. Instead, I need how to modify these things myself, so that I can write a solution that's easier for the average PC user when he wants to move his Windows system to a bigger hard disk.
In particular, here's what I tried:
I have a disk with several partitions, one of which is the NTFS partition with Windows on it, and the disk uses the plain old MBR block 0 for the partitions layout (no more than 4 partitions).
Now I format and partition a new, larger, disk. There I make room for the NTFS partition and copy the contents from the old disk's NTFS Windows partition into. And I make the partition "active".
However, when I try to boot from this disk, I get a "read error" message immediately and the booting stops, the exact text is:
A disk read error occurred
Press Ctrl+Alt+Del to restart
I verified that both disks have the same boot sector code in block 0.
It seems to me that something else might need updating. I guess that somewhere there's a absolute block reference that I need to update, probably pointing to the next level loader or to the NT kernel.
Update: I found this article going quite into the depth of what I want to know. However, it says to modify boot.ini, but I have Windows 7 installed here, where such things appear to have changed: No boot.ini but a folder called System Volume Information with GUID and other data in it that sounds related to my problem. Going to keep digging...
Update 2: Thanks to the terrible looking but very informative website by starman, I was able to figure out the first step: The NTFS boot sector has a field for "hidden" sectors. This feld has to contain the sector number of the boot sector. This solves the "read error" message. Now, however, I get a "BOOTMGR is missing" error instead. Looks like there's another place where a block number has to be adjusted, but I can't find anything in the code listing about this.
I do find a lot of help sites suggesting Windows tools for fixing this "BOOTMGR is missing" problem, but none seem to know what goes on behind the scenes. Kind of like suggesting to re-install Windows when there's a little problem with it. At least, those fixes seem to work, mostly involving the Bcdedit and Bootrec tools. Now, who knows what they do, especially the latter, in regards to a moved partition?
Update 3: After lots of trial-and-error attempts, I believe now that the solution lies in the BCD-Template registry file, residing usually inside \Windows\System32\config. If I get this updated using the "bcdboot" command, Windows starts up from it. I am now in the middle of figuring out what information this registry contains relevant to the above question. Any pointers to the contents of this registry are welcome.
Update 4: Turns out that while the BCD-Template file gets rewritten and has different binary contents than its predecessor, the values inside do not change. So it must be something else that bcdboot.exe writes. I had previously already checked if it changes the first 32 boot blocks of the partition, but they appear to remain unchanged. Parititon map doesn't get changed, either. So what is it that bcdboot modifies besides the BCD registry? Any tips on how I can trace that? Are there low level tools that show me what files a program writes to?
Update 5: The answer seems to be: c:\Boot\BCD is also changed, and that appears to be the key file for the boot manager's process. I'll investigate this later...
Update 6: It seems to be an important detail that I had originally two partitions created when I installed Windows 7: A small partition of 204800 sectors which appears to be a bootstrap partition, followed by the actual, large, partition containing the Windows system (drive C:). When I tried to transfer this installation to a new, larger, disk, I had kept the same two partitions intact on the new drive, although they ended up at a different offset. This alone led to the "BOOTMGR is missing" message. Since then, I've used bcdboot.exe only on the Windows partition, which added the \Boot\BCD file on that partition. That file (and folder) did originally only exist on the smaller partition. Hence, this problem may be more complicated in my case as one partition (the boot strapper) referred to another partition (the one containing the OS), whereas other people may only have to deal with one partition containing both, and maybe there the solution is simpler.
Update 7: Found one more detail: The \Boot\BCD file records the MBR's serial number. If that number doesn't match, the system won't boot. Next I'll test if there's also an absolute block reference stored in there.
Source: (StackOverflow)
I have just installed Windows-8 preview twice, because at first I accidentally installed it at the wrong partition and now I have got 2 entries with Windows-8 in the boot loader and would like to get rid of the other one.
So how can I remove an extra boot loader entry in Windows-8?
Source: (StackOverflow)
I have been trying to come up with an easier way of installing Windows and Linux dual booting on my laptop, not necessarily in that order. What we generally have to do is install Windows first, and then install linux and allow GRUB to handle Windows.
So what I'm trying to achive is to find a way to bypass that pesky installation process (windows) and just use an image to directly copy into my drive. This would also allow me to retain my boot manager (GRUB). (not that I cannot restore it afterwards, but it is Microsoft policy to monopolize, in this case denying the existence of other boot managers in the system).
I first obtained a legal copy of Windows 8.1, then proceeded to install it on a virtual machine using VirtualBox. Then, I created an NTFS partition on my GPT partitioned hard drive and copied the contents of the Windows partition from the .vdi image to the newly created partition.
Of course, it doesn't work yet. I don't know how to replace bootmgr. It gives
File: \Boot\BCD
Status: 0xc000000e
Info: The Boot Configuration Data for your PC is missing or contains errors.
because it can't find that file from the other partition which is used for booting, system recovery, etc.
Now, I've read that bootmgr eventually executes winload.exe to boot Windows up. I have no clue what to do next.
I reckon it should work theoretically because I have all the files required to run Windows. I also think that I should not be the only one who has thought of this, and hence I may be missing something very basic here. Maybe it is already done?
I have little idea how booting works. What I managed to understand is that when you dual-boot Windows and Linux, you chain the windows bootloader to linux's. So what I am trying to achieve is to somehow get rid of the Windows bootloader.
EDIT
I have been looking at the binary files bootmgr
and \Boot\BCD
. bootmgr
reads the BCD file and lists your options, among which you can select to boot into.
So information like executing winload.exe
resides in the BCD file. Now, I think bootmgr
itself is executed by syslinux using the chain.c32
module. What I am trying to do is somehow execute the windows bootloader, i.e. winload.exe
directly from syslinux (if possible), or modify bootmgr
so that it executes winload.exe
itself (whose path will be directly in the bootmgr
executable) without looking for BCD or anything else.
Hibernation (which requires a different procedure) is of no concern to me at this step.
Edit your question to tell us the firmware type, and (if EFI) whether
you have enabled the Compatibility Support Module in the firmware's
setup
My firmware is EFI (with CSM enabled), and I normally boot into Arch Linux using GRUB.
I have discovered that bootmgr
executes System32\winload.exe
on legacy systems, and System32\winload.efi
on EFI.
I have 0.0
idea on what to do from here. For the last 10 days, I have been trying to make changes to BCD and I think I am about to reach success. But that is irrelevant, because what I really want to do is to bypass the Windows Boot Manager altogether.
If you have any idea whether there is a way to execute that winload.efi
from the EFI shell (just a guess), or some other modification to GRUB so that it will boot Windows in EFI mode without the chainloader.
Any advices are welcome.
Addendum
Following forum posts might provide some useful insight:
http://reboot.pro/topic/19371-chainload-directly-to-winloadexe/
1.
The grub4dos right now can chainload a bootloader (like NTLDR or
BOOTMGR) because it can act as a replacement of the code contained in
a "normal" bootsector (i.e. something like 300 bytes of machine code).
This code simply sets a few parameters and then calls the loader.
Even that is (was) not easy at all to understand and replicate with
different code.
A NT system loader like BOOTMGR has more or less in a single .exe a
"real mode" operating system (not entirely unlike DOS) and
facilities/tools to parse both plain text and Registry hives, it is
not something that can be re-written from scratch easily.
The good guys @ReactOS are working on writing the FREELDR (which aims
to be a replacement for the much simpler NTLDR) since YEARS (and
believe me there are among the ReactOS programmers some really good
and good at it guys).
It seems (but it is not documented clearly) that they managed to
boot experimentally a Server 2003 with NTLDR.
2.
With the introduction of support for (U)EFI, BootMgr helps to abstract
the difference between BIOS and (U)EFI. For example, here are two
sequences:
BIOS (PCAT) -> BootMgr { BootMgr stub -> embedded BootMgr.exe } -> WinLoad.exe -> Windows
64-bit (U)EFI -> BootMgFw.efi -> BootMgr.efi -> WinLoad.efi -> Windows
WinLoad expects a certain environment (including API) to be present.
BootMgr takes care of this, so [almost] the same WinLoad program will
work in either environment.
In fact, (U)EFI defines a method for storing and fetching boot
parameters, so BootMgr's BCD covers that same purpose, regardless of
BIOS/(U)EFI.
But beyond BIOS and (U)EFI differences, BootMgr lets you make a "boot
choice," whereas WinLoad boots a particular operating system that it
knows how to boot.
Depending on how much of an environment WinLoad expects to be present,
it might be possible to invoke WinLoad directly. Michael Brown's
wimboot invokes the BootMgr PE[1] directly, so it could invoke WinLoad
directly, except that WinLoad probably wants more of an environment.
You could try it!
[1] Not to be confused with the BootMgr which GRUB4DOS and Syslinux'
chain.c32 can invoke. That BootMgr includes a stub which knows how to
invoke the embedded BootMgr PE.
Source: (StackOverflow)