Ubuntu – How to edit a bootable USB stick

live-usb

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

Best Answer

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