[SOLVED] How to Overhaul or Replace Grub setup?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

[SOLVED] How to Overhaul or Replace Grub setup?

Post by jackerbes »

I think I need something like a new start or fresh start on my grub related files and configuration.

I have a new hard drive and I installed Windows 7 Ultimate (W7U) and then Mint 19.3 with a USB boot stick. Those were both working fine and when I booted I got a menu offering me a choice of the two operating systems.

The Mint 19.3 install was later removed and then I made root (/) Home and Swap partitions and copied my previous Mint 19 root and home partitions into those new partitions. I did this because I wanted to have Firefox and Thunderbird configured as they were in the old install and also wanted to get all the same apps and commands in place.

The first image shows the drive in gparted as it is now and it has W7U in partition sda3 and the Mint install is in sda4, sda5, and sda6. The W7U install created the sda1 and sda2 partitions.

When I boot I no longer get a menu offering me the two OS install. But I can boot from the Super Grub 2 Customizer Boot Disk CD and choose to have it show me the operating systems that it finds on the hard drive.

And I can scroll down through the listing and choose either the Windows install or the Mint install and then the system will boot my choice.

So what I want is to have a grub menu that offers me a choise of the two but I can't seem to figure out how to do it.

Any suggestions as to how to get this grub configuration sorted out and get a new boot menu are appreciated.

Jack
Attachments
my hard drive
my hard drive
menu that offers no OS choices
menu that offers no OS choices
OS's from listing in Super Grub 2 disc
OS's from listing in Super Grub 2 disc
Last edited by jackerbes on Sun Mar 15, 2020 8:19 pm, edited 1 time in total.
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
User avatar
Kadaitcha Man
Level 11
Level 11
Posts: 3605
Joined: Mon Aug 27, 2012 10:17 pm

Re: How to Overhaul or Replace Grub setup?

Post by Kadaitcha Man »

jackerbes wrote:
Fri Mar 13, 2020 8:37 pm
The Mint 19.3 install was later removed and then I made root (/) Home and Swap partitions and copied my previous Mint 19 root and home partitions into those new partitions. I did this because I wanted to have Firefox and Thunderbird configured as they were in the old install and also wanted to get all the same apps and commands in place.
You can't do that and expect it to work. The quickest way for you to get up and running again is to purchase the paid version of Aptik and migrate your existing system to a clean installation.

The only other hope you have is to learn about chroot and try to get grub installed from inside a chroot jail. This is not going to be a simple fix for you.
Coming to a thread near you: Lots of bragging about my AMD 5950X. Currently delayed due to high demand.
It's pronounced kad-eye-cha, not kada-itcha.
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How to Overhaul or Replace Grub setup?

Post by pbear »

jackerbes wrote:
Fri Mar 13, 2020 8:37 pm
... then the system will boot my choice.
I read this to say you are able to boot into Mint, albeit only from Super Grub 2. Is that correct?

If so, do that, then run sudo grub-install /dev/sda.

If not, as KMan says, you're looking at chroot. See askubuntu.
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

Re: How to Overhaul or Replace Grub setup?

Post by jackerbes »

I read this to say you are able to boot into Mint, albeit only from Super Grub 2. Is that correct?
That's correct, after I boot from the Grub 2 CD and have it show me the list of operating systems, I can cursor up or down to highlight either the "Windows Boot Manager (on sda1)" entry or the "Linux Mint" entry and when I press Enter it will boot either Windows or Linux.

The attachment on my first post shows what I see from the grub disc's list of operating systems. And the two entries I can use to choose an OS are the two lines just following the blue line.

I have attached a text file that is a copy of the contents of the grub.cfg file that is if that is of any help.

Jack
Attachments
grub_cfg_content.txt
grub.cfg file content from hd0,gpt4
(5.14 KiB) Downloaded 14 times
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

Re: How to Overhaul or Replace Grub setup?

Post by jackerbes »

I ran the command
sudo grub-install /dev/sda.
as you suggested from the terminal and go the following result:
sudo grub-install /dev/sda.
jack@jack-SL510:~$ sudo grub-install /dev/sda
[sudo] password for jack:
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.
Jack
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How to Overhaul or Replace Grub setup?

Post by pbear »

This implies you have a hybrid boot problem, i.e., that Windows in installed in UEFI mode and Mint in BIOS/legacy mode.

Boot again, open Terminal and expand to full screen. Run these two commands:

Code: Select all

inxi -Fxz
sudo parted --list
Copy the outputs and post into the thread, placing them in separate code boxes (as I've used here). Please do not use attachments or screenshots.
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

Re: How to Overhaul or Replace Grub setup?

Post by jackerbes »

Thanks for the reply pbear, this is the first time I have heard what the problem is. That is helpful!

Here is your requested info:

Code: Select all

jack@jack-SL510:~$ inxi -Fxz
System:    Host: jack-SL510 Kernel: 4.15.0-20-generic x86_64
           bits: 64 gcc: 7.3.0
           Desktop: Cinnamon 3.8.9 (Gtk 3.22.30-1ubuntu4)
           Distro: Linux Mint 19 Tara
Machine:   Device: laptop System: LENOVO product: 42435UU v: ThinkPad T520 serial: N/A
           Mobo: LENOVO model: 42435UU serial: N/A
           UEFI: LENOVO v: 8AET56WW (1.36 ) date: 12/06/2011
Battery    BAT0: charge: 37.9 Wh 97.2% condition: 39.0/47.5 Wh (82%)
           model: SANYO 42T4763 status: N/A
           hidpp__0: charge: N/A condition: NA/NA Wh
           model: Logitech Wireless Mouse M325 status: Discharging
CPU:       Dual core Intel Core i7-2640M (-MT-MCP-) 
           arch: Sandy Bridge rev.7 cache: 4096 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 11163
           clock speeds: max: 3500 MHz 1: 861 MHz 2: 797 MHz 3: 798 MHz
           4: 797 MHz
Graphics:  Card-1: Intel 2nd Generation Core Integrated Graphics Controller
           bus-ID: 00:02.0
           Card-2: NVIDIA GF119M [Quadro NVS 4200M] bus-ID: 01:00.0
           Display Server: x11 (X.Org 1.19.6 )
           drivers: modesetting,nouveau (unloaded: fbdev,vesa)
           Resolution: 1600x900@60.00hz
           OpenGL: renderer: Mesa DRI Intel Sandybridge Mobile
           version: 3.3 Mesa 19.2.8 Direct Render: Yes
Audio:     Card Intel 6 Series/C200 Series Family High Def. Audio Controller
           driver: snd_hda_intel bus-ID: 00:1b.0
           Sound: Advanced Linux Sound Architecture v: k4.15.0-20-generic
Network:   Card-1: Intel 82579LM Gigabit Network Connection (Lewisville)
           driver: e1000e v: 3.2.6-k port: 6080 bus-ID: 00:19.0
           IF: enp0s25 state: down mac: <filter>
           Card-2: Intel Centrino Advanced-N 6205 [Taylor Peak]
           driver: iwlwifi bus-ID: 03:00.0
           IF: wlp3s0 state: up mac: <filter>
Drives:    HDD Total Size: 1000.2GB (36.4% used)
           ID-1: /dev/sda model: APPLE_HDD_HTS541 size: 1000.2GB
Partition: ID-1: / size: 49G used: 23G (48%) fs: ext4 dev: /dev/sda4
           ID-2: /home size: 394G used: 317G (85%) fs: ext4 dev: /dev/sda6
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 43.0C mobo: N/A gpu: 37.0
           Fan Speeds (in rpm): cpu: 1965
Info:      Processes: 212 Uptime: 18 min Memory: 1311.4/7859.5MB
           Init: systemd runlevel: 5 Gcc sys: 7.4.0
           Client: Shell (bash 4.4.201) inxi: 2.3.56 

Code: Select all

jack@jack-SL510:~$ sudo parted --list
[sudo] password for jack:         
Model: ATA APPLE HDD HTS541 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                          Flags
 1      1049kB  106MB   105MB   fat32           EFI system partition          boot, esp
 2      106MB   240MB   134MB                   Microsoft reserved partition  msftres
 3      240MB   500GB   500GB   ntfs            W7U-64                        msftdata
 4      500GB   554GB   53.7GB  ext4            /
 6      554GB   984GB   430GB   ext4            Home
 5      984GB   1000GB  16.1GB  linux-swap(v1)  swap


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: Too many primary partitions.
Model: HL-DT-ST DVDRAM GT50N (scsi)                                       
Disk /dev/sr0: 11.6MB
Sector size (logical/physical): 2048B/2048B
Partition Table: unknown
Disk Flags: 

Jack
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
User avatar
kukamuumuka
Level 16
Level 16
Posts: 6697
Joined: Tue Sep 03, 2013 4:51 am
Location: Finland
Contact:

Re: How to Overhaul or Replace Grub setup?

Post by kukamuumuka »

Shrink /dev/sda1 a little bit and make about 2MB bios_grub partition in the front of /dev/sda1 and then install grub-pc

Edit: Actually you need to install grub-efi, because Windows uses UEFI, and both of systems must be installed on the same mode.

Edit /etc/fstab file like

Code: Select all

/dev/sda1 /boot/efi vfat defaults 0 2
…. after that mount that partition

Code: Select all

sudo mount -a
…. and make a folder

Code: Select all

sudo mkdir -p /boot/efi/EFI/ubuntu
… install grub-efi and update grub

Code: Select all

apt update
apt install grub-efi-amd64 mokutil
sudo update-grub
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How to Overhaul or Replace Grub setup?

Post by pbear »

The odd thing is that Mint seems to be booting in UEFI mode, so there's no reason for grub-install to be looking for a BIOS boot partition. I've run into this once before and the solution was two-fold. Part one was what kuka has already suggested, i.e., installing grub-efi-amd64. Part two was copying in (from a live session) a folder, /usr/lib/grub/x86_64, which grub-install seems not to be scripted to create.

Please open File Manager and confirm that folder is there. Or you can run ls /usr/lib/grub and report the output.
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

Re: How to Overhaul or Replace Grub setup?

Post by jackerbes »

If I look at the filesystem as root from my home folder (/Home/jack) and enter that command I get this:

Code: Select all

jack@jack-SL510:~$ ls /usr/lib/grub
grub-mkconfig_lib  i386-pc
and if I go to the root folder and enter that command I get this:

Code: Select all

jack@jack-SL510:~$ cd /
jack@jack-SL510:/$ ls /usr/lib/grub
grub-mkconfig_lib  i386-pc
If I am on a drive that has a fresh Windows install, when and where would I make the choice to do what you suggest here:
installing grub-efi-amd64


I don't recall ever seeing such a choice offered anywhere.

For the record, I am using a Lenovo laptop with a dual core intel CPU and my BIOS settings are to use the UEFI mode and not the legacy mode.

Jack
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
User avatar
Flemur
Level 18
Level 18
Posts: 8860
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to Overhaul or Replace Grub setup?

Post by Flemur »

Kadaitcha Man wrote:
Fri Mar 13, 2020 9:12 pm
You can't do that and expect it to work.
It works for me.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
Flemur
Level 18
Level 18
Posts: 8860
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to Overhaul or Replace Grub setup?

Post by Flemur »

I've done this and it worked:

Install a recent version of Mint and let the installer take care of all the (dual) booting/EFI stuff, then just copy your old installation files over the new installation, but preserve the old /boot/grub/grub.cfg file before copying your OS over it. After copying and before booting anything you'll have to fiddle with /boot/grub/grub.cfg and /etc/fstab before the new system works.

You can get fix the /boot/grub/grub.cfg file by sticking something like this above the first 'menuentry', but of course replace these values with your values:

Edit: do this editing from the LiveMedia

Code: Select all

menuentry 'MINT 19.3  SDA3  5.3.0-40 ' {
  search --no-floppy --fs-uuid --set=root 6d483594-5e30-477e-8239-a4a745c2b48e
  linux      /boot/vmlinuz-4.15.0-88-generic root=LABEL=MT19 ro
  initrd  /boot/initrd.img-4.15.0-88-generic
}
6d4......48e = the UUID of the partition with your new Mint and with the boot files.
root=LABEL=MT19 can be replaced with root=UUID=the same uuid again (sigh).

Changes to /etc/fstab are similar

Edit: then boot Mint. Then run sudo update-grub to get a regular grub menu (though I just add more entries like the one shown, by hand)
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

Re: How to Overhaul or Replace Grub setup?

Post by jackerbes »

We have had a major breakthrough!

I decided to try a new install from the ground up. it went as follows:

1 - This morning I took a spare hard drive and deleted everything from it. Then I ran the Windows 7 Ultimate install DVD and it installed that OK.

2 - Then I ran gparted from a CD and resized the W7U partition to make room for a Linux install. I booted it several times and it would simply start windows.

Still using gparted, I created Root, Home, and Swap EXT4 partitions in the free space on the hard drive.

3 - I made a Mint Linux 19.3 Cinnamon 64-bit USB boot stick from the *.iso file on the Mint downloads pages. Then I booted from that and saw the 19.3 install screen.

I started the Linux install and chose to "do something else" when it got to the screen with that option on it.

4 - That brought me to a gparted screen and I saw the partitions that I had created above in step 2. I edited the partitions a little so that they were identified at having an intended use as Root, Home, and Swap partitions.

5 - Then I ran the 19.3 Linux install and that went as normal. At the end I did a restart and got a menu screen offering me the choice of either Windows or Linus. I am working from the Linux install now!

One difference I noted was that, when I look at the files in this install, there is now an folder named "/boot/efi" listed under "devices" and it is located in a partition that only has about 73 Mb of free space. So that tell me it is in that sda1 partition created during the Windows install.

The attachments shows files with the efi device and tthe disk as gparted sees it now.

Jack
Attachments
after_install_efi_folder.png
Screenshot from 2020-03-15 11-32-00.png
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
pbear
Level 15
Level 15
Posts: 5664
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How to Overhaul or Replace Grub setup?

Post by pbear »

Congratulations and well done.

By the way, if you run ls /usr/lib/grub now, I'm willing to wager a bright shiny nickel you'll
get x86_64. Which is further evidence that what went wrong the first time is that,
for reasons I can't spot, grub was installed for BIOS/legacy the first time around.
User avatar
Kadaitcha Man
Level 11
Level 11
Posts: 3605
Joined: Mon Aug 27, 2012 10:17 pm

Re: How to Overhaul or Replace Grub setup?

Post by Kadaitcha Man »

Flemur wrote:
Sun Mar 15, 2020 7:54 am
Kadaitcha Man wrote:
Fri Mar 13, 2020 9:12 pm
You can't do that and expect it to work.
It works for me.
Yes, but you're not new to Linux, hey.
Coming to a thread near you: Lots of bragging about my AMD 5950X. Currently delayed due to high demand.
It's pronounced kad-eye-cha, not kada-itcha.
User avatar
jackerbes
Level 3
Level 3
Posts: 179
Joined: Fri Jul 03, 2015 8:37 am

Re: How to Overhaul or Replace Grub setup?

Post by jackerbes »

pbear wrote:
Sun Mar 15, 2020 12:54 pm
Congratulations and well done.

By the way, if you run ls /usr/lib/grub now, I'm willing to wager a bright shiny nickel you'll
get x86_64. Which is further evidence that what went wrong the first time is that,
for reasons I can't spot, grub was installed for BIOS/legacy the first time around.
Where do I send your nickel? I don't really understand it but this is what happened:

Code: Select all

jack@jack-T520:~$ ls /usr/lib/grub
grub-mkconfig_lib  x86_64-efi  x86_64-efi-signed
The two x86... items are folders, the grub-mkconfig_lib is not a folder but I don't know what the different colors mean other than the folders being blue. The grub... entry is more like turquoise.

I guess I'll mark this one solved and say

Thank You All Very Much Again!

for all the help I get here!

Jack
Mint 18.3 and 19, 64-bit, Cinnamon, Lenovo ThinkPad T520 laptop, ASUS Z-97 desktop, Samsung S6 Android phone
Jack Erbes in Ellsworth, ME, USA
Post Reply

Return to “Installation & Boot”