Page 1 of 7 123 ... LastLast
Results 1 to 10 of 65

Thread: Howto make USB boot drives

  1. #1
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Howto make USB boot drives

    Quick start manual and mkusb

    The fastest way to start making USB boot drives is to install the mkusb PPA, install and update the mkusb package like all the other program packages. See this link
    https://launchpad.net/~mkusb/+archive/ubuntu/ppa

    Code:
    sudo add-apt-repository ppa:mkusb/ppa  # and press Enter to accept it
    sudo apt-get update
    sudo apt-get install mkusb
    You can download the quick start manual and check the md5sums at this link http://phillw.net/isos/linux-tools/mkusb/

    - View or download the new quick start manual http://phillw.net/isos/linux-tools/m...art-manual.pdf
    - View or download the old quick start manual http://phillw.net/isos/linux-tools/m...-manual-74.pdf
    - Check the md5sums http://phillw.net/isos/linux-tools/mkusb/md5sum.txt.asc


    If you want to try the new mkusb version 8, get it via the PPA

    The intention is that the menus and desktop file should make this version useful for a larger group of people.


    There are more details (text and screenshot pictures) at this wiki page https://help.ubuntu.com/community/mkusb

    Doing the same thing many times


    For the first time I had been helping to test a new Ubuntu version (Lubuntu 12.04 LTS). After a while I wanted to make itsimpler and safer to transfer the code to the USB pendrive. I have been happy using unetbootin, because of its high success rate. I also tested Ubuntu's startup disk creator usb-creator-gtk, which has the advantage that you reach Ubuntu's first screen, that is skipped by unetbootin. Both tools work with my computers and can be used to create persistent live systems.

    Temporary edit: usb-creator-gtk was buggy in Lubuntu 13.04 and 13.10, and is being debugged. It is improved and can create persistent USB drives in 13.10 but it crashes when trying to erase a disk. There is project to rewrite it for 14.04 LTS. If you still have problems with usb-creator-gtk, as a temporary workaround, you can try using usb-creator-kde or unetbootin or one of the other tools instead. See details at post #4

    dd image of iso file to USB device safely

    But I also read somewhere that it should be possible to boot from a direct image of the iso file. So I tried it with dd, the disk destroyer ;-) And it works, the computer boots from a USB device (pendrive, stick, flash drive, but also disk or SSD) just like it were from a CD drive. Also like a CD, it will be mounted read-only, so it cannot carry persistence.

    Since dd is a bit risky, I made a shell-script, so that you get advice from a help text window and have to run dd manually only once, but with support from the script to avoid writing to any internal drive. The first time you must select the correct USB device, if more than one are connected. So it is safer and also much more convenient (but not 100%).

    The next daily build will automatically select the correct USB device (when it is inserted into the computer). So for the next daily builds it is safe and very convenient.

    I cloned an ubuntu-desktop-amd64.iso this way, and the USB pendrive works in both UEFI and CSM (BIOS) modes.

    Shell script

    The shell-script has been updated and improved and will be updated again when necessary. It is now convenient to use also for one-off creations of USB boot devices from iso files and compressed image files and also to wipe the drives if necessary after the cloning. The shellscript can monitor the data transfer with pv, and suggests that you install it, if not available. Notice that pv shows Mibibytes and dd shows Megabytes.

    The new version 8 is available now, and is very different, because it has replaced the crude text interface with menus (using the program package dialog).

    The shell-script versions 4, 5 ... 8 work well not only in graphical desktops with terminal windows, but also in text screens (for example in a server). They can manage img.xz files (compressed with xz with ~20% better compression than gzip).

    If you have installed mkusb from the PPA, it will be in the system path, $PATH, and you can run it from the menu or dash or with the command

    Code:
    sudo -H mkusb
    Otherwise, it is easiest to change directory to where the file mkusb is located and run it with ./mkusb ( dot means the current directory, so ./file means a file in the current directory)

    A typical dialogue looks like this the first time you run the script (and the label of the iso file does not match that on the USB drive). Either the general usage text

    Code:
    $ ./mkusb -h
    Usage:  # New: menus to select source file and target device #
    ---- Make a USB install device from ISO or image file --------
    sudo ./mkusb
    sudo ./mkusb file.iso
    sudo ./mkusb "quote file name (1) with special characters.iso"
    sudo ./mkusb file.img
    sudo ./mkusb file.img.gz
    sudo ./mkusb file.img.xz
    ---- Install from 'file.img.xz', show all mass storage devices
    sudo ./mkusb file.img.xz all
    ---- Wipe the USB device (may take long time) ----------------
    sudo ./mkusb wipe-whole-device
    ---- Wipe the first megabyte (MibiByte), show only USB devices
    sudo ./mkusb wipe-1
    ---- Wipe the first megabyte, show all mass storage devices --
    sudo ./mkusb wipe-1 all
    ---- Help and Version ----------------------------------------
    ./mkusb -h
    ./mkusb -v
    $ ./mkusb -v
    mkusb version 8.0
    $
    or the specific usage text to help you cut and paste to get 'sudo and the path' easily, and then run the whole script to get the advice how to run the dd command line.

    Code:
    $ mkusb saucy-desktop-i386.iso
    Usage:
    sudo /home/sudodus/bin/mkusb saucy-desktop-i386.iso
    $
    Here is the shell-script for anyone to use or improve.

    Download mkusb from the following link

    http://phillw.net/isos/linux-tools/mkusb

    There are also previous versions for users that like simple scripts.

    Before making the PPA, I put the file mkusb into my ~/bin directory and made it executable. Now the installer does the job (putting mkusb into the system directory /usr/sbin)

    Code:
    chmod ugo+x mkusb
    Use the current md5sum.txt.asc file to check that the md5sum matches before you start using mkusb!

    Verify that this signed md5sum file is correct with the following commands

    Code:
    gpg --keyserver hkp://pgp.mit.edu --recv-keys EB0FC2C8
    gpg --verify md5sum.txt.asc
    
    The output should be something like

    Code:
    gpg --keyserver hkp://pgp.mit.edu --recv-keys EB0FC2C8
    ... 
    gpg: key EB0FC2C8: public key "Nio Sudden Wiklund (sudodus) <address@mailserver.com>" imported (or not changed the second time ...)
    ...
    gpg --verify md5sum.txt.asc
    gpg: Signature made Sat Aug  2 12:09:06 2014 CEST using RSA key ID EB0FC2C8
    gpg: Good signature from "Nio Sudden Wiklund (sudodus) <mail address>"
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg:          There is no indication that the signature belongs to the owner.
    Primary key fingerprint: 0303 EA77 E34C 52F2 2958  47C6 BD43 C742 EB0F C2C8
    The warning "This key is not certified with a trusted signature! There is no indication that the signature belongs to the owner." means that there is no chain of trusted keys between your computer's keyring and the key, that was used to sign the md5sums (the key of sudodus). Check that the result matches, when you verify it: The md5sums and the signature of your output of these commands should match. Then there is reason to trust that nobody else has written the mkusb script file and its md5sum. The date of the signature will change at updates, and the text might be translated to your local language, but it should be clear that it is a

    'Good signature from "Nio Sudden Wiklund (sudodus)"'.

    Use the new version, or stay with an old version with more direct interaction in the terminal window or version 7.4, the last non-menu version.

    mkusb version 8 with menus

    The new version of the mkusb tool is still only a bash script, that has been running in crude text mode, but people want eye candy, so I've made a menu interface, and also improved the identification of devices slightly (replaced calling parted -ls with a home-made bash function).

    See the attached pictures, which illustrate the crucial part of mkusb, how to help selecting the correct device and avoid overwriting other devices.

    mkusb version 9

    New: You can test mkusb version 9 with pure graphical menus and info texts including red warning menus via ppa:mkusb/unstable

    See the link https://help.ubuntu.com/community/mkusb with details at /v9

    File selection and the other dialogues use zenity (so this version works only in a graphical environment)

    mkusb-nox

    mkusb-nox is supplied via the PPA. It works in text screens, 'No X'.

    Wipe the CD file system

    I should add, that if you want to re-use a USB drive that has been used like this, you should wipe it with dd (overwrite with zeros), otherwise grub-install doesn't want to write into the mbr area, because it recognizes the CD file system, iso9660. (You need not wipe it before cloning.)

    You can use the shell-script also for this task and wipe the whole drive, 'wipe-whole-device', but often it is enough to wipe the first megabyte of the drive, 'wipe-1'.

    Code:
    $ sudo ./mkusb wipe-1
    It is very important that you wipe your intended target drive and nothing else. It will be completely wiped, not even PhotoRec can do anything after that operation. But there are other (and better) tools to wipe an entire HDD or SSD for example hdparm or DBAN.

    And after that you can use gparted to make a new partition table (for example MBR) and suitable partition(s) for example FAT32 with boot and lba flags.

    Several iso files can be cloned to working USB pendrives

    ISO files that can be be cloned to working USB boot drives are called hybrid iso files. I tested and could make working USB boot drives from

    {Ubuntu, Kubuntu, Lubuntu, Xubuntu} {12.04 LTS, 14.04 LTS, 14.10} with PPAs for these versions (precise, trusty, utopic)
    Ubuntu mini.iso version 14.04+ Plus means 'and newer versions'. See this link.

    Bento
    Bodhi
    Clonezilla
    Debian Wheezy (and 9w)
    Fedora 20 (use mkusb 7 alias mkusb-nox or mkusb 8 because mkusb 9 suffers from a bug in zenity)
    Knoppix 7.4 (needed treatment with isohybrid)
    Linux Mint
    LXLE 12.04.3
    LXLE 12.04.4 revisited 32-bits (needed treatment with isohybrid)
    Mageia 4.1 Gnome Live and installed (needs a legacy desktop file)
    openSUSE 13.1 (use mkusb 7 alias mkusb-nox or mkusb 8 because mkusb 9 suffers from a bug in zenity)
    ToriOS alpha
    Webconverger

    while some other iso files did not work (although they make good CD boot disks). It is often possible to convert such an iso file to a hybrid iso with the following command

    Code:
    isohybrid downloaded-file.iso
    It converts the iso in-place (the file is overwritten), so make a copy before you run isohybrid if you want to keep the original file untouched. See the following link

    http://gparted-forum.surf4.info/view...d=30798#p30798

    Complete install to USB

    I also installed Lubuntu to a 16 GB USB pendrive, a complete install, like to a HDD. It was a little tricky with the swap partition, so now I know, why people advice, that you should disconnect the internal drive before doing it. This pendrive is truly portable, and probably better than a persistent live system. Please avoid proprietary drivers, if you want portability! There are several compressed image files, that were made from such installed systems, and they can be installed with mkusb.

    Booting USB drives with grub2 and iso files 'grub-n-iso'


    64-bit versions work only in 64-bit computers. 32-bit versions work in 32-bit and 64-bit computer with BIOS, but not with UEFI.

    The 'grub-n-iso' method uses grub2 to boot from an iso file, so once you have such a USB pendrive, you can boot most Intel and AMD computers that can run a 32-bit system (except very old non-PAE systems, UEFI systems, systems with too low RAM, and systems with non-compatible hardware). The 'grub-n-iso' method can be used to create multi-boot USB pendrives by selecting iso file to boot from in the grub menu. There is space in 'grub-n-iso-n-swap' for a second iso file. You can also start from this link to Pendrivelinux and modify the USB drive to suit what you need: size, number of iso files ...

    You can use the shell-script also for this task, to clone a compressed image from a file file.img.gz to a USB drive.

    Code:
    $ sudo ./mkusb Lubuntu-13.10-desktop-grub-n-iso.img.gz
    ...
    243967+1 poster in
    243967+1 poster ut
    999292416 byte (999 MB) kopierade, 33,9696 s, 29,4 MB/s
    One Button Installer

    The One Button Installer is very simple, it uses only standard text mode programs and shell-scrips and menus via the dialog program package. It is easy to use and needs very little RAM.

    The file dd_blank-obi_7.8GB_25_LubuntuTrusty_nonpae.img.xz contains Lubuntu and the One Button Installer scripts. There is a wiki page at https://help.ubuntu.com/community/OBI, and files to download are available at http://phillw.net/isos/one-button-installer/ There is also a tutorial thread here, One Button Installer, 'OBI'.

    A system to install is stored in a tarball, a compressed tar file, file.tar.gz. Tarballs can be added and removed in a similar way as the iso files of the 'grub-n-iso' installer.

    Code:
    $ sudo ./mkusb dd_blank-obi_7.8GB_25_LubuntuTrusty_nonpae.img.xz
    A tool that helps boot some computers from [other] USB boot drives - Chainloader

    The chainloader is useful for middle-aged computers, for example computers without a CD/DVD drive, where it can be hard to boot from a USB drive, or when you want to run from a fast USB 3 drive that is unwilling to boot. See this link to the tutorial Howto help USB boot drives

    References to tutorials and tips how to make USB boot drives

    Ubuntu Wiki - FromUSBStick
    Pendrivelinux about Multisystem
    https://launchpad.net/gdiskdump
    Last edited by sudodus; 2 Days Ago at 01:54 AM. Reason: changed are described in the following posts

  2. #2
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    I added details how to wipe the CD file system, if you want to use the USB drive with a normal file system again.

  3. #3
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    The shell-script is updated 2013-06-09 (June 9) and much improved compared to the original version. It is now convenient to use also for one-off creations of USB boot devices. There are also some hints about the usage. See the opening post (the first post).

  4. #4
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    Temporary edit:

    The startup disk creator version usb-creator-gtk is buggy in Lubuntu 13.04, and it is being debugged right now. Please install two
    additional packages, that help it work, either directly or via a PPA!

    Code:
    sudo apt-get install usb-creator-gtk python-gudev gir1.2-gudev-1.0

    or
    Code:
    sudo add-apt-repository ppa:jmarsden/lubuntu
    sudo apt-get update
    sudo apt-get install usb-creator-gtk
    It is improved in current updated/upgraded development installations of Lubuntu 13.10 (saucy-proposed December 18 2013)) and can create persistent USB drives, but it crashes when trying to erase a disk. There is project to rewrite it for 14.04 LTS. If you still have problems with usb-creator-gtk, as a temporary workaround, you can try using usb-creator-kde or one of the other tools instead.
    See this bug report (and comments #15 and #16) and this bug report about the current debugging.

    -o-

    A dd image of ubuntu-13.04-desktop-amd64.iso creates a USB pendrive that works in both UEFI and CSM (BIOS) modes.

    64-bit versions work only in 64-bit computers. 32-bit versions work in 32-bit and 64-bit computer with BIOS, but not with UEFI.

    -o-

    The 'grub-n-iso' method uses grub2 to boot from an iso file, so once you have such a USB pendrive, you can boot most Intel and AMD computers with a 32-bit system (except very old non-PAE systems, UEFI systems, systems with too low RAM, and systems with non-compatible hardware). The 'grub-n-iso' method can be used to create multi-boot USB pendrives. You can also start from this link to Pendrivelinux and modify the USB drive to suit what you need.
    Last edited by sudodus; December 18th, 2013 at 12:05 PM.

  5. #5
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    The shell-script is updated 2013-06-15 (June 15) and improved compared to the previous version. It is now convenient to use also for one-off creations of USB boot devices from iso files and compressed image files and also to wipe the drives if necessary after the cloning.

    A typical dialogue looks like this the first time you run the script (and the label of the iso file does not match that on the USB drive). Either the general usage text

    Code:
    $ mkusb
    Usage:
    ---- Make a USB install device from 'file.iso' -------
    sudo /home/olle/bin/mkusb file.iso
    ---- Make a USB install device from 'file.img.gz' ----
    sudo /home/olle/bin/mkusb file.img.gz
    ---- Make a USB install device from 'file.img.xz' ----
    sudo /home/olle/bin/mkusb file.img.xz
    ---- Wipe the USB device (may take long time) --------
    sudo /home/olle/bin/mkusb wipe-all
    ---- Wipe the first megabyte (MibiByte) --------------
    sudo /home/olle/bin/mkusb wipe-1
    ---- Version -----------------------------------------
    /home/olle/bin/mkusb -v
    $
    or the specific usage text to help you cut and paste to get 'sudo and the path' easily, and then run the whole script to get the advice how to run the dd command line.

    Code:
    $ mkusb saucy-desktop-i386.iso
    Usage:
    sudo /home/sudodus/bin/mkusb saucy-desktop-i386.iso
    $
    Edit: There are more details in the first post (the tutorial) while these following posts are 'only' comments about updates.
    Last edited by sudodus; September 30th, 2013 at 10:59 AM.

  6. #6
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    You can make a working USB install drive with the dd cloning method with mini.iso version 13.04. I learned this from innn at the Ubuntu Forums. See this link.

  7. #7
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    Bugfix: To avoid problems, when a bad partition table is found on some of the drives

    parted -l
    was changed to parted -ls

    when used in the shell-script. See man parted

    -o-

    A compressed copy of the shell-script file is attached to the first post.

    The size and md5sum of the script file are listed. This makes it possible to check that the file was copied or downloaded correctly.
    Last edited by sudodus; June 24th, 2013 at 02:38 AM.

  8. #8
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    There is also

    gdiskdump


    which is a GUI for diskdump (dd), a clone and imaging tool for mass storage devices (hard disk drives, SSD, USB pendrives ...).


    This is an open source Graphical User Interface for the Unix Command dd. You can easily select the Input- and Outputstream, so you can clone or image your Harddrive or Partition.


    Wikipedia: "dd is a common Unix program whose primary purpose is the low-level copying and conversion of raw data."
    The version 0.8 .deb Package is working on Ubuntu 9.10+ (x86 and amd64) and other Debian like Distros.

    [The link to gdiskdump was added at the end of post #1]

  9. #9
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    The shell-script is updated 2013-09-05 (Sept 5) and much improved compared to the previous version. See the opening post (the first post).

    1. The script is updated to manage the changes of the iso file in version 13.10, so that the next daily build will automatically select the correct USB device.

    2. The data transfer can be monitored with pv. If not installed, the user gets a tip to install pv, but the old style is there for users who do not want the extra verbosity with pv (if pv is not installed).

    3. There is also the previous version with a minor but important fix to partly manage the new iso format of 13.10 (the version from June 23 plus a minor fix). While I'm happy with the new version and recommend it, you are given the opportunity to have this old version (with the fix), if you prefer the simpler way it works and looks. It can also be used, if you have tweaked your own version of mkusb (patch the update into your version)

    Code:
    diff mkusb2 mkusb-old-plus-minor-fix
    72c72,73
    <  target="$(blkid | grep "$label" |sed s/.:.*// |grep "/dev/sd")"
    ---
    >  #target="$(blkid | grep "$label" |sed s/.:.*// |grep "/dev/sd")"
    >  target="$(blkid | grep "$label" |cut -b -8 |grep "/dev/sd")"
    4. The code windows in the opening post are also updated for typical input and output when using mkusb.

    5. There is a brief introduction to the One Button Installer

    There is a wiki page at https://help.ubuntu.com/community/OBI, and files to download are available at http://phillw.net/isos/one-button-installer/. There is also a tutorial thread here, One Button Installer, 'OBI'.
    Last edited by sudodus; December 31st, 2013 at 09:10 AM.

  10. #10
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Howto make USB boot drives

    The new version 4 is available now, but several instructions in post #1 are still describing version 3. Version 4 is more automatic. You need not copy and paste the command line. This example shows how to select the target device with (+/-) or the number of the list item. Go ahead with (g) or quit with (q). (Toggle 'USB-only' with (u) if you want to write to a drive that is not a USB drive.)
    Code:
    sudo mkusb saucy-desktop-i386.iso
    The iso file SHOULD BE loop mounted on a temporary file READ-ONLY:
    mount: warning: /tmp/tmp.Jbu6YwpDsR seems to be mounted read-only.
    Lubuntu 13.10 "Saucy Salamander" - Beta i386 _found_ in iso-file
    Lubuntu 13.10 "Saucy Salamander" - Beta i386 _not_ in USB device
    Do you want to make a new one? (y/n)
    y
    ***  WARNING: the device will be completely overwritten      ***
         Use the info in the xterm window (less /tmp/help-mkusb.txt)
    ***  quit with (q)                                           ***
    ***  Unmount the device if mounted  ****************************
     
    Model: ATA SAMSUNG HD322HJ (scsi)    Disk /dev/sda: 320GB    
    Model: ATA OCZ-AGILITY3 (scsi)    Disk /dev/sdb: 60.0GB    
    Model: ATA WDC WD10EARS-00Y (scsi)    Disk /dev/sdc: 1000GB    
    Model: SanDisk Cruzer Blade (scsi)    Disk /dev/sdd: 4005MB    
    Model: SanDisk Extreme (scsi)    Disk /dev/sde: 32.0GB    
    Model: JetFlash Transcend 16GB (scsi)    Disk /dev/sdf: 15.8GB    
    Live drive: /dev/sdb
    USB drive:  /dev/sdd: 4004 MB, 4004511744 bytes
    USB drive:  /dev/sde: 32.0 GB, 32017047552 bytes
    USB drive:  /dev/sdf: 15.8 GB, 15812526080 bytes
     
    ---> 1: install to SanDisk Cruzer Blade (scsi) Disk /dev/sdd: 4005MB
         2: install to SanDisk Extreme (scsi) Disk /dev/sde: 32.0GB
         3: install to JetFlash Transcend 16GB (scsi) Disk /dev/sdf: 15.8GB
    Select another device with (+/-) or the number of the list item.
    Go ahead with (g) or quit with (q). Toggle USB-only with (u).
    2
         1: install to SanDisk Cruzer Blade (scsi) Disk /dev/sdd: 4005MB
    ---> 2: install to SanDisk Extreme (scsi) Disk /dev/sde: 32.0GB
         3: install to JetFlash Transcend 16GB (scsi) Disk /dev/sdf: 15.8GB
    Select another device with (+/-) or the number of the list item.
    Go ahead with (g) or quit with (q). Toggle USB-only with (u).
    g
    2: source: saucy-desktop-i386.iso
       target: SanDisk Extreme (scsi) Disk /dev/sde: 32.0GB 
    Do you really want to wipe and install to this device? (y/n)
    'Do you really want to wipe and install to this device? (y/n)' is the last warning. If you answer y (and press the Enter key), the source file will be cloned to the target device.

    This interface is borrowed from the One Button Installer, version 0.6 and 0.7.

    Version 4 works well not only in graphical desktops with terminal windows, but also in text screens (for example in a server). It can manage img.xz files (compressed with xz with ~20% better compression than gzip).
    Last edited by sudodus; November 11th, 2013 at 09:50 AM.

Page 1 of 7 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •