How to edit a bootable USB stick?

Trying to add nomodeset to the boot options of the 16.04 desktop installer.

Tried hdparm to make the USB writable, but it has no effect.

Tried isomaster to create a modified the iso before flashing it with Startup Disk Creator - USB isn't detected as bootable.

Looked at the https://help.ubuntu.com/community/LiveCDCustomization - it's an overkill that doesn't look promising. Edit: tried that, and it's not bootable.

Similar to this question that was shut down:

How to create a bootable usb stick that is not read only


Solution 1:

Depending on how you created the USB boot drive, it will be read-write or read-only.

Cloned drive

A cloned drive created with the 'Startup Disk Creator' in Ubuntu 16.04 LTS or newer versions, has a hybrid iso9660 file system, which works both in DVDs and USB pendrives (and memory cards), but it is read-only by design, so you cannot edit anything in it. Also 'Disks' alias gnome-disks, and 'mkusb' (when cloning and creating live-only drives) make USB drives with a hybrid iso9660 file system.

Extracted drive

An extracted drive, for example

  • a persistent live drive created with mkusb or
  • a live-only drive created with Rufus,

can be edited. You can add nomodeset and other boot options to the boot configuration file, so that they will persist (survive to be used in the future). Edit boot/grub/grub.cfg in partition #3, 'usbboot' for mkusb. You may need to boot from another drive in order to mount the FAT32 file system read-write for Rufus.

New tips to make your USB boot drive with Ubuntu 19.10+

  • You can edit your binary iso file and replace the cosmetic boot options quiet splash with the boot option 'persistent ' or 'nopersistent' (the strings contain 12 characters, so the replacement can be done without any offset in the following part(s) of the iso file. You can do it with sed

    sed 's/quiet splash/persistent  /' standard.iso > persistent.iso
    sed 's/quiet splash/nopersistent/' standard.iso > nopersistent.iso
    

    and clone the modified iso file, or flash directly with

    sed 's/quiet splash/persistent  /' standard.iso > /dev/sdx
    sed 's/quiet splash/nopersistent/' standard.iso > /dev/sdx
    

    where x is the device letter for the USB pendrive.

  • You can do it with a safety belt using mkusb-minp

  • It is more convenient and also safer to use mkusb-plug for the whole process including the sed commands, and there is a graphical user interface.

  • You can do it yourself with an extracting method and get whatever combinations of boot options, that you like, according to this link

Solution 2:

You could try UNetBootIn. It's a software which allows you towrite to existing partitions on the usb stick, like fat32 or ext4. Persistence only works with fat32. However the usb stick is writeable due to its filesystem.

Unetbootin can be downloaded using

sudo apt update && sudo apt install unetbootin 

Solution 3:

If you flash your image using rufus on windows using GPT boot structures then you can use (on Ubuntu 16.04 LTS): sudo mount -o remount,rw /media/cdrom /media/cdrom to remount your drive. I wouldn't recommend it but it does work.