Crear y usar una imagen viva de instalación

Chase Lau, The Fedora Docs Team Version unknown Last review: 2019-10-05

Descargar Fedora

Usted puede descargar Fedora desde https://getfedora.org/.

Hay múltiples escritorios disponibles para usar con Fedora. Cada uno tiene una apariencia y sensaciones ligeramente diferente y ofrecen diversos niveles de personalización. Puede usar la imagen Fedora Workstation, que trae de modo predeterminado el escritorio GNOME y cambiar su entorno posteriormente instalando paquetes adicionales, o puede descargar una imagen spin que le brindará un entorno diferente listo para usar. Visite Fedora Spins para más información.

También se puede aprovechar de Fedora Labs. Fedora Labs es una selección de paquetes de software seleccionados y de contenidos específicos mantenidos por miembros de la Comunidad Fedora. Estos pueden instalarse como versiones completas independientes de Fedora o como complementos en instalaciones Fedora existentes. Más detalles Fedora Labs. @

Vea, por favor, la Guía de Inicio de Fedora para obtener ayudas sobre el proceso de instalación de Fedora.

Creación y uso de un USB vivo

Puede escribir todas las imágenes ISO de Fedora en un lápiz USB, hacer esto es una manera conveniente, en cualquier ordenador con arranque desde USB, de instalar Fedora o de probar un entorno Fedora vivo sin escribir en el disco duro del ordenador. Necesitará un lápiz USB que sea al menos tan grande como la imagen que desee escribir.

Usar Fedora Media Writer

La herramienta oficial y soportada para crear un lápiz USB Fedora es la utilidad Fedora Media Writer, anteriormente conocida como LiveUSB Creator. Vea la guía Fedora Media Writer en la descripción general de la Documentación de Usuario de Fedora.

Fedora Media Writer destruye todos los datos del lápiz USB. Si necesita un método de escritura no destructivo (para preservar los datos existentes en su lápiz USB) o soporte para la 'persistencia de datos', puede usar la utilidad livecd-iso-to-disk sobre Fedora.

Usar GNOME Disks

Este método destruirá todos los datos en el lápiz USB. Si necesita un método de escritura no destructivo (para preservar los datos existentes en su lápiz USB) y/o soporte para la 'persistencia de datos', puede usar la utilidad livecd-iso-to-disk en Fedora.

Este método se considera no soportado. Puede usarlo bajo su propio riesgo.

Este método es para personas que ejecuten Linux u otro unix con GNOME, Nautilus y la Utilidad GNOME Disk instalados. Particularmente, si está usando una distribución distinta de Fedora que no soporte Flatpak, este puede ser el método más fácil disponible. Una instalación estándar de Fedora o una instalación estándar de GNOME de muchas otras distribuciones será capaz de usar este método. En Fedora, compruebe que están instalados los paquetes nautilus y gnome-disk-utility. Pueden estar disponibles para otros escritorios herramientas gráficas de escritura directa similares o puede usar el método de línea de comando direct write.

  1. Descargue una imagen Fedora, elija un lápiz USB que no contenga ningún dato y conéctelo.

  2. Ejecute Nautilus (Archivos), abra la Vista General presionando la tecla Start/Super, teclee Archivos y pulse kbd:[Enter].

  3. Busque la imagen descargada, pulse con el botón derecho sobre ella, vaya a Abrir Con y pulse Montador de imágenes de disco.

  4. Seleccione su lápiz USB como el Destino y pulse Iniciar la Restauración.

Métodos de línea de comandos

Estos métodos se consideran no soportados. Puede usarlos bajo su responsabilidad.

Usar la herramienta livecd-iso-to-disk

Este método destruirá todos los datos en el lápiz USB if the --format parameter is passed.

El método livecd-iso-to-disk es ligeramente menos fiable que Fedora Media Writer y se puede usar solo con confianza desde dentro de Fedora: no funciona en Windows o macOS, y no está soportado (y normalmente fallará) en distribuciones no Fedora. Sin embargo, soporta tres características avanzadas que FMW no incluye:

  1. Puede usar un método no destructivo para crear el lápiz, lo que significa que los archivos existentes en el lápiz no serán destruidos. Esto es menos fiable que los métodos de escritura destructivos y debe usarse solo si no tiene un lápiz que pueda permitirse limpiar.

  2. En las imágenes vivas, puede incluir una función llamada superposición persistente que permite que los cambios realizados persistan durante los reinicios. Puede realizar actualizaciones como una instalación normal sobre disco duro, excepto que las actualizaciones del kernel requieren una intervención manual y que el espacio de superposición puede ser insuficiente. Sin una superposición persistente el lápiz volverá a un estado nuevo cada vez que se inicie.

  3. En las imágenes vivas, también puede tener un área separada para almacena información de la cuenta de usuario y datos como documentos y archivos descargados, con cifrado opcional para mayor seguridad y tranquilidad.

Al combinar estas funciones, puede llevar su ordenador en su bolsillo y arrancarla en casi cualquier sistema que esté usando.

No es una buena idea intentar escribir una nueva versión de Fedora usando un livecd-iso-to-disk de una versión mucho más antigua de Fedora: es mejor usar una versión como máximo dos más antigua que la que está intentando escribir.

Compruebe que el paquete livecd-tools está instalado: dnf install livecd-tools.

Recuerde identificar el primer nombre del dispositivo lápiz USB. En todos los caso, puede añadir el parámetro --efi para que el dispositivo pueda arrancar en modo UEFI nativo. La información de utilización detallada está disponible ejecutando: livecd-iso-to-disk --help o man livecd-iso-to-disk.

Para hacer que un lápiz USB arranque como imagen Fedora, sin borrar ningún dato en él, asegure que el dispositivo USB no está montado antes de ejecutar los siguiente y dé la contraseña de root cuando se le pida:

# livecd-iso-to-disk Fedora-Workstation-Live-x86_64-39-1.1.iso /dev/sdX

En caso de que no sea posible arrancar desde un disco creado con el método mostrado arriba, antes de volver a particionar y formatear, a menudo funciona, para permitir el inicio, el restablecer el registro de inicio maestro:

# livecd-iso-to-disk --reset-mbr Fedora-Workstation-Live-x86_64-39-1.1.iso /dev/sdX
Usar la opción --format en el siguiente comando borrará todos los datos en el dispositivo USB.

Si es necesario puede volver a particionar livecd-iso-to-disk y volver a formatear el dispositivo de destino:

# livecd-iso-to-disk --format --reset-mbr Fedora-Workstation-Live-x86_64-39-1.1.iso /dev/sdX

Para incluir un sistema de archivos persistente para /home, use el parámetro --home-size-mb. Por ejemplo:

# livecd-iso-to-disk --home-size-mb 2048 Fedora-Workstation-Live-x86_64-39-1.1.iso /dev/sdX

Esto creará un sistema de archivos de 2 Gb que será montado como /home cada vez que arranque el lápiz, permitiendo que preserve los datos en /home a través de los inicios.

Para habilitar el soporte de 'persistencia de datos' - de modo que los cambios que haga en todo el entorno vivo persistan a través de los inicios - añada el parámetro --overlay-size-mb para añadir un área de almacenamiento persistente de datos en el lápiz objetivo. Por ejemplo:

# livecd-iso-to-disk --overlay-size-mb 2048 Fedora-Workstation-Live-x86_64-39-1.1.iso /dev/sdX

Aquí, 2048 es el tamaño deseado (en megabytes) de la superposición. La herramienta livecd-iso-to-disk no aceptará un tamaño de superposición mayor de 4095 para VFAT, pero los sistemas de archivos ext[234] solo están limitados por el espacio disponible.

Debido a la manera en la que está implementado actualmente, cada sencillo cambio a esta forma de superposición, escribe Y borra, resta de su espacio libre por lo que, eventualmente se "agotará" y su memoria USB ya no arrancará. Puede usar el estado de dmsetup``live-rw para ver cuanto espacio se mantiene en la superposición.

La salida contendrá algo así como una instantánea 42296/204800, indicando que 42296 de 204800 sectores de 512 bytes están asignados. Debido a estas limitaciones es aconsejable usar la persistencia system-level con moderación, solo para cambios de configuración y actualizaciones de seguridad importantes. O, si tiene suficiente espacio de disco disponible, los cambios en la instantánea del sistema raíz de LiveOS se pueden fusionar en una nueva copia del sistema de archivos raíz.

Puede combinar --home-size-mb y --overlay-size-mb, en cuyo caso los datos escritos en /home no agotarán la superposición persistente.

Usar un método de escritura directa

Este método destruirá todos los datos en el lápiz USB. Si necesita un método de escritura no destructivo (para preservar los datos existentes en su lápiz USB) y/o soporte para la 'persistencia de datos', puede usar la utilidad livecd-iso-to-disk en Fedora.

Este método escribe la imagen al lápiz USB de forma muy parecida a Fedora Media Writer o la Utilidad de Disco GNOME, pero usa una utilidad de línea de comando denominada dd. Como los otros métodos de escritura directa, destruirá todos los datos en el lápiz y no soporta las funciones avanzadas como persistencia de datos, pero es un método muy fiable. La herramienta dd está disponible en la mayoría de los sistemas operativos de formato Unix, incluyendo las distribuciones Linux y macOS y tiene disponible un puerto Windows. Este puede ser su mejor método si no usa Fedora Media Writer o la Utilidad de Disco GNOME o solo prefiere utilidades de línea de comandos y desea una forma sencilla y rápida de escribir en un lápiz.

  1. Identifique el nombre de la partición del dispositivo USB. Si utiliza este método con Windows, con el puerto enlazado anteriormente, el comando dd --list debería proporcionarle el nombre correcto.

  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 umount /dev/sdX*, where X is the appropriate letter, e.g. umount /dev/sdc*.

  3. Write the ISO file to the device:

    # dd if=/path/to/image.iso of=/dev/sdX bs=8M status=progress oflag=direct
  4. Wait until the command completes.

    If you see dd: invalid status flag: 'progress', your dd version doesn’t support the status=progress option and you’ll need to remove it. In this case, you won’t see writing progress.

Using UNetbootin for Windows, macOS, and Linux

Este método se considera no soportado. Puede usarlo bajo su propio riesgo.

UNetbootin may work in some cases but not others - for instance, it will likely create a stick that is bootable in BIOS mode, but not UEFI mode. Fedora cannot guarantee support for UNetbootin-written images.

While your results may vary, it is usually the case that the Fedora Media Writer, livecd-iso-to-disk, GNOME, and 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.
  1. Download the latest UNetbootin version from the official site and install it. On Linux, the download is an executable file: save it somewhere, change it to be executable using chmod ugo+x filename 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 choose the correct device for your stick.

  5. Click OK.

If you do not see sdX listed, you might have to reformat the drive. You can do this from most file manager or disk utility tools, e.g. the GNOME disk utility ("Disks") on Fedora. The FAT32 format is most likely to result in a bootable stick. This will cause you to lose all data on the drive.

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:

# livecd-iso-to-disk /run/initramfs/livedev /dev/sdX"

Booting from USB sticks

Almost all modern PCs can boot from USB sticks. However, how you tell the system to boot from a USB stick varies substantially from system to system. Initially, you can 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.

    If 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 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, F11, F12 or Delete is to be pressed 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. (If this does not work, consult the manual of your computer)

  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.

    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 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 UEFI page. USB sticks written from x86_64 images with Fedora Media Writer, GNOME Disk Utility, dd, other dd-style utilities 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.

Identifying a stick on Linux

Most of the writing methods will require you to know the /dev name for your USB stick, e.g. /dev/sdc, when using them on Linux. You do not need to know this in order to use Fedora Media Writer. To find this out:

  1. Insert the USB stick into a USB port.

  2. Open a terminal and run dmesg.

  3. Near the end of the output, you will see something like:

    [32656.573467] sd 8:0:0:0: [sdX] Attached SCSI removable disk

    sdX will be sdb, sdc, sdd, etc.

This 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.

Troubleshooting a live USB

livecd-iso-to-disk problems

Partition isn’t marked bootable

If you get the message Partition isn’t marked bootable!, you need to mark the partition bootable. To do this, run parted /dev/sdX, and use the toggle N boot 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

If you get the message Need to have a filesystem label or UUID for your USB device, you need to label the partition: dosfslabel /dev/sdX LIVE.

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 --format when writing the stick.

MBR appears to be blank

If your test boot reports a corrupted boot sector, or you get the message MBR appears to be blank., you need to install or reset the master boot record (MBR), by passing --reset-mbr when writing the stick.

livecd-iso-to-disk on other Linux distributions

livecd-iso-to-disk 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 livecd-iso-to-disk on any distribution other than Fedora is unsupported and not expected to work: please use an alternative method, such as Fedora Media Writer.

Testing a USB stick using qemu

You can test your stick using QEMU.

# umount /dev/sdX1
$ qemu -hda /dev/sdX -m 1024 -vga std

Mounting a Live USB filesystem

You can use the liveimage-mount script in the livecd-tools 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.

Creating and using live CD

Getting started

To create a live image, the livecd-creator tool is used. For this, super user privileges are needed.

The livecd-creator tool is part of the _livecd-tools_package. If it is not installed on your system, add it with DNF:

# dnf install livecd-tools spin-kickstarts

If you are interested in localized (i.e. translated into other languages) live CD files, install also l10n-kickstarts.

Configuring the image

The configuration of the live image is defined by a file called kickstart. It can include some basic system configuration items, the package manifest, and a script to be run at the end of the build process.

For the Fedora project, the most important live image configurations files are:

kickstart files for other spins, e.g. Fedora Electronics Lab, can be found in /usr/share/spin-kickstarts/ after installing the spin-kickstarts package. These pre-made configuration files can be a great place to start, as they already have some useful pre and post-installation scripts.

system-config-kickstart

You can create a customized kickstart file by running system-config-kickstart.

You might have to install the package first with dnf install system-config-kickstart.\ This tool is mainly intended for generating kickstart files for automated installs, not live images, so the output will probably not be usable without editing, but it may help you to generate particular kickstart directives. Remember to add the line %include /usr/share/spin-kickstarts/fedora-live-base.ks at the beginning of your kickstart file to include the base live configuration.

Making the image

To make the image, simply issue the following command:

ksflatten -c /usr/share/spin-kickstarts/fedora-live-workstation.ks \
-o fedora-live-workstation-flat.ks
livecd-creator --verbose \
--config=fedora-live-workstation-flat.ks \
--fslabel=Fedora-LiveCD \
--cache =/var/cache/live

The name given by --fs-label is used:

  • As a file system label on the ext3 and iso9660 file systems. As such, it’s visible on the desktop as the CD name.

  • In the isolinux boot loader.

If you have the repositories available locally and don’t want to wait for the download of packages, just substitute the URLs listed in the configuration file to point to your local repositories.

If you have an x86_64 machine you’re building on but you want a 32-bit happy iso image, add the following before your livecd-creator command:

setarch i686 livecd-creator [...]

Examples

Spinning the Fedora desktop

The following command:

ksflatten -c /usr/share/spin-kickstarts/fedora-live-workstation.ks \
-o fedora-live-workstation-flat.ks
livecd-creator --verbose \
--config=fedora-live-workstation-flat.ks \
--fslabel=Fedora-LiveCD \
--cache=/var/cache/live

This will create a live CD called Fedora-LiveCD using the fedora-live-workstation.ks configuration file.

A Barebones live CD

The following command:

livecd-creator --verbose \
--config=/usr/share/doc/livecd-tools-$(rpm -q livecd-tools --qf "%{VERSION}")/livecd-fedora-minimal.ks \
--cache=/var/cache/live

This will create a live CD that will boot to a login prompt.

Testing your live CD using KVM or qemu

QEMU running Fedora 17

As root:

# qemu-kvm -m 2048 -vga qxl -cdrom filename.iso

If you do not have KVM support, you have to use qemu instead.

# qemu-system-x86_64 -m 2048 -vga qxl -cdrom filename.iso

Replace filename.iso with the name of your created Live CD image and qemu-system-x86_64 with an appropriate qemu binary for the target system, e.g. qemu-system-i386.

Live image media verification

The live image can incorporate functionality to verify itself. To do so, you need to have isomd5sum installed both on the system used for creating the image and installed into the image. This is so that the implantisomd5 and checkisomd5 utilities can be used. These utilities take advantage of embedding an md5sum into the application area of the iso9660 image. This then gets verified before mounting the real root filesystem.