2

I have Ubuntu installed on hd1 (edit: with full disk encryption), and it was working fine.

I then installed a second hard drive (hd2), and installed Ubuntu to onto it - it is working fine.

The problem is now, I cannot boot to hd1 Ubuntu at all, and I would like to boot to that by default.

In the boot options there is only one "Ubuntu" - how can I resolve this so that there are two options Ubuntu on hd1 (default) and Ubuntu on hd2?

sumade
  • 193
  • I've had multiple Ubuntu's installed and generally the "Ubuntu" refers the last installed; and the second is often referred to by version number (if they are both the same version; I'm not sure this applies as I commonly have LTS & latest). In these cases I just rename then in grub configs. note: if your use of hd1/hd2 is because of PATA drives (not scsi/sata) I'm not sure if that could influence things (too far back) – guiverc Mar 12 '18 at 22:20
  • not sure why they are designated hd1/hd2, they are both SATA - the ubuntu installed is the same version on both, and there is not a second option with the version number name I am afraid - how would I go about renaming in the grub config? I guess this is what koleygr is suggesting - but will both be shown automatically if I change the name of one? – sumade Mar 12 '18 at 22:24
  • ok found the grub config file - I see the menuentry 'Ubuntu' part - I could change this for one of them? - do I need to run update-grub after changing it? thanks – sumade Mar 12 '18 at 22:35
  • I'm surprised os-prober didn't find them both when you run update-grub. It did on one of my systems which had an old 32 bit system installed on it, and I had to go figure out how to NOT show it. Have you run update-grub since you installed the 2nd system? – Organic Marble Mar 12 '18 at 22:36
  • i have run update-grub on the 2nd system (- can't access the first system yet, through >grub prompt doesn't work either (manually setting linux and initrd, then boot), i can unencrypt the hard disk and then it does not boot - perhaps a symptom of installing second OS and the name being the same I am not sure) – sumade Mar 12 '18 at 22:38
  • Have you run grub-install too? I am writing an answer with my way that will recognize both systems during grub updates also (and I need the filenames -i think they are different than in debian-) – koleygr Mar 12 '18 at 22:39
  • I have just run it, rebooting - ok done, still only Ubuntu is shown - I see Ubuntu and Advanced options for Ubuntu, that is all - I am guessing if it was working I would see Ubuntu and Ubuntu2 or whatever there – sumade Mar 12 '18 at 22:41
  • Install in both disks if it shows that found more systems.. (not just "Found linux-4-6" etc but "found Ubuntu.." too) – koleygr Mar 12 '18 at 22:43
  • Ok, it did not find more systems - but the first hard disk is not mounted in this second OS - if I mount to /xyzabc will it then find it? – sumade Mar 12 '18 at 22:46
  • No.. I dont think so... I found that the filenames are the same... In 2 minutes you will have an answer with my way – koleygr Mar 12 '18 at 22:47
  • @sumade check the answer and let's fit it to your needs... (I suppose it will work but we need more to do to automate for every update or reinstall of grub) – koleygr Mar 12 '18 at 22:52
  • 1
    If your first install is LVM & encrypted, and second install is not, then second install does not have lvm2 & cryptsetup drivers. Same if your install is not ext4, as you then need drivers. And probably have to mount other / partition so os-prober can see it. If standard install os-prober should have found it. – oldfred Mar 12 '18 at 23:14
  • The second install is ext4 - but you are right that the first install is LVM and encrypted, the second is not – sumade Mar 12 '18 at 23:15
  • Ah - the essential piece of data that was not previously mentioned! – Organic Marble Mar 12 '18 at 23:55
  • so they are both called ubuntu-vg - if i remove the first drive and then boot from a live disk and change the volume group name on the second hard disk, then unencrypt and mount everything so that grub can see all the files, if i then update grub, will both show up in the boot loader when i replace the first drive? – sumade Mar 13 '18 at 04:51
  • it is possible using grub to locate vmlinuz... and initrd.img... and boot successfully after reinstalling the second OS with full disk encryption - how is it possible to add this information to the boot loader? If I can do it manually surely it can be done automatically? thanks again – sumade Mar 13 '18 at 04:57
  • any ideas? i have seen the grub-install --bootloader-id parameter and wonder whether that is applicable here also - i was thinking to use a live USB OS to change the vg name of one installation so I can mount them both, then use update-grub/grub-install (possibly with --bootloader-id parameter), then hopefully that will find both installations and add entries to the bootloader - am I on the right lines? - perhaps I need to change the vg name in grub.cfg also (unless update-grub will find this automatically) – sumade Mar 14 '18 at 12:09
  • or, if i write my own configuration file as per grub manual, it looks like i can specify linux and initrd files as i did manually from >grub prompt - e.g. menuentry "Debian sid installer" { search --set=root --label GRUB --hint hd0,msdos5 linux /debian/dists/sid/main/installer-amd64/current/images/hd-media/vmlinuz initrd /debian/dists/sid/main/installer-amd64/current/images/hd-media/initrd.gz } - not sure which is the best option – sumade Mar 14 '18 at 14:40
  • so perhaps i could edit /etc/grub.d/40_custom and use: menuentry "ubuntu" { set root=(hd1,gpt2) linux /vmlinuz..... etc. initrd /initrd....etc.} menuentry "ubuntu2" { set root=(hd2,gpt2) linux /vmlinuz.... etc. initrd /initrd.... etc. } – sumade Mar 14 '18 at 14:47

0 Answers0