Documentation for a newer release is available. View Latest

Actualizando Manualmente el Kernel

indexterm:[kernel,upgrading the kernel]indexterm:[kernel,package]indexterm:[kernel,RPM package]indexterm:[package,kernel RPM] El kernel Fedora es el kernel hecho a medida por el equipo Fedora para asegurar su integridad y compatibilidad con el hardware soportado. Antes de que el kernel sea liberado debe pasar primero un riguroso conjunto de pruebas de garantía de calidad.

Los kernel Fedora están empaquetados en formato RPM para que sean fáciles de actualizar y verificar usando los administradores de paquetes DNF o PackageKit. PackageKit consulta automáticamente a los repositorios DNF y le informa de los paquetes que tienen actualizaciones disponibles, incluyendo los paquetes kernel..

Este capítulo es, por lo tanto, solo útil para los usuarios que necesitan actualizar manualmente un paquete kernel usando el comando rpm en lugar del comando dnf.

Utilice DNF para instalar núcleos siempre que sea posible

Siempre que sea posible, utilice o DNF o el administrador de paquetes PackageKit para instalar un nuevo núcleo porque ellos siempre instalan un nuevo núcleo en lugar de reemplazar el actual algo que podría, potencialmente, dejar su sistema incapaz de arrancar.

Para más información sobre la instalación de paquetes de kernel con DNF vea Actualizando Paquetes.

Visión General de los Paquetes de Núcleo

Fedora contiene los siguientes paquetes de núcleo:

  • kernel — Contiene el núcleo para sistemas únicos, multinúcleo y multiprocesador.

  • kernel-debug — Contiene un núcleo con numerosas opciones de depuración habilitadas para el diagnóstico del núcleo, con el coste de un rendimiento reducido.

  • kernel-devel — Contiene las cabeceras del núcleo y los makefiles suficientes para construir módulos contra el paquete kernel.

  • kernel-debug-devel — Contiene la versión de desarrollo del núcleo con numerosas opciones de depuración habilitadas para diagnóstico del núcleo, con el coste de un rendimiento reducido.

  • kernel-headers — Incluye los ficheros de cabecera C que especifican la interfaz entre el núcleo Linux y las librerías y programas del espacio de usuario. Los ficheros de cabecera definen estructuras y constantes que son necesarias para la construcción de la mayoría de los programas estándar.

  • linux-firmware — Contiene todos los ficheros de firmware que son requeridos por los diversos dispositivos para trabajar.

  • perf — Este paquete contiene scripts de apoyo y documentación para la herramienta perf enviada en cada subpaquete de imagen de núcleo.

  • kernel-abi-whitelists — Contiene información relacionada con la ABI del núcleo de Fedora, incluyendo una lista de los símbolos de núcleo que son necesarios por los módulos de núcleo externos de Linux y un complemento de dnf para ayudar a la aplicación.

  • kernel-tools — Contiene herramientas para la manipulación del núcleo Linux y documentación de apoyo.

Preparando la Actualización

Antes de actualizar el núcleo, se recomienda dé algunos pasos preventivos.

Primero, asegure que tiene un medio de arranque funcional para el sistema en caso de que ocurra un problema. Si el cargador de arranque no está configurado apropiadamente para arrancar el nuevo núcleo, usted puede usar este medio para arrancar Fedora.

Los medios USB vienen con frecuencia en forma de dispositivos flash a veces llamados pen drives, thumb disks o keys o como dispositivos de disco duro externamente conectados. Casi todos los medios de este tipo están formateados como sistemas de archivos VFAT. Puede crear su medio USB arrancable sobre un medio formateado como ext2, ext3, ext4 o VFAT.

Puede transferir un fichero imagen de distribución o un fichero imagen mínimo de arranque a un medio USB. Asegure que hay suficiente espacio libre disponible en el dispositivo. Se requiere alrededor de 4 GB para imagen de distribución DVD, alrededor de 700 MB para imagen de distribución CD o alrededor de 10 MB para imagen mínima de medio de arranque.

Usted debe tener una copia del archivo boot.iso de un DVD de instalación de Fedora o del CD-ROM#1 de instalación y necesita una dispositivo de almacenamiento USB formateado con el sistema de archivos VFAT y alrededor de 16 MB de espacio libre. El siguiente procedimiento no afectará a los archivos existentes en el dispositivo de almacenamiento USB a nos ser que tengan los mismos nombre de ruta que los ficheros que usted vaya a copiar en él. Para crear el medio de arranque USB ejecute los siguientes comandos como usuario root:

  1. Instalar el cargador de arranque SYSLINUX en el dispositivo de almacenamiento USB:

    ~]# syslinux /dev/sdX1

    …​donde sdX es el nombre del dispositivo.

  2. Crear los puntos de montaje para boot.iso y el dispositivo de almacenamiento USB:

    ~]# mkdir /mnt/isoboot /mnt/diskboot
  3. Montar boot.iso:

    ~]# mount -o loop boot.iso /mnt/isoboot
  4. Montar el dispositivo de almacenamiento USB:

    ~]# mount /dev/sdX1 /mnt/diskboot
  5. Copiar los archivos ISOLINUX desde boot.iso al dispositivo de almacenamiento USB:

    ~]# cp /mnt/isoboot/isolinux/* /mnt/diskboot
  6. Usar el archivo isolinux.cfg del boot.iso como el archivo syslinux.cfg para el dispositivo USB:

    ~]# grep -v local /mnt/isoboot/isolinux/isolinux.cfg > /mnt/diskboot/syslinux.cfg
  7. Desmonte boot.iso y el dispositivo de almacenamiento USB:

    ~]# mkdir /mnt/isoboot /mnt/diskboot
  8. Usted debería reinicia la máquina con el medio de arranque y verificar que es capaz de arrancar con él antes de continuar.

Alternativamente, sobre sistemas con dispositivo de disco flexible, usted puede crear un disquete de arranque instalando el paquete mkbootdisk y ejecutando el comando mkbootdisk como root. Vea la página de manual man mkbootdisk después de instalar el paquete para información de utilización.

To determine which kernel packages are installed, execute the command dnf list installed "kernel-*" at a shell prompt. The output will comprise some or all of the following packages, depending on the system’s architecture, and the version numbers might differ:

~]# dnf list installed "kernel-*"
Last metadata expiration check performed 0:28:51 ago on Tue May 26 21:22:39 2015.
Installed Packages
kernel-core.x86_64                      4.0.3-300.fc22                @System
kernel-core.x86_64                      4.0.4-300.fc22                @System
kernel-core.x86_64                      4.0.4-301.fc22                @System
kernel-headers.x86_64                   4.0.4-301.fc22                @System
kernel-modules.x86_64                   4.0.3-300.fc22                @System
kernel-modules.x86_64                   4.0.4-300.fc22                @System
kernel-modules.x86_64                   4.0.4-301.fc22                @System

From the output, determine which packages need to be downloaded for the kernel upgrade. For a single processor system, the only required package is the kernel package. See Overview of Kernel Packages for descriptions of the different packages.

Downloading the Upgraded Kernel

There are several ways to determine if an updated kernel is available for the system.

  • Via Fedora Update System — Download and install the kernel RPM packages. For more information, refer to https://bodhi.fedoraproject.org/.

  • Via DNF using check-update:

dnf check-update --enablerepo=updates-testing

To install the kernel manually, continue to Performing the Upgrade.

Performing the Upgrade

After retrieving all of the necessary packages, it is time to upgrade the existing kernel.

Keep the old kernel when performing the upgrade

It is strongly recommended that you keep the old kernel in case there are problems with the new kernel.

At a shell prompt, change to the directory that contains the kernel RPM packages. Use -i argument with the rpm command to keep the old kernel. Do not use the -U option, since it overwrites the currently installed kernel, which creates boot loader problems. For example:

~]# rpm -ivh kernel-kernel_version.arch.rpm

The next step is to verify that the initial RAM disk image has been created. See Verifying the Initial RAM Disk Image for details.

Verifying the Initial RAM Disk Image

The job of the initial RAM disk image is to preload the block device modules, such as for IDE, SCSI or RAID, so that the root file system, on which those modules normally reside, can then be accessed and mounted. On Fedora 31 systems, whenever a new kernel is installed using either the DNF, PackageKit, or RPM package manager, the Dracut utility is always called by the installation scripts to create an initramfs (initial RAM disk image).

On all architectures other than IBM eServer System i (see Verifying the Initial RAM Disk Image and Kernel on IBM eServer System i), you can create an initramfs by running the dracut command. However, you usually don’t need to create an initramfs manually: this step is automatically performed if the kernel and its associated packages are installed or upgraded from RPM packages distributed by The Fedora Project.

On architectures that use the GRUB 2 boot loader, you can verify that an initramfs corresponding to your current kernel version exists and is specified correctly in the /boot/grub2/grub.cfg configuration file by following this procedure:

Verifying the Initial RAM Disk Image
  1. As root, list the contents in the /boot/ directory and find the kernel (vmlinuz-kernel_version) and initramfs-kernel_version with the latest (most recent) version number:

    Ejemplo 1. Ensuring that the kernel and initramfs versions match
    ~]# ls /boot/
    config-3.17.4-302.fc21.x86_64
    config-3.17.6-300.fc21.x86_64
    config-3.17.7-300.fc21.x86_64
    efi
    elf-memtest86+-5.01
    extlinux
    grub2
    initramfs-0-rescue-db90b4e3715b42daa871351439343ca4.img
    initramfs-3.17.4-302.fc21.x86_64.img
    initramfs-3.17.6-300.fc21.x86_64.img
    initramfs-3.17.7-300.fc21.x86_64.img
    initrd-plymouth.img
    lost+found
    memtest86+-5.01
    System.map-3.17.4-302.fc21.x86_64
    System.map-3.17.6-300.fc21.x86_64
    System.map-3.17.7-300.fc21.x86_64
    vmlinuz-0-rescue-db90b4e3715b42daa871351439343ca4
    vmlinuz-3.17.4-302.fc21.x86_64
    vmlinuz-3.17.6-300.fc21.x86_64
    vmlinuz-3.17.7-300.fc21.x86_64
    • we have three kernels installed (or, more correctly, three kernel files are present in the /boot/ directory),

    • the latest kernel is vmlinuz-3.17.7-300.fc21.x86_64, and

    • an initramfs file matching our kernel version, initramfs-3.17.7-300.fc21.x86_64.img, also exists.

      initrd files in the /boot/ directory are not the same as initramfs files

      In the /boot/ directory you might find several initrd-kernel_versionkdump.img files. These are special files created by the kdump mechanism for kernel debugging purposes, are not used to boot the system, and can safely be ignored. For more information on kdump, see the Red Hat Enterprise Linux 7 Kernel Crash Dump Guide.

  2. (Optional) If your initramfs-kernel_version file does not match the version of the latest kernel in /boot, or, in certain other situations, you might need to generate an initramfs file with the Dracut utility. Simply invoking dracut as root without options causes it to generate an initramfs file in the /boot/ directory for the latest kernel present in that directory:

    ~]# dracut

    You must use the --force option if you want dracut to overwrite an existing initramfs (for example, if your initramfs has become corrupt). Otherwise dracut will refuse to overwrite the existing initramfs file:

    ~]# dracut
    F: Will not override existing initramfs (/boot/initramfs-3.17.7-300.fc21.x86_64.img) without --force

    You can create an initramfs in the current directory by calling dracut initramfs_name kernel_version, for example:

    ~]# dracut "initramfs-$(uname -r).img" $(uname -r)

    If you need to specify specific kernel modules to be preloaded, add the names of those modules (minus any file name suffixes such as .ko) inside the parentheses of the add_dracutmodules="module more_modules" directive of the /etc/dracut.conf configuration file. You can list the file contents of an initramfs image file created by dracut by using the lsinitrd initramfs_file command:

    ~]# lsinitrd /boot/initramfs-3.17.7-300.fc21.x86_64.img
    Image: /boot/initramfs-3.17.7-300.fc21.x86_64.img: 18M
    ========================================================================
    Version: dracut-038-31.git20141204.fc21
    [output truncated]

    See man dracut and man dracut.conf for more information on options and usage.

  3. Examine the /boot/grub2/grub.cfg configuration file to ensure that an initramfs-kernel_version.img file exists for the kernel version you are booting. For example:

    ~]# grep initramfs /boot/grub2/grub.cfg
    	initrd16 /initramfs-3.17.7-300.fc21.x86_64.img
    	initrd16 /initramfs-3.17.6-300.fc21.x86_64.img
    	initrd16 /initramfs-3.17.4-302.fc21.x86_64.img
    	initrd16 /initramfs-0-rescue-db90b4e3715b42daa871351439343ca4.img

    See Verifying the Boot Loader for more information on how to read and update the /boot/grub2/grub.cfg file.

Verifying the Initial RAM Disk Image and Kernel on IBM eServer System i

On IBM eServer System i machines, the initial RAM disk and kernel files are combined into a single file, which is created with the addRamDisk command. This step is performed automatically if the kernel and its associated packages are installed or upgraded from the RPM packages distributed by The Fedora Project; thus, it does not need to be executed manually. To verify that it was created, run the following command as root to make sure the /boot/vmlinitrd-kernel_version file already exists:

ls -l /boot/

The kernel_version should match the version of the kernel just installed.

Verifying the Boot Loader

When you install a kernel using rpm, the kernel package creates an entry in the boot loader configuration file for that new kernel. However, rpm does not configure the new kernel to boot as the default kernel. You must do this manually when installing a new kernel with rpm.

It is always recommended to double-check the boot loader configuration file after installing a new kernel with rpm to ensure that the configuration is correct. Otherwise, the system might not be able to boot into Fedora properly. If this happens, boot the system with the boot media created earlier and re-configure the boot loader.

In the following table, find your system’s architecture to determine the boot loader it uses, and then click on the "See" link to jump to the correct instructions for your system.

Table 1. Boot loaders by architecture
Architecture Boot Loader See

x86

GRUB 2

Configuring the GRUB 2 Boot Loader

AMD AMD64 or Intel 64

GRUB 2

Configuring the GRUB 2 Boot Loader

IBM eServer System i

OS/400

Configuring the OS/400 Boot Loader

IBM eServer System p

YABOOT

Configuring the YABOOT Boot Loader

IBM System z

z/IPL

Configuring the GRUB 2 Boot Loader

Fedora 31 is distributed with GRUB 2, which reads its configuration from the /boot/grub2/grub.cfg file. This file is generated by the grub2-mkconfig utility based on Linux kernels located in the /boot directory, template files located in /etc/grub.d/, and custom settings in the /etc/default/grub file and is automatically updated each time you install a new kernel from an RPM package. To update this configuration file manually, type the following at a shell prompt as root:

grub2-mkconfig -o /boot/grub2/grub.cfg

Among various code snippets and directives, the /boot/grub2/grub.cfg configuration file contains one or more menuentry blocks, each representing a single GRUB 2 boot menu entry. These blocks always start with the menuentry keyword followed by a title, list of options, and opening curly bracket, and end with a closing curly bracket. Anything between the opening and closing bracket should be indented. For example, the following is a sample menuentry block for Fedora 21 with Linux kernel 3.17.6-300.fc21.x86_64:

menuentry 'Fedora (3.17.6-300.fc21.x86_64) 21 (Twenty One)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.17.4-301.fc21.x86_64-advanced-effee860-8d55-4e4a-995e-b4c88f9ac9f0' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='hd0,msdos1'  f19c92f4-9ead-4207-b46a-723b7a2c51c8
        else
          search --no-floppy --fs-uuid --set=root f19c92f4-9ead-4207-b46a-723b7a2c51c8
        fi
        linux16 /vmlinuz-3.17.6-300.fc21.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rhgb quiet LANG=en_US.UTF-8
        initrd16 /initramfs-3.17.6-300.fc21.x86_64.img
}

Each menuentry block that represents an installed Linux kernel contains linux and initrd directives followed by the path to the kernel and the initramfs image respectively. If a separate /boot partition was created, the paths to the kernel and the initramfs image are relative to /boot. In the example above, the initrd16 /initramfs-3.17.6-300.fc21.x86_64.img line means that the initramfs image is actually located at /boot/initramfs-3.17.6-300.fc21.x86_64.img when the root file system is mounted, and likewise for the kernel path.

The kernel version number as given on the linux /vmlinuz-kernel_version line must match the version number of the initramfs image given on the initrd /initramfs-kernel_version.img line of each menuentry block. For more information on how to verify the initial RAM disk image, refer to Verifying the Initial RAM Disk Image.

The initrd directive in grub.cfg refers to an initramfs image

In menuentry blocks, the initrd directive must point to the location (relative to the /boot directory if it is on a separate partition) of the initramfs file corresponding to the same kernel version. This directive is called initrd because the previous tool which created initial RAM disk images, mkinitrd, created what were known as initrd files. The grub.cfg directive remains initrd to maintain compatibility with other tools. The file-naming convention of systems using the dracut utility to create the initial RAM disk image is initramfs-kernel_version.img.

For information on using Dracut, refer to Verifying the Initial RAM Disk Image.

After installing a new kernel with rpm, verify that /boot/grub2/grub.cfg is correct and reboot the computer into the new kernel. Ensure your hardware is detected by watching the boot process output. If GRUB 2 presents an error and is unable to boot into the new kernel, it is often easiest to try to boot into an alternative or older kernel so that you can fix the problem. Alternatively, use the boot media you created earlier to boot the system.

Causing the GRUB 2 boot menu to display

If you set the GRUB_TIMEOUT option in the /etc/default/grub file to 0, GRUB 2 will not display its list of bootable kernels when the system starts up. In order to display this list when booting, press and hold any alphanumeric key while and immediately after BIOS information is displayed, and GRUB 2 will present you with the GRUB menu.

Configuring the OS/400 Boot Loader

The /boot/vmlinitrd-kernel-version file is installed when you upgrade the kernel. However, you must use the dd command to configure the system to boot the new kernel.

  1. As root, issue the command cat /proc/iSeries/mf/side to determine the default side (either A, B, or C).

  2. As root, issue the following command, where kernel-version is the version of the new kernel and side is the side from the previous command:

    dd if=/boot/vmlinitrd-kernel-version of=/proc/iSeries/mf/side/vmlinux bs=8k

Begin testing the new kernel by rebooting the computer and watching the messages to ensure that the hardware is detected properly.

Configuring the YABOOT Boot Loader

IBM eServer System p uses YABOOT as its boot loader. YABOOT uses /etc/aboot.conf as its configuration file. Confirm that the file contains an image section with the same version as the kernel package just installed, and likewise for the initramfs image:

boot=/dev/sda1 init-message=Welcome to Fedora! Hit <TAB> for boot options
partition=2 timeout=30 install=/usr/lib/yaboot/yaboot delay=10 nonvram
image=/vmlinuz-2.6.32-17.EL
	 label=old
	 read-only
	 initrd=/initramfs-2.6.32-17.EL.img
	 append="root=LABEL=/"
image=/vmlinuz-2.6.32-19.EL
	 label=linux
	 read-only
	 initrd=/initramfs-2.6.32-19.EL.img
	 append="root=LABEL=/"

Notice that the default is not set to the new kernel. The kernel in the first image is booted by default. To change the default kernel to boot either move its image stanza so that it is the first one listed or add the directive default and set it to the label of the image stanza that contains the new kernel.

Begin testing the new kernel by rebooting the computer and watching the messages to ensure that the hardware is detected properly.