3

My goal to archive is the following: I want to install Ubuntu alongside my already existing Windows system on the same hard drive. I checked Windows (msinfo32) and it's running in UEFI-Mode, Secure Boot disabled. I installed Ubuntu in a encrypted Luks/LVM container on sda6 but I also wanted to put the grub-loader on an external USB drive/stick to boot from.

In the end it should boot Windows normally without the usb stick present and it should automatically boot Ubuntu when this usb stick is connected to my laptop. After installing Ubuntu i got a broken grub prompt on startup. (Minimal Bash-like line editing is supported...)

How to archive this scenario and make it work like describe above?

fdisk -l

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   2050047   2048000  1000M Windows recovery environment
/dev/sda2    2050048   2582527    532480   260M EFI System
/dev/sda3    2582528   2844671    262144   128M Microsoft reserved
/dev/sda4    2844672 305432575 302587904 144.3G Microsoft basic data
/dev/sda5  305432576 306358271    925696   452M Windows recovery environment
/dev/sda6  306358272 939612159 633253888   302G Linux filesystem
/dev/sda7  939612160 976773119  37160960  17.7G Windows recovery environment

The external USB Drive for the grub-bootloader looks like this

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *     2048 60061695 60059648 28.7G ef EFI (FAT-12/16/32)

The contents of the sdc1 partition is as follows:

drwxr-xr-x 4 root root 16384 Sep 30 22:04  EFI/
drwxr-xr-x 2 root root 16384 Sep 30 21:19  grub/
drwxr-xr-x 2 root root 16384 Oct  1 08:47 'System Volume Information'/

The grub folder is empty.

EFI contains this:

drwxr-xr-x 2 root root 16384 Sep 30 22:04 BOOT/
drwxr-xr-x 2 root root 16384 Sep 30 22:04 ubuntu/

EFI/BOOT contains:

-rwxr-xr-x 1 root root 1334816 Sep 30 22:04 BOOTX64.EFI*
-rwxr-xr-x 1 root root 1213032 Sep 30 22:04 fbx64.efi*
-rwxr-xr-x 1 root root 1269496 Sep 30 22:04 mmx64.efi*

EFI/ubuntu contains:

-rwxr-xr-x 1 root root     108 Sep 30 22:04 BOOTX64.CSV*
-rwxr-xr-x 1 root root     201 Sep 30 22:04 grub.cfg*
-rwxr-xr-x 1 root root 1681280 Sep 30 22:04 grubx64.efi*
-rwxr-xr-x 1 root root 1269496 Sep 30 22:04 mmx64.efi*
-rwxr-xr-x 1 root root 1334816 Sep 30 22:04 shimx64.efi*

EFI/ubuntu/grub.cfg contains this

search.fs_uuid d95a5ab4-76bd-4ab2-a05d-41c1dba56758 root lvmid/VmoR2t-OB91-x6E3-csJp-r79R-gAsE-CbYau0/S6fvUX-3vKN-yzeO-L7om-s6Ae-vlO9-eKSUvF 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

ls -al /dev/disk/by-uuid/

lrwxrwxrwx 1 root root 10 Oct 1 09:03 0079-8DF5 -> ../../sdc1 lrwxrwxrwx 1 root root 10 Oct 1 09:03 5266B2F066B2D3C7 -> ../../sda5 lrwxrwxrwx 1 root root 10 Oct 1 09:03 6C98155B981524DC -> ../../sda7 lrwxrwxrwx 1 root root 10 Oct 1 09:03 9E143B29143B0435 -> ../../sda4 lrwxrwxrwx 1 root root 10 Oct 1 09:03 C848147848146808 -> ../../sda1 lrwxrwxrwx 1 root root 10 Oct 1 09:03 EA3B-1E3B -> ../../sda2 lrwxrwxrwx 1 root root 10 Oct 1 09:03 f40a050c-d12c-418c-83cd-8ca5695dee89 -> ../../sda6

bumblebean
  • 31
  • 2
  • 1
    Welcome to Ask Ubuntu: Unplug your Windows drive, Install Ubuntu to the external USB drive, (in the same BIOS UEFI mode Windows is installed in). Plug the Windows drive back in, set Ubuntu as first HDD, boot Ubuntu and run sudo update-grub. This will add Windows to Ubuntu's boot menu. – C.S.Cameron Oct 01 '20 at 11:22
  • @C.S.Cameron I only have one drive with Win8.1 and Ubuntu 20.04. I also don't want Ubuntu system on a external drive. It's on sda6 but I want to boot Ubuntu only with an USB stick connected and if it's not present normally boot into Windows. I think I need a way to fix the Grub installation on my USB device that is sdc1. See output above. – bumblebean Oct 01 '20 at 11:30
  • 1
    Do a Persistent install of Ubuntu to USB using mkusb. copy the Ubuntu menuentry from the internal drives grub.cfg to the USB's sdx2/ boot/grub/grub.cfg. Set the USB to boot first. You can then delete other menuentries and partitions 1,4 & 5 if you wish. – C.S.Cameron Oct 01 '20 at 11:41
  • If your internal drives Ubuntu does not have grub, make a full install USB per my first comment, sudo update-grub will add both Windows and internal Ubuntu to the USB's GRUB menu. There is advice for making a Full install USB on this page: https://askubuntu.com/questions/1217832/how-to-create-a-full-install-of-ubuntu-20-04-to-usb-device-step-by-step – C.S.Cameron Oct 01 '20 at 11:47
  • Here is a template image that can be flashed to a USB drive to create BIOS and UEFI boot partitions: https://phillw.net/isos/linux-tools/uefi-n-bios/dd_grub-boot-template-for-uefi-n-bios.img.xz. After flashing copy grub.cfg from the internal drive to overwrite /usbboot/boot/grub/grub.cfg on the USB. You can use Disks, mkusb, Etcher, Rufus, etc to flash it. It will overwrite everything on the USB drive. It takes up 257MB of space on the USB. It was created by sudodus. If this works for you, let me know and I will write a formal answer. – C.S.Cameron Oct 01 '20 at 13:02

1 Answers1

1

Booting Ubuntu Encrypted Drive from External Drive.

I installed Ubuntu using the option for Full Disk Encryption.

Similar to: How to Make BIOS/UEFI Flash Drive with Full Disk Encryption

enter image description here

I Flashed https://phillw.net/isos/linux-tools/uefi-n-bios/mkusb_grub-boot-template-for-uefi-n-bios_fat32_4GB_use-in-wins_2020-09-07.img.xz to a 4GB flash drive in Windows using Rufus, in Ubuntu mkusb or Disks will work.

enter image description here I use the FAT32 partition for data

Then I cut the "encrypted" Ubuntu menuentry from grub.cfg on the encrypted drive, (sdc5), and added it to grub.cfg on the external USB drive (sdd4) as the first menuentry.

I have had success booting this drive in BIOS and in UEFI mode.

C.S.Cameron
  • 19,519