Dual Boot - Windows is Gone

General support questions
desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Dual Boot - Windows is Gone

Post by desertcat » 2018/07/12 00:31:20

desertcat wrote:
2018/07/12 00:06:32
8675309-jim wrote:
2018/07/11 21:27:39
[root@host1 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.6.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.6.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-43234573075840038f8e1069cd864b44
Found initrd image: /boot/initramfs-0-rescue-43234573075840038f8e1069cd864b44.img
Found Windows Recovery Environment (loader) on /dev/sda1
done
Very Good!!! "Found Windows Recovery Environment (loader) on /dev/sda1" . Windows is there. The trick is getting the Windows partition to be added to the grub2 menu. I suspect if you rebooted the machine now the Windows partition will show up and all you need to do is select it and be on your merry way. If NOT... There is a very good utility that everyone IMHO should download and install called Grub Customizer To install run: yum install grub-customizer. It helps you recover from a grub2 menu that has gone out in the weeds. You run Grub Customizer and you get a preview of the menu that will come up when you reboot the machine. You should get something like this:

CentOS Linux Kernel 1
CentOS Linux Kernel 2
CentOS Linux Kernel 3
CentOS Linux Rescue
Windows 7 (8, 10, etc.)

This will come up during the boot and you then select "Windows" to boot into Windows or any other OS. What happens if during the boot Windows is NOT found?? OK this is where it may get a bit hairy but it is not big thing:

Under /etc/grub.d you should find a file called 40_custom this is where you would create a custom menu entry such as this:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.


### BEGIN /etc/grub.d/40_custom ###

if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
menuentry "Fedora 20 (3.19.8-100.fc20.x86_64)(Heisenbug)"{
# --class fedora --class gnulinux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.15.10-200.fc20.x86_64-advanced-6f9e3ccb-4afc-bb29-7fa6ba2d9dbd'
set gfxpayload=text
insmod gzio
insmod part_msdos
insmod ext2
set root='hd1,msdos2'

linux /vmlinuz-3.19.8-100.fc20.x86_64 root=UUID=6f9e3ccb-c6e9-4afc-bb29-7fa6ba2d9dbd ro vconsole.font=latarcyrheb-sun16 rhgb quiet nouveau.modset=0 rd.driver.blacklist=nouveau video=vesa:off LANG=en_US.UTF-8
initrd /initramfs-3.19.8-100.fc20.x86_64.img
# chainloader +1
}

EOF

You would substitute Windows 7,8,10 or whatever for "Fedora 20". You would then save the file. After you saved the file run Grub Customizer Windows 7,8,10 should show up in the menu. Reboot the machine and select Windows from the menu.

I hate Grub2. Grub Customizer is just one of those utilities that can save your bacon.
Your /etc/grub.d/custom_40 file for Windows maybe as simple as:


menuentry "Windows 7" {
set root='(hd1,1)'
chainloader +1

8675309-jim
Posts: 19
Joined: 2018/07/11 01:57:42

Re: Dual Boot - Windows is Gone

Post by 8675309-jim » 2018/07/12 02:26:29

I will try in a little while. I have to get some stuff done right now though and since my files are on my windows machine it is a pain in the butt. I have tried re-booting the machine several times, and I have changed that 40_custom file several times too, but I have not tried grub-customizer, so I will.

Sorry for the pessimism, but I don't expect it to work either because nothing has so far.

I thank you for the help, but at this point I just wish I hadn't done a dual boot because this has turned into a huge fiasco.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Dual Boot - Windows is Gone

Post by TrevorH » 2018/07/12 02:43:16

From linux, logged in as root, what do you when you run file -s /dev/sda[1-6] ?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

8675309-jim
Posts: 19
Joined: 2018/07/11 01:57:42

Re: Dual Boot - Windows is Gone

Post by 8675309-jim » 2018/07/12 03:40:35

file -s /dev/sda[1-6]
/dev/sda1: x86 boot sector, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 2048, dos < 4.0 BootSector (0x80)
/dev/sda2: x86 boot sector; partition 1: ID=0x72, starthead 13, startsector 1920221984, 1816210284 sectors, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 36866048, dos < 4.0 BootSector (0x80)
/dev/sda3: x86 boot sector, code offset 0x52, OEM-ID "NTFS ", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, heads 255, hidden sectors 37070848, dos < 4.0 BootSector (0x80)
/dev/sda4: x86 boot sector; partition 1: ID=0x83, starthead 254, startsector 2048, 1024000 sectors; partition 2: ID=0x5, starthead 254, startsector 1026048, 42993664 sectors, extended partition table, code offset 0x0
/dev/sda5: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
/dev/sda6: LVM2 PV (Linux Logical Volume Manager), UUID: wHTW9B-TH3A-V7M6-0DNx-GLp7-y2Cb-mkIeH3, size: 22011707392

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Dual Boot - Windows is Gone

Post by hunter86_bg » 2018/07/12 03:57:56

Ok, have you rebooted and tried the last entry in grub?
Of course you can always run the windows install media and repair the whole PC, but it will wipe grub2 and then you need a custom Windows boor menu.
Last edited by hunter86_bg on 2018/07/12 04:01:02, edited 1 time in total.

8675309-jim
Posts: 19
Joined: 2018/07/11 01:57:42

Re: Dual Boot - Windows is Gone

Post by 8675309-jim » 2018/07/12 04:00:51

Still have the same problem.

All I want is my windows back. Funny how I can mount the drive and see all of my files, but cannot just open the windows OS.

Thanks for the help people, but I'm still having no luck

8675309-jim
Posts: 19
Joined: 2018/07/11 01:57:42

Re: Dual Boot - Windows is Gone

Post by 8675309-jim » 2018/07/12 04:03:25

hunter86_bg wrote:
2018/07/12 03:57:56
Ok, have you rebooted and tried the last entry in grub?
Of course you can always run the windows install media and repair the whole PC, but it will wipe grub2 and then you need a custom Windows boor menu.
Not quite sure what you mean I have rebooted my computer about 100 freaking times in the last 3 or 4 days. Tried the last entry in grub? Not sure what last entry you are talking about?

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Dual Boot - Windows is Gone

Post by hunter86_bg » 2018/07/12 04:04:56

Can you give the output of

Code: Select all

cat /proc/cmdline

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Dual Boot - Windows is Gone

Post by desertcat » 2018/07/12 05:22:47

Sorry for your problems. Trust me I feel your pain as I've been there and done that. OK there are three (3) files and/or directories where your problems are located:

/boot/grub2/grub/grub.cfg
/etc/default/grub
/etc/grub.d under which you should find:

00_header
00_tuned
01_users
10_linux
20_linux_xen
20_ppc_terminfo
30_os-prober
40_custom

Unless you have done something clever (like deleted Windows) the Windows partitions is still there. Running os-prober *should* find it. I've done that and came up blank. if you write a 40_custom file for Windows pay close attention that you do not forget something or scramble something. Don't forget the { } and root='(hdx,y)' statements. When you write your menu entry it should look something like this:

menuentry "Windows 7" {
set root='(hd1,1)'
chainloader +1
}

EOF

The biggest problem I've had is with the set root='(hd?,?)' statement. IF windows is on the same drive as CentOS 7 your hd *should* = 0.
The second part of that statement maybe something like a single number such as 1, or it might be something like msdos2. Thus your set root= statement can take one of two forms:

set root='(hd0,1)' [example]

or something like this:

set gfxpayload=text
insmod gzio
insmod part_mosdos
insmod ext4
set root='hd0,msdos1' [example]


I *suspect* that a windows partition will look more like the first example [ set root='(hd0,1)'] rather than the second which I *think* is used only with other linux partitions.... but I could be WRONG. See if you can get someone who has written a 40_custom statement for Windows, as they should know a lot better than me who does NOT run Windows at all. My GUESS is that since your Windows partition has been identified as being on /dev/sda1 windows set root= statement is *probably* "(hd0,1), though it could be (hd0,0), (hd0,2) or even (hd1,0), (hd1,1), or (hd1,2). Though a person who dual boots Windows is likely going to have a lot better insight into this.

The good news is unless you corrupted the Windows partition (doubtful) adding your Windows partition to the menu is nothing more than doing a lot of hacking.

Again sorry I can not be of better assistance but this *should* give you some starting points where to look.

Best Wishes
Last edited by desertcat on 2018/07/12 05:35:26, edited 1 time in total.

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Dual Boot - Windows is Gone

Post by desertcat » 2018/07/12 05:32:08

8675309-jim wrote:
2018/07/12 04:03:25
hunter86_bg wrote:
2018/07/12 03:57:56
Ok, have you rebooted and tried the last entry in grub?
Of course you can always run the windows install media and repair the whole PC, but it will wipe grub2 and then you need a custom Windows boor menu.
Not quite sure what you mean I have rebooted my computer about 100 freaking times in the last 3 or 4 days. Tried the last entry in grub? Not sure what last entry you are talking about?
Grub Customizer should make this task easier. If the partition is there you will see it in preview; if NOT then you need to hack, probably /etc/grub.d/40_custom

Post Reply