(20141224 – This post has been amended to address changes in recent versions of Ubuntu, and to remove outdated instructions — iceflatline)
This post will describe how to use the Window 7 boot configuration data editor (BCDEdit) to configure a Windows 7 system that can boot to Windows 7 or a Linux distribution. The steps described in this post assume that Windows 7 and the Linux distribution will occupy the same physical hard drive. Configuring BCDEdit to recognize and boot a Linux distribution located on a second physical hard drive is beyond the scope of this post.
To help explain the steps involved, we’ll use an 320 GB SATA hard drive with Windows 7 already installed. We’ll reduce the size of the partition containing the Windows 7 operating system and re-partition the remaining unallocated disk space in order to install the Linux distribution Ubuntu. We’ll then use BCDedit to add a Windows boot menu option for Ubuntu. All steps involved assume you have a functioning CD drive (or USB drive if you’d prefer) that the system can boot from. The software versions used in this post were as follows:
- Ubuntu v14.10 (x64)
- Windows 7 Professional (x64)
Oh…, and while I’ve never encountered a situation where the Windows 7 Disk Management tool destroyed existing disk data, make sure you backup any critical files before you proceed.
So, let’s get started.
Reducing the Windows Partition
The first thing that we need to do is reduce the size of the existing Windows 7 partition. While you can use third-party applications like GParted, I found Windows 7’s own Disk Management tool to be the most efficient method for accomplishing this task. The Disk Management tool can be accessed by using Win+r and entering the command diskmgmt.msc.
You’ll notice that Windows 7 currently occupies all of the existing disk space using two primary partitions: one small boot partition; the other for the operating system. When finished, we’ll have five partitions in total: the two Windows 7-related partitions just mentioned, and ones for the Ubuntu operating system and Linux swap. We’ll also create a small FAT32 partition for sharing data between Windows 7 and Ubuntu. You’ll need to determine how much space you want to allocate to each of these additional partitions based on your requirements and disk size. For our 320 GB disk example, we’ll use the following partition layout:
Windows 7: ~100MB (Windows 7 boot loader)
Windows 7: ~251 GB
Ubuntu: ~31 GB
Linux-Swap: ~1 GB
FAT32: ~16 GB
Right-click on the Windows 7 volume (C:) and selected “Shrink Volume.” Then enter the amount of space (in Megabytes) that the partition should shrink (which in turn becomes the amount of space available to install our Linux distribution), which in our example is 48000 Megabytes (48 Gigabytes), then select “Shrink” (See Figure 1). When complete, exit out of the Disk Management tool and reboot the system.
Installing Ubuntu
Now it’s time to partition our 48 GB of unallocatd disk space and install Ubuntu. Download a copy of Ubuntu Desktop and burn it to a CD (or place it on a bootable USB drive). Boot the system using the Ubuntu disk. Select “Try Ubuntu…” and then double-click the “Install Ubuntu…” icon when the desktop appears. Continue through the installation process until you arrive at “Installation type” and select “Something else”, then select “Continue”. (See Figure 2).
The screen that follows is where we’ll instruct Ubuntu how to partition the unallocated disk space. Left-click on “free space” to highlight it and then select the “+” icon to create a new partition. Make the size of this partition 31000 MB. Ensure it’s a primary partition, and located at the beginning of the free space. Select the Ext4 journaling file system and, since this partition will serve as the root partition for Ubuntu, set the mount point to / from the list of choices in the drop-down lists. Now select “OK” to accept the changes (See Figure 3).
Now let’s create a partition for use as Linux swap space. Once again, left-click on free space to highlight it and then select the + icon to create a new partition. Make the size of this partition 1000 MB. Our disk is limited to a maximum of four primary partitions, so we’ll make this a logical partition – again located at the beginning of the free space. Select “swap area” from the list of choices in the drop-down list, then select “OK” to accept the changes (See Figure 4).
Using similar steps, let’s partition the remaining free space as a FAT32 file system. This too should be a logical parition, located at the beginning of the space. You may also wish to set the mount point to /media/share, or something similar. The benefit of selecting a mount point at this stage is that Ubuntu will add this partition to the file /etc/fstab so that the system automatically mounts it at boot time. No worries though, you can always select a different mount point and manually mount it and/or add it to /etc/fstab at a later time. When complete, select “OK” to accept the changes (See Figure 5).
The final step is critical. We need to tell the Ubuntu installer where to install the system bootloader (GRUB 2). We DO NOT want to install the bootloader on /dev/sda, as that would overwrite our disk’s master boot record, nor do we want to install it on /dev/sda1 or /dev/sda2, as that would overwrite the Windows 7 bootmanager files and boot configuration data, or the operating system itself. Instead, let’s have Ubuntu install its bootloader on the partition that will contain the Ubuntu operating system – in our case /dev/sda3. To do this, click on the drop down list under “Device for boot loader installation” and select /dev/sda3 (See Figure 6).
Select “Install Now” and Ubuntu will begin the installation. When it completes you’ll be asked whether you’d like to reboot or “continue testing”. You should select continue testing as the following steps require access to a terminal.
Configure Windows for Dual Boot
Now that we have our disk partitioned and Ubuntu installed, let’s set up our system to boot Windows 7 or Ubuntu. This will involve copying the boot record of our Ubuntu partition to Windows 7, and using BCDEdit to create a new entry in the BCD store that will point to that file. This way Windows 7 will display a menu at boot time that will give you a choice between Windows 7 and Ubuntu.
First, let’s make a mount point for the FAT32 partition we created. Open a terminal and enter the following:
1 2 |
sudo su mkdir /mnt/share |
Next, let’s mount the correct device to this directory. Recall from the partitioning steps above that the FAT32 partition is located at device /dev/sda6:
1 |
mount /dev/sda6 /mnt/share |
Write the first 512 bytes of our Ubuntu partition to a file and copy that file to our FAT32 partition:
1 |
dd if=/dev/sda3 of=/mnt/share/ubuntu.bin bs=512 count=1 |
Note: using the FAT32 partition in the aforementioned steps is optional. You may chose to use another device such as a USB drive to copy the *.bin file to.
Exit out of the Ubuntu live system and reboot to Windows 7. Along the way, you may see Windows perform a disk check (don’t worry, that’s normal, and should only occur once as a result of these procedures). Log into Windows 7 and open the FAT32 volume you created and you should see the ubuntu.bin file. Copy that file to the root of the Windows 7 volume (e.g., C:).
Now we’ll use BCDEdit to add an entry to Windows 7’s BCD store. Administrative privileges are required to use BCDEdit, so use Win+r, type cmd, and then press CTRL+SHIFT+ENTER. Let’s start by creating an entry for our Linux distribution. Note here that you are free to choose another entry name if desired:
1 |
bcdedit /create /d “Ubuntu” /application bootsector |
BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}. Next, let’s specify which partition hosts a copy of the linux.bin file:
1 |
bcdedit /set {ID} device partition=c: |
The path to our ubuntu.bin file:
1 |
bcdedit /set {ID} path \ubuntu.bin |
An entry to the displayed menu at boot time:
1 |
bcdedit /displayorder {ID} /addlast |
and finally, let’s specify how long the menu choices will be displayed:
1 |
bcdedit /timeout 30 |
That’s it! Now reboot and you will be presented with menu where you can choose to boot to Windows 7 or Ubuntu. When you choose Ubuntu, you’ll be taken to the it bootloader menu where you can choose to continue booting Ubuntu.
On a final note, if at any time you want to eliminate the Ubuntu menu option simply delete the BCD store entry you created using the following command:
1 |
bcdedit /delete {ID} |
Conclusion
With a minimal amount time and a little Windows command line foo, you can easily set up a system that can dual boot Windows 7 and your choice of Linux distributions.
References
http://technet.microsoft.com/en-us/library/cc709667%28WS.10%29.aspx
WOW… what a great article which i was needing help of.. i have a small query that the above tutorial will work if 7 is installed in logical partition instead of primary partition & ubuntu being the first primary partition ???????
Pratheek, thanks for the kind words, glad you enjoyed it. In answer to your question, yes, it should still work so long as the machine is using the Win 7 bootloader to boot. Again, just make sure to install the GRUB bootloader in the same partition you’re installing the associated linux distro on.
Nice article,
helped me through a rough time ;)
You can use Ubuntu Live-CD instead of GParted for the command to copy the data to os-share. if you failed to install a fat32 partition for sharing data with win a ubuntu live-cd can help if you got a usb device. Connect and the ubuntu from live cd will automatically mount it to /media/YOURDEVICENAME
But Again, GREAT Work 1000x thx
Thanks GlorteX. Good advice. You’re absolutely right, you certainly can use the Ubuntu Live CD (or any Live CD for that matter…). I chose the Gparted disk because it boots to a useful environment much faster than the Ubuntu Live CD.
hey, thanks much for the post. This allowed me to:
– wipe a thinkpad, install Win XP from the factory partition
– install Windows 7
– install Ubuntu
– set up all to boot from the Windows 7 bootloader
… all in the same afternoon/evening.
Not like the old days….
Excellent! Thanks Raul. Glad it helped. You’re right about it not being like the old days :(
I’ve installed linux on a 2nd physical drvie and followed the above steps. When I selected Linux, it never booted into linux. I had a blank screen, with a flashing underscore at the upper left corner of my screen. I would have thought the steps above should work regardless. BTW, I didn’t create a FAT32, I used the ubuntu Live CD and used the ‘dd’ command to copy the 512 bytes into a file.
ted, I agree. Although I haven’t tried the steps above when Linux was installed on another physical drive, the steps should work regardless.
I would first make sure that Windows recognizes your Linux disk as a valid drive in Disk Manager and also make sure that you’ve given BCD the correct drive letter in the following command:
[plain light=”true”]
bcdedit /set {ID} device partition=n:
[/plain]
Where n is the correct drive letter.
However, in your case, the blinking cursor suggests to me that the GRUB bootloader is missing (or is not in the correct location), so make sure you’ve installed GRUB on the Linux disk correctly. You should be able to verify that it has been by trying to boot to your Linux disk directly when the machine starts.
Skipping the Fat32 partition is perfectly acceptable. I included that step simply because I find it useful for sharing files between OSs. Using the Ubuntu live CD to issue the dd command is also fine – in fact, you could use any valid Linux or Unix live CD. I recommended using the gparted disk in the instructions because I find it boots faster that most live CDs.
Good luck, and let me know how you make out.
Update – I forgot to mention I was using Fedora 12 instead of Fedora 11. Installed bootloader in the 1st partition and verified the boot sector ftype was ext3 instead of ext4. Copied 1st 512 into a file and placed file in c:\ directory (under windows of course). It may be there is a slight compatibility/bug/whatever issue with Fedora 12 and my H/W (which I fine a little odd since my laptop is not that old). It’s a Dell M6400, 4G RAM, and a 320G HD.
Anyway, finally gave up and installed CentOS 5.4 (RedHat in all but name). Worked beautifully! No problems. Followed steps as before and everything fell into place. Not quite sure why it didn’t work with Fedora 12, but after spending a couple of long nights trying to determine what was wrong, I’m happy just to get it to work with CentOS!
BTW, your writeup was spot on (despite my fickled Fedora 12). Thanks
Ah, gotcha. Well, I’m glad you got it working with CentOS. Still though, I wonder why Fedora 12 isn’t working for you. Time permitting I’ll try installing it here and see if I can duplicate the problem.
Best of luck ted, and thanks for the update.
One other thing I still forgot to mention. The generated grub.conf had the HD designations backwards. Windows 7 is on hd0. grub.conf, for whatever reason, labeled it hd1 and fedora 12 as hd0 (huh? Iget that at all). I made a copy of grub.conf and edited to to correct the HD designations. Still didn’t work. Now I did forget to change the HD designation for the splash.img.gz(?) file. This may be why it didn’t work.
Anyway, CentOS generated a correct version of grub.conf. So there was no reason to go back to Fedora 12. I would have prefered Fedora 12, but not to the point where I would have messed up my Windows 7 installation.
Hopefully, I’ve haven’t overstayed my welcome, but I felt I should let others know what may happen using Fedora 12.
ted, you’re not overstaying at all. The updates are very much appreciated.
I’m a but confused here. I thought BCD could act as a replacement for Grub, which is Linux’s boot loader. Can’t BCD boot a linux distro directly, by doing something like this grub command?
title Linux-2.6.7
root (hd0,1)
kernel /boot/vmlinuz-2.6.7 root=/dev/hda2 vga=791 ro
Thanks
Hi. I Try variant with Win7 & Ubuntu. After i select item on winloader menu – i see this:
GRUB_
Can’t type anything…only CtrlAltDel… what can i do?
Thanks…
I updated many of the steps in this post today to address changes in recent versions of GParted, Fedora and Ubuntu.
patyr, thanks for your comment. I assume you used Ubuntu v9.10 (Karmic)? If so, I suspect you may have placed Ubuntu’s bootloader on the wrong partition. The steps I originally described in the post assumed GRUB. However, beginning with Karmic, Ubuntu uses GRUB 2 as its bootloader and the steps necessary to place the GRUB 2 on the correct partition are different. I’ve since updated the post so you might try going back over the steps again.
Mogplus8, thanks for your comment. Absolutely, there’s no particular reason why you need to use the GRUB menu or chainload Windows 7 in GRUB. I set it up the way I described because I rather like seeing the GRUB menu after selecting “Linux” from the Windows bootloader. It gives me the opportunity to return back to Windows, or to boot to an older kernel version if desired. The choice is yours though. Note: I have not tested your GRUB configuration suggestion so I can’t comment on whether a distribution(s) will boot with it or not.
iceflatiline,
I have the same result as patyr, in which I get the GRUB_ after selecting the Ubuntu option and I can only do Ctrl+Alt+Del…
The only difference is that I installed Windows 7 on one hard drive and Ubuntu 9.10 on a different hard drive. I most likely chose the wrong partition. Instead of removing and reinstalling Ubuntu, is there a way to edit the linux.bin file to point to the right partition and then repeat the steps to copy the linux.bin file? if not, I assume I could reinstall Ubuntu, choose the correct partition and then just skip to the copying of the linux.bin file??
Thanks!
GylWind, no way to edit the *.bin file that I’m aware of.
Thanks for the quick response. I will reinstall and hopefully pick the right partition. The last time, I clicked the down-arrow and was given list, such as /dev/sdb, /dev/sdb1, /dev/sdb6 along with the Windows partitions. I chose /dev/sdb1. Should I have picked /dev/sdb? or do I need to type it in as (hd1,0), for example?
Ugh! Unfortunately, I have not been able to get Windows 7 Enterprise and Ubuntu 9.10 to dual boot successfully. I either get GRUB with a blinking cursor when I select UBUNTU or I just get a blinking cursor. I have tried using the drop-down selection to choose the boot area (/dev/sdb and /dev/sdb1) to no avail as well as typing (hd1) or (hd1,1).
Windows is on its own hard drive (160GB) and I’m installing UBUNTU to a 60GB hard drive. GParted sees Windows drive as /dev/hda1 and UBUNTU as /dev/hdb1 (ext4), /dev/hdb2 (extended), /dev/hdb5 (swap) and /dev/hdb6 (fat32).
Any help for you or anyone here will be much appreciated.
Thanks,
GylWind
Ok – I gave up! I removed both IDE drives and used a SATA drive. I installed Windows 7 Enterprise and then created partitions for Ubuntu and followed the directions above. IT WORKED! So, the lesson I’m learning is that Windows and Ubuntu must have partitions on the same hard drive for this to work. Using separate hard drives for each OS doesn’t seem to work. If someone knows or figures out something I couldn’t – let me know :-D
Thanks!
GylWind
Gylwind, thank you for your comments and sorry for belated reply, work really has me buried right now.
I set up a similar scenario (sda=Win 7, sdb=Linux) on my test rig last night and ran into similar difficulties. I suspect we’ll need to trick the windows bootloader into recognizing the boot sector on the second drive somehow, but the necessary BCDedit commands escape me right now. I’ll continue to work on this and post a solution when/if I find one.
mea culpa for the frustration…
Hi iceflatline, really nice site and article. It’s great to see someone take such effort and care when making something like this as I have read many a forum, where the replies are one liners but assume that you understand what they mean.
I have Win 7 x64 installed to sda (installed first), ubuntu 9.10 x64 installed to sdb and a few more drives which I will connect later but for now, I get the same issue where once ubuntu is selected, I immediately go to a blank black screen with the flashing cursor. I have tried 3 rebuilds so far of the ubuntu system, changing the boot and using EasyBCD in windows but haven’t been able to get around it. Online searches seem to have the same issue when win is first and ubuntu is second and using the windows bootloader. I suppose the only way to get around it is to change the order. Ubuntu first then windows.
Hi frank, thanks for the kind words.
If the two operating systems are on the same physical disk (separate partitions) then the steps defined in the article should do the trick for you regardless of whether the small windows boot partition is the first partition or not. However, when the two operating systems are on separate physical media, I have not been able to (yet) successfully coax Windows into recognizing the GRUB bootloader residing on the other disk using BCDEdit.
What I suspect may work, although I haven’t tried it, is to install Ubuntu on, say, disk a, and Windows on disk b, then use the GRUB bootloader on disk a to chainload Windows from disk b. You’d likely have to edit GRUB’s config file manually though as I doubt Ubuntu would recognize the existence of Windows located on disk b at install.
Just some thoughts… let me know how you make out.
I installed Ubuntu 9.10 next to Windows 7 64 bit Home Premium using your detailed guide.
Let me make 2 remarks:
1) During the installation at step 7/7 -> “Advanced” -> “Device for bootloader installation”, when it comes to replacing “(hd0)” with “(hd0,3)”, I used the dropdown list in that dialog instead of typing “(hd0,3)”.
The dropdown list offered “/dev/sda”, “/dev/sda1”, “/dev/sda2” and “/dev/sda3”, so I chose “/dev/sda3”
This also worked, so I assume it doesn’t matter whether you specify the grub2 or the linux name of the partition.
2) After the installation and the steps involving bcdedit and copying the bootsector of sda3 to c:\ I booted into Ubuntu and updated the system. After another reboot, selecting “Linux” in the Windows boot menu just displayed
GRUB_
and didn’t boot Ubuntu.
It turned out, the Ubuntu updates included an update of grub2, which changed the boot sector in /dev/sda3, but of course did not change the copy in c:\linux.bin
I had to repeat the steps that describe copying the bootsector to c:\
After that, Linux booted again.
Hi Iceflatline,
Well, I have since gone through and re-installed everything, starting with ubuntu on sda and then windows 7 on sdb. During the installation of Windows 7, I had issues with windows saying that it couldn’t find a valid installation location or partition. I bounced back and forth between Live sessions, GParted and the Windows installation process but kept having the same issue. I then disconnected sda (read in a few forums that installing that way would get around it) and installed fine. Now, I can’t get Ubuntu to take over the boot process (although, I have played around with GParted trying to make the partition not bootable) but it hasn’t seemed to change anything. It looks like for now, unless I give up on having the dual boot on separate HDD’s, it just can’t be done (at least for the time being).
A curious question, which could be a part of the reason I am having such a challenge with this is in the other disk management software, I think it’s Dalimpsest, it says something like isw_raid_member. I have searched for some reference to this but there doesn’t seem to be much in the way of suggestions on how to resolve this. I did remove some reference to raid on sda when I originally installed ubuntu on it. I have been chopping and changing the sequence of the HDD’s. Some reference mdmraid commands but the one I used was different. Anyway, I might just spend another day trying to figure it out, then work on the 1 HDD option.
frank, thanks for the update. You’ve definitely been busy!
You might look into using GRUB’s map command. While I’ve not had the occasion to use it, but it purportedly allows one to chainload Windows (or another OS) from a second disk by essentially performing a virtual swap between your first and second hard drive. You can learn more about using it from the Super Grub Disk Wiki
Thanks for the feedback iceflatline. Can you help me with another question? I’d like to install Kubuntu in my Linux partition, but I don’t want to clobber Win7 or BCD. If I just install Kubuntu and then skip the Grub install bit will that do it, or will Kubuntu still overwrite the MBR? If I can install Kubuntu can I set BCD up to boot into Win7 or Kubuntu? I used EasyBCD last time, but that seems to have hidden everything in a binary file so I can’t tell what’s going on.
All help greatly appreciated.
Cheers,
Ian
tscharlii, thanks much for the great info and bringing this to everyone’s attention.
Regarding your first comment, yes, I noticed this change recently myself. This was a much needed update to Ubuntu’s installer in my opinion as the previous method made it too easy for users to unintentionally overwrite the disk MBR. I’ll update the article soon to make reference to the drop down list.
Regarding your second comment, that situation is interesting indeed. I’ve not experienced any post installation updates causing subsequent boot problems. I’ll test this and if need be update the article.
Thanks again…
Mogplus8,
I don’t recall if Ubuntu/Kubuntu LiveCD actually gives you the option to not install GRUB. So, if you don’t select an alternate partition, then yes, it will install itself to the MBR. You might want to check out and try Ubuntu’s text-based installer, which, if I recall correctly, will give you greater control over the install, including whether or not to install GRUB. An important thing to remember though is that, whether it’s Kubuntu, Ubuntu or another distribution, it will need a bootloader. If I understand your series of comments correctly, it’s the GRUB menu you find objectionable. If that’s the case, you may want to consider simply hiding it. So long as GRUB is set to boot Kubuntu by default, then you should go right to it when you select it from the Windows bootloader screen.
Hello,
I am experiencing exactly the same problem as Ted when I want to install Ubuntu 10.04 on a second disc, with a Win7 dual boot.
I did not want to change anything on my 1st disc with Win7 installed in factory, as I suspect my PC is tatooed. So I created a partition for Ubuntu on my second disk (/sdb2), installed Ubuntu onto it with the bootsector on /sdb2.
I then copied it (with dd if=/sdb2 of=… bs=512 count=1) to a file that I placed on my C:, and used the same bcdedit commands to create the entry for bootmgr.
What I got:
1. I did not harm my Win7 boot, it still works :-)
2. but my Linux boot won’t work, black screen with some cryptic characters when I launch it.
I did not understood if ted could solve his problem with the Ubuntu distro… I do not know what to do now, I have a lot of unanswered questions…
is this due to Ubuntu being installed onto a different disc from Win7 ?
I noticed an “osdevice” option together with “device” in bcdedit, should I use it ?
Where is the bug ? Chaining incorrect from bootmgr to Grub, from Grub phase 1 to phase 2 ?
Any help is greaty appreciated… Thanx !!
Gilles
Hi and thanks for allowing comments without the need to register; that’s ballsy. I have the same setup as Gillies, and up until where he says “What I got:”, I did everything the same as him.
What I get, when I boot up and choose Ubuntu is “BOOTMGR is missing. Press Ctrl+Atl+Del to Restart”
I opened the linux.bin file in notepad and can see that my error is one that is list in there but the rest of the info in there is encrypted (or not meant to be read in notepad). Any help here is also appreciated.
Thanks for this thorough guide by the way.
Sorry for my blatant ignorance, I am just now noticing that it has already been stated this guide will not work if each OS is installed on separate physical disks. Shyte! would have been nice. Thanks nonetheless.
Jeremy, thanks for your comments. Yes, the intent of this article was to describe how to dual boot off the same hard drive. I hope to find the time soon to determine how to achieve the same thing using two separate hard drives.
[…] grub? If you want to use the Windows 7 bootloader you got to use BCDEdit. Check the tutorial here. You can also have a look at the latest beta version of EasyBCD which supports Grub2. You will […]
I have the same problem with this. I install Ubuntu on second HDD and this with bcdedit dont work with me. How to resolve this?
Before this thread dies I was surprised none have mentioned the start up manager left idling in your repository, a GUI interface to swap O/S or kernel and mess about with the splash screen, time out etc
https://help.ubuntu.com/community/StartUpManager
Another solution would be to avoid all these various conflicts altogether!! simply buy a switch that front panels a 4 way dial and physically swap drives. one drive alive at a time. keep them all totally independent and avoid all the potential software headaches.
http://www.usbgear.com/SATA-Switch.html
I am sure you could source an UK supplier. I am definitely going down this road!! Hope this helps others
DIK
Dulwichdik, thanks for the tips!
I am having the same problem as Ted and Gilles here is my setup:
Ubuntu 10.04 – Disk 0 (IDE drive)
Windows 7- C: -Disk 1 (SATA drive)
I set the Linux partition’s device to C: and the path to \linux.bin like the guide says.
If only there was a way for windows to recognize Linux as D: or something and then I could specify it. But it goes unnamed in the disk manager(i can still see it but its labeled Disk 0). It seems the problem could be the linux.bin has to be found on the same drive as the linux partition. Is there any way to point to the linux.bin stored on the linux drive maybe?
Please keep looking into a solution.
Is it possible the 512 byte dump went wrong? when I open the linux.bin in a text file I see a lot of gibberish and then
“Remove disks or other media.ÿ
Disk errorÿ
Press any key to restart
¬ËØ Uª”
If you need any more information let me know.
Thanks,
Syrn
update: I rules out the possibility that it was a bad dump, i redid the process with the livecd and I dont get any signs of error when opened up with notepad anymore. The same thing happens, the dreaded blinking cursor.
Thinking back to what I said earlier about the linux.bin having to be on the linux partition was definitely wrong. For example, my dad dual boots windows xp and windows 7 each on different drives… so what i said earlier doesn’t make sense. Now I’m really perplexed. What could be halting the boot? And most importantly how can I fix it?
Thanks,
Syrn
Syrn, thanks for your questions and comments.
To clarify, the scope of the article is really to describe how to dual boot between two OS residing on the same hard drive using the Win 7/Vista BCD store. I use this configuration often for laptops where I typically only have one drive.
As I mentioned in an earlier comment, I hope to find the time soon to determine how to achieve the same thing using two separate hard drives, assuming BCD will even support that configuration.
In the mean time, a few options for you:
You could use GRUB or GRUB2 as your bootloader. GRUB2 in particular appears now to do a pretty good job of discovering Windows partitions and drives on its own;
You could use a third-party Windows solution like EasyBCD;
Or you could simply select which drive you want through your systems BIOS.
Hope this helps.
Thanks for the great information. The latest EasyBCD build did the trick and I would highly recommend this program as a solution for people running two separate hard drives. The only issue is you must sign up to the forums to download the latest build. It seems they have custom .bin files that solve the issues I was facing.
The following quote helped me get started:
“Use EasyBCD 2.0 latest build (not 1.7) in W7 to add a Linux entry to the BCD. Select the correct grub (2 or legacy depending on the distro you use), and in the latter case tick the “grub isn’t …” box only if Linux is on a different drive to W7.” -Terry60
It did quite annoy me that I had to sign up to get the latest beta build so I have uploaded EasyBCD 2.0 Beta – Build 100.
To the users above having problems with EasyBCD, have you tried the latest build?
Thanks a lot for sharing this information, I do not know about anyone else, but I can totally make use of it.
You’re welcome Robyn. Thanks for your kind comment.
Thanks, man.
I don’t know why, but i like the Windows Bootmanager more.
Ans my wife only uses Windows, so it’s easier this way.
Congratulations for your perfect job.
Twinsen, thanks for your comments.
Hi man, this is really good,very useful guide, thanks, it enabled me to install windows 7/ubuntu/Centos multi-boot using windows bootloader,thanks again, u should make it as a sticky topic in all linux forums btw, did u try that ? i think guys at fedoraforum.org will love that.
mnassar, thanks much for your comment. Glad to hear it worked well with Centos. Also, thanks for your suggestion regarding a forum sticky topic. I had given some consideration to sharing this post with some forums, but ultimately decided against it. I’ve already updated the post several times to reflect changes in the way Ubuntu and Fedora installers work, and I anticipate updates will be needed in the future. I don’t relish the idea of trying to maintain a forum sticky or two, as well as the post, in order to keep their content aligned.
Anyway, cheers. And thanks again for your comments.
I had a question regarding the partitioning of the Hard drive. I know there can only be 4 primary partitions on the disk. My laptop came with an 8 gig “Recovery” primary partition as the first partition. So the 100Mb Boot is the second, and the third is Win7. Can I make the remaining partition an extended partition, and split it up into 3 for the OS (Ubuntu), swap and share partitions? Will this work or is there a better way to work around this?
Thanks!
Mike, thanks for your question. Yes you can. As a matter of fact, that’s essentially the same partition layout I have on the Lenovo laptop I’m using to type this response.
I was able to install Ubuntu and get my laptop to dual boot. Thanks! Now for a little problem when I’m in Ubuntu. It looks like the right 1/10 of my screen is cut off and not displaying correctly(I was barely able to restart/shutdown as I could only see about two characters on the menu). I tried to change resolutions, yet it still cut off the right portion. I think I need to install a new driver for my laptop as I don’t have the buttons to change how the input is received like on a normal monitor. Can you point me in the right direction or a utility that can help me out with this.
Thanks again for all your help!
Mike, I’m afraid I can’t be of too much help. A quick Google search did not seem to reveal any systemic problems, so I suspect this a problem with the native drivers in your system not detecting your display resolution or refresh rate correctly. You might try playing with those two aspects a bit to see if you can correct the problem. You might also want to consider posting your question to the Ubuntu forums or LinuxQuestions. Good luck and post again when you find the solution.
I did a search in the Unubtu forum link you posted and searched for my vid card in the appropriate forum and found my answer.
http://ubuntuforums.org/showthread.php?t=1470822&highlight=nvidia+geforce+gt+330M
Took a little bit for me work it through because it has been so long since I’ve used Linux and my hand wasn’t being help through this process but I was able to get it to work.
Thanks for all your help!
Mike
Awesome Mike! Glad you got it working. Enjoy your dual boot setup!
Don’t usually leave comments on blogs but this is an excellent article. Had been struggling with F13 and Windows 7 so thanks for the tutorial, have got it working, thanks
Actually I had a small problem, was installing F13, booting from GRUB into Windows 7 (should return to windows boot screen) gave me the infamous BOOTMGR not found error. However, I’d done a clean install of Windows 7 and the boot partition was on the same partition as the install. So I needed to change the menu.lst in /boot/grub to reflect where the Windows 7 bootmgr was.
Hope this helps anyone else who has this issue -> solution of above is here:http://forums.freebsd.org/showthread.php?t=5113
Michael, thanks for your kind comment and advice, both very much appreciated.
Thanks a lot, iceflatline. The guide is great.
I would like to share some experience as well. It seems like some critical updates of an installed Ubuntu 10.04 may affect its GRUB boot sector. It makes the “C:\linux.bin” file a kind of out-of-sync. Well I’m not sure that I get things right so I simply tell
I downloaded and installed updates through the Update Manager (Now I can’t tell which updates there were), Ubuntu prompted me to reboot. Windows boot manager showed both the windows and the ubuntu options, but choosing Ubuntu lead to a black screen – grub menu didn’t show up.
1. I booted from a liveusb and “wrote the first 512 bytes of our Linux boot partition to a file” again.
2. Then I put the new file in the C:\ and compared it with the old one (Windows shell: C:\>comp linux.bin linux2.bin /a). They were different.
3. So I removed the old file and renamed the new one to “linux.bin” thus there would be no need to update the BCD entry.
4. Rebooted.
These measures fixed the black screen problem and Ubuntu got up and running again.
alexander, thanks so much for sharing this. Your experience made me smile… I encountered the same issue and fixed it the same way you did! Something in that particular update changed the boot sector enough to render the image we created useless. Creating a new boot sector image using dd was the only way out of the mess. Ain’t Linux great!?
Thanks again for sharing your solution. I’m sure it will be of help to others.
Thanks for this article.
I’ve been struggling to install Ubuntu 10 on a machine with FakeRAID 1 running Windows 7. Although the Ubuntu 10 installer recognised the RAID setup, it wouldn’t let me reformat the partition (the harddisks had already been partitioned by the vendor). I followed a suggestion I saw on an Ubuntu forum and installed Ubuntu 9, and then Ubuntu 10 without reformatting the Linux partition, and that seemed to work…
… Except that Grub wasn’t working. I tried to install it in different places, but it never seemed to make any difference whatsoever — the machine booted happily into Windows as if Grub didn’t exist.
I was therefore hopeful when I found this, but alas it didn’t work. I didn’t get any error messages, but just as others have described in comments above, I just get a blank screen with a blinking cursor when I select Linux.
I’m wondering whether Grub didn’t get written correctly to the Linux partition, either.
Is there a non-Grub way to boot Linux, I wonder?
[…] then found a blog posting describing how to use Windows 7′s boot loader, BCDedit, to boot Linux. It looked promising, […]
I solve the problem by using EasyBCD instead of BCDedit.
Thomas, thank you for posting. Next time you might try Gparted rather than Ubuntu’s partitioner. It features support for hardware RAID, motherboard BIOS RAID, and Linux software RAID. Once partitioned correctly, the remaining steps should work correctly. Anyway, glad you were able find a solution that worked for you :)
Hello, Iceflatline,
Your tutorial has been very helpful. Thank you for the detailed instructions. However, I must be doing something wrong. I have updated GRUB2 and downloaded all the updates I can (booting 10.04 from the live CD), and moving the (hopefully updated) linux.bin to C:\.
Here’s what’s now happening: Ubuntu won’t boot, and I have three (3!) “Linux” buttons on the Windows Boot Manager screen when I attempt to boot. The consistent error message is: “This is not a bootable disk. Please insert a bootable floppy and press any key to try again . . .”
So I need to delete the three inoperable “Linux” links in the “Windows Boot Manager” screen, and start over somewhere.
I will appreciate any help you can offer. Thanks, Iceflatline.
Boris
Boris, thanks for your comment and sorry you’re running into problems. My sense is that your linux.bin file does not contain the GRUB2 boot sector. This could be because a) you installed GRUB2 on a partition different from the partition your Ubuntu OS is installed on, or b) you’ve incorrectly copied the sector containing GRUB2 to linux.bin when using the dd command.
As you’ve suggested, I would start by deleting the existing Linux BCD store entries. Run back through the install steps again, making sure that in the partitioning step, you’ve correctly selected the “/” mount point for the partition you want to install the Ubuntu OS on. Then, make sure you select this same partition when it comes time to install the GRUB2 bootloader. Finally, make sure you’ve passed the correct partition to the dd command (if=). Again, this should be the same partition. I’ve caught myself several times entering the wrong partition when entering this command.
Hope this helps and good luck!
hi,
i am new member
Good instructions Iceflatline, very useful, I have been using these with XP but never with w7.
But here is another challenge : what should be done to install w7, Ubuntu 11 AND backtrack 5 (ubuntu Lucid with GRUB2)
I used easyBCD to create and set up menu options in the windows boot screen (i chose the names “Ubuntu 11” and “backtrack 5”), when I click any of them, the command takes me to the same OS : Ubuntu 11 !!!
Please somebody have any idea ????
Orlando, thanks for the question. I’m afraid I don’t have much experience with easyBCD, but perhaps others have. You may also want to post your question in the NeoSmart forums, if you haven’t already.
This is how i got slackware 13.37 64 bit dual booting with win7 64 bit installed first. Using lilo instead of Grub.
http://www.linuxquestions.org/questions/slackware-14/dual-booting-win7-starter-slackware-13-1-a-845373/page2.html#post4364003
iceflatline, what I meant was, somebody have some idea how to use your instructions to edit BCD in w7 to allow to boot ubuntu 11 & backtrack 5 (both w/grub2) ??? When I type “bcdedit /create …” the system create the same ID . Maybe I have been done something bad
Orlando, make sure in the step utilizing the dd command that you copy the correct partitions and that each is a uniquely named .bin file (they cannot both be named “linux.bin” for example). In the next step make sure you use the /d parameter and that it follows the /create parameter in the bcdedit command. Here again you must use a unique entry name for each case (they cannot both be “Linux”).
Man you have made this complex topic very simple with nice layouts and real life examples.
Thanks for teaching this @ free of cost.
Also thanks to all those who have asked their questions via comments, it helped to clear few doubts.
Appreciate all of you. ;-] Bye
Ratnakar, thanks for your kind words. I too appreciate all the comments and feedback on this post.
[…] for multiboot. However, Windows 7 bootloader supports also supports multi-booting fine, check out this tutorial if you want to retain Windows 7 bootloader: There is no me. I do not exist. There used to be a […]
[…] update your Windows bootloader. So you need to do some manual work to make it happen.There is a thorough article explaining this and you can just jump to end of the article to find the proceadure. ← […]
I have found a solution to start Linux by the Windows 7 boot manager if Windows and Linux are on different hard disks. You can use bcdedit to build an entry in the windows 7 boot manager. In this entry you have to call GRUB4DOS instead of GRUB within linux.bin
GRB4DOS is a powerfull package but you only need two programs of it – grldr and grldr.mbr
You may download the package from
http://sourceforge.net/projects/grub4dos/
From this package copy grldr and grldr.mbr to the Windows root directory, usually C.
Now, use bcdedit for the entry in the windows 7 boot manager:
First backup:
bcdedit /export c:\bcdbackup
Then create {id}:
bcdedit /create /d “Linux” /application bootsector
The result will look like this:
The entry {05d33150-3fde-11dc-a457-00021cf82fb0} was successfully created.
The long string {05d33150-3fde-11dc-a457-00021cf82fb0} is the id for this
entry.
Then, use the following commands to set boot parameters:
bcdedit /set {id} device partition=C:
bcdedit /set {id} path \grldr.mbr
bcdedit /displayorder {id} /addlast
Please replace {id} with the actual id returned from the previous command.
At last check the bcd file:
bcdedit -v
Now, you need the appropriate menu.lst.
For a first trial you may use the menu.lst from the GRUB4DOS package. Copy it to the the Windows root directory, usually C.
Reboot your system.
The appropriate menu.lst could look like this:
# menu.lst for grldr of GRUB4DOS
# copy it to c:
color blue/green yellow/red white/magenta white/magenta
timeout 8
default /default
title Linux
root (hd1,0)
kernel /boot/vmlinuz root=/dev/……………..
initrd /boot/initrd
title windows 7
find –set-root /bootmgr
chainloader /bootmgr
title Reboot
reboot
Take your Linux menu.lst and edit it under Linux. Then copy it to the Windows C-Partition.
Now it should work.
Rudi.RG, this is awesome! I’ve been meaning to come up with a solution to this challenge for awhile now but never seem to get around to it. Thanks so much for your efforts on this and for posting it!
Rudi.RG, thank you for this. I’ve followed through but seem to have come unstuck at the Grub4dos menu.1st. When I boot and select my Unbutu option I get a Grub4dos menu asking me to select one of various find and boot options none of which include Linux. I just don’t know where to go from here. Grateful for any help. My Windows 7 Boot is on my first hdd with no other partition on the drive apart from system reserved and my Unbutu is on my second drive on partition 2.
As a follow up if you’re following Rudi RG steps I found the following worked for my system
title Linux
root (hd1,1)
kernel /boot/vmlinuz-3.0.0-12-generic root=/dev/sdb2 this equates to hd1,1
initrd /boot/initrd.img-3.0.0-12-generic
I edited one of the menu.lst items in the text editor in the ubuntu live usb which I’d downloaded.
Thomas, awesome. Thanks for your comment.
i was running xp and arch linux. But when install windows 7 in other drive then it windows 7 start automatically. Please give me a way to start xp and windows 7.
pankaj, I’ll try to help, but I’m not sure I fully understand your problem. Could you provide a little more detail?
[…] that allows *both* Grub2 and the Win7 bootloader to *coexist* (each on a different partition): http://www.iceflatline.com/2009/09/h…using-bcdedit/ […]
@iceflatline
Hi,
thank you so much for this article, it helped me a lot !
I just have one question though, I hope you will be able to help me.
Your article has been quoted as a source in a wiki page for Archlinux :
https://wiki.archlinux.org/index.php/Windows_and_Arch_Dual_Boot#Using_Windows_7_Boot-Loader
On this page the author writes :
“Some documents state that the partition being loaded by the Win boot-loader must be a primary partition but I have used this without problem on an extended partition. ”
So he is saying that it is perfectly possible to get a dual-boot such as the one described in your article when Linux is installed on a logical partition.
However, in my case it simply doesn’t work. When Linux is installed on a primary partition everything works fine, but when Linux is installed on a logical partition Windows bootloader (BOOTMGR) is unable to chainload to Grub2, it can load Windows 7 but not Linux (the system just restarts as if BOOTMGR didn’t see where Grub2 was).
If you have any experience in such a setup (Windows on a primary partition and Linux/Grub2 on a logical partition) and you could give me some advice to help me find out what I’ve done wrong, I would greatly appreciate it.
If you need any further detail I will gladly provide them.
Thanks in advance !
(sorry if there are any mistakes, English is not my native language.)
blob, Window’s bootloader absolutely will boot Linux installed on a logical partition. In fact I’m writing this response using CrunchBang Linux installed on logical device /dev/sda5, which was booted using Windows – the same way described in the post.
I’ve booted many Linux distros this way, and the only way I’ve seen that it doesn’t work is if GRUB is not installed correctly (or at all) on the logical partition containing the distro, or the boot sector of this logical partition was not copied correctly to a *.bin file.
@blob: I boot off an extended partition without any issues (had to install twice to make grub2 work, before i just got a blank screen)
@topic
Very nice.
I installed Mint 12 that way but grub2 refused to install in a partition. It has to be installed inside the mbr.
I found no instructions how to solve it, so here is my way – in case someone finds this page like I did.
Be careful not to kill your partition table. It should work with a blocksize of 444 which prevents you from overwriting the partition table but I did not test it and 512 will work too ;-)
backup the mbr:
dd if=/dev/sda of=/root/mbr_orig.bin bs=512 count=1
install whatever you want and install grub to /dev/sda
backup the new mbr
dd if=/dev/sda of=/root/linux.bin bs=512 count=1
(copy it to the windows parition or fat USB stick or somewhere)
write back the original mbr
dd if=/root/mbr_orig.bin of=/dev/sda bs=512 count=1
Windows boots as usual and you can work with bcdedit as written in thsi how-to.
oh, an important note:
First prepare all partitions! Create all partitions you need before backup up the first time!
Daniel, thanks very much for your comments.
did exactly what you said but everytime i try to load linux from windows bootloader the PC reboots its self and goes to windows boot manager.
Basically it does a loop: win bootloader, select ubuntu, reboot pc, win bootloader. is there any way to solve this?
Kisun, I’m not sure. I’ve never encountered that particular problem before. It appears though that BCD may not be correctly pointed to GRUB. About the only thing I could suggest is to go back through the steps, ensuring that you’ve correctly installed GRUB on the partition containing Ubuntu, and that you’ve indeed pointed BCD to the correct partition.
Thank you SO much for this. I was able to use this guide to have my X201 Tablet PC dual boot Ubuntu and Windows 7 without hurting my Rescue and Recovery capability on boot up!
Leadpoizon, you’ve touched upon exactly the reason I wrote this post – my experiences with wiping out many a recovery partition. Thanks for your comment.
[…] instructions worked well for me: http://www.iceflatline.com/2009/09/h…using-bcdedit/ If you do an update that causes lilo to be run, you may need to grab the MBR off your partition […]
ted, blob, and others are all correct. You instructions *are* faulty. “It works for me” is not actually listening to what they are saying. Stop arguing with them for crissakes. I don’t care how many distros you have working. The bottom line is this does not work with *GRUB2*. GRUB2 will only work if it is installed in the MBR. It seems GRUB2 has pulled a rude Microsoft-anti-competitive behavior. The external hard disk or not is a red herring. The real issue is that the step for copying the bootloader off the GRUB2 boot partition does not work. GRUB2 has changed the way it works and leaves you with something that will not boot. This is asinine. Linux can’t do anything right and I’m so sick of the days lost fudging and fidgeting twiddly little bits just to get a damn partition table or boot record to work. The only thing modern linux has accomplished is to force users to install it as the only OS on my machine. fucking anti-competitive assholes. They’re as bad as microsoft in the 90s.
Mario, you sound frustrated. Linux can be hard to deal with sometimes, which it makes it all that much sweeter when you finally bend it to your will.
In fact though, Grub2 will work when installed on a primary or logical partition. I’ve most recently installed CrunchBang v10-20111125 (x64), Fedora 16 (x64) and Ubuntu v11.10 (x64) – all using Grub2 – along side Windows 7 Pro in the manner described in this post – in both primary and logical partitions – and they all work.
As for the problems concerning Linux Mint cited by some in the comments, I cannot say. I have not gotten around to installing that particular distro yet.
Anyway, perhaps a third-party boot solution like NeoSmart’s EasyBCD may be more to your liking.
[…] personal use) EasyBCD (http://neosmart.net/EasyBCD/), which I found mentioned in the comments in this blog post by iceflatline. I actually tried the method described in the post first and it worked. […]
[…] Re: Dual boot and partitions There a re many ways to go about doing this. For a simple situation, such as yours, where 1 HDD will hold 1 MBR 1 WIndows7 partition 1 Linux partition I suggest following this guide: Download or buy BCDEditor 2.X Make sure it is 2.0.X or higher, the 1.X builds do not work correctly for windows 7. Download and burn Gparted. Follow this simple guide to load both OS onto the MBR: How to Dual Boot Windows 7 and Linux using BCDEdit | iceflatline […]
Can I use this method if I have Ubuntu intalled in VHD (virtual hard disk) which is seeting in my c:\Vm folder.
thanks.
Daniel, having not tried that before so I honestly don’t know. Give it a try and let me know how you make out.
Before following the bcdedit command steps you need to run bcdedit by itself. This should list the current windows 7 boot menu list. If it does not then you need to do the following:
1) Start -> Control Panel -> Search [Partition] -> Run Partition Manager
2) If you see a BDEDrive, make sure it’s *active* and assign to it a drive letter. I assigned “Z:”.
3) Now run bcdedit and you will see the windows 7 boot menu list.
4) Now continue with the bcdedit steps in the tutorial of this article.
Credits: Victek @ http://www.sevenforums.com/performance-maintenance/66592-bcdedit-error-message.html
I tried to install ubuntu 10.04 on a system with windows7.
This article did not help. However, it was helpful in understand the whole process.
According to the following article, you cannot *manually* install grub on the MBR, since there is a bug
in the ubuntu 10.04 distribution.
http://neosmart.net/wiki/display/EBCD/Ubuntu
The main problem I had was that windows 7 did not allow me to assign a drive letter to the newly installed
ubuntu 10.04 partition. The bcdedit commands requires you to specify the drive letter to associate it with
a boot menu entry.
I will have to restore the windows 7 master boot record, and reinstall ubuntu 10.04 and allow it to install grub2 in the master boot record (which will include windows 7 as a boot menu list choice.)
Asif, I assume you’re speaking to the case where Ubuntu is installed on another drive (not partition)?
Just found this, it’s great.
I would recommend doing the partitioning during the Ubuntu install rather than separately with GParted then also run the following attrib command under Win7 to stop linux.bin from being deleted and update grub as follows so you don’t get a second menu, I’m using Ubuntu 12.04
attrib +S +H +R linux.bin
sudo gedit /etc/default/grub
set GRUB_TIMEOUT=0
sudo update-grub
Hi, thanks for that great guide! ;-)
I also had the problen installing ubuntu 12.04 on a second hdd(cursor blinking in black screen forever).
I tried Easybcd, added a simple entry with linux/grub2. Nothing else. And worked at first.
Regards!
First off, Hi everyone.
Second, mario, you need to chill dude, please. I understand your frustration because I (and most everyone else who owns a computer) has been there. But the bottom line is, this post works.
Win7 installed first, then Kubuntu 12.04 LTS second, Ubuntu server 12.04 LTS third, all on one HD, server on logical partition, all bootable from windows bootloader. EXCELLENT TUTORIAL iceflatline !! Any questions?
steve, thanks for your comments. Much appreciated.
Hat-off to iceflatline for this guide, this is by far the best I have read to achieve booting linux using native windows boot manager via bcedit, which is pretty much what grub is doing I think but I feel easier to use than grub.
thanks,
yi
yi, thanks for taking the time to comment and for the kind words.
many, many, many thanks for your great article, still solid and valid after years!
With your help I’ve been able to fix the dual installation of Windows 7 Home Premium (64b) along with Linux Mint 13 (32b, noway with 64b) on a Samsung np305!!!
Thanks again, SA
SA, you’re very welcome, and thanks for your kind words.
Thank you Andy, this is most solid and logical tutorial to have Windows 7 along with Linux on the same HD.
Just 30 minutes and I have my Linux BT5 R2 x64 on my win7 notebook, everything works fine.
Mike
what about win8? do you think this will work on win8??
jaytho, I have not tested this setup with Win8 so I can’t say with certaintity. My guess is that it will work so long as the the OEM allows you to disable MSFT’s UEFI and secure boot (or it is not enabled by default) or the Linux distribitor (Fedora, Ubuntu, etc.) has a cryptographically signed bootloader. Of course, if you’ve built your own machine using a OEM version of Win8 all this likely won’t matter and you should be able to dual boot just fine.
Mike, thanks for kind words. Much appreciated.
Thanks for this very useful guide. The only improvement I can think of is the usage of “Master Boot Record”. It seems that every time you used it you meant “Volume boot record” (http://en.wikipedia.org/wiki/Volume_Boot_Record). MBR (http://en.wikipedia.org/wiki/Master_boot_record) is quite different and doesn’t need any tweaking (yes, GParted modifies it during partition creation/shrinking). I’m not sure if GRUB2 would affect MBR even if we give it a chance during installation.
Nick, thanks for raising this. I’ll research it further and if a change is warranted, will do so in the next revision to the post.
With the help of your thorough guide, I was able to get this working on a triple boot (win7 win8 preview and ubuntu). Thanks!
Recipe: partition as you direct. Install Ubuntu, Install Win8, Install win7, then tweak bcdedit from the win7 bootloader install.
THANKS!!!!
jaytho, thanks for testing that out and posting the results. Much appreciated.
Rather than copying the Linux boot record to the c: drive and telling BCDEdit to find it there in order to boot Linux, wouldn’t it be more efficient to just have the path element in BCDEdit point to this boot record’s correct location on the Linux partition?
This is how EasyBCD does it.
Tatiana, that approach would certainly be more efficient. Could you provide the bcdedit commands for it?
Thanks for this very helpful guide! I was unable to download EasyBCD (firewall?), and was clueless as to how to do it otherwise. In previous dual boot installations these steps were not neccessary – the choice between windows and linux systems showed automatically. Did I miss something in the install, or did they change something for Ubuntu 12.04?
Hi, thanks for the instructions. I was able to follow them until the configuring for dual boot section. The fisrt 3 lines of commands return ‘permission denied’ or ‘only root can do that’ in Terminal. No idea how to gain root access (tried su but I don’t know root password, and the only user account I have on windows7 is not recognized). I tried from both GParted and Ubuntu disks.
Is there a different way to accomplish these first 3 steps of the dual boot section? It seems like a trivial problem but I’m copletely stuck.
I was trying to do this using windows 8 bootloader. I updated the bcd entries to show linux as boot option. I then booted using usb drive, and followed the steps above to copy the boot partition. I was able to create linux.bin in windows C:\ directory. I verified that the file is present in the windows partition.
After restart I was presented with a option to boot into linux and windows 8. I selected linux but I got a error saying that it cannot find linux.bin. I restarted back to windows and found that linux.bin is created was deleted somehow in the boot process. I am not able to get to grub.
Only thing I did different from the instructions was I created the bcd entry first and the linux.bin file later. I think it should not have any effect. Anyone know the reason why “linux.bin” is deleted.
I don’t understand Russian but somehow I used the google translate to see what you have written. The steps you mentioned are exactly the same as mentioned in the article. That did not solve my problem.
Thank you.
Pete,
If you’re using Gparted, you can gain the escalated privileges you need by prefacing the commands with sudo. Alternatively, you can type the command sudo su first, then proceed as instructed. I don’t recall offhand, but I suspect the Ubuntu Live CD is the same.
Karen, I removed the Russian comment. I have reason to believe it was simply spam.
Regarding your issue with Windows 8, I have not had the opportunity yet to explore these procedures with Win8 so I can’t say for certain that it does not indeed remove the *.bin file, or that other issues may occur as a result of using this new OS. All I can suggest at this point is that you create the *.bin file first and add it to c:\ then create the entry in the BCD store.
I’m interested in determining if this is some kind of systemic problem so by all means post an update.
THANK YOU THANK YOU! While I have as many years around Windows as there have been years with Windows around, I am a Linux/Ubuntu/Grub/Gpart novice and a Windows BCDedit novice as well. I have asked about this on freenode irc #Ubuntu it is not common knowledge AFAIK. NOW I SEE how to tell Linux where it should live, and how to tell the system how to run one MBR covering both on the first partition – as all of Win7 Win8 Ubuntu have multi-boot loaders of their own, and they do not co-exist well at all…
[…] with a Windows recovery CD. A quick google search for "linux bcdedit windows 7" found a result with an example for adding a boot entry for a Linux distro. I'm more of a security freak though […]
I was hanging around here WHINING about my attempts to install Ubuntu to dual boot with win7 win8 win8 server
FOUND A SOLTION
http://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/comment-page-2/#comment-157120
Works on win8! (RP – or is it RC, the install named the partition “RC” lol, the more expected name, considering Microsoft)
Couple caveats for Windows ppeeple (I have been abused by Microsoft for over 35 years lol)
1. IF you have existing partitions, as I did, you will probably get different sda numbers than in the example: USE THE PARTITION NUMBERS YOU ACTUALLY HAVE in following the excamples.
2. IF you have NTFS and ext partitions already, you need not re-create them; possibly the only new one needed from GPartition Live might be the FAT32 to copy linux.bin to and from.
3. The FAT32 may not give a choice for a mount point in GPartition at lerast on win8 RC …if so it will ask again when you “apply” the changes, do it then
4. When installing your Linuc distro be sure to use the actual partion numbers (for sdaX) as one follows the examples
5. When you do the windows BCDedit command be sure to use the partition numbers you actually have!
6. Linux (as windows) has some interminal points in the install process, particularly anything to do with updating GRUB the bootloader
Other than as noted, it works EXACTLY as Iceflatline says.
IF YOU HAVE or want to have THESE OS’s on DIFFERENT DRIVES there are posts (topward the end) of the comments on his post, that say how to do that. I maven’t done that so YMMV.
I almost forget (actually, I DID forget, but then I remembered lol): the commands entered in Ubuntu Terninal (command prompt) may well have to beging with “sudo”:
~$ sudo mkdir /mnt/share
and so on
Hi,
i am tring to use Norton Ghost to image the HDD with 2 OS:
Win 7 – pro 64 bit
Fedora 17
my issue is that Ghost is not identifing the Linux partitions , if Fedora is handeling the boot loader, these is how i got to this post, problem is :
each time i tried to follow this guide steps i ended with working Win7 OS but entering the “Linux” left me hanging with :
GRUB _
and only a restart to the laptop was abled,
is there any chance that in Fedura 17 some steps need changes ?
any other ideas ?
thanks a lot
Hi , I managed to install Win7 starter and Ubuntu in a single hardisk and able to boot up successfully, I then captured the whole hardisk image using rapid deloy and restore it to another NB that I have, I use the -raw command to capture and restore it to another NB, the NB cant boot and it will keep rebooting , anyone there can help to solve my issue ? Pls advise, thanks !
This article helped me getting win7 & ubuntu 12.04 work side by side. Thank you very much.
Bodhi, You’re welcome. Thanks for the comment.
This did not work for me. After selecting Linux the System seems to freeze for a second and reboots. How are the first 512 bytes of the partition useful? I do not understand (and my system doesn’t, either, apparantly).
P.S.: Ok nvm you must enter “C:/” in the boot.ini and not copypaste what windows has in place there.
zyl, c:/? or is it c:\?
You probably don’t need dd. I got the appropriate boot sector file from /boot/grub/i386/boot.img in my Ubuntu installation.
TRIPLE BOOT XP, VISTA, UBUNTU; USING BCD
1. install xp.
2. install vista.
3. install ubu, bootloader to ubu partition.
4. boot live-cd to ubu
5. make ‘dd if=…. ubuntu.bin (as mentioned above)’
6. copy ubuntu.bin to xp’s root
7. open xp’s boot.ini
8. new line ‘C:ubuntu.bin=”Ubuntu”‘
can somebody confirm? i did lot of different tries, maybe something affecting, but the i got wished result.
[…] flashes by in less than a second. Using the ThinkVantage button just opens w7. I've looked at http://www.iceflatline.com/2009/09/h…using-bcdedit/ but since the lenovo will ignore the gparted, this doesn't help. Ideas gratefully received… […]
[…] to grub after that. But here is a pretty good tutorial if you want to keep windows bcd intact. How to Dual Boot Windows 7 and Linux using BCDEdit | iceflatline I would just caution you about using dd if you don't know how be very careful. It is a good linux […]
Hi iceflatline, I hope you still read these posts.
I’m trying to create a space for an additional linux partition on my drive, but I stumbled upon an unexpected problem.
There is a BDEDrive partition (required by BitLocker) behind C: Windows 7 (primary partition), which gives me the headache.
So far I managed to shrink C: partition and move the BDEDrive adjacent to it. This is my disk layout:
/dev/sda1 – Windows 7 (primary partition)
/dev/sda2 – BDEDrive (primary partition)
/dev/sda3 – Linux-Swap (primary partition)
/dev/sda4 – Ubuntu (primary partition)
The issue is that when I try to start BitLocker, it complains. The following message is displayed:
“The path specified in the Boot Configuration Data (BCD) for a BitLocker Drive Encription integrity-protected application is incorrect. Please verify and correct your BCD settings and try again.”
I suppose that I could use BCDEdit to redefine the new location of BDEDrive partition in the BCD setting.
Do you have an idea how to do this?
By the way, my BDEDrive is NOT corrupted. When I move it back to its original place, BitLocker works again.
blnl, it seems to me you have two options: you could reconfigure BitLocker to recognize its new partition; or you could move it back to its original partition, create some unused space on your disk, and in that unused space create either a primary partition for Ubuntu, along with and an extended partition containing a logical partition for swap space, or simply create an extended partition containing two logical partitions, one for Ubuntu and one for swap.
Thanks iceflatline,
I was looking into how to configure BitLocker but in the Control Panel > BitLocker Drive Encryption, there is nothing useful to be configured. I can only turn on/off BitLocker, suspend protection or write out the recovery key.
However, while reading Microsoft article “BitLocker Drive Encryption Step-by-Step Guide for Windows 7”, section “Turning On BitLocker Drive Encryption on an Operating System Drive (Windows 7)”, the following paragraph explains it all:
“If you have a single partition for your operating system drive, BitLocker will prepare the drive by shrinking the operating system drive and creating a new system partition to use for system files that are required to start or recover the operating system and that cannot be encrypted. This drive will not have a drive letter to help prevent the storing of data files on this drive inadvertently. After the drive is prepared, the computer must be restarted.”
So, all I need to do is to remove the BDEDrive partition. Next time when I turn on the BitLocker it will create a new one for me (presumably adjacent to C: partition).
hai
i am using with windows 7 professional i will use for the next os for bossgnu/linux i will open to the windows 7. it says bootmgr is missing why are you say the problem
thanks
arun
blnl, excellent. I’m glad you found a work-around. Thanks for taking the time to post again so that others can benefit from your experience.
arun, it appears you may have somehow written over or in some other way corrupted your windows boot record. I would suggest booting to the Win7 disk and let it repair the problem. I won’t go into the details here as there are numerous good articles online on how to perform this repair.
This was incredibly helpful and worked like a charm. Thank you!
jar, thanks for the kind comment. You’re very welcome.
I have a very similar setup: Lenovo ThinkPad Edge e530, 320 GB HDD, no SSD.
Everything worked perfectly! Thanks!
grateful user, cool. Glad it worked for you.
I want to change the windows boot manager to Linux GRUB how do I do that?
Shura, I assume you mean you want to use GRUB to boot to either a Linux distribution or Windows? In that case, simply install Linux to the partition of your choice, then instead of instructing the installer to install GRUB on that partition, instruct it to install it on the MBR of the disk itself (usually the default). GRUB should detect the various Windows partitions and give you a choice to boot to either Linux or Windows after you reboot the machine.
If you are trying to boot a Linux distribution located on a second physical hard drive, please try this:
http://blog.mattrudge.net/2010/08/04/booting-ubuntu-through-ntldr/
You just have to use a hex editor to edit your linux.bin file. It could not be easier!
It worked for me like a charm!
Iceflatline, perhaps you could update your How To with this…
Best wishes
Renato
Renato, thanks for posting this solution. I will test it and, if it works correctly, include it in the next update to this post.
Hello Iceflatline,
Really well written article. Thumbs up for you.
But i am facing issue (for sure due to my mistake), Ubuntu is not booting up and giving Error while windows 7 is working perfectly fine. Few questions are in my mind :-
1) What is the need to format a partition in FAT 2 ? (I used my pen drive but i can see all my NTFS drives too when boot with Ubuntu Live CD)
2)”bcdedit /set {ID} path \linux.bin” in this command “PATH” should be written as it is or it means like : C: , D: or something like that ?
Its giving error in this format:-
Windows could not boot, it might be due to changes occurred in hardware or software. Please use your windows CD to repair.
File: \Linux.bin
Status: 0xc000000f
Info: The selected entry could not be loaded because the application is missing or corrupt.
Thanks & Regards
AJ, thanks for you comments and questions. Regarding the FAT32 partition, it is purely optional. I find having such a partition handy on the occasions when I want share files between Windows and Linux. However, you can accomplish the same thing with a flash memory drive. Regarding the syntax for the command “bcdedit /set {ID} path \linux.bin”, that is the literal word “path” in the command not a placeholder for a directory path.
Hi, Thanks for your quick revert. Any idea why am i getting that error ? What could be the reason and solution ? I followed your instruction word by word but unable to boot with Ubuntu and getting above mentioned error :(
I repeated the operation and now there are entries for Ubuntu alone !!! How to delete them ? Because i don’t know the {IDs}
i mean 3 entries for Ubuntu !!!
P.S. : can’t i edit my post here ? Because it feels a bit odd to see continuous 3-4 posts from 1 person. I am really sorry for that.
AJ, unfortunately no. Unlike a forum, CMS software like WordPress generally does not allow one to edit comments. Regarding deleting the BCD store entry, enter bcdedit without any options to produce a list of entries. Find the identifier you want to delete, then use the command bcdedit /delete {ID} to remove it. Regarding your error, I’m not sure how best to guide you here. Perhaps starting over would be your best option, making sure to install GRUB2 on the correct partition containing Ubuntu, and closely following the steps to create the BCD store entry. I’ve done this setup many times and it will work.
Thanks Iceflatline.
Kindly have a look at my partition design and suggest accordingly :
http://s1.postimage.org/5l72wyxy7/Partition.png
AJ, what is the partition you have marked as “GRUB?”
That is /boot (I selected this partition in “Device for Boot Loader”)
2nd is /swap
3rd is / (root, here i installed Ubuntu)
4th is /home
AJ, you should have selected the device containing your Ubuntu OS as the location to install the boot loader. Then run the command dd if=(that device), etc against that device in order to correctly copy the boot sector (aka GRUB2). I suggest reinstalling Ubuntu, this time selecting the correct device for the boot loader. Your separate /boot partition is not needed and can be eliminated to recover some disk space.
Hello!
Everything went well at first, but I realized that I made booting entry for my linux swap partition. Then I try to do new booting entry with bcdedit and with correctly done linux.bin. bcdedit /create… worked, but other when trying other commands I get following:
“An error occurred while attempting to reference the specified entry
System cannot find the file specified”
When I type bcdedit /enum all, I found that I have created 6 different Real-mode boot sectors with same identifier during my trials. I cannot remove any of those by using the identifier, because it gives that same error message. Has this error message something to do with those 6 entries?
These are the six entries:
Real-mode Boot Sector
———————
identifier {3f8cb10b-8b67-11e2-8057-c2df5ab5c723}
description “Linux”
Real-mode Boot Sector
———————
identifier {3f8cb10c-8b67-11e2-8057-c2df5ab5c723}
description Ubuntu 12.04
Real-mode Boot Sector
———————
identifier {3f8cb10d-8b67-11e2-8057-c2df5ab5c723}
description “Linux”
Real-mode Boot Sector
———————
identifier {3f8cb10e-8b67-11e2-8057-c2df5ab5c723}
description “Linux”
Real-mode Boot Sector
———————
identifier {3f8cb10f-8b67-11e2-8057-c2df5ab5c723}
description “Linux”
Real-mode Boot Sector
———————
identifier {3f8cb110-8b67-11e2-8057-c2df5ab5c723}
device partition=C:
description “Linux”
Awesome guide, very useful especially for someone who doesn’t know Win 7 very well, It worked flawlessly for a dual boot with Arch Linux
Anon222, Thanks very much for the comment. I had intended to try it with Arch but had never gotten around to it. So glad to hear it works.
[…] */ http://www.iceflatline.com/2009/09/h…using-bcdedit/ Google-Suche nach "bcdedit add linux entry" Da ich aber weder ein UEFI-Board, noch ein Windows 7 […]
First, let me add to the many other comments here that this has been a huge help! Thank you!
This has been my first experience with a Linux installation, and I’ve spent a few days trying to set up CentOS 6.4 to dual boot with Win7. My system is relatively new and uses UEFI to boot (though I’ve had to use legacy SATA to write the bootloader anywhere but the MBR in the ESP). Near as I can tell, all commands in the guide executed without a hitch, I checked that linux.bin was copied correctly to the shared FAT32 partition, and the new entry “Linux” even shows up fine in the Windows Boot Manager.
When I try to boot Linux from here, I go to an error screen describing that Windows failed to load (?) and that c:\linux.bin was missing or corrupt. Windows 7 continues to boot fine from the Windows Boot Manager, and I return to Explorer to find linux.bin sitting there happily in C:
I understand from many of the comments that GRUB (0.97 for CentOS, though a successful install by another user tells me this shouldn’t be a problem) must be properly written to the Linux boot partition, and I specified this in the actual CentOS 6.4 installation. Prior to this guide, writing GRUB to the MBR results in error 18 and not being able to boot either OS, which is what brought me here in the first place.
I would be fantastically grateful for any insight you could offer. BXPython will not build outside of a Linux environment and I’d like to be able to crunch these binary data sets at home. Your dedication to answering our questions over the last couple years is admirable at worst!
[…] – trying to add GRUB into bcdedit – was just as fruitless. I tried adding it as as in http://www.iceflatline.com/2009/09/h…using-bcdedit/ but it was a no-go. I imagine the culprit is once again EFI, and that marking it as a bootsector […]
for thomas wallbank:
it’s not menu.1st, its menu.lst, as in abbreviation for MENU_LIST
for panjaj:
How to add an xp entry to W7 (also other NT6.x such as vista/w8):
while booted to the NT6 system, copy NTLDR, NTDETECT.COM & boot.ini from XP partition to the boot partition (the one containing the NT6 BOOT folder)
If you have a small boot partition 1 (containing your BOOT folder) before your OS partition(s), you may not be able to see it when booted to W7 or W8. It is not an actual hidden partition, but W7/8 does not assign a volume letter in this case. You would have to do that manually in Disk Management before you could copy the NT5 boot files from XP to it. You could then Remove the volume letter in Disk Management again afterward. Partition 1 will still have a volume letter assigned for XP use when you boot to XP.
assuming the working BOOT folder is on volume X: as the booted NT6 system sees it (you will need to substitute your actual BOOT folder volume for my “X:”):
bcdedit /store X:\boot\bcd /create {ntldr} /d “Earlier more advanced OS’s by BOOT.INI here on JE80_N1”
This CREATES the NTLDR bootmenu entry (in the description I use the volume label on the target HDD of mine; JE80_N1) I always label all my volumes, using my desired hardware nomenclature rather than intended contents, especially multibooting. On the menu I am saying where my working boot.ini is in this way. Alphabetical volume letters are SUPPOSED TO change upon reboot if a new HDD is added or a previously hidden volume is made visible, so you should be relying on static descriptive volume labels rather than flaky volume letters if you rely on anything. You can call the menu entry whatever you want to within the quotes, like “XP Pro on primary HDD partition 3”, which can be more descriptive of what will actually be booting if you want.
Once this {NTLDR} entry is created, do not rerun this command except after you have deleted the entry. Instead to change the menu text (description) this would be an example subsequent command:
bcdedit /store X:\boot\bcd /set {ntldr} description “XP Home now installed on pri HDD part3” (or something like that)
At this point, in the NT6 BCD you have added a NT5 section which does nothing and is not even visible on the menu. You then need to specifiy a device:
bcdedit /store X:\boot\bcd /set {ntldr} device partition=X:
partition=X: refers to whatever volume letter NT6 has presently assigned to the partition having the BOOT folder. As an alternative you could refer to absolute device ID, replace “partition=X:” with “partition=\Device\Harddisk0\Partition1”, or something like that referring to a different HarddiskX\PartitionY if you are that advanced and have the boot folder somewhere else.
you still need to specify a PATH on the above specified Device:
bcdedit /store X:\boot\bcd /set {ntldr} path \ntldr
You will still not see the XP ntldr entry on the menu until you specifiy whether you want to add it first or last:
bcdedit /store X:\boot\bcd /displayorder {ntldr} /addfirst (this does not effect which OS is booted as default)
XP may still not appear on the bootmenu unless you specify a timeout:
bcdedit /store X:\boot\bcd /timeout 3
I’m using 3 seconds for menu display, after which it boots the default entry if you make no choice (NT6 is still probably default at this point). you can make XP the default if you like:
bcdedit /store X:\boot\bcd /set {bootmgr} default {ntldr}
for Karen:
if you only have one linux on one partition, you could always improve your chances by copying your LINUX.BIN to other visible as well as possible non-visible or hidden partitions.
ALSO My findings are that NT5 & NT6 bootloaders work just fine when properly placed into a hidden partiion as well as a regular visible partition. Other than the NT bootloader, the rest of the Windows OS fileset will need to be in an unhidden volume however. Linux naturally will not only handle GRUB in a hidden partition, but also boot linux when its whole fileset is on a hidden partition itself, whether the same volume as its boot/grub folder or not.
now for iceflatline:
pleased that you are still accepting comments, especially without registration. Your tutorial is so helpful, but some people are coming here looking to boot multiple HDD’s. -you are very generous, I can not say too much, so I think I will :-)
this is my full syntax command for running bcdedit by itself:
bcdedit /store X:\boot\bcd /enum all
just to see before & after effects of editing, such as accomplished above.
I always specify the /STORE since I am a massive multibooter and have BOOT folders on more than one partition, only the one you are actually booted from will be edited without specifying the exact bcd store. Also, IIRC once you specify a particular store, that same store will continue to be edited even if you later specify no store at all (using short syntax). That is until you specify a different store, or the first store is closed in a different way, such as rebooting or closing it in the registry. You can also use the NT6 bcdedit.exe from the XP command line, even while booted to XP directly or booted from a NT5 boot floppy, in that case you have not accessed a NT6 boot folder to get the system up, so MUST specify which bcd store to edit. Also when desired, it seems like the NT6 boot folder can sometimes be shared with GRUB regardless of which OS was installed first, Key NT6 files BCD & BCD.LOG are in \boot, grub keeps its key files in \boot\grub mostly but sometimes has kernels & their associates in \boot, still having no filename conflicts other than potentially MEMTEST. Always make backup copies of a working or to-be-edited BOOT folder. Plus I usually will be installing XP to a FAT32 partition, but who knew? If you prepare in advance a virgin HDD for W7, making the first FAT32 partition big enough for your intended XP as well as your BOOT folder and numerous BOOT backups, you might find some advantages. (since its FAT32 you can also put W98seDOS and lots of dos goodies if you are so inclined, but would then need to boot dos from the NT5 boot.ini menu the NT5 way, or you could bypass NT5 and use NT6 to point to BOOTSECT.DOS similarly to how you have pointed to LINUX.BIN) for this type of NT “chainloading”, remember to keep the bootsector filenames to the regular 8.3 DOS maximum namesize, and follow the other traditional dos filename rules.
Anyway if you have not focused on my comments to panaj above, this may be the answer to boot from a separate HDD: in the tutorial’s bcdedit /set {ID} device partition=c: you should be able to substitute something like
bcdedit /set {ID} device partition=\Device\Harddisk0\Partition1
or
bcdedit /set {ID} device partition=\Device\Harddisk1\Partition1
or
bcdedit /set {ID} device partition=\Device\Harddisk2\Partition3
or something like that
then BOOTMGR should be able to find LINUX.BIN on a different HDD, provided you correctly specify the exact HDD & partition where linux.bin actually is.
if I was specifying the bcd store specifically, I would add “/store X:\boot\bcd” in between bcdedit & /set (as above) to use full syntax and avoid editing the wrong one of my many boot folders.
and for everybody:
linux in a logical partition will usually boot using the NTx bootloaders when it will not boot using GRUB. This is a deficiency in most grub complilations which have a bug when chainloading and/or accessing logical volumes. Naturally grub-legacy has proven more reliable than grub2 and both have been fixed by now, but you will still have difficulty finding a distro more than a year or two old which can chainload logicals. Apparently a goal for grub2 was to inhibit non-developers from multibooting, especially on older PCs where you need it most. This also seems to be the objective of EFI/GPT and of course Secure Boot for the newer consumer PCs.
I am working on a tutorial myself, for installing 4 different windows on 4 different partitions, for multibooting the regular windows way using original vendor-supplied bootable CDs/DVDs. Any user who can install windows on a blank HDD would be able to perform it easily. As long as the PC has regular old-fashioned MBR/BIOS. The easy way is completely impossible using EFI/GPT however. Do not let the concept of EFI having more than 4 primary partitions fool you, it is not intended to be used to your advantage, especially if multibooting. I have been booting windows residing on logical volumes for years, I’ll have a future tutorial on that too, the obstacles are far less than they would seem. For windows use I have moved down to a maximum of 11 partitions on the average HDD (fewer if HDD is smaller than 80GB) since you only get 24 letters of the alphabet anyway. If the internal HDD has 11, and you add another HDD internal or USB which has 11, there is also probably a CDROM or SDcard reader and that’s all 24 volume letters. Any excess is OK but you would have to juggle volume letters in Disk Management for windows to see which ones you want at the time, regardless of GPT or not. MBR/BIOS handles this in a MUCH more user-friendly and less time-consuming way, revealing EFI/GPT as FAR more costly to the individual or when a single administrator can not clone their working image to very many PC’s. There are literally decades of free, proven MBR/BIOS tools, even if “only” the ones from the most recent decade are still useful on the latest MBR/BIOS PCs. By comparison, there yet is a dramatically lesser number of effective free EFI/GPT tools, and those that appear are not expected to be useful for very many years into the future. This is by design.
Therefore if you want to multiboot, even if you really like W8, make sure to NEVER purchase a PC which is “Made for Windows 8”, unless you can be sure the EFI & Secure Boot can be disabled on the motherboard, and make sure that they have been disabled before then partitioning using MBR/BIOS, formatting, & installing W8 or anything else. You will be a much happier camper. This is for consumers, hobbyists, and regular PC users.
Server operators can be as advanced at coding as developers, and some may be able to pinpoint the dire need which made them acquire EFI equipment to begin with. But if you printed out all the messages on discussion boards about EFT/GPT from confused overworked IT guys, there would be a lot of dead trees. They’ve been dealing with it the longest, there are some unhappy operators in their camp who definitely do not have it made in the shade. Especially when things go wrong . . .
hope this helps,
ztron
ztron. thanks for your very generous comments. I took the liberty of removing some of the white space, otherwise your comments are as posted.
Hi, “System Reserved partition” question –
I have a Toshiba Satellite L305 (purchased January 2009; not used to present time and therefore brand factory new). I set it aside shortly after purchase because Vista refused to connect to Apple remote iDisk storage…but I did come across [and printed] this fantastic page at the end of 2009 (!)
I am ‘researched and ready’ – four years after buying the laptop – to:
1.) Do a Clean Install of Windows 7 (using Upgrade”CD) thus getting rid of Vista.
2.) Deal with various driver problems reported in 2009-2010 (function key issues; brightness control, etc.). [Hopefully the later Toshiba and/or Linux drivers solved these issues.]
3.) Install Linux Mint
Despite all recent searching and Googling, I cannot find a sharp, definite answer to this question:
Can a Windows/Linux dual-boot system be *accomplished* if Linux is added to a system where the “System Reserved” (Windows boot) partition has been made not to exist during Windows 7 configuration – by means of various methods suggested elsewhere?
In such a case, it would seem reasonable that the Windows boot files/records – in the absence of a System Reserved partition – would be installed directly to the “C:/” primary/Active Windows OS partition, right?
Can a dual-boot system (i.e., secondary Linux) be made to operate without that System Reserved partition? Can Linux/Grub deal with that?
On the other hand, possibly it’s the case (but I hope not) that the boot files on the “System Reserved” partition are the very thing that makes the dual-boot system possible.
Can someone advise?
September 10, 2013 – In the intervening days I have learned that a dual-boot system can be successfully achieved without a System Reserved partition.
Hi,
i’m from Germany so read carefully my awesome English post ;-)
First THX to all for share n1 informations.
So i will share what i found…
http://www.plop.at/en/bootmanager/full.html
i use this on thinclient where the master HDD is a bioswriteprotected CF Card too boot something else than the manufactura wanna ;-) (im using the iso files written to cf Card)
And a other Thing…
if i made dual boots early i just boot xp and start the install inside xp and got a automatic boot menu…
its a Long time ago can’t remember what i installed but i remember it worked this way.
For now i only use win7 desk. and Linux Servers …
because grub2 has somthing changed and most installs that dont categorise normal will fail.
Sorry but it doesn-t work if both grub2 and the linux os are on a logical partition. In that case, the first 512B of the logical partition are NULL.
This is my fdisk -l situation
/dev/sdb1 2048 30722047 15360000 27 Hidden NTFS WinRE
/dev/sdb2 * 30722048 30926847 102400 7 HPFS/NTFS/exFAT
/dev/sdb3 30926848 813323208 391198180+ 7 HPFS/NTFS/exFAT
/dev/sdb4 813324286 976771071 81723393 5 Extended
/dev/sdb5 813324288 968691711 77683712 83 Linux
/dev/sdb6 968693760 976771071 4038656 82 Linux swap / Solaris
Ubuntu and GRUB2 are installed onto /dev/sdb5 but the first 512B are NULL, so nothing works.
FollowTheMedia, here’s my fdisk -l output. As you can see here my extended partition occurs on /dev/sda3. My Linux (in this case CrunchBang) and its bootloader (GRUB) are iinstalled on logical partition /dev/sda6. It works quite well.
[text]
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x607a9f43
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2457599 1227776 7 HPFS/NTFS/exFAT
/dev/sda2 2457600 780165119 388853760 7 HPFS/NTFS/exFAT
/dev/sda3 780167166 878661631 49247233 f W95 Ext’d (LBA)
Partition 3 does not start on physical sector boundary.
/dev/sda4 944005120 976771071 16382976 7 HPFS/NTFS/exFAT
/dev/sda5 780167168 812935167 16384000 7 HPFS/NTFS/exFAT
/dev/sda6 812937216 876638207 31850496 83 Linux
/dev/sda7 876640256 878661631 1010688 82 Linux swap / Solaris
[/text]
Hum, I start thinking that something is terribly wrong with my MBR. I should rewrite it down from scratch.
First of all thank you very much it was very helpful but i had this anomaly.
When selecting to install the bootloader in /dev/sda3 when i restarted i only got the grub rescue command prompt and couldn’t for any reason log onto windows 7. Then i reinstalled and selected /dev/sda for the bootloader and i got a menu to choose between windows 7 and ubuntu and everything worked fine.
Hey i don’t know how but i did it one more time and it worked even though i had to repair windows by Bootrec.exe /fixMBR. Also i had the same problem as AJ which was caused from inattentiveness as i hadn’t moved linux.bin to c and therefore it couldn’t find it.
I follow all your steps but after rebooting and selecting Linux, I’m stuck in blinking cursor, I have CentOS 6.4 x64 in Windows 8.1 installed.
I was able see the grub menu and select CentOS 6.4 only If I boot my flash drive (the installer I used to install CentOS) but in Windows 8.1 it didn’t work.
I have C: and E: logical partition before, I shrink the E: to have a free space to install the CentOS.
/boot (200 MB) – ext4
/swap (4Gig) – ext4
/ (all free space) – ext4
If you can make another updates with Windows 8.1 and CentOS dual booting I appreciate it, and it is very helpful to others.
jeck, thanks for posting. Sorry you’re having difficulties. A couple of things to check:
– That Windows secure boot has been disabled, if applicable;
– that the grub boot loader is installed in the correct partition (e.g., /boot);
– that the boot sector of that partition has been correctly copied.
I’ve not attempted to boot from another Windows partition on the same drive (e.g. “/E”). You may need to adjust the bcdedit command to reflect this partition, for example:
[text light=”true”]
bcdedit /set {ID} device partition=e:
[/text]
But again, I have not personally tested this.
Your suggestion for a post update to include Windows 8.x is a good one. As soon as I find some spare time I will do that.
Hi iceflatline,
Thanks for the quick response, I’ve just solve my problem. I made an article for it, here’s the link http://dixies-hd.blogspot.com/2013/11/how-to-dual-boot-windows-81-and-centos.html
Thank you and more power.
[…] […]
Thank you so much. You saved my day. Straight to the point, very well explained . Greetings from Brasil.
Thank you for the clear and well laid out guide. I successfully set up dual boot for Win7 and Linux, and learned about Linux and bcdedit in the process.
Stillwaters, you’re welcome. Thanks for the kind words.
@iceflatline, I am desperately trying to get a dual boot from separate hdd’s going. Win8 on /dev/sda and Archlinux on dev/sdb. I’ve seen some mention of grub4dos working, were you able to confirm it? I’ve tried but it has failed. I suspect its because the UEFI system does not like booting MBR?
My setup as follows
Primary SSD (Win8)
|- /dev/sda1 – recovery (ntfs)
|- /dev/sda2 – boot (fat32)
|- /dev/sda3 – unknown
|- /dev/sda4 – windows primary (ntfs)
Secondary HDD (Windows Data Disk / Archlinux install)
|- /dev/sdb1 – unknown
|- /dev/sdb2 – windows secondary (ntfs)
|- /dev/sdb3 – /boot (fat32)
|- /dev/sdb4 – /mnt (ext4)
|- /dev/sdb5 – /mnt/var (ext4)
|- /dev/sdb6 – swap
|- /dev/sdb7 – /mnt/home (ext4)
I am able to boot into Arch via the BIOS, which has an entry for partition3 of sdb.
Is this at all possible using bcdedit? has anyone been able to make progress booting into a secondary hdd in a UEFI sys.
I’m new to it all so help/guidance appreciated.
tmanz, I wish I could help you. However I have not attempted to dual boot by editing Windows data store (or using other, third-party applications). If you roll back through the comments in this post, those provided by Rudi.RG and ztron may be of assistance.
BTW, UEFI will boot MBR disks just fine. Your motherboard should provided a setting for booting “legacy” or “Other OS” devices.
Hi iceflatline, second time I post and thanks again this post is excellent.
I followed your guide to a dot installing ubuntu 13.10 alongside windows 7 and everything run like a clock up until I upgraded to 14.04.
There is a bug when upgrading to 14.04 where grub breaks and as a result you get the error
grub_term_highlight_color not found or sth like that and you end up in grub-rescue command prompt.
Would you happen to know what should I do to fix this? I know that it is specific to one distribution, but I am not so sure what I can alter without messing the previous configuration which was working so well.
satrapes, that’s a new one. I’ll need to do some further research.
Ok thank you very much.
Hi everyone,
I just wanted to let you know my success story with booting from multiple HDD.
I read carefully all comments with looking for a answer how dual boot Windows 7 and Linux while Linux on a second hard drive.
First my eye caught Rudi.RG’s solution with GRUB4DOS and I was almost to try it when reading further found Renato’s post with a link to http://blog.mattrudge.net/2010/08/04/booting-ubuntu-through-ntldr/ which unfortunately was not opening for me :(. Anyway , I Googled around and found what it was talking about it there:
You have to edit the linux.bin file with Hex editor and change whatever you find at the 0064 address to value 81. That’s all! It worked like a charm for me.
Now if somebody could explain what does it mean and how robust is it, it would be a great contribution to this wonderful iceflatline’s tutorial.
Cheers!
Excellent tutorial. Thank you so much. And the “Related Posts” tells me you fuck with SliTaz, too. <3 I’ma try to make it a point to be by here again.
Eric & Kickiss, thanks for contributing. Much appreciated.
Thank you so much for this tutorial, it’s exactly what I was looking for.
Excellent article. Clearly written and technically accurate. A real breath of fresh air.
I was able to use this (with minor changes) to triple boot LinuxMint 17.1, Windows 8.1 and Window 10 Insider Preview.
I installed the Linux partitions on a secondary drive that had an existing partition. My main drive already had two partitions (the two windows partitions) so I couldn’t force the Linux and the swap partitions onto that. No issues though, just needed to be careful with the drive designations when following the article’s instructions.
Also, I didn’t need a hex editor to change the .bin file. It worked exactly the way the article said it would.
It worked! Well, mostly, and not at first. After reading oodles of forums, this solution seemed the most straightforward. During the Precise puppy install, the process asked where to install Grub4dos, and I pointed to sda3 as was suggested instead of sda1. It then wanted me to mark sda3 as “boot” so I did (a mistake). Apparently it also UNMARKED the first partition as boot because when I rebooted only puppy came up! Windows 7 rescue disk couldn’t see windows any more. Eventually in Linux I figured out thru GParted that the first partition needed set back to boot, and then windows 7 returned. Pheeeew, no damage. I had EasyBCD in windows, but no matter what settings I tried, Linux would not boot. So undid any changes EasyBCD made, and copied isolinux.bin to C: and manually edited the BCD file as suggested here. Now THAT worked — puppy was listed as a choice & would boot up.
However, it seems I have no functionality for Grub in the advanced startup options after choosing Linux. Something about invalid file hd -1, -1 or something. Not even sure Grub loaded properly — nothing in /boot except the kernel and an empty grub folder. /menu.lst shows:
# menu.lst produced by grub4dosconfig-v1.8.0
color white/green yellow/blue white/black green/black
#splashimage=/splash.xpm
timeout 10
default 0
# Full installed Linux
title Precise Puppy 5.7.1 (sda3/boot)
kernel /boot/vmlinuz root=/dev/sda3 ro
# Advanced Menu
title Advanced menu
configfile /menu-advanced.lst
commandline
and /menu-advanced.lst shows:
# /menu-advanced.lst produced by grub4dosconfig-v1.8.0
title Back to the main menu
configfile /menu.lst
commandline
# additionals
title Bootup from HDD\nBootup from the master boot record of the hard disk drive
chainloader (hd0)+1
title Find Grub2\nBoot up grub2 if installed
find –set-root –ignore-floppies –ignore-cd /boot/grub/core.img
kernel /boot/grub/core.img
title Grub4Dos commandline\n(for experts only)
commandline
title Reboot computer
reboot
title Halt computer
halt
So my question is, to get grub’s functionality during Linux bootup (I may need it), do I need to re-run Grub4dos? Grub’s settings are rather cryptic. I’m afraid of screwing something up again — right now the multi-boot works fine & don’t want to risk that and the method here didn’t mess w/windows mbr, which I like.
Thanks in advance…..
Stroback, sorry my friend. I have absolutely no stick time with Grub4DOS or the “Precise puppy.”
Very clean tutorial, but I am having issues as I like some of the commenters, once everything is installed I pick the Ubuntu option in the windows boot loader and it goes no where. Well it goes to Windows Boot Manager window
“Windows has failed to start. A recent hardware or software change might be the cause. To fix the problem:
[1. windows install disk]
[2.Choose language…]
[3. Click “repair computer …]
[contact admin or computer mfg for asssistance blah blah]
File:\ubuntu.bin
Status:0xc000000f
Info: the application or operating system couldn’t be loaded because a required file is missing or contains errors.
”
I have tried this multiple times, putting the .bin in c:\ubuntu.bin, c:\$WINDOWS.~BT (which was a hidden file folder, but had some boot stuff in it so thought it could be what the BIOS or EFI thinks is c:\?
Its really weird, its like everything goes to plan but then nothing… I wouldn’t mind if i could just skip the grub boot loader either. If I could go from the BCD directly to the linux image that would be great.
What else could I check?
Any assistance would be apprecaited.
d4p4g, apologies for the delay – family in from out of town. I just ran through the steps again using a Ubuntu 15.10 and Windows 7 pro and can’t reproduce the error. It seems to work fine. Are you saying that both operating systems will not boot?
Simple and elegant. Still works! Thank you.
Nikhil, thanks! Good to know. I really do need to carve out some time to update this post though.
[…] https://iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/ […]
Great page,
But it does not work for my Asus laptop.
I continue to get a message Ubuntu will force EFI. Then I choose: something else and the whole proces stops.
I only can close the installation proces.
Every book, page, says it simple but it keeps on failing.
I had some hope your article would work, but still stuck
Hello, So I tried to follow this to dual boot Windows 10 and Ubuntu Studio 16.04.
Needless to say I got as far as the creation of the additional boot entry with bcdedit and all looked good but I am getting the same boot manager screen as d4p4g above upon rebooting the system. I have tried with Secure Boot on and Off with the same outcome.
Curious if d4p4g was trying to do something with a new Windows O/S and this is only limited to Windows 7?
Any guidance that someone could provide in making this successful would be greatly appreciated.
Posted a message but I don’t see it…
Attempted to follow this for a Windows 10 and Ubuntu Studio 16.04 dual boot.
Needless to say I got the same error as d4p4g above when the systems was rebooted and pointed at the \ubuntu.bin. Tried with Secure Boot on and off with same results.
Does anyone know if this will work with Windows newer than 7?
Anything I can try to get this to work?
Thanks!
Bill S.
Bill S, it very well could be an issue with Windows 10. Unfortunately I don’t have a copy at the moment to try to recreate the problem. Hope to soon and will post when I can.
Hi iceflatline..
Thank you for your simple, clean and straightforward tutorial !
Still following up on this thread after 6 years or so? – Well, this really must be an interesting topic..
To make a long story short:
About 2 weeks ago I installed Windows 10 Pro on a new SSD-drive , the primary disk, and then, except for Grub2, Linux Mint 18 on an old, SATA-drive as the second disk. This second disk already had one NTFS partition configured.
Apart from your recommended way of installing Linux, I followed your tutorial step by step. – I have rebooted the PC, switched back and forth between the 2 OS’es dozens of times, and It just works flawlessly.
One thing though, has to be mentioned. I have an old PC, about 8 years or so. The motherboard is running BIOS, not EFI. BIOS can’t boot to a second connected disk. The days of Windows NTLDR for configuring a second disk are long gone. – Windows-XP I think. Yes there are 3-party software like EasyBCD that can do the job, but it too has to be installed on C: and thus occupy more space than my method.
After installing Win10 Pro, I reduced the C: partition with 1 GB. – Yes, that’s more than enough for the Linux installer.
– On my C: it occupies 58.2 MB.
1. Configured BCD according your tutorial
Installed Mint 18 this way;
2. Created a 300 MB partition on /dev/sda5 (the win10 disk).
3 For the rest of the Linux installation I created 3 partitions on disk nr.2.
/dev/sdb2/ / (the root), /dev/sdb6/home and /dev/sdb7/swap.
4. Finally made the installer install the bootloader (Grub2) on /dev/sda5. (disk nr.1)
Primary or Logical partition dosn’t matter. Both works !
No need for a FAT32 partition since nowadays I think most Linux-distros can write directly to NTFS partitions. And that’s where the ????.bin file you so wisely mentioned in your tutorial. has to be placed anyway.
Thanks again.
Hi again..
Forgot this : The Linux partition on C: is: /dev/sda5/boot (where Grub2 will be installed).
Sorry !
Norvegia, great information here! Thanks so very much for your comment.
Found the answer: Win8+ uses the new ‘Metro’ bootloader, which can be disabled via:
bcdedit /set {default} bootmenupolicy legacy
Apparently my first post was lost, as only my follow-up to it now shows up? Good thing I copied it:
————————
Thanks! I’ve been using this (and/or the info referenced from the Arch Wiki) for years. I just migrated my Arch x64 setup (BIOS, not UEFI) to a new drive, now with Windows 10; using GRUB for the Linux partition this time.
My previous setup was with Windows 7, with Syslinux as the Linux bootloader; it would come right up to the BCD boot list and get to linux in seconds. My new setup brings up the boot menu (buttons now) after basically loading Windows first (30+ sec; and if I then select Win10 it goes right into the login screen), then after selecting Linux, it waits another 5sec, reboots, then loads GRUB.
So what took ~10sec with Win7/Arch/Syslinux now takes a couple minutes with Win10/Arch/GRUB! I presume this is a Windows 10 (and 8/8.1) thing? Or is there something I can do to make it like the fast Win7 bootloader menu? Thanks again for this tutorial!
jwh, thanks for posting this. As for the lengthy boot times, I don’t know for sure. I don’t have access to Windows 10 at the moment so have not way to test. As you suggest though it may very well be Windows boot issue.
Hi..
A comment about Windows 10 and the boot-menu.
Windows 10 is by default configured for fast boot, which is why the boot-menu comes up with buttons.
Selecting Linux causes a reboot before GRUB gets loaded. To avoid this both “fast boot” and “hybrid sleep” must be disabled from within Windows 10!
There are 2 ways to do this:
1. the Control Panel->Power Options.
2. All Settings->System->Power & Sleep->Additional power settings.
Both brings up the power plan window.
Select:
“Choose what the power button does” and “Change settings that are currently unavailable”.
Disable “fast boot”.
and then:
Select “Change plan settings” and “change advanced power settings”. Select Sleep->Allow hybrid sleep.
Switch “Settings” from On to Off.
The boot menu will from now on look like it did in Windows 7, and there is no reboot before GRUB gets loaded when Linux is selected.
Norvegia, thanks for posting this comment.
Hello
I have followed the instructions to the dot.
My computer has two partitions prior to windows, and then a C and D for windows, so my Linux Mint ends up at /dev/sda5
I made sure to select /dev/sda5 for bootloader.
Instead of creating a FAT32 partition, I copied the Linux.bin file onto a USB stick with FAT32 and then used windows to copy it to C:\
I get almost identical error to AJ above. Satus is 98.
I made sure I kept all lower case.
Windows failed to start…..
File: \linux.bin
Status: 0xc0000098
Info: The selected entry could not be loaded because the application is missing or corrupt.
I’m using Windows 7 and 1x SSD.
I discovered that no one seem to have informed you when this error message occurs. And you may never have encountered yourself yet.
After following all your steps and rebooting, I do get the BSD boot menu and can choose windows or Linux.
Windows will boot as normal, but if, and after choosing Linux I get the error message above.
That message says “Windows failed to start. A recent hardware….”, even though it is trying to load linux.bin which is confusing.
Ingvar, thanks for your comments. I agree this is confusing. It appears that you did not over write the windows boot record, which it good. Why the BCD store is not recognizing the Linux boot record on the other partition is not clear to me. The error message seems to suggest that the BCD store thinks the Linux partition is a Windows partition. Is it possible the wrong partition was was copied when is the dd command?
Iceflatline,
No, have several times tried to re-read /dev/sda5, which is the “/” Linux partition, with the “dd” command. No success.
Does it need the MBR of /dev/sda set up in any way in order to use this linux.bin correctly? I doubt the MBR is correct. If I choose to boot legacy USB with a YUMI created Linux USB pen, and then from the USB grub menu choose to boot from regular HD, then I get approximately th is message “invalid partition table”.
My computer’s options don’t allow booting from MBR, so this is a trick-around…
However, since EFI doesn’t need MBR, the missing partition table is not noticed otherwise.
I did install rEFInd, which works. I can choose at boot up if I want to boot rEFInd or BCD or a third one. So I can still troubleshoot the problem, although not strictly necessary now.
Thanks for your great post, btw. And for still responding extremely fast to comments after 6 years ;-D
Note: Your robots.txt does not list this article, and it is hard to find through Google (as is any good help with EFI issues).
Ingvar, not that I am aware of. All that’s really going on here is that you are adding another entry to the Windows BCD data store; that entry simply points to location containing of the MBR of Linux partition. Of course it has been awhile since I wrote this post so perhaps something has changed.
Is it possible to use /dev/sda instead of in my case /dev/sda5?
Of course I would have to reinstall with grub on /dev/sda.
What would be the command to bcdedit?
Still need the linux.bin?
Thanks
If I recall correctly, you indicated that you boot Windows from this device, /dev/sda? If so then, then yes, you can install GRUB to /dev/sda but know that it will most likely over write the Windows boot loader. Usually this isn’t a problem as GRUB is sophisticated enough now to recognize the presence of a bootable Windows partition and give the option of adding it to its menu. However, if it doesn’t, you’ll need to add it to the GRUB configuration manually. Until GRUB knows where Windows is, you won’t be able to boot it.
The reason I wrote this article was to give those wishing to dual boot the option of using the Windows boot loader instead of GRUB.
Seem this doesn’t work with BitLocker’d Win10 / Elementary.
With above mods in place… Win10 still boots but Linux GRUB will not load, just gives error 0xc000007b which appears to be 32bit Vs. 64bit incompatibility.
Asecret, yes Microsoft suggests turning off both BitLocker and Secure Boot before setting BCDEdit options. More about that can be found here: https://msdn.microsoft.com/en-us/windows/hardware/drivers/devtest/adding-boot-entries#editing-the-boot-menu-in-windows-vista-and-later
rulzz, perhaps it’s the application you’re running as a service with srvany that’s consuming CPU time? What happens if you shut down the service and just run the application normally?
Does anyone know if this technique work with secure boot on?
Hi, I had Centos running on my desktop and I installed windows 10. Now I cant boot into Centos. The other problem being that the steps given to copy the 512 bytes are not possible as I dont have access to the Linux OS.
Any suggestions?
Moiz R, it appears the CentOS boot loader was overwritten when you installed Windows. You’ll need to reinstall the CentOS bootloader, which I believe is GRUB. A quick web search suggests there are quite a few instructions for how to reinstall GRUB. The Rescatux program might also be a place to start.
hi, i did not find if this been covered before, but after recent updates in openSUSE tumbleweed this boot setup broke (boot on / or /boot on primary or logical partition, same problem). don’t now exactly what is cause, but solution seems to be create new linux.bin since first 512b of partition were probably changed(otherwise new linux.bin should not help).
link to forum thread, i made
https://forums.opensuse.org/showthread.php/526787-quot-GRUB-_-quot-hang?p=2836091#post2836091
jaan, thanks for taking the time to post the issue and solution. Really appreciate it.
I have browsed this helpful article and comments in my search for a solution to my dual-boot problem. I have a second-hand Lenovo T430 laptop. It has Win7 installed. I want to install Linux Mint 17.x or 18.x (which use Grub2) in dual boot, without overwriting the Win7 bootloader.
I have done this successfully on other computers using EasyBCD, so I understand about partitioning and about putting the Grub on to the Linux Mint’s root (/) partition. But in this case EasyBCD does not do the job.
The curious thing about this Lenovo laptop is that (in its original state with only Win7 installed) on initial bootup the Windows boot menu appears fleetingly, showing two options – the default is “Boot To Windows”, the other option is “Restore Original Windows Image” (with a warning that this will wipe the hard drive). After a mere 2 seconds, the default is to boot into Win7. I have never encountered this boot-menu on any other computer.
I went through the whole process of installing Mint on appropriate partitions, and putting Grub on Mint’s root (/) partition, then rebooting into Win7 and adding Linux Mint to the EasyBCD menu.
But when rebooting, instead of getting the Windows boot menu with Linux Mint also listed, I still got, again, only the Windows boot menu with the “Boot Windows” or “Restore Image” options. No sign of Mint.
Two little clues. As well as a System Reserved partition and the Win7 partition, there was, and is, also a Recovery partition (only visible in GParted) on the drive. And when I was going through the install options for Mint, the installer said that there were “multiple OSs” already on the drive. I presumed that this was something to do with the Recovery partition (does it contain an image which Linux thinks is another OS?). And has the Linux Rescue and Recovery tool on the laptop not only created that Recovery partition but also modified the Windows bootloader to cause that screen with the Restore option to appear? If so, is that preventing EasyBCD from modifying the Windows bootloader?
If any of that is on-target, then what can I do to discover the existing contents of the Windows bootloader/BCD? And if EasyBCD can’t enable booting into Linux Mint, can I use bcdedit to modify the bootloading process to add Linux Mint (or rather its Grub) without messing up the Recovery partition and/or the Restore-image option which already appears to be in place?
br1anst0rm, hmmm, it’s been awhile since I’ve dealt with this issue. A couple of thoughts though. I think that the second boot option may be the Lenovo feature that allows you to reinstall the OS to the state is was in when it left the factory.
I’ve owned many Lenovo laptops but I have never seen that feature offered as a boot option. Usually you have to enter the recovery option by pushing a button during boot, where your offered the ability to reinstall the OS. And yes, it does wipe the drive.
I suspect one of the two partitions you’re seeing via GParted is this recovery partition, the other is likely the Windows boot partition, where windows keeps its BCD settings.
The steps described in the post should allow you to add the Linux boot option using BCDedit as well as how long the options are displayed.
Before you do anything though you might want to consider cloning the entire drive to another (of equal or greater size) while you’re experimenting.
By the way, if you’re not interested in this factory recovery partition you should be able to delete it and recover its space using Windows 7’s disk management tool. You should consult the Internet though, as I’ve not done that before.
Hello iceflatline and thanks for responding to my recent post.
I have been casting around for advice and guidance – including the EasyBCD support forum and the Linux Lite and Linux Mint forums (as I use these Linux OSs and use EasyBCD to set up dual boots on my other non-Lenovo computers).
It has been like putting together a jigsaw puzzle. I feel like Sherlock Holmes trying to follow clues and make deductions. But I think I have figured out the explanation, even if I haven’t found a solution. The main elements are these:
– it is certain that – as you say – the laptop has not only a System Reserved (Windows Boot) partition, but also a Recovery Partition which is part of the Lenovo OEM setup;
– it seems almost certain that either as OEM or when Win7 was (re)installed, Lenovo modified the BCD so that in the initial stages of booting, the Windows Boot Manager/Loader offered up the Restore System Image option that appears as the first screen.
– The BCD (which I have been able to look at via the EasyBCD GUI) includes a line beginning “device” which is a custom entry which I presume is what brings up the screen offering the option to Restore System Image (which is on the Recovery partition);
– this “device locate” custom entry is so configured that once it gets to the file concerned, it stops. That’s a crude summary of the detailed explanation at this site: http://www.mistyrebootfiles.altervista.org/documents/BCDEdit/files/device_locate.htm.
– so even though for my dual boot I installed Linux Mint on to a separate partition with its Grub, and used EasyBCD to add this to the BCD entries, the boot process – which goes to the Windows bootloader first – does not proceed to the stage where the link to Grub and the Linux OS is offered.
– it follows that in order to set up dual boot while keeping the Win7 Bootloader and adding the Linux OS and its Grub, the BCD has to be edited either manually or using EasyBCD….. but that in doing so, the custom configuration that Lenovo has put in place, and its recovery partition, have to be changed or removed. That’s pretty radical surgery, and even if I take a backup or clone the drive, I’m not sure it’s something i want to attempt.
Which leaves me with the choice of abandoning dual boot ambitions for this computer and leaving it with Win7 only, or deleting Windows – and the Recovery partition – entirely and installing only one or more Linux OSs.
If you are interested in more background on the efforts to figure all this out, and links to some other helpful websites, the posts in this thread on the Linux Lite forum (which are too long to copy-and-paste here) have screenshots of my BCD entries and other details: https://www.linuxliteos.com/forums/installing-linux-lite/dual-boot-with-win7-problem-with-boot-menus-on-lenovo-laptop/msg46058/#msg46058.
br1anst0rm, that is indeed a tough choice. I won’t offer any counsel though as it is ultimately up to you to decide. But do let me know which way you go. And by the way, really appreciate all the information provided in your comment. I’m sure it will be of help to others who may come across this post.
Hi iceflatline,
I have been using these same steps with great success on my PC (Arch+Win10)
Initially I was getting fed up with windows updates causing me issues due to syslinux being sat in MBR and this just solved it for me.
I didn’t comment when I first discovered your article but though that as it has served me well for so long (2017 I found this article and implemented it) I thought I had better come give well deserved props.
Must admit I followed a slightly different path but what I did was based on the info here
Thank you.
t0m5k1, thank you for your kind words. You made my day! I’m glad the post was helpful to you.
Hm. I am using Windows 8.1 with UEFI with Bitlocker and Secure Boot disabled. I have this minor assembly program for testing purposes that I want as a boot option. I followed the instructions to the T – I created a new partition with the assembly .bin file on there and pointed bcdedit towards it with bcdedit /set {(ID)} device partition=O: and bcdedit /set {(ID)} path \assemblyTest.bin and the option to boot to this file DOES pop up alongside my Windows 8.1 boot option. The problem is that when I try to run it, Windows throws an error along the lines of “Windows is missing an important file.” (I am on mobile right now – writing this off of the top of my head – will post full error message and screenshot tomorrow.) The odd thing is that the assembly program does in fact boot from USB when using Rufus, but I would seriously prefer not booting from USB all the time and would like to have a nice and clean partition for my program to boot from. I do not understand what the problem is. Help?
theguydude, that’s a tough one. Perhaps try moving the *.bin file you created to c:\ and then use partition=c:? Maybe the BCDEdit thinks it needs to be there.
On the other hand, you mentioned an assembly program. Perhaps Windows has a way to boot such a program independent of the steps described in the post. Might be worth researching.
I did the whole process manually and had to tune the process to target specifically i386-pc and to disable os-prober. The configuration seems fragile and running update-grub may put the boot sector copy out of sync.
# ls -l /dev/disk/by-label
yhteensä 0
lrwxrwxrwx 1 root root 10 syys 1 18:47 BOOT -> ../../sda1
lrwxrwxrwx 1 root root 10 syys 1 18:47 OS -> ../../sda2
lrwxrwxrwx 1 root root 10 syys 1 18:47 Ubuntu -> ../../sda3
/# mount /dev/sda3 mnt
/# sudo mount –bind /dev /mnt/dev &&
> sudo mount –bind /dev/pts /mnt/dev/pts &&
> sudo mount –bind /proc /mnt/proc &&
> sudo mount –bind /sys /mnt/sys
/# sudo chroot /mnt
/# chmod a-x /usr/bin/os-prober
/# grub-install –target=i386-pc –force /dev/sda3
Installing for i386-pc platform.
grub-install: warning: File system
ext2' doesn't support embedding.
ext2′ doesn’t support embedding.grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
Installation finished. No error reported.
/# grub-install --target=i386-pc --recheck /dev/sda3
Installing for i386-pc platform.
grub-install: warning: File system
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.
/# update-grub
Sourcing file
/etc/default/grub'
/etc/default/grub.d/init-select.cfg’Sourcing file
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.0.0-25-generic
Found initrd image: /boot/initrd.img-5.0.0-25-generic
Found linux image: /boot/vmlinuz-5.0.0-13-generic
Found initrd image: /boot/initrd.img-5.0.0-13-generic
done
/# exit
/# umount /mnt/sys
/# umount /mnt/proc
/# umount /mnt/dev/pts
/# umount /mnt/dev
/# mount /dev/sda2 /mnt
/# dd if=/dev/sda3 of=/mnt/linuxbootsector.bin bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0.000535549 s, 956 kB/s
/# umount /mnt
/# bcdedit /create /d “Ubuntu” /application bootsector
/# bcdedit /set {ID} device partition=c:
/# bcdedit /set {ID} path \linuxbootsector.bin
/# bcdedit /displayorder {ID} /addlast
/# bcdedit /timeout 5
/# bcdedit /default {ID}
Ah, oh, I also commented out the efi partition from fstab.
UUID=e2bc4a8c-9dc5-4ef0-9751-71e3eae5c868 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
#UUID=2C0A-1FA9 /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
This is a great resource for Linux users, and it definitely got me started on setting up my dual-boot computer. Now, after considerable additional study, I may be in a position to make a contribution. Take the situation where Linux is installed on the second disk, with the grub loader occupying the boot sector of a FAT partition of that second disk. As has been pointed out, extracting the boot sector into a file, placing it on the FAT partition, and calling it with BCD from the first disk will not work. This appears to be due to the unusual arrangement of the BIOS booting the computer from the first disk, but trying to load an operating system on the second disk. Normally, to boot an OS on the second disk, the BIOS would be configured to boot from the second disk to start with. In that case, the BIOS would perform a swap, designating the second disk hd0. The grub loader relies on this designation, as it reads the rest of Grub into memory. If the grub loader is called by BCD from the first disk, however, no swap has been performed, and the grub loader will look for the rest of Grub and Linux on the first disk, hd0. After studying the source code for the grub boot loader, I noticed that it is specifically designed to accept a one-byte alteration to solve this problem. There is a byte value of 0xFF which can be changed to a value of 0x81. This byte is located between the initial jump instruction and the actual beginning of the grub code. In my bootsector, it is at offset 0x64. By the way, the 0x81 value originates from arguments for the system call to load disk sectors into memory. See the Wikipedia article on INT 13h, values for register DL. So just change the one byte in a hex editor, and the boot loader on the second disk should work with BCD on the first disk.
Sam, thanks so very much for contributing to this post. This looks like an elegant approach, indeed!
Great article with detailed steps to easily follow. Still works in 2023 with a12 year old ACER non-uefi laptop running Windows 10 (a bit slow) after an upgrade from Windows 7. Added Linux Mint 21 and used the Windows Boot Manager as described. I’m not a great fan of GRUB, too complicated to maintain imho. If the laptop was UEFI I would use rEFInd boot manager which I like a lot.
Thanks for all the information it was very useful!
Thanks for the comment, Andy. It has been awhile since I wrote this post :). Good to know the steps are still useful.