quick-docs/en-US/live-usb.adoc

561 lines
22 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

= How to create and use Live USB
'''
[IMPORTANT]
======
This page was automatically converted from https://fedoraproject.org/wiki/How_to_create_and_use_Live_USB
It is probably
* Badly formatted
* Missing graphics and tables that do not convert well from mediawiki
* Out-of-date
* In need of other love
Pull requests accepted at https://pagure.io/fedora-docs/quick-docs
Once you've fixed this page, remove this notice, and update
`_topic_map.yml`.
Once the document is live, go to the original wiki page and replace its text
with the following macro:
....
{{#fedoradocs: https://docs.fedoraproject.org/whatever-the-of-this-new-page}}
....
======
'''
image:mediawriter-icon.png[mediawriter-icon.png,title="mediawriter-icon.png"]
This page explains *how to create and use Fedora USB media*. You can
write all https://getfedora.org/[Fedora ISO images] to a USB stick,
making this a convenient way on any USB-bootable computer to either
install Fedora or try a 'live' Fedora environment without writing to the
computer's hard disk. You will need a USB stick at least as large as the
image you wish to write.
[[quickstart-using-fedora-media-writer]]
Quickstart: Using Fedora Media Writer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
image:Fedora_Live_USB_creator.png[Fedora Media Writer
screenshot,title="Fedora Media Writer screenshot"]
For most cases, the best tool to create a Fedora USB stick is the
https://github.com/MartinBriza/MediaWriter[Fedora Media Writer] utility,
which was formerly known as LiveUSB Creator. It is available on Fedora,
other Linux distributions using http://flatpak.org/[Flatpak], Windows
and macOS.
Fedora Media Writer is graphical and easy to use. It can download recent
Fedora images for you as well as writing them to the USB stick.
On Fedora, you can use a Fedora graphical software installation tool to
install the package, or use the command line:
On Windows and macOS, you can download the installer from
https://github.com/MartinBriza/MediaWriter/releases[the releases page].
On other Linux distributions, if they support the
http://flatpak.org/[Flatpak] application distribution system, you can
download a flatpak from
https://github.com/MartinBriza/MediaWriter/releases[the releases page].
To run the tool, look for *Fedora Media Writer* in the system menus.
When you start Fedora Media Writer, the three dots in the bottom will be
flashing while the tool checks for a new Fedora release.
To write the stick:
1. Choose which Fedora flavor you want to install or try.
+
::
On the title screen, you can choose Workstation, Server or your own
.iso file. Other choices (including KDE, Cinnamon, Xfce and so on) are
under the "..." button at the bottom of the list.
2. Ensure your USB stick is plugged into the system.
3. Click _Create Live USB_.
4. Ensure the right stick is selected.
5. Click _Write to disk_ and wait for the write to complete.
6. Once the stick has been written, shut the system down and boot it
from the USB stick (see link:#booting[the Booting section]).
After writing, your USB stick will have a changed partition layout and
some systems may report it to be about 10MB large. To return your USB
stick to its factory configuration, insert the drive again while Fedora
Media Writer is running. The app provides you with an option to restore
to the factory layout. This layout includes a single VFAT partition.
__TOC__
[[booting-from-usb-sticks]]
Booting from USB sticks
~~~~~~~~~~~~~~~~~~~~~~~
image:Bios_USB_boot.jpg[Set USB as first boot device. Your BIOS may be
different.,title="Set USB as first boot device. Your BIOS may be different."]
Almost all modern PCs can boot from USB sticks (some very old ones may
not be able to). However, precisely how you tell the system to boot from
a USB stick varies substantially from system to system. First, just try
this:
1. Power off the computer.
2. Plug the USB drive into a USB port.
3. Remove all other portable media, such as CDs, DVDs, floppy disks or
other USB sticks.
4. Power on the computer.
5. If the computer is configured to automatically boot from the USB
drive, you will see a screen that says "Automatic boot in 10 seconds..."
with a countdown (unless you do a native UEFI boot, where you will see a
rather more minimal boot menu).
If the computer starts to boot off the hard drive as normal, you'll need
to manually configure it to boot off the USB drive. Usually, that should
work something like this:
1. Wait for a safe point to reboot.
2. As the machine starts to reboot, watch carefully for instructions on
which key to press (usually a function key, Escape, Tab or Delete) to
enter the boot device selection menu, "BIOS setup", "firmware", or
"UEFI". Press and hold that key. If you miss the window of opportunity
(often only a few seconds) then reboot and try again.
3. Use the firmware ("BIOS") interface or the boot device menu to put
your USB drive first in the boot sequence. It might be listed as a hard
drive rather than a removable drive. Each hardware manufacturer has a
slightly different method for doing so.
+
::
*Be careful!* Your computer could become unbootable or lose
functionality if you change any other settings. Though these settings
can be reverted, you'll need to remember what you changed in order to
do so.
4. Save the changes, exit, and the computer should boot from the USB
drive.
If your system has a link:Unified_Extensible_Firmware_Interface[UEFI]
firmware, it will usually allow you to boot the stick in UEFI native
mode or BIOS compatibility mode. If you boot in UEFI native mode and
perform a Fedora installation, you will get a UEFI native Fedora
installation. If you boot in BIOS compatibility mode and perform a
Fedora installation, you will get a BIOS compatibility mode Fedora
installation. For more information on all this, see the
link:Unified_Extensible_Firmware_Interface[UEFI page]. USB sticks
written from x86_64 images with link:#fmw[Fedora Media Writer],
link:#gnome[GNOME Disk Utility], link:#dd[dd], other dd-style utilities,
and link:#litd[livecd-iso-to-disk] with should be UEFI native bootable.
Sticks written with other utilities may not be UEFI native bootable, and
sticks written from i686 images will never be UEFI bootable.
[[checking-usb-disk-size-free-space]]
Checking USB disk size / free space
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As noted before, the disk must have a certain amount of storage space
depending on the image you select. If you use a destructive method, the
stick must be at least the size of the image; if you use a
non-destructive method, it must have at least that much free space.
Whichever operating system you are using, you can usually check this
with a file manager, usually by right clicking and selecting
_Properties_. Here is a screenshot of how this looks on GNOME:
image:Properties_USB_size.png[thumb|350px|none]
[[identifying-a-stick-by-name-on-linux]]
Identifying a stick by name on Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Most of the link:#writing[alternative writing methods] will require you
to know the name for your USB stick - e.g. - when using them on Linux.
You do not need to know this in order to use link:#fmw[Fedora Media
Writer]. To find this out:
1. Insert the USB stick into a USB port.
2. Open a terminal and run .
3. Near the end of the output, you will see something like:
....
[32656.573467] sd 8:0:0:0: [sdX] Attached SCSI removable disk
....
where sdX will be sdb, sdc, sdd, etc. *Take note of this label* as it is
the name of the disk you will use. We'll call it _sdX_ from now on. If
you have connected more than one USB stick to the system, be careful
that you identify the correct one - often you will see a manufacturer
name or capacity in the output which you can use to make sure you
identified the correct stick.
[[alternative-usb-stick-writing-methods]]
Alternative USB stick writing methods
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As explained above, the recommended method for writing the stick in most
cases is link:#fmw[Fedora Media Writer]. In this section, other tools
which may be useful in specific circumstances are documented.
[[using-gnome-disk-utility-linux-graphical-destructive]]
Using GNOME Disk Utility (Linux, graphical, destructive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This method is for people running Linux (or another *nix) with GNOME,
Nautilus and the GNOME Disk Utility installed. Particularly, if you are
using a distribution other than Fedora which does not support Flatpak,
this may be the easiest available method. A standard installation of
Fedora, or a standard GNOME installation of many other distributions,
should be able to use this method. On Fedora, ensure the packages and
are installed. Similar graphical direct-write tools may be available for
other desktops, or you may use the link:#dd[command line "direct write"
method].
1. Download a Fedora image, choose a USB stick that does not contain
any data you need, and connect it
2. Run Nautilus (Files) - for instance, open the Overview by pressing
the Start/Super key, and type _Files_, then hit enter
3. Find the downloaded image, right-click on it, go to *Open With*, and
click *Disk Image Writer*
4. Double-check you're really, really sure you don't need any of the
data on the USB stick!
5. Select your USB stick as the *Destination*, and click *Start
Restoring...*
[[command-line-method-using-the-livecd-iso-to-disk-tool-fedora-only-non-graphical-both-non-destructive-and-destructive-methods-available]]
Command line method: Using the _livecd-iso-to-disk_ tool (Fedora only,
non-graphical, both non-destructive and destructive methods available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The method is slightly less reliable than Fedora Media Writer and can be
used reliably only from within Fedora: it does not work in Windows or OS
X, and is not supported (and will usually fail) in non-Fedora
distributions. However, it supports three advanced features which FMW
does not include:
1. You may use a _non-destructive_ method to create the stick, meaning
existing files on the stick will not be destroyed. This is less reliable
than the _destructive_ write methods, and should be used only if you
have no stick you can afford to wipe.
2. On live images, you can include a feature called a _persistent
overlay_, which allows changes made to persist across reboots. You can
perform updates just like a regular installation to your hard disk,
except that kernel updates require link:#Kernel_updates[manual
intervention] and link:#limited_overlay[overlay space may be
insufficient]. Without a _persistent overlay_, the stick will return to
a fresh state each time it is booted.
3. On live images, you can also have a separate area to store user
account information and data such as documents and downloaded files,
with optional encryption for security and peace of mind.
By combining these features, you can carry your computer with you in
your pocket, booting it on nearly any system you find yourself using.
It is not a good idea to try and write a new Fedora release using the
version of in a much older Fedora release: it is best to only use a
release a maximum of two versions older than the release you are trying
to write.
Ensure the package is installed:
Basic examples follow. Remember to link:#device[identify your USB
stick's device name] first. In all cases, you can add the parameter to
(try to) render the stick bootable in native UEFI mode. Detailed usage
information is available by running: or .
To make an existing USB stick bootable as a Fedora image - without
deleting any of the data on it - make sure that the USB drive is not
mounted before executing the following, and give the root password when
prompted:
::
In case it is not possible to boot from a disk created with the method
shown above, before re-partitioning and re-formatting, often resetting
the master boot record will enable booting:
::
If necessary, you can have _livecd-iso-to-disk_ re-partition and
re-format the target stick:
::
To include a persistent filesystem for , use the parameter. For example:
::
This will create a 2 GiB filesystem that will be mounted as each time
the stick is booted, allowing you to preserve data in across boots.
To enable 'data persistence' support - so changes you make to the entire
live environment will persist across boots - add the parameter to add a
persistent data storage area to the target stick. For example:
::
where 2048 is the desired size (in megabytes) of the overlay. The
_livecd-iso-to-disk_ tool will not accept an overlay size value greater
than 4095 for VFAT, but for ext[234] filesystems it is only limited by
the available space.
You can combine and , in which case data written to will not exhaust the
persistent overlay.
[[command-line-direct-write-method-most-operating-systems-non-graphical-destructive]]
Command line "direct write" method (most operating systems,
non-graphical, destructive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This method direct writes the image to the USB stick much like
link:#fmw[Fedora Media Writer] or link:#gnome[GNOME Disk Utility], but
uses a command line utility named . Like the other "direct write"
methods, it will destroy all data on the stick and does not support any
of the advanced features like data persistence, but it is a very
reliable method. The tool is available on most Unix-like operating
systems, including Linux distributions and OS X, and
http://www.chrysocome.net/dd[a Windows port is available]. This may be
your best method if you cannot use Fedora Media Writer or GNOME Disk
Utility, or just if you prefer command line utilities and want a simple,
quick way to write a stick.
1. link:#device[Identify the name of the USB drive partition]. If using
this method on Windows, with the port linked above, the command should
provide you with the correct name.
2. *Unmount all mounted partition from that device.* This is very
important, otherwise the written image might get corrupted. You can
umount all mounted partitions from the device with , where X is the
appropriate letter, e.g.
3. Write the ISO file to the device:
+
::
4. Wait until the command completes.
+
::
If you see , your dd version doesn't support the option and you'll
need to remove it (and you won't see writing progress).
[[using-unetbootin-windows-os-x-and-linux-graphical-non-destructive]]
Using http://unetbootin.sourceforge.net/[UNetbootin] (Windows, OS X and
Linux, graphical, non-destructive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
image:Unetbootin_gtk3.png[Unetbootin
screenshot,title="Unetbootin screenshot"]
While your results may vary, it is usually the case that the
link:#fmw[Fedora Media Writer], link:#litd[livecd-iso-to-disk],
link:#gnome[GNOME] and link:#dd[dd] methods give better results than
UNetbootin. If you encounter problems with UNetbootin, please contact
the UNetbootin developers, not the Fedora developers.
UNetbootin is a graphical, bootable USB image creator. Using it will
allow you to preserve any data you have in the USB drive. If you have
trouble booting, however, you may wish to try with a blank, cleanly
FAT32-formatted drive.
If you are running a 64-bit Linux distribution, UNetbootin may fail to
run until you install the 32-bit versions of quite a lot of system
libraries. Fedora cannot help you with this: please direct feedback on
this issue to the UNetbootin developers.
1. Download the latest UNetbootin version from
http://unetbootin.sourceforge.net/[the official site] and install it. On
Linux, the download is an executable file: save it somewhere, change it
to be executable (using or a file manager), and then run it.
2. Launch UNetbootin. On Linux, you might have to type the root
password.
3. Click on *Diskimage* and search for the ISO file you downloaded.
4. Select Type: USB drive and link:#device[choose the correct device
for your stick]
5. Click OK
[[creating-a-usb-stick-from-a-running-live-environment]]
Creating a USB stick from a running live environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you are already running a live CD, DVD, or USB and want to convert
that into a bootable USB stick, run the following command:
::
See link:#Mounting_a_Live_USB_filesystem[this section] for mounting the
root filesystem outside of a boot.
[[troubleshooting]]
Troubleshooting
~~~~~~~~~~~~~~~
[[fedora-media-writer-problems]]
Fedora Media Writer problems
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Bugs can be reported to
https://github.com/MartinBriza/MediaWriter/issues[GitHub] or
https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=mediawriter[Bugzilla].
You can http://bugz.fedoraproject.org/mediawriter[browse existing
Bugzilla reports]. Please report any problems you encounter that have
not already been reported.
[[livecd-iso-to-disk-problems]]
livecd-iso-to-disk problems
^^^^^^^^^^^^^^^^^^^^^^^^^^^
[[partition-isnt-marked-bootable]]
Partition isn't marked bootable!
++++++++++++++++++++++++++++++++
If you get the message , you need to mark the partition bootable. To do
this, run , and use the command, where X is the appropriate letter and N
is the partition number. For example:
....
$ parted /dev/sdb
GNU Parted 1.8.6
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Imation Flash Drive (scsi)
Disk /dev/sdX: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16
(parted) toggle 1 boot
(parted) print
Model: Imation Flash Drive (scsi)
Disk /dev/sdX: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16 boot
(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.
....
[[partitions-need-a-filesystem-label]]
Partitions need a filesystem label!
+++++++++++++++++++++++++++++++++++
If you get the message , you need to label the partition:
[[partition-has-different-physicallogical-endings]]
Partition has different physical/logical endings!
+++++++++++++++++++++++++++++++++++++++++++++++++
If you get this message from fdisk, you may need to reformat the flash
drive when writing the image, by passing when writing the stick.
[[mbr-appears-to-be-blank]]
MBR appears to be blank!
++++++++++++++++++++++++
If your test boot reports a corrupted boot sector, or you get the
message , you need to install or reset the master boot record (MBR), by
passing when writing the stick.
[[livecd-iso-to-disk-on-other-linux-distributions]]
livecd-iso-to-disk on other Linux distributions
+++++++++++++++++++++++++++++++++++++++++++++++
is not meant to be run from a non-Fedora system. Even if it happens to
run and write a stick apparently successfully from some other
distribution, the stick may well fail to boot. Use of on any
distribution other than Fedora is unsupported and not expected to work:
please use an alternative method, such as link:#fmw[Fedora Media
Writer].
[[ubuntus-usb-creator]]
Ubuntu's _usb-creator_
^^^^^^^^^^^^^^^^^^^^^^
Ubuntu and derivative Linux distributions have a program similar to
Fedora Media Writer. This *does not work* with Fedora ISO images, it
silently rejects them. usb-creator requires the ISO to have a Debian
layout, with a file and a casper directory. Do not attempt to use this
utility to write a Fedora ISO image.
[[testing-a-usb-stick-using-qemu]]
Testing a USB stick using qemu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can test your stick using QEMU as shown in the screenshot below.
image:Screenshot_qemu_gtk3.png[`Screenshot_qemu_gtk3.png`,title="Screenshot_qemu_gtk3.png"]
For example, you could type the following commands:
....
su -c 'umount /dev/sdX1'
qemu -hda /dev/sdX -m 1024 -vga std
....
[[mounting-a-live-usb-filesystem]]
Mounting a Live USB filesystem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can use the
https://github.com/livecd-tools/livecd-tools/blob/master/tools/liveimage-mount[_liveimage-mount_]
script in the package to mount an attached Live USB device or other
LiveOS image, such as an ISO or Live CD. This is convenient when you
want to copy in or out some file from the LiveOS filesystem on a Live
USB, or just examine the files in a Live ISO or Live CD.
[[kernel-updates-for-livecd-iso-to-disk-written-images-with-a-persistent-overlay]]
Kernel updates for _livecd-iso-to-disk_-written images with a persistent
overlay
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you have link:#limited_overlay[sufficient overlay space] to
accommodate a kernel update on a Live USB installation, the kernel and
initramfs will be installed to the /boot directory. To put these into
service they must be moved to the /syslinux directory of the
installation partition. This is accessible from the running Live USB
filesystem at the /run/initramfs/live mount point. The new initramfs
(such as initramfs-4.9.13-200.fc25.x86_64.img) and kernel (such as
vmlinuz-4.9.13-200.fc25.x86_64) should be moved to replace the
/run/initramfs/live/syslinux/initrd.img and
/run/initramfs/live/syslinux/vmlinuz files, respectively.
* *Note*: _dracut_ no longer includes the _dmsquash-live_ module by
default. Starting with Fedora 19, _dracut_ defaults to the option, which
precludes the _dmsquash-live_ module. So, one can add a dracut config
file, as root, before updating the kernel:
....
echo 'hostonly="no"
add_dracutmodules+=" dmsquash-live "' > /etc/dracut.conf.d/01-liveos.conf
....
The following commands will move the new kernel and initramfs files to
the device's /syslinux directory:
....
bootpath=run/initramfs/live/syslinux
new=4.9.13-200.fc25.x86_64
cd /
mv -f boot/vmlinuz-$new ${bootpath}/vmlinuz
mv -f boot/initramfs-${new}.img ${bootpath}/initrd.img
....
[[multi-live-image-boot-installations]]
Multi Live Image boot installations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The _livecd-iso-to-disk_ --multi option allows one to install more than
one LiveOS image on a single device. Version 24.2 or greater of will
automatically configure the device boot loader to give a Multi Live
Image Boot Menu for the device.
Category:LiveMedia
'''
See a typo, something missing or out of date, or anything else which can be
improved? Edit this document at https://pagure.io/fedora-docs/quick-docs.