Update grub2 Without Reconfiguring

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Update grub2 Without Reconfiguring

Post by catplace »

I've got LM18.1 (and grub2) installed on D:, with Windows 7 on C:. I use the motherboard UEFI setup (F12) to select which OS to boot. This way, I figure my Windows and Linux installations are independent of each other; I don't want to start Windows via a Linux component or vice versa.

Last time I allowed Mint to update grub2, grub2 took the opportunity to install itself onto C: which prevented me from booting Windows. I had to give my computer to someone else for a week to get it fixed.

Unfortunately, I see there's another update to grub2 available, but I'm too scared to apply it in case it reinstalls itself on C: again. Is there a way to update grub2 WITHOUT letting it change its configuration?

There's also an update to the shim. Is it safe to update this, or will doing so also result in a reconfiguration?

Apologies for the newbie questions. I did search for answers but couldn't find any.
User avatar
winemaker9
Level 1
Level 1
Posts: 36
Joined: Mon Oct 26, 2009 11:18 am

Re: Update grub2 Without Reconfiguring

Post by winemaker9 »

Here's something that should help you. Grub Customizer....been using it for years now, simple to use and sure makes changes easy.

http://linuxg.net/how-to-install-grub-c ... e-systems/

or if you just want to see what it looks like, check out this video

https://www.youtube.com/watch?v=rsEZHe0zskk

There is an option in the second screen if I remember right that either allows or prevents grub from looking for additional OS's (like windows)...

Enjoy....
Steve
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

Thanks for the reply, Steve! I'll see whether Grub Customizer can tell grub to stay away from other disk drives. I hope grub respects such settings when upgraded; it seems to me that it takes the opportunity to propagate rather than honouring its previous configuration.
mr_raider
Level 7
Level 7
Posts: 1889
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: Update grub2 Without Reconfiguring

Post by mr_raider »

If grub sees another EFI partition it will try to use it. The trick is to disconnect the windows drive when you first install mint so the other partition is not visible.

After that you will have two EFI partitions, one on each disk. You can switch the boot order on BIOS. Grub should not reinstall to the windows partition.
Image
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

mr_raider wrote:...Grub should not reinstall to the windows partition.
Thanks mr_raider. This is indeed the issue; the only way to get the initial installation going was to physically disconnect the Windows drive.

Unfortunately, when grub2 is updated, it seems to go through its installation process again. Last time I updated it, it installed itself on the Windows drive. I really don't want to have to take my computer apart every time there's a grub2 update, so I haven't applied the latest update.

Hence, I was wondering whether there's a way of updating grub that doesn't result in it propagating across drives.
mr_raider
Level 7
Level 7
Posts: 1889
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: Update grub2 Without Reconfiguring

Post by mr_raider »

catplace wrote:
mr_raider wrote:...Grub should not reinstall to the windows partition.
Thanks mr_raider. This is indeed the issue; the only way to get the initial installation going was to physically disconnect the Windows drive.

Unfortunately, when grub2 is updated, it seems to go through its installation process again. Last time I updated it, it installed itself on the Windows drive. I really don't want to have to take my computer apart every time there's a grub2 update, so I haven't applied the latest update.

Hence, I was wondering whether there's a way of updating grub that doesn't result in it propagating across drives.
I don't get it. I have a dual boot system. Windows 10 and Mint 18.1. Each on different disk. Each disk has it's own EFI partition, and when I run a grub or kernel update, it ONLY updates the EFI partition on it's disk.

Output the result of the following command:

Code: Select all

sudo parted -l
and this one

Code: Select all

sudo efibootmgr
Image
User avatar
Flemur
Level 18
Level 18
Posts: 8863
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Update grub2 Without Reconfiguring

Post by Flemur »

More than one person in the thread below had the same problem, though there's some other nonsense going on there too, I think (changing where it was installed -?).

Anyway
https://ubuntuforums.org/showthread.php?t=1489190
Near the bottom of page 1:

Code: Select all

sudo dpkg-reconfigure grub-pc
will allow you to select/deselect disks that should be updated by grub2
"Sure enough, the Windows drive was selected, so I unselected it and selected the Ubuntu drive."
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
mr_raider
Level 7
Level 7
Posts: 1889
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: Update grub2 Without Reconfiguring

Post by mr_raider »

Except the OP has grub-efi, not grub-pc. I'm still not convinced, and I would wait for the output of the two commands above.
Image
User avatar
Flemur
Level 18
Level 18
Posts: 8863
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Update grub2 Without Reconfiguring

Post by Flemur »

mr_raider wrote:Except the OP has grub-efi, not grub-pc. I'm still not convinced, and I would wait for the output of the two commands above.
Then he should probably run

Code: Select all

sudo dpkg-reconfigure grub-efi
The "-pc" version does indeed ask where to install the bootloader.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

Thank you both very much for your interest! The results of the commands are below (I think; I'm lousy at command-line stuff).

It's probably obvious to you, but the 3001GB drive should be for Windows, and the 2000GB drive for Linux. There could be bits of EFI, grub and loaders all over the place as a consequence of the horrendous route I went through to get Linux installed.

The dpkg-reconfigure bit seems interesting and relevant, although I won't try it just yet. I would hope that any changes it makes 'stick' across grub2 updates.

sudo parted -l

Code: Select all

Model: ATA WDC WD3003FZEX-0 (scsi)
Disk /dev/sda: 3001GB
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   3001GB  3000GB  ntfs         Basic data partition          msftdata


Model: ATA WDC WD2001FASS-0 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                  Flags
 1      1049kB  300MB   299MB   fat32                                 boot, esp
 2      300MB   33.1GB  32.8GB  linux-swap(v1)
 3      33.1GB  533GB   500GB   ext4
 4      533GB   2000GB  1467GB  ntfs            Basic data partition  msftdata


Model: ATA SAMSUNG HD501LJ (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary  ntfs


Model: ATA OCZ-VERTEX2 (scsi)
Disk /dev/sdd: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  120GB  120GB  primary  ntfs
sudo efibootmgr

Code: Select all

BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0001,0000,0010,0004,0005,0006,000C,000F
Boot0000* ubuntu
Boot0001* Windows Boot Manager
Boot0004  ATAPI   iHAS324   B
Boot0005  SAMSUNG HD501LJ
Boot0006  OCZ-VERTEX2
Boot000C  WDC WD2001FASS-00W2B0
Boot000F  WDC WD3003FZEX-00Z4SA0
Boot0010* ubuntu
mr_raider
Level 7
Level 7
Posts: 1889
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: Update grub2 Without Reconfiguring

Post by mr_raider »

Ok. Mount the windows EFI partition:

sudo mount /dev/sda1 /mnt

Then navigate to /mnt/EFI and check the contents. What folders do you see?
Image
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

mr_raider wrote:...What folders do you see?

Code: Select all

drwxr-xr-x 2 root root 1024 Oct 26  2016 Boot
drwxr-xr-x 3 root root 1024 Oct 24  2016 Microsoft
drwxr-xr-x 3 root root 1024 Oct 25  2016 ubuntu.hidden
The .hidden was an early attempt of mine to stop linux from using that drive. I didn't have the courage to delete it altogether.
mr_raider
Level 7
Level 7
Posts: 1889
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: Update grub2 Without Reconfiguring

Post by mr_raider »

catplace wrote:
mr_raider wrote:...What folders do you see?

Code: Select all

drwxr-xr-x 2 root root 1024 Oct 26  2016 Boot
drwxr-xr-x 3 root root 1024 Oct 24  2016 Microsoft
drwxr-xr-x 3 root root 1024 Oct 25  2016 ubuntu.hidden
The .hidden was an early attempt of mine to stop linux from using that drive. I didn't have the courage to delete it altogether.
Is their an Ubuntu folder in the boot folder? If not, you don't have an ubuntu bootloader in that EFI partition (sda). Furthermore your Microsoft bootloader looks intact (\EFI\Microsoft\Boot\bootmgfw.efi). Delete the ubuntu.hidden folder, and go back into your BIOS. Make sure that the windows boot manager is the first choice. If that doesn't work, set the disk with windows as the first choice (the 3 tb disk)

If neither works, try using a refind USB key or ISO.

http://www.rodsbooks.com/refind/
Image
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

mr_raider wrote:...Is their an Ubuntu folder in the boot folder?...
I don't think so; I get this:

Code: Select all

peter@WhiteElephant /mnt/EFI/Boot $ ls -la
total 781
drwxr-xr-x 2 root root   1024 Oct 26  2016 .
drwxr-xr-x 5 root root   1024 Oct 25  2016 ..
-rwxr-xr-x 1 root root 672640 Nov 20  2010 bkpbootx64.efi.hidden
-rwxr-xr-x 1 root root 124928 Oct 26  2016 bootx64.efi.hidden
Remember that I don't have any boot problem at the moment. The BIOS (do we still call it that in an EFI system?) lists Windows first, and that boots by default without an intervening grub. To get linux, I F12 on startup and select 'ubuntu' from the BIOS/EFI boot menu. That then loads grub (presumably on sdb) which loads linux (presumably also on sdb).

My problem is that I want it to stay this way if I allow grub2 and shim-signed to update. I need to keep grub from worming its way onto sda. Flemur's link (which I apologise for not finding for myself) seems relevant.
mr_raider
Level 7
Level 7
Posts: 1889
Joined: Sun Jun 20, 2010 9:50 am
Location: Montreal, QC

Re: Update grub2 Without Reconfiguring

Post by mr_raider »

Once installed grub should not affect the other EFI partition

Here is my windows EFI

Code: Select all

mr_raider@HK-47 /mnt/EFI $ ls -la
total 3
drwxr-xr-x 5 root root 512 Mar 20  2014 .
drwxr-xr-x 5 root root 512 Dec 31  1969 ..
drwxr-xr-x 2 root root 512 May 11 19:48 Acronis
drwxr-xr-x 2 root root 512 Jan 20  2013 Boot
drwxr-xr-x 4 root root 512 Nov 24  2012 Microsoft

Here is my Linux EFI:

Code: Select all

HK-47 EFI # ls -la
total 2
drwx------ 3 root root  512 May 21 14:20 .
drwx------ 4 root root  512 Dec 31  1969 ..
drwx------ 3 root root 1024 Jun 16 22:36 ubuntu

If you are worried, install refind to your Linux EFI partition by following these instructions:

http://www.rodsbooks.com/refind/installing.html

Refind will allow you to boot any EFI OS, even if your windows bootloader gets hosed.
Image
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

I'm afraid refind is well beyond me. It also wouldn't stop grub2 from hosing sda1 when it upgrades (which, I agree, it shouldn't, but it sometimes does).
catplace
Level 1
Level 1
Posts: 10
Joined: Sat Jun 17, 2017 5:10 pm

Re: Update grub2 Without Reconfiguring

Post by catplace »

Because the way forward seems to come from the ubuntu forum, I've continued my quest there.
Post Reply

Return to “Installation & Boot”