The officially official Devuan Forum!

You are not logged in.

#1 2018-05-08 21:01:14

Ron
Member
Registered: 2018-04-22
Posts: 529  

On putting boot loader on its own partition

A little background: I was tripled-booting Mint, Jessie & ASCII (Miyo). Jessie was on sda5 and ASCII on sda6. Since ASCII runs so well, I decided to delete my Jessie partition and integrate it into my ASCII partition. So I did that (while booted in Mint), but it messed up the grub loader, which I fixed by reinstalling ASCII (I know, that was drastic).

Question: If I had installed grub on its own partition, would that have prevented grub from getting messed up? Also, how big should the separate grub partition be? Thanks!

Offline

#2 2018-05-09 00:45:12

GNUser
Member
Registered: 2017-03-16
Posts: 570  

Re: On putting boot loader on its own partition

What probably happened is that GRUB was looking for /boot/grub/grub.cfg on your /dev/sda5 (Jessie) partition. When you deleted that partition, GRUB could no longer find its config file.

Does your disk use MBR ("msdos") or GPT partition table? Use sudo parted -l | grep 'Partition Table' to find out. If you are using MBR, best place to install GRUB is generally to the "root" (technically called the MBR) of the disk containing your OS partitions, which would be to /dev/sda in your case (not to /dev/sda5, /dev/sda6, or any /dev/sdaX. Definitely not to a partition just for the bootloader). Like so:

sudo grub-install /dev/sda

Note that GRUB will look for /boot/grub/grub.cfg on the partition from which you run the grub-install command (i.e., if you run grub-install from your ASCII partition, GRUB will look for /boot/grub/grub.cfg in /dev/sda6)

If you have a GPT partition table, see this for some background and ask here for help if you need it.

Hope that helps.

P.S. When GRUB fails to find its config file in the future, you can boot your OS this way:

power up your computer

when GRUB first shows up, press 'c' to get a GRUB command prompt, which will look like something like this: grub>

grub> ls # this will show you how GRUB sees your disk and partitions. let's assume it sees your ASCII partition as (ahci0,msdos6)

grub> set root=(ahci0,msdos6)

grub> linux /vmlinuz root=/dev/sda6

grub> initrd /initrd.img

grub> boot

You will then boot to your OS and, when it's running, you can reinstall GRUB (to look for that OS's /boot/grub/grub.cfg) with sudo grub-install /dev/sda

Last edited by GNUser (2018-05-09 18:33:06)

Offline

#3 2018-05-09 01:55:27

Ron
Member
Registered: 2018-04-22
Posts: 529  

Re: On putting boot loader on its own partition

GNUser wrote:

Note that GRUB will look for /boot/grub/grub.cfg on the partition from which you run the grub-install command (i.e., if you run grub-install from your ASCII partition, GRUB will look for /boot/grub/grub.cfg in /dev/sda6)

Thanks for all the info GNUser. My system uses the MBR partition table (thanks for showing me how to check). Here's what happened, I believe. The last OS I installed was ASCII. Now when I deleted Jessie, that caused my ASCII partition, which had been sda6 up to that point, to switch to being sda5 (I wasn't expecting that). So based on what you wrote above (I believe) GRUB was looking  for /boot/grub/grub.cfg in /dev/sda6, which then no longer existed. Does that sound plausible to you?

Also, what makes putting GRUB on its own partition a bad idea? I'm just wondering because that is an option when installing the OS.

Once again, thanks for the help.

Last edited by Ron (2018-05-09 01:55:58)

Offline

#4 2018-05-09 03:19:12

GNUser
Member
Registered: 2017-03-16
Posts: 570  

Re: On putting boot loader on its own partition

Yes, your explanation is correct: When you deleted Jessie, ASCII's partition changed from /dev/sda6 to /dev/sda5, so GRUB could no longer find ASCII's grub.cfg--even though the file still existed--because GRUB was still looking for it in /dev/sda6.

[If GRUB used UUIDs to locate partitions, your partition reshuffling would not have created a problem. However, based on this discussion (see posts #6 and #8) GRUB "remembers" its grub.cfg partition using a single byte, which is enough to store a single digit (e.g., /dev/sda6) but not enough to store the 32 digits of a UUID.]

Are you sure that the option you saw during installation didn't have to do with putting /boot in its own partition? That would make more sense and some people do that. However, putting GRUB in its own partition just doesn't make any sense for a disk with MBR partition table--among other reasons because it would not prevent the kind of issue you experienced. If your impulse to put GRUB in its own partition is to keep it out of harm's way, perching it at the "root" of /dev/sda (which is called its MBR) accomplishes your intent beautifully: It would be very difficult for you or some piece of software to accidentally wipe the disk's MBR.

(In GPT-land everything is different, but I don't want to confuse things since both you and I live in MBR-land.)

Last edited by GNUser (2018-05-09 18:38:20)

Offline

#5 2018-05-09 04:08:11

MiyoLinux
Member
Registered: 2016-12-05
Posts: 1,323  

Re: On putting boot loader on its own partition

The Refracta Installer does ask where you want to install grub...the MBR, Partition, etc.

Ron, I don't know if this will help for future reference, but...

If you choose MBR, it will put Grub on /dev/sda, and that Grub will be in control...and would be in control IF you have any other operating systems on your computer. If you choose Partition, then a list of partitions is given for you to choose from.

Ron, if you choose Partition, you would normally want to install Grub on the same partition that you're going to use for the Operating System. For example, I have a hard drive with 10 partitions. If I want to install a distro on partition 9...or..../dev/sda9, then I would also install Grub on /dev/sda9.

Then after installation, I would reboot the computer into the main operating system and run...

sudo update-grub

That system will then find the newly installed system so that it's available to choose from at the Grub screen.


I have been Devuanated, and my practice in the art of Devuanism shall continue until my Devuanization is complete. Until then, I will strive to continue in my understanding of Devuanchology, Devuanprocity, and Devuanivity.

Veni, vidi, vici vdevuaned. I came, I saw, I Devuaned. wink

Offline

Board footer