0

I have a number of UEFI machines. One of them has Kubuntu 17.04 on it. Couldn't I...

Boot 17.04; Download and mount a 17.10 iso image; chroot to that image; run ubiquity in their to install 17.10 on a separate flash drive

There by creating a booting and mobile 17.10 installation on a flash drive without having to reboot or change anything on the 17.04 machine?

Maybe I'm trying to do things the hard way but it looks like it might be fun to try.

FyFAIR
  • 121
  • 1
    Are you just trying to install Ubuntu to a flash drive? You could also create a persistent live system using mkusb. See https://help.ubuntu.com/community/mkusb. – Enterprise Oct 25 '17 at 19:44
  • mkusb create a live system by cloning an iso image. The created partition uses the same file system as the image. I was trying to create a live system that uses ext4 file system on the flash drive (or maybe try out btrfs). – FyFAIR Oct 25 '17 at 22:01
  • mkusb can create a live-only system with the same file system as the image (iso9660). mkusb can also create a persistent live system with several partitions (as indicated by @PJSingh). See this link, https://help.ubuntu.com/community/mkusb/persistent - Is this what you want, or would you rather get an installed system for example according to the following link, https://askubuntu.com/questions/786986/boot-ubuntu-from-external-drive/942312#942312 – sudodus Oct 26 '17 at 13:28

1 Answers1

2

I don't know offhand how Ubiquity for 17.10 would run from a boot of Ubuntu 17.04. Even if you use chroot, you'll still be running the older kernel and have lots of 17.04 stuff running in the background. You could always try this, but you might be the first person in the world to do so, and with little reason....

Instead of doing it this way, why not simply boot the 17.10 installer directly? There's no reason this wouldn't work on your computer -- or if there is, you haven't identified what that reason might be. This course will eliminate the risk of problems because you ran the installer from an older OS's environment.

Either way you do it, you face a problem: By default, Ubiquity will try to install GRUB to the first EFI System Partition (ESP) it finds, which will normally be the ESP on your hard disk. Thus, you'll end up with a USB drive that will not boot by itself and a computer that will not boot unless the USB drive is plugged in. (The latter is because Ubuntu configures its GRUB to rely on /boot/grub/grub.cfg, which will be on the USB drive after you install Ubuntu there.) The easiest solution to this problem is to tell Ubiquity to not install GRUB, but then install it (or some other boot loader) manually later. In brief, the procedure is:

  1. Boot the Ubuntu installer in its "try before installing" mode -- do not select the option to install Ubuntu as the computer boots!
  2. Once the installer has booted and you see a desktop environment, open a Terminal window.
  3. Type ubiquity -b. The -b option tells Ubiquity to not install a boot loader.
  4. Install to the USB drive normally, but be sure it includes an ESP.
  5. Install a boot loader to the ESP, using the filename EFI/BOOT/bootx64.efi. This step is itself fairly complex, and I'm afraid I don't have a step-by-step procedure handy for doing it from an Ubuntu installation environment; however...
    • Boot Repair might be able to do the job, or at least help.
    • My web page on EFI boot loaders for Linux covers the general principles and procedures, along with several boot loader options. You should be able to piece together a procedure after reading that page, although there'll be some trial-and-error when it comes to configuration details.

The final step of boot loader installation is trickier than it should be because installing to a USB drive is not something that Ubiquity was designed to do, and because GRUB configuration is a nightmare. (Most people don't experience the nightmare because GRUB provides configuration scripts that do things properly, and Ubiquity sets things up properly for the common case of installing Ubuntu to a hard disk. Your case is not common, though.) If you don't need Secure Boot support, using another boot loader is likely to be easier than using GRUB, since everything else is easier to configure than GRUB; but GRUB is the only one that comes signed in a way that makes it work with Secure Boot without jumping through extra hoops. Thus, if you need Secure Boot, it's more of a toss-up.

Note also that BIOS-mode and EFI/UEFI-mode booting rely on entirely separate boot loaders. Thus, if you want your USB drive to be bootable in both modes, you'll need to install both BIOS-mode and EFI-mode boot loaders, which further complicates matters. My procedure assumes you want to boot only in EFI mode, since you explicitly mentioned UEFI computers but not BIOS computers.

Finally, there are other ways to do this. The easiest is likely to be to install using a computer with no OS already on it. That way, you can set up the USB drive with an ESP, and it will be the only ESP available. Post-installation, it then becomes a matter of renaming a few files, as described here, to get the USB drive booting on any computer. Temporarily unplugging your hard disk or changing its ESP's type code to something else may be a way to do this with your regular computer, but these options run the risk of follow-on problems. (Most notably, some EFIs erase boot options that are no longer valid, so if you unplug your hard disk, you may find that it will no longer boot when you plug it back in.)

Rod Smith
  • 44,284
  • 7
  • 63
  • 105