[SOLVED] Problem with grub/dual boot not working

Questions about Grub, the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
edoliveira

[SOLVED] Problem with grub/dual boot not working

Post by edoliveira »

Hi,

I'm fairly new to linux. I had done an installation of Linux Mint on a laptop with windows 7, no problem. Now I installed linux Mint in a PC that also had windows 7.

Before the installation I had:
sda1 had the windows bootloader
sda2 had windows 7
created sda3 with ext4 and installed mint

For the installation of Mint it asked to install the bootloader. In the install on the other pc nothing was asked. I directed it to sda1 (it asked to format fat32)

After installation the GRUB only had option for Linux Mint.

I used the live USB to try and repair GRUB. After I did it the GRUB just loads a command line with minimum bash commands. No boot list.

I tried repairing again now not using the automatic solver but going into the advanced settings but no luck.

Can you help me fix this so that I can have dual boot?
I can re-install Mint (the only thing I did was update it) but I would rather not touch windows as I have some programs there I might not be able to recover for another install.

Grub repair gave me the following Url: http://paste.ubuntu.com/p/gRnG4KKQzy/

Thanks in advance for your help.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
linux-rox
Level 10
Level 10
Posts: 3334
Joined: Sun Jul 19, 2020 9:17 pm

Re: Problem with grub/dual boot not working

Post by linux-rox »

Do you have an image backup of the Win7 system? I'm afraid you're going to need it. Sounds to me like you overwrote the Windows boot folder when you directed the LMDE boot loader to sda1 and authorized the installer to format it. Behind that, sounds like you have a UEFI computer, with Win7 installed in legacy mode but the LMDE live session booted in UEFI. At least, that's the only theory I can think of which accounts for the facts.

Let's check a few things. Boot a live session (same thing you used to install). Set up an internet connection, open Firefox, and open this thread. Open Terminal and run these commands one line at a time. Use copy-and-paste, don't retype them.

Code: Select all

inxi -SMpo
sudo mount /dev/sda1 /mnt
sudo ls /mnt
Once you've done that, click Edit on the top menu and choose Select All, then Edit > Copy. Switch to Firefox, hit Post Reply, and paste in from clipboard. To give you a hint, the first command will tell us (among other things) whether the live session booted in BIOS or UEFI mode. The last command will tell us what folders are in that partition. If it says EFI, that's bad. What you want is Boot, bootmgr, and BOOTSECT.BAK.
User avatar
cpedretti
Level 3
Level 3
Posts: 199
Joined: Tue Mar 10, 2020 12:06 am

Re: Problem with grub/dual boot not working

Post by cpedretti »

edoliveira wrote: Wed Dec 30, 2020 10:20 am Hi,

I'm fairly new to linux. I had done an installation of Linux Mint on a laptop with windows 7, no problem. Now I installed linux Mint in a PC that also had windows 7.

Before the installation I had:
sda1 had the windows bootloader
sda2 had windows 7
created sda3 with ext4 and installed mint

For the installation of Mint it asked to install the bootloader. In the install on the other pc nothing was asked. I directed it to sda1 (it asked to format fat32)

After installation the GRUB only had option for Linux Mint.

I used the live USB to try and repair GRUB. After I did it the GRUB just loads a command line with minimum bash commands. No boot list.

I tried repairing again now not using the automatic solver but going into the advanced settings but no luck.

Can you help me fix this so that I can have dual boot?
I can re-install Mint (the only thing I did was update it) but I would rather not touch windows as I have some programs there I might not be able to recover for another install.

Grub repair gave me the following Url: http://paste.ubuntu.com/p/gRnG4KKQzy/

Thanks in advance for your help.

LMDE4, needs a swap partition with the size of the maximum memory of your computer.

To have an view of an HowTo => viewtopic.php?f=250&t=329765

Windows 7 use EFI boot, LMDE4 can both, need to be managed in your bios parameters.
AMD Ryzen 7 3700X - 32GB DDR4 RGB White - RTX4060TI O8GB White- SSD NVME Crucial P5 500GB - Mobo Gigabyte AORUS ELITE B550 V2 - PSU Corsair RM750 White - Case Corsair 5000D Airflow White 7 fans AF120 ARGB - AIO Corsair H100I Cappelix 240 White
edoliveira

Re: Problem with grub/dual boot not working

Post by edoliveira »

Hi Linux-rox,

Thanks for the assist.

First, I was afraid you were going to say that regarding win 7 boot. When I selected sda1 for linux boot I had great doubts that I was doing the right thing. At the time Gparted gave me a warning that moving the win 7 OS to make room for the Linux bootsec could arrise problems with that OS I decided not to move it but I though I might regret it but clearly I didn't understand what I was doing.
I have to check but I'm almost certain I have one or 2 images to save me. :)
Could I be able to restore just the win bootsec from a win installation USB? It could solve my problems for the time being and I could restart the process.

Here are the lines from the terminal

Code: Select all

mint@mint:~$ inxi -SMpo
System:
  Host: mint Kernel: 4.19.0-8-amd64 x86_64 bits: 64 Desktop: Cinnamon 4.4.8 
  Distro: LMDE 4 Debbie 
Machine:
  Type: Desktop System: ASUS product: All Series v: N/A 
  serial: <root required> 
  Mobo: ASUSTeK model: H97-PLUS v: Rev X.0x serial: <root required> 
  UEFI: American Megatrends v: 0314 date: 04/23/2014 
Partition:
  ID-1: / size: 7.77 GiB used: 104.0 MiB (1.3%) fs: overlay source: ERR-102 
  ID-2: /lib/live/mount/medium raw size: 1.89 GiB size: <root required> 
  used: <root required> fs: iso9660 dev: /dev/sdc1 
  ID-3: /lib/live/mount/rootfs/filesystem.squashfs raw size: 1.73 GiB 
  size: <root required> used: <root required> fs: squashfs dev: /dev/loop0 
Unmounted:
  ID-1: /dev/sda1 size: 100.0 MiB fs: vfat label: N/A uuid: A711-5EEE 
  ID-2: /dev/sda2 size: 174.31 GiB fs: ntfs label: N/A 
  uuid: F8DA8F90DA8F4A38 
  ID-3: /dev/sda3 size: 49.16 GiB fs: ext4 label: N/A 
  uuid: 77ded255-edb5-4336-813a-17a61a1958e7 
  ID-4: /dev/sdb1 size: 367.91 GiB fs: ntfs label: N/A 
  uuid: 1EF07DAC628017DC 
  ID-5: /dev/sdb2 size: 97.85 GiB fs: ext4 label: Linux dados 
  uuid: 062f151e-585f-4426-9b69-aab9e130e9a4 
  ID-6: /dev/sdc2 size: 2.9 MiB fs: vfat label: LMDE 4 Cinnamon 64-bit 
  uuid: DEB0-0001 

Code: Select all

mint@mint:~$ sudo mount /dev/sda1 /mnt
mint@mint:~$ sudo ls /mnt
EFI
mint@mint:~$ 
From your explanation it is bad :o

Is there any hope here or should I go for the image and start over?

In any case, if I can restore the windows, what should I do then to put linux mint again? I read some things about legacy and UEFI but I don't really understand what I should do to install it the right way.
Also, should I push the OS 100 mb to make way for a linux boot sector? Should be before or after the windows boot drive?
In other words, should I try to push sda1 and sda2 100mb and create a new sda1 for linux, then the previous windows boot as sda2 and then the OS in sda3?
Or just push the sda2 to sda3 and create the linux boot in sda2?

Sorry for the long post but this still bafles me.

Thanks
edoliveira

Re: Problem with grub/dual boot not working

Post by edoliveira »

Hi cpedretti,

I looked at the tutorial.

It seems fairly simple to follow. I just have to sort this thing with windows boot first.

I have a question, though. I installed LMDE4 alongside Win7 in a laptop before this install and it didn't ask me for the swap or anything and its running OK.
Do I need to go back and create a swap drive?
If it needs a swap drive how is it working?

thanks
linux-rox
Level 10
Level 10
Posts: 3334
Joined: Sun Jul 19, 2020 9:17 pm

Re: Problem with grub/dual boot not working

Post by linux-rox »

Let's start with, you don't need a swap partition. It's supported, but not needed. In any event, has nothing to do with the current problem.

Second, yes, I'm afraid you have quite a muddle on your hands. Don't know whether there's any way to restore just the Windows boot partition. Research on the internet, of course. If not, restoring the whole thing shouldn't take too long.

Third, as for Mint, the solution is relatively simple: You need to figure out how to boot the live session in legacy mode. It will be some Fn key, e.g. F9 or F10 (varies depending on the computer), which brings up a menu with two choices for how to boot the USB drive. Sometimes only one of the choices is labeled, but you can infer the other from one label. What you want is legacy or CSM mode; if only the UEFI option is labeled, pick the other one. To confirm boot mode, run inxi -SM. See above, where it says UEFI? You want to see UEFI (legacy).

Once booted into the live session in legacy mode, the installation will be just like your other one. No extra Mint partition for boot loaders (that's a UEFI thing). Rather, the boot loader will go on the MBR (displacing Windows), then you'll boot Windows from the Grub menu.
edoliveira

Re: Problem with grub/dual boot not working

Post by edoliveira »

Hi,

Thanks for the reply.

I tried several things to restore it, even foung this "distro" (don't know if its the correct name for it) rescatux that is able to restore windows MBR and correct problems in linux grub but it didn't work in my case. Maybe I was too far gone.

In the end I'm restoring the disk backup I had saved up. I'm using clonezilla for that.

After I restore the disk (in process) I'll install mint in Bios mode as you said.

Thanks again for the assist.

For anyone reading this, two linux distributions that might save you a lot of hassle:

- To restore grub or correct other boot problems - Rescatux
https://www.supergrubdisk.org/category/ ... ux-stable/

- Always backup your OS disk. You never know what might happen. I use Clonezilla every 6 months. It can backup both linux and windows as it makes a block by block copy
https://clonezilla.org/downloads.php
linux-rox
Level 10
Level 10
Posts: 3334
Joined: Sun Jul 19, 2020 9:17 pm

Re: Problem with grub/dual boot not working

Post by linux-rox »

edoliveira wrote: Fri Jan 01, 2021 7:55 pm ... able to restore windows MBR
The problem is, the MBR wasn't the problem. You overwrote the partition where the Windows boot files reside. The equivalent in Linux would be deleting all the Grub files. Anyway, glad you were able to restore. And I agree, full system backup of Windows should be standard procedure before installing Linux.
Locked

Return to “Installation & Boot”