So, I had this bright idea to save me from toting my laptop between work and home. I'd get a usb SSD drive, install kubuntu and sync my /home directory to it. That way I could just carry the usb drive to work, plug it in a laptop there, and run it as a near-clone of my laptop at home.
I got a live distro of kubuntu and installed it on the usb ssd drive using my home laptop, and it worked fine. When I have the usb dive plugged in my home computer, I can boot from either the usb drive or the internal drive, and it does great. However... if I pull out the usb drive, and try to boot just using the internal hard drive, I just get the grub command line.
If I type "boot," I get the error "You need to load the kernel first." if I type "ls" I get: (proc) (hdo) (hdo,gpt2) (hd0,gpt1)
Here's the df from booting with the usb ssd:
% df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 3256960 2352 3254608 1% /run
/dev/sda2 1921208544 274306084 1549236620 16% /
tmpfs 16284792 14436 16270356 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
/dev/nvme0n1p1 523248 5368 517880 2% /boot/efi
tmpfs 3256956 72 3256884 1% /run/user/1000
/dev/nvme0n1p2 982862268 307631972 625229964 33% /mnt/hd
Note that /boot/efi is on the internal drive (nvme0n1p1), which I don't really want -- since it means I can't really take the drive to work and boot on a random laptop.
Here's the /boot directory on the flash:
/boot$ ls
config-5.19.0-21-generic memtest86+.elf
config-5.19.0-29-generic memtest86+_multiboot.bin
efi System.map-5.19.0-21-generic
grub System.map-5.19.0-29-generic
initrd.img vmlinuz
initrd.img-5.19.0-21-generic vmlinuz-5.19.0-21-generic
initrd.img-5.19.0-29-generic vmlinuz-5.19.0-29-generic
initrd.img.old vmlinuz.old
memtest86+.bin
Here's the /boot directory on the internal drive:
/mnt/hd/boot$ ls
config-5.15.0-48-generic memtest86+.elf
config-5.15.0-57-generic memtest86+_multiboot.bin
config-5.15.0-58-generic System.map-5.15.0-48-generic
config-5.18.0-051800rc1-generic System.map-5.15.0-57-generic
efi System.map-5.15.0-58-generic
grub System.map-5.18.0-051800rc1-generic
initrd.img vmlinuz
initrd.img-5.15.0-48-generic vmlinuz-5.15.0-48-generic
initrd.img-5.15.0-57-generic vmlinuz-5.15.0-57-generic
initrd.img-5.15.0-58-generic vmlinuz-5.15.0-58-generic
initrd.img-5.18.0-051800rc1-generic vmlinuz-5.18.0-051800rc1-generic
initrd.img.old vmlinuz.old
memtest86+.bin
So, I need to tell grub on the usb ssd not to look to the internal drive for /boot/efi, and I need to tell grub on the internal drive not to look to the usb drive to find out where the kernel lives.
I think.
I have to say that this all seems a mystery to me, and I have yet to find a tutorial that explains it well.
How can I do this? As an aside, I have lots of backups, so I'n not averse to wiping both drives and starting from scratch, but I don't want to repeat the same mistakes.
Thanks.
sudo grub-install
or Boot-Repair. Or add ESP. Or reinstall & Remove esp flag from Windows before install to second or external drive - Tim Richardson https://askubuntu.com/questions/16988/how-do-i-install-ubuntu-to-a-usb-key-without-using-startup-disk-creator – oldfred Jan 14 '23 at 15:40