Score:1

Grub forcing me to boot from flash drive

br flag

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.

Organic Marble avatar
us flag
You need to fix grub in both places by doing this in both places: https://askubuntu.com/a/831241/243321 When fixing the home PC, use a different live USB than the persistent one you take to work (just to avoid confusion - you *could* use the same one, but the procedure is confusing enough already).
oldfred avatar
cn flag
If you did a full install, it puts boot files on internal drive's ESP. Old but valid bug with work arounds. https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1396379 If you have ESP on external drive, you can just reinstall grub, by updating fstab (make sure its remounted) with external drive's ESP & `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
William Oliver avatar
br flag
The answer by Organic Marble worked for me. Unfortunately, I don't see a check mark next to it, so I can't mark it as answered. Since it worked, I did not try Tim Richardson's method. Once again, any pointers to a good tutorial on this would be appreciated.
C.S.Cameron avatar
cn flag
My wife has been doin similar to what you want to do for quite a while. See ubfan1's answer here: https://askubuntu.com/questions/991189/using-existing-home-directory-from-a-bootable-external-drive
William Oliver avatar
br flag
Yes it does. It can be flagged as a duplicate -- though I didn't *know* it was a duplicate until it was pointed out.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.