Linux install apparently destroyed my Windows MBR or Boot partition (Win7 on a separate hard drive)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
reboot, you should now see the grub menu with an entry for windows.
If windows doesn't boot, at the grub menu hightligh the windows 7 entry, press e for edit, change the (hd0,1) as per post 58.
If you find one that works, change the /etc/grub.d/40_custom to the one that works and rerun update-grub. If you get a "ntldr" not found message, grub is installed in uefi mode.
Last edited by colorpurple21859; 01-06-2021 at 10:23 AM.
I also missed in post #37 that sda1 is 105MB fat32, while neither sdb or sdc has a fat32 partition.
Quote:
Originally Posted by AnneF
Code:
xxx@YODA:~$ sudo parted -l
[sudo] password for xxx:
Model: ATA Hitachi HDS72105 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 106MB 105MB fat32 boot, esp
2 106MB 240MB 134MB Microsoft reserved partition msftres
3 240MB 133GB 133GB ntfs msftdata
4 133GB 343GB 210GB ntfs Basic data partition msftdata
Model: ATA WDC WD5000AAKX-2 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 2002MB 2001MB primary ext4 boot
2 2003MB 318GB 316GB extended
5 2003MB 52.0GB 50.0GB logical ext4
6 52.0GB 68.0GB 16.0GB logical linux-swap(v1)
7 68.0GB 318GB 250GB logical ext4
Model: ATA WDC WD10EADX-22T (scsi)
Disk /dev/sdc: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 2000MB 1999MB primary ext4
2 2001MB 318GB 316GB extended
5 2001MB 52.0GB 50.0GB logical ext4
6 52.0GB 68.0GB 16.0GB logical linux-swap(v1)
7 68.0GB 318GB 250GB logical ext4
3 318GB 1000GB 682GB primary ntfs
xxx@YODA:~$
so need to humbly apologise again.
The absence, or presence, of a fat32 partition is possibly creating a conflict preventing one OS from booting. Alas I'm not experienced enough to even suggest a cure.
The absence, or presence, of a fat32 partition is possibly creating a conflict preventing one OS from booting.
That partition is the EFI partition as shown in the first post by the OP. The most likely scenario is that Ubuntu was booted and installed in UEFI mode while windows 7 is in all likelihood, installed in Legacy mode and Grub UEFI won't boot it. The OP was asked to mount and post the information on what is on that partition in an least two posts and never did so we really have no idea how the 2 systems were installed.
Considering the information in your fdisk -l Output:
To me it looks like there is an UEFI esp on the 500GB Hitachi disk and some ntfs-partitions. Then there are 2 other disks with a classic partition-table, one with an MBR.
Before you decide to make a new or different bootloader-config, please try to select the boot-device in your bios-splash-screen between the 500GB Hitachi Disk and the 500GB WD Disk. Assuming you never changed BIOS-settings regarding the use of EFI and both OS once worked, you most likely can use both parallely. There should be a hotkey like "Press F8 for BIOS-Bootscreen" or inside the BIOS-Menu a slection of the boot-order.
It is quite unusual that Win7 uses EFI and then your fresh Linux-Install does not, perhaps you did not have all these disks connected during install(?). Anyways you need to isolate next if the working Linux-System uses efi. When you have a folder /sys/firmware/efi and there is something inside, you came up with EFI.
When it is not: unplug all disks except the Hitachi 500GB and look if it boots into Windows. Then you have a windows-efi-config.
please try to select the boot-device in your bios-splash-screen between the 500GB Hitachi Disk
Done and failed to boot with a black screen. See post 38.
Quote:
It is quite unusual that Win7 uses EFI and then your fresh Linux-Install does not
I think it would be more than unusual but certainly possible. If the OP had simply mounted that partition with the step by step instructions posted in post 18 and posted that info here, it would have been obvious which system(s) were using EFI as there would have been separate folders for Microsoft and ubuntu if both systems were EFI. The OP never did that.
The sda drive shows as a GPT drive with the output from parted while the others show msdos, the ones with Ubuntu on them which looks like two separate installs. sda1 has the required boot/esp flags.
Additionally, the OP indicated that when she tried to download a windows 7 iso she was informed that is was an OEM install and refused to download (post 56).
The OP could have also saved a lot of the hassle trying to get GParted and boot repair if using the Ubuntu install iso. GParted is on it and it's entirely possible to download boot repair on the Ubuntu iso/usb and wouldn't have had the problem with sources.list as it is a read-only medium and can't be changed.
Following the instructions in post 61 would create a window boot entry, The grub menu would show up, determined if grub is loaded in efi or legacy when attempting to boot windows(no ntldr error in efi mode) and if grub is legacy mode and window is installed in legacy mode should boot with some trial and error.
Last edited by colorpurple21859; 01-07-2021 at 03:45 PM.
Following the instructions in post 61 would create a window boot entry,
I expect so and if the OP had bothered to follow the detailed instructions by another member in post 18, anyone reading this thread would have known if Ubuntu/windows 7 were Legacy or UEFI.
Ah! Okay, I didn't realize this is already on Page 5 ;-)
Cheers
Family member in hospital - out of town for a while. I have a grandson with primary progressive multiple sclerosis (this type of MS is a lot like ALS).
Originally Posted by ...Now follow the instructions at this site to repair the MBR (or google and pick a random site that explains how to fix the windows 7 MBR using a windows cd).
If you don't know the windows product key its normally on the laptop somewhere, so have a look for the genuine windows sticker with a bunch of letters and numbers on it.
Hopefully that is helpful, if not I apologise and maybe someone else can help you.
Sorry, I thought I had replied to this a while back.
I already have backups of my windows7 system drive (TrueImage) and data drive (Secondcopy).
I bought this PC off-lease from a refurbisher a few years ago and I'm not sure they gave me the right (hand-labeled) repair CD. When I try to use it, I'm told it is not the right CD.
When I try to download an ISO from the sites you mentioned, I'm told my product key is from a pre-installed system and it won't allow me to download.
Anne
Done and failed to boot with a black screen. See post 38.
The OP could have also saved a lot of the hassle trying to get GParted and boot repair if using the Ubuntu install iso. GParted is on it and it's entirely possible to download boot repair on the Ubuntu iso/usb and wouldn't have had the problem with sources.list as it is a read-only medium and can't be changed.
I'm not quite understanding all of this. I did boot from the USB ISO try-or-install thumbdrive and I ran GPARTED from it to get the information I posted about the drives in this thread.
You're saying I can download boot repair (onto or from?) the Ubuntu iso/usb (the one I made and installed from?).
(I think sources.list is fixed - I did everything with that that y'all told me to with that and it appeared to be successful, I think. At least it stopped looking for a CD.)
The part about modifying grub (post #18) with the "ntldr (hd0,1)/bootmgr ' I didn't do - because using that cmd in a terminal didn't work ("no such file found") and I didn't want to put it into the boot script if it wasn't even working in the terminal.
I don't understand what you are saying about boot repair from the Ubuntu installation thumb drive. How could that replace the win7 boot partition? If Ubuntu can boot windows7, could you please tell me the steps to do it? Could Ubuntu boot windows even if windows is unable to boot itself from it's own boot partition?
I'm concerned so many of the terminal instructions don't seem to complete successfully. I'm also having other anomalies: Firefox has stopped rendering pages correctly, I can't seem to "find" Abiword to install it, plus other things. I'm wondering if I should just make a current backup of my data, and Firefox bookmarks & passwords, and just make a new install USB with Kubuntu on it? I think Abiword comes with it, and I need a new install of Firefox and I don't know how to do these things in Ubuntu (apparently not "connected" to repositories). Since so many "sudo" cmds aren't working, maybe there is something wrong with my install. Maybe a new install would see windows7 & fix grub?
If I do this, since gparted says my win7 is installed as EFI, should I install Kubuntu NOT as "legacy" but as the other choice (UEFI?).
(Win10 was originally on this machine and when they replaced it with Win7, apparently they didn't do it correctly.)
If I have the same results with Kubuntu, I'll just have to buy another machine. I'd still like to use Linux, but after this experience, I'm afraid Linux will destroy my new machine's OS also.
In order to help others to help you, it would be useful if we could first determine if you have mixed installs, EFI Ubuntu and Legacy windows 7. Boot into Ubuntu and open a terminal and copy/paste each of the commands below into the terminal consecutively, hit the Enter key after each line. When you enter sudo su, you will be prompted for your primary user password so enter it and then hit the Enter key, your prompt should then be white. If you first enter sudo su, you will not need sudo for the other commands. When you have done that, post the output of the last command, ls /mnt/sda1/EFI. This will NOT repair anything but will give us useful information on which to try to help:
Quote:
sudo su
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
ls /mnt/sda1/EFI
If you want to get data off the drive from windows on the D partition (that is sda4) repeat the process as shown below while still in the terminal with sudo su enabled:
Quote:
mkdir /mnt/sda4
mount /dev/sda4 /mnt/sda4
ls /mnt/sda4
After you run the last command, it should show a list of directories/files on your data partition. You should then have no problem copying that data FROM the hard drive to another hard drive or flash/usb drive. It would be best if the hard drive/flash drive you are copying TO is formatted ntfs.
You can also access your C drive in a similar manner by repeating the commands above and entering sda3 in place of sda1/sda4 in the above commands. Understand that the steps outlined above are one time only and if you reboot Ubuntu, you will have to repeat the process so before trying to save data, have another disk available to copy to. If you try to access sda3, change the last ls command to the one below so that you can see your user name directory and the directories/files there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.