Main menu:


Please consider a small donation:



Or you can donate bitcoin:


Thanks to TekLinks in Birmingham, AL, for providing colocation and bandwidth.

Page Rank


FOSS Force Best Blog--2013 Award

Recent posts

Recent comments

About this blog

I am Eric Hameleers, and this is where I think out loud.
More about me.


Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 262 other subscribers

My Favourites



January 2017
« Dec    

RSS Alien's Slackware packages

RSS Alien's unofficial KDE Slackware packages

RSS Alien's multilib packages

RSS Slackware64-current


Adding Linux to the Windows7 boot menu

When I create a Windows / Linux dual-boot computer I usually add Windows as an option to my LILO boot menu. That is the easiest way, and works always.

However, I ran into a situation where I could not use LILO as the primary boot loader and I had to look into the Windows7 “boot configuration data” or BCD. Actually it was Windows Vista, not Windows7, which was the first to abandon good old C:\boot.ini and start writing its bootloader configuration into a binary block of data. I wrote this post just to have this procedure available as a reference.

Windows7 contains the command-line program BCDedit which you are supposed to use for editing your Windows boot menu. A total load of crock it is. It will not support any OS that does not boot from the same hard disk that Windows7 is installed to… so I had some issues getting my Slackware added to the Windows boot menu because I had installed it on a second hard disk.

In the end I decided to shrink the Windows partition a little bit and add a small Linux partition where I could install LILO.

Microsoft has added a basic partition manager to Windows7 – something they do more often. If a 3rd party creates an invaluable add-on to provide functionality Microsoft did not include into Windows, then Microsoft will eventually copy its basic functionality into a half-hearted clone. Anyway, the freed-up hard disk space was allocated to a small partition which became Slackware’s “/boot” and I installed LILO to that /boot partition.

Then, just like in the days of Windows NT and “c:\boot.ini”, I extracted the first 512 bytes from the root sector of that /boot partition (in my case, that partition was “/dev/sda3“) and wrote it to a USB stick which I had mounted on “/mnt/hd“:

dd if=/dev/sda3 of=/mnt/hd/linux.bin bs=512 count=1

Rebooted to Windows7 and transfered that 512 byte file called “linux.bin” from the USB stick to the root of the Windows C: drive.

Next, I used BCDedit to add an entry to Windows7’s BCD store. Note that administrative privileges are required to use BCDedit!. What you do is navigate to “Start->All Programs->Accessories“, Right-click on “Command Prompt” and select “Run as administrator“.

In this command window, enter the BCDedit commands. Start by creating an entry for Slackware Linux. I use “Linux” as the label for the boot menu. The actual label you choose is arbitrary of course:

bcdedit /create /d “Linux” /application BOOTSECTOR

BCDedit will return an alphanumeric identifier for this entry. Copy that string into a text file and do not lose it!

In the remainder of this article I will refer to this string as {ID}. You would replace {ID} with the actual identifier as returned by the command you ran. An example of what you can get for an {ID} is {244ebca6-432f-11df-ab86-ce0c22f636af}.

The next step will be to specify which partition holds the copy of the Linux boot loader sector (our “linux.bin” file):

bcdedit /set {ID} device partition=c:

Then specify the actual path to the “linux.bin” file on that C: drive:

bcdedit /set {ID}  path \linux.bin

The Windows boot menu needs an entry for our Slackware Linux OS:

bcdedit /displayorder {ID} /addlast

Usually you won’t see the boot menu at all (after all, it does not contain any other entry than Windows7 itself). In order to allow the user of the computer some reflection time, we add a delay to the menu’s display timeout. Say, the boot menu should remain visible for 30 seconds before booting into the default selection:

bcdedit /timeout 30

That would be all. You can test the new Windows boot menu by rebooting the computer. You should be able to select either Windows7 (default) or Linux to boot into. When you choose “Linux”, you’ll be taken to Slackware’s familiar LILO menu.

If at any time you would have to remove the “Linux” menu option, you can run the following command … provided you wrote the {ID} string down somewhere:

bcdedit /delete {ID}

Have fun, even with Windows,



Comment from Ellendhel
Posted: February 24, 2012 at 02:07

This was already tricky to do that with MS Windows XP, I hope to never need to do that with the actual Microsoft system… Anyway it’s still good to know, just in case.

Thanks a lot for this documentation!

Comment from oldfogie
Posted: February 24, 2012 at 03:55

Hi Eric,

Another tool in win 7 is “msconfig” for the boot information and adjustments to the startup as well.


Comment from schultzter
Posted: February 24, 2012 at 04:12

The only thing is if you re-configure lilo you need to delete the entry in EasyBCD and re-add it so that it recreates the root sector from Slackware. There’s no update button.

Comment from silviu
Posted: February 24, 2012 at 07:46

Good to know it works. Hope I never have to use it though …

Comment from weput
Posted: February 28, 2012 at 01:22

I’ve just read this post and this looks complicated..

Comment from khalid
Posted: February 28, 2012 at 18:12

bonjour Mr eric
first excuse my english
well a have the same case that you discribe in this post,
and i a apply all the commandes successfully , then i reboot
it good i have 2 choises windows and linux ; but when i click linux i have just black screen that all
i need u help

Comment from alienbob
Posted: February 28, 2012 at 19:28

Hi Khalid

It looks like one of two possibilities:

(1) you did not successfully copy the first 512 bytes of your linux boot sector into a file and to the C: partition of your Windows installation. or

(2) You copied the first 512 bytes of your linux bootsector successfully, but you never checked if your Linux installation was bootable at all.

If those 512 bytes copied out of the Linux bootsector have to boot your Linux from the Windows menu, then Linux must be able to boot too. Did you use LILO, or GRUB to setup your bootsector in Linux? Both should work.


Comment from khalid
Posted: February 28, 2012 at 20:24

hello eric
i use lilo
i installed /boot in /dev/sda4 and lilo there too i think, with lilo expet but iam not an expert!
then i rundd if=/dev/sda4 of=/media/disk/linux.bin bs=512 count=1
hereis my df

khalid@libre ~> df
Filesystem Type Size Used Avail Use% Mounted on
/dev/root ext4 97G 11G 81G 12% /
/dev/sdb3 ext4 231G 448M 219G 1% /home
/dev/sda4 ext4 1.4G 48M 1.3G 4% /boot
/dev/sda2 fuseblk 280G 53G 227G 19% /winc
/dev/sda3 fuseblk 393G 99M 393G 1% /wind
/dev/sdb2 fuseblk 350G 60G 290G 18% /winf
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
root is on /dev/sdb1
and there is another windows partition recovery on sda1
thats it
thanks Mr eric for your reactivity

Comment from khalid
Posted: February 28, 2012 at 20:59

my slackware 13.37 is bootable
i boot it from slackDvd and ca va all run very well

Comment from Jason
Posted: March 4, 2012 at 15:38


I’m gonna take a shot in the dark here. I recently ran into a minor snag when trying to install windows XP on an acer netbook. That notebook also had a windows recovery partition, and whenever I tried to load anything other than windows 7 off that drive, it would start windows recovery automatically. I had to remove the partition before I was able to finish the windows XP installation. Is there any way that your recovery partition might be interfering similarly?

Pingback from Can’t boot Windows 7 after Slackware install
Posted: March 14, 2012 at 20:42

[…] the root partition, and add 'linux' to the win7 bootmenu using the 512bytes method discribed here (…ws7-boot-menu/ ) […]

Comment from Zdenko
Posted: March 21, 2012 at 15:46

Hello Eric!

I used the same way to multiboot for many years.
It is “finger braking” but it works. Creating 1 sector long file (lilo boot
sector) and copy it to windows boot partition every time lilo.conf changed
was my nightmare.

So I was forced to find another solution.
The result was brilliant and free GAG:

It has some excellent features I need – hides all primary partitions
except the boot one. So I could install many windows OSes all with boot
disk C: (each on other primary partition)
The physical boot disk is not an issue any more. You can boot from any
physical or logical disk as long as disk with GAG is present.

For me GAG is magic boot loader.

Linux: after executing lilo (writing new boot sector) all is done, just
reboot to use new lilo configuration.

Try it, it is real time saver.



Comment from FeyFre
Posted: April 5, 2012 at 22:16


Just tried this instruction on my notebook HP Compaq 6720S. I have just installed Slackware64 13.37 side-by-side Windows 8, and now observing very weird behaviour, and don’t know whether it is intended to be because of Windows loader, or it is my notebook’s tricks:
turned on notebook power. after boot device selection it show black screen a little, then it show windows booting screen(windows flag-log+running progress bar). then it suddenly shows boot loader menu where I can select linux. If I do select windows, it almost instantly load windows. When I select Linux – I observer black screen again(for ten second or like) and, surprise, my notebook reboots. After POST screen and boot device selection, it almost instantly loads into boot screen of Lilo and I finally can choose kernel to load.
Is this normal for Windows (visra/7/8) bootloader to load windows and only then show bootmenu(and then reboot system Windwos cannot unload itself)? Or it is just trick of my notebook?

PS. It worth to mention that after user updates lilo on boot partition he must update linux.bin too.

Pingback from Booting Slackware 14 with UEFI and GPT
Posted: February 10, 2013 at 00:46

[…] to ruin the ability to boot Windows. What I have tried is following AlienBob's instructions here:…ws7-boot-menu/ This didn't work. It gave an error about not being able to boot from a corrupt boot sector, or […]

Comment from snowglobe
Posted: May 2, 2013 at 20:05

The part that I’m not clear on is the lilo part.
I have a win8 system where win8 was already installed so slack is on sda6. Do I use the /boot/boot.008 file? I had initially installed XFS but there was no boot loader
in /dev/sda6 I reinstalled with ext3 but still not working.

I did this to run lilo after slack14 install
mkdir /sl14
mount /dev/sda6 /sl14
mount –bind /proc /sl14/proc
mount –bind /dev /sl14/dev
mount –bind /sys /sl14/sys
chroot /sl14
vi /etc/lilo.conf
lilo -v

Thanks for the tips here.

Comment from snowglobe
Posted: May 2, 2013 at 20:08

I should say that after reinstall and using ext3 I did dd if=/dev/sda6 of=/usb/linux.bin bs=512 count=1

Comment from alienbob
Posted: May 2, 2013 at 21:31

No idea whether the Windows 8 bootloader behaves similar to the WIndows 7 bootloader, snowglobe…

Pingback from Dual boot with separated disks and Windows 7
Posted: May 3, 2013 at 05:34

[…] You need to copy the boot sector file to the Windows partition (the second partition of the first hard disk). Here is a good explanation of how to add a boot sector file to the Windows boot menu. Adding Linux to the Windows7 boot menu […]

Pingback from Dual Boot
Posted: May 25, 2013 at 21:23

[…] "/dev/sda2" instead of "/dev/sda". Then you can add GRUB to the Windows menu. Adding Linux to the Windows7 boot menu The above instructions are for LILO, but the same thing works for GRUB. You basically copy the […]

Pingback from Newbie Interested in installing Slackware, questions
Posted: May 26, 2013 at 22:36

[…] partition. 2. Dual-booting with windows 7 is a bit tricky. Fortunately, there is a very valuable entry in Alien's Bob (a main Slackware contributor) blog. 3. I'm not familiar with SSD's but I haven't […]

Comment from Zdenko
Posted: May 29, 2013 at 08:23


As of March 21, 2012 at 15:46 above:
All problems with multiboot (windows all versions, linux, or whatever) are elegantly solved with free GAG:
This is a boot loader that installes itself in MBR of a bootable device (whatever it is). Then you have a choice to install whatever OS you want wherever you want: first physical disk, second, primary partition, secondary, extended.. You just do a normal install of an OS and when it boots and works as expected, you simply add that OS to GAG boot menu. No more copy of first boot sector of Linux to windows and any menu creation in Windows to multiboot. Just plan install of every OS you want and adding in to GAG boot menu. That’s all. Simple as nothing else. When you do some changes to Lilo (new kernel for example) there is no need to do any changes regarding multi booting. Just save new Lilo to boot sector. That is all.
Please give a chance to GAG and you’ll never go back!

Regards all,


Comment from jack
Posted: June 1, 2013 at 03:05


maybe a dumb question but i have an macbook and i want to put windows in the bootmenu. is that also possible?

Comment from alienbob
Posted: June 1, 2013 at 13:14

Hi jack

It is not a dumb question, but I simply can not answer it. Macbooks are not within my scope.


Pingback from Experience Booting Linux Using the Windows 7 Bootloader | The Linux Experiment
Posted: July 26, 2013 at 19:34

[…] to this article on Eric Hameleers’ blog, the Windows 7 Bootloader does not play well with loading operating […]

Pingback from Cannot boot with ext4
Posted: December 24, 2013 at 12:35

[…] Do you mean Easybsd, the script to manage post installation of FreeBSD or EasyBCD the Windows utility to manage the Windows bootloader? Anyway, it seems that Slackware is not the sole OS in your PC. Could you please describe what OS are installed and how Slackware is supposed to be booted? If you have a dual-boot Windows 7/Vista – Slackware, you should consider reading this tutorial from Alien's Bob: Adding-linux-to-the-windows7-boot-menu/ […]

Pingback from Windows 7 + Slackware 14.1 dualboot SSD
Posted: January 17, 2014 at 17:33

[…] with Windows 7 as well, but I just use the Windows bootloader. AlienBOB has a nice tutorial:…ws7-boot-menu/ The downside with this is that every time you run lilo (i.e. when your kernel is updated), you […]

Pingback from Installer Hangs on MacBook Pro [Video showing problem]
Posted: May 7, 2014 at 21:34

[…] might be harder to set up. Booting via emulated BIOS can be done by going through Windows first. AlienBob's instructions will work. I don't recommend this method if you are installing Windows 8 unless there is no other […]

Comment from SlowLeaner
Posted: February 10, 2015 at 01:06

Thank you SO MUCH Eric!

Never coulda done this without you

“bcdedit /set {ID} path \linux.bin”

resulted in ERROR and unable to boot Slackware

Checked the output of bcdedit and learned that the EXISTING path of my {current} device c: path was \Windows\system32\winload.exe

so instead of:

bcdedit /set {ID} path \linux.bin

i used:
bcdedit /set {ID} path \Windows\system32\linux.bin

I moved the linux.bin file from \Windows to \Windows\system32

Slackware now successfully boots on my Windows7 machine

Pingback from dual boot win7/slackware 14.2 64bit in legacy mode on gpt disk | SOPEE.NET IT KNOWLEDGE BASE
Posted: November 14, 2016 at 14:13

[…] to write to the “boot sector” of a gpt partition, so I can use the instructions here…ws7-boot-menu/ in order to dual […]

Comment from tim
Posted: November 29, 2016 at 00:20

thanks for recording the bcdedit process. It was helpful in getting a form of dualboot on my new acer laptop with a buggy bios

Write a comment