0

I decided to install Ubuntu 20.04 onto an external hard drive, for use with my laptop. On the laptop's internal disk is some sensitive data that I stupidly neglected to back up.

So I formatted the external drive, added partitions for / and /home and swap. Used the installer and the external drive wouldn't boot into Ubuntu.

I decided to try installing it again. For some reason, instead of manually selecting the drive and parititons, I clicked "reinstall ubuntu 20.04".

I believe the it installed the files to the external drive, but it (re-)installed GRUB to my internal drive. I believe this because the installer showed /dev/sda being written to (this is the external drive) and it showed GRUB commands being used on /dev/nvme00 (this is the internal drive).

Now I can successfully boot into the new Ubuntu with the drive plugged in, however I cannot boot into my main OS on the laptop.

Can I recover my installation from this? If not, how should I go about recovering my files/data (if possible).

Thanks.

  • Be aware of launchpad bug 1396379, where the installer puts grub bootloaders onto the first EFI partition it sees (regardless of what you specify). This is usually sda, with the install going to sdb, but your case sda is your target -- check that it's EFI partition actually has the bootloaders in .../EFI/ubuntu (... being where you mount it, /boot/efi the usual automatic place). The EFI menu (some key at power-up to allow you to select boot device or OS) should still allow skipping grub and starting Windows directly. – ubfan1 May 29 '22 at 01:52
  • Link to bug which includes several work arounds. https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1396379 But you must manually partition in advance & include ESP on external drive. If always booting from same system, having Ubuntu entry works just fine. But if wanting to directly boot or boot on another system, you need ESP and grub installed to external. Also in bug report. https://askubuntu.com/questions/16988/how-do-i-install-ubuntu-to-a-usb-key-without-using-startup-disk-creator If you create ESP, you can edit fstab with new ESP and reinstall grub. – oldfred May 29 '22 at 02:34
  • @ubfan1 Thanks for your comment, I'm surprised this is such a long standing bug in ubuntu. I just mounted my /dev/nvme00 and it does not contain and EFI directory, but does have a grub directory. The main install is not windows, but debian. Manually selecting the drive from the boot menu fails :( – aaaaaaaaab May 29 '22 at 15:18

0 Answers0