Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Unable to boot Windows after Debian install

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
rick619
Posts: 6
Joined: 2017-09-13 04:56

Unable to boot Windows after Debian install

#1 Post by rick619 »

What I did: I had Linux Mint installed and decided I'd rather have Debian and have a dual boot with Windows 7. Before installing Debian, I tried to get rid of the version of Grub installed with Mint.

So I booted to a Windows 7 install disk, went to 'repair computer' and went to a command prompt.

Used bootrec with /fixmbr then /scanos then /rebuildbcd

Bootrec was able to find the Windows 7 install. I then rebooted, but unable to boot Windows or Mint.

I then installed Debian figuring it might be able to detect the windows partition. No such luck. Debian is working well though. I'd like to restore my Windows 7 OS. The files are all still there, I can access all my data.

Any way to do this within Debian? Or any boot repair tools suggested?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Unable to boot Windows after Debian install

#2 Post by Head_on_a_Stick »

Please post the full output of:

Code: Select all

# parted --list
# efibootmgr -v
https://packages.debian.org/stretch/parted
https://packages.debian.org/stretch/efibootmgr
deadbang

rick619
Posts: 6
Joined: 2017-09-13 04:56

Re: Unable to boot Windows after Debian install

#3 Post by rick619 »

Model: ATA KINGSTON SUV400S (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 106MB 105MB primary ntfs boot
2 106MB 209GB 209GB primary ntfs
3 209GB 240GB 30.8GB extended
5 209GB 227GB 18.0GB logical ext4
6 227GB 240GB 12.8GB logical linux-swap(v1)

efibootmgr wasn't installed, so I ran:

sudo apt-get install efibootmgr which seemed to work.

# efibootmgr -v
EFI variables are not supported on this system.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Unable to boot Windows after Debian install

#4 Post by Dai_trying »

I think you need to check if os-prober is installed, if not install it and then run

Code: Select all

sudo update-grub
this should bring Windows into your grub entries.

rick619
Posts: 6
Joined: 2017-09-13 04:56

Re: Unable to boot Windows after Debian install

#5 Post by rick619 »

Dai_trying wrote:I think you need to check if os-prober is installed, if not install it and then run

Code: Select all

sudo update-grub
this should bring Windows into your grub entries.
Not sure how to check if I have os-prober, but here are the results of update-grub, doesn't see the Windows partition.

Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
done

rick619
Posts: 6
Joined: 2017-09-13 04:56

Re: Unable to boot Windows after Debian install

#6 Post by rick619 »

So I figured this one out myself:

I figured this is more of a Windows problem than a Linux problem and I am a Windows admin.

I booted to a Bootable Win7 USB. I did the Windows bootrec commands again. All were fine, accept for bootrec /rebuildbcd which was getting error:

bootrec /rebuildbcd
Successfully scanned Windows installations.
Total identified Windows installations: 1
[1] C:\Windows
Add installation to boot list? Yes(Y)/No(N)/All(A):
I selected Y and received:
Element not found.


I then rebooted and got error:

Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:
1. Insert Windows CD and run a repair your computer option.
File: /Boot/BCD
Status: 0xc000000f
Info: an error occurred while attempting to read the boot configuration data.

So I read up on that error and found it could be related to setting USB in the BIOS to 3.0 instead of AUTO to default to 2.0. I remember doing this during the Windows setup and had changed it back to 3.0 only. So changed it back to auto (2.0) and booted to the Win7 USB. This time the bootrec /rebuild completed without error and I was back into Win7.

So now I have the opposite problem: Won't boot to Debian. I'll search for Debian recovery, but don't want to lose Win7 again in the process. I have the Live USB I installed Debian, will research if I can use that to repair/restore Grub.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Unable to boot Windows after Debian install

#7 Post by Dai_trying »

This is the contents of a text file I keep for just this sort of problem

Code: Select all

How to chroot from live session to (other OS) on disk

Assumption 1: (other OS) is installed on /dev/sda1 but is not accessible via grub
Assumption 2: /dev/sda1 is the root partition, and you do not have a separate boot partition
Goal: reinstall grub in mbr of /dev/sda:

Boot from livecd or usb, then in the terminal window enter:

    TARGET=/media/sda1
    sudo mkdir -p $TARGET
    sudo mount /dev/sda1 $TARGET
    sudo mount --bind /dev     $TARGET/dev
    sudo mount --bind /dev/pts $TARGET/dev/pts
    sudo mount --bind /proc    $TARGET/proc
    sudo mount --bind /sys     $TARGET/sys
    sudo chroot $TARGET /bin/bash

This places you in a root terminal on the (other OS) system Do whatever you want to do there, e.g. re-install grub

    grub-install /dev/sda
    update-grub

To exit from chroot:

press control-D or enter exit

This brings you back to where you were in the live session and you can unmount

    sudo umount -l $TARGET/dev/pts
    sudo umount -l $TARGET/dev
    sudo umount -l $TARGET/proc
    sudo umount -l $TARGET/sys

Thats it…

Reboot into the (other OS) system on disk.
WARNING:

As you have sorted your windows startup out you must be warned this will remove the windows bootloader and replace it with grub, it might put you back into the same situation you had before... if it does you can check if os-prober is installed with

Code: Select all

apt-cache policy os-prober
this will give you something like this if it is installed

Code: Select all

os-prober:
  Installed: 1.76~deb9u1
  Candidate: 1.76~deb9u1
  Version table:
 *** 1.76~deb9u1 500
        500 http://ftp.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status
or this if not installed

Code: Select all

os-prober:
  Installed: (none)
  Candidate: 1.76~deb9u1
  Version table:
     1.76~deb9u1 500
        500 http://ftp.debian.org/debian stretch/main amd64 Packages
And it can be installed with

Code: Select all

sudo apt-get install os-prober
Then update grub and it should pickup windows.

HTH

rick619
Posts: 6
Joined: 2017-09-13 04:56

Re: Unable to boot Windows after Debian install

#8 Post by rick619 »

Thanks for the suggestions.

I ended up downloading the DVD version of the iso and booted to it since the Live iso doesn't include the rescue option. Ran the rescue, and was able to restore grub and boot to both Windows and Debian.

Two minor issues remaining:

1. I want to change the boot order so Windows is primary. I looked at a few walkthroughs and edited /etc/default/grub

This file seemed to be a blank template. Had some of the options in there, but didn't list Windows. I tried changing the default to 3 (the line for Windows). Saved it, ran update-grub. Still defaulting to Debian though. Didn't have time to mess with it.

2. After selecting Windows on the menu, my screen goes a little funky with some unreadable flashing images. Windows eventually loads the screen returns to normal.

rick619
Posts: 6
Joined: 2017-09-13 04:56

Re: Unable to boot Windows after Debian install

#9 Post by rick619 »

I did some searching and was able to download and install 'Grub Customizer'. It's not made for Debian apparently, but I was able to get it to work. Once it defaulted to Win7, it's no longer doing the odd display on the LCD. So fixed for now until I break something else! :mrgreen:

Post Reply