How to stop grub2 updating mbr

Asked by Cool Bear

Hi

I have a dedicated grub partition to manage multiple OS (including many different linuxes). Every now and then when I upgrade the software on one of these linuxes, including Ubuntu, something calls grub-install (or something similar) and overwrites the MBR pointing at just this one OS. This means that only this particular linux can be loaded and I have to sort things out manually.

I have disabled grub finding other OS's when it makes a config file and I still want the config file maintained when new kernels are installed for instance. Is there a similar setting somewhere to stop the MBR being overwritten?

Many thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

You could apt ping the kernel and then update-grub will never get executed. If the system is running fine on the current kernel then there is no real need to update it.

Revision history for this message
Cool Bear (coolbears) said :
#2

Hi thanks for responding. I'm not sure what you mean by "apt ping". I think you might mean pinning which is not what I want. I want to be able to maintain the latest and greatest software level and so updating kernels is a must.

Cheers

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4
Revision history for this message
Cool Bear (coolbears) said :
#5

Hi thanks, but as I said I don't want to pin kernels, I'd be happy pinning grub but I'm not sure that's the only package that runs grub-install.

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

Disclaimer: Fiddling around with boot records has a certain risk that it fails in a way that the system does no more boot from that device. So please use caution and do it on your own risk!

As far as I know, grub (of Ubuntu) usually is configured to modify the MBR in the first hard disk (probably /dev/sda), whenever it is updated.
If you have different Operating Systems on your partitions, and if each of these OSes wants to maintain the MBR of /dev/sda the way it thinks it should be, you definitely will run a bit into chaos.

You might try to reconfigure grub (of Ubuntu) that it does not change the MBR of the whole disk, but just the boot part of its own partition.
This might be possible with the command

sudo dpkg-reconfigure grub

and then selecting that grub is installed just on the own Ubuntu partition (/dev/sdaX or similar, with X to be replaced by the number of the right partition).

If that really works well, you could try finding similar techniques on other OSes to prevent their access to the disk MBR.

Revision history for this message
Cool Bear (coolbears) said :
#7

Hi

Yes I've tried dpkg-reconfigure but got an error when I entered the Ubuntu root partition because it is an LVM volume.

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

What is the output of

sudo debconf-show grub-pc

Revision history for this message
Cool Bear (coolbears) said :
#9

Hi

I have tried to cut and paste the output but with no luck. There are no obvious copy/paste buttons, the middle button on the mouse doesn't work and the standard ctrl-C does nothing. Can cut and paste be done? If so how and where does one find out this sort of info? I know this is off topic but it is needed to be able to continue as I don't want to hand copy the output.

Also there seems no way to attach a file?

The Launchpad interface does leave something to be desired.

Cheers

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

Launchpad answers does not allow to attach files. If you want to provide a screenshot or picture, you have to upload to any picture hosting service of your choice and provide the link.

In a terminal window of the xorg environment you can use the right mouse button or the window's menu entries for copying and pasting.

Ctrl-c does not work, but you have to use Ctrl + Shift + C

Revision history for this message
Cool Bear (coolbears) said :
#11

Hi

Copying in a terminal is no problem, it is the pasting into this message pane that I cannot find how to do. Ctrl-Shift-V doesn't work.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#12

CTRL + V in the web browser

Or right click -> Paste

Revision history for this message
Cool Bear (coolbears) said :
#13

Hi

I am not using the web browser per se but the lainchpad app which runs in webapp-container. Ctrl-V doesn't work and right click gives nothing.

Can you help with this problem?

Provide an answer of your own, or ask Cool Bear for more information if necessary.

To post a message you must log in.