Installing AlmaLinux on portable harddrive

Hey all,
I’ve installed 9.3 to a USB hard drive, with the intention of making it a fully portable and bootable OS. I booted into my laptop (running Pop_OS) with a live USB stick, and then installed 9.3 to the Portable Drive. That seems to be working - I can boot into the Drive (I’m there right now, running Alma), but it’s not portable - I get something that looks like grub (a couple options with variations of Alma**), but it hangs after I select the OS and before I can log in.

I’ve read that I need to do something like grub-install --removeable, but two issues with that:

  • Doesn’t seem like grub got installed? When I’m in Alma and do “grub”, “grub-install” I get “command not found”. Sudo doesn’t help…although there IS a /boot/grub/grub.cfg…
  • It seems like the grub-install --removeable is to make sure BOOTX64 gets installed to the EFI, but I’ve already got that:


BOOTX64.EFI fbx64.efi



Anyone have any advice - how can I make this drive bootable on other systems?

To answer the simpler question first: all grub commands are actually grub2 commands, so you need grub2-install. My own 9.3 system has:

$ ls /{,s}bin/grub*
/bin/grub2-editenv      /bin/grub2-mklayout         /bin/grub2-script-check          /sbin/grub2-reboot
/bin/grub2-file         /bin/grub2-mknetdir         /bin/grub2-syslinux2cfg          /sbin/grub2-set-bootflag
/bin/grub2-fstest       /bin/grub2-mkpasswd-pbkdf2  /sbin/grub2-bios-setup           /sbin/grub2-set-default
/bin/grub2-glue-efi     /bin/grub2-mkrelpath        /sbin/grub2-get-kernel-settings  /sbin/grub2-set-password
/bin/grub2-kbdcomp      /bin/grub2-mkrescue         /sbin/grub2-install              /sbin/grub2-setpassword
/bin/grub2-menulst2cfg  /bin/grub2-mkstandalone     /sbin/grub2-macbless             /sbin/grub2-switch-to-blscfg
/bin/grub2-mkfont       /bin/grub2-mount            /sbin/grub2-mkconfig             /sbin/grubby
/bin/grub2-mkimage      /bin/grub2-render-label     /sbin/grub2-probe

However I’m not sure I’d do things the way you describe. Go to the downloads page and scroll down to the section “Live Media”. Click on Alma 8 or 9 as desired and download the appropriate ISO. Now use dd(1) to create your USB disk. One important point to remember: if you are building your system on, say sdc the target for dd will be /dev/sdc and NOT /dev/sdc1.

ok good, yes, thanks:

# ls /{,s}bin/grub*
/bin/grub2-editenv               /sbin/grub2-install
/bin/grub2-file                  /sbin/grub2-mkconfig
/bin/grub2-menulst2cfg           /sbin/grub2-probe
/bin/grub2-mkimage               /sbin/grub2-reboot
/bin/grub2-mkpasswd-pbkdf2       /sbin/grub2-set-bootflag
/bin/grub2-mkrelpath             /sbin/grub2-set-default
/bin/grub2-mount                 /sbin/grub2-set-password
/bin/grub2-script-check          /sbin/grub2-setpassword
/sbin/grub2-bios-setup           /sbin/grub2-switch-to-blscfg
/sbin/grub2-get-kernel-settings  /sbin/grubby

(think I’ve got the text figured out too, good good)

On your suggestion, I thought those live USB drives were read-only, not editable like a full linux install. Maybe that idea is leftover from when I used to do the same thing with CDs/DVDs…In any case, I have one of those, that’s how I installed to the external drive in the first place (dd if=… of=… etc), but that’s not writeable now, right?

If I understood correctly, @cduston, your laptop already had a Pop_OS installation (and still has it), and you booted from a flash drive, to install AlmaLinux on an external drive.

This happened more than once to me with Anaconda (which is a bit dumb) and GRUB2 (which is so crappy that I can’t use the appropriate words here). Here’s what happened: GRUB2 got installed (with updated settings) on your internal drive, the one that already had (and still has) Pop_OS!

Yes, Anaconda is that dumb. (If I’m not wrong, with all its faults, Calamares is smarter in regard to where to install GRUB2.)

So you can boot the OS installed on your external drive if and only if you’re using the laptop with Pop_OS installed internally, because it was this GRUB that has been updated to also boot from the external drive, right?

Have you tried to use a procedure like the one cursorily presented here? Install the bootloader — The Sans-Anaconda Install

The idea is to boot from your Pop_OS, then chroot as described so that the GRUB2 commands would actually perform their actions on the external drive!

Please tell us if it worked for you. Others might benefit from your experience, because your scenario is a common one amongst distro-hoppers, yet, surprisingly, I’ve yet to come over a wiki page or a blog post detailing what to do exactly in such a case.

1 Like

I’ve been playing with a 250 GB USB drive. Putting the live CD onto it results in a very weird partition table, and it is quite impossible to claim some of the spare space back. Several attempts only resulted in corrupting the live CD. I have come across this askubuntu article which may help, but I must stress I’ve not tried any part of it.

The only solution I can see for your truly portable, yet writeable, OS is to write the live OS to a USB stick, and keep the disk as a writeable disk that you mount on each system. Another solution if you only need to move within your private intranet is to set up an NFS or SAMBA directory tree and mount that where you need it. Last, and by far the trickiest, is to build your own live CD - have fun!

Sorry, but I believe you missed the point. I’ve been using complete external installations of Linux distros for years, and I mean distros installed on very fast USB flash drives! (which are rare). It’s very feasible. Except that they were not installed with Anaconda, but with Calamares. That is, if you want that the distro you installed (not as a LiveISO) on the flash/external drive to be used on a different PC. This is what the OP seems to be wanting to do, and I know this scenario.

Funny thing, Ubuntu has this bugs for ages: Bug #1396379 “installer uses first EFI system partition found ev...” : Bugs : ubiquity package : Ubuntu

What it does: no matter where you install a distro, it will install or update GRUB on the wrong drive, i.e. on the first internal drive, which is hijacked by Ubuntu! Nobody ever bothered to fix this bug in Ubiquity. In Anaconda, I don’t even know whether it has been reported as a bug!

Oh, the first bug report is older, but for some reason they marked the OLDER bug as being a duplicate of the NEWER bug, despite being the other way around. Well, this is Ubuntu for you… Bug #1173457 “Ubuntu Installer uses wrong bootloader location f...” : Bugs : ubiquity package : Ubuntu

I think you’ve summarized the problem well - installing the OS to the external drive is not a major problem, the problem is getting grub installed to that drive and not to the “internal” drive. And actually, I think that I’ve fixed the problem by following something like what you describe in that link, the “Sans-Anaconda Install”.

First, FYI, I don’t know anything about Anaconda or Calamares. I saw those directories in my Alma install, but I don’t think I used them during any of this process (I will have to investigate that further, however).

However, the problem is slightly more detailed. In particular, after chroot etc, the grub reinstall took a bit more.

grub2-install /dev/sda --removable

fails, missing x86_64-efi. So, find that:

$ dnf provides /usr/lib/grub/x86_64-efi

tells me what to install to get it, then I did so:

$ sudo dnf install grub2-efi-x64-modules-1:2.06-70.el9_3.1.alma.1.noarch
$ sudo grub2-install /dev/sda --removable -d /usr/lib/grub/x86_64-efi/

SAYS fails because of secure boot, but actually if you just reinstall stuff and pretend there’s no problem:

dnf reinstall shim-* grub2-efi-* grub2-common

Then this boots on other machines! (I think the shim-* is actually the important thing here, but this is the command I ran).

(Note…does not work on one of my machines, booting windows 10 and Slackware 15, using reFIND…but it does seem to boot on other machines I try, so still some unfinished business…)

EDIT: I see Anaconda is a system installer - looking at screenshots, that’s clearly what I used to install Alma! I did not see an option to switch to Calamares, so maybe how to do that would be a useful addition to this story.

Wow, if it works for you, then I’m glad.

I suppose that the Win10/Slackware15 machine has Secure Boot enabled. No matter what the “theory” says, I keep Secure Boot disabled on all my machines. Still UEFI mode, but w/o Secure Boot. (With ELRepo’s kernels, this is even necessary.)

shim is important because the meaning of it is “Secure Boot chain-loading bootloader (Microsoft-signed binary)”.

AlmaLinux and Fedora only use Anaconda. Calamares is used by other distros, such as Manjaro, EndeavourOS, Garuda, Lubuntu, Debian’s live images (iso-hybrid). There is no way to use another installer: you just use the one offered by the respective distro.