Skip to Content

initramfs (Dracut) Referencia de comandos

A partir de Ubuntu 26.04, la herramienta de compilación initramfs cambió de initramfs-tools a Dracut. Los comandos diarios cambian en consecuencia: los antiguos update-initramfs y lsinitramfs se reemplazan por dracut y lsinitrd, y el directorio de configuración pasa a ser /etc/dracut.conf.d/.

Note

Los sistemas actualizados a 26.04 aún pueden conservar initramfs-tools, en cuyo caso los comandos antiguos seguirán funcionando. Las instalaciones nuevas utilizan Dracut de forma predeterminada. Confirme con which dracut / dracut --version.

Mapeo de comandos

Antiguo (initramfs-herramientas)Nuevo (Dracut)Descripción
sudo update-initramfs -usudo dracut -fReconstruya initramfs para el kernel actual (-f sobrescribe el archivo existente)
sudo update-initramfs -u -k allsudo dracut -f --regenerate-allReconstrucción para todos los kernels instalados
sudo update-initramfs -u -k $(uname -r)sudo dracut -f --kver $(uname -r)Compilación para una versión específica del kernel
lsinitramfs /boot/initrd.img-$(uname -r)lsinitrdListar archivos incluidos en initramfs
lsinitramfs … | grep xxxlsinitrd | grep xxxComprobar si un módulo/archivo está empaquetado
/etc/initramfs-tools//etc/dracut.conf.d/Directorio de configuración
/etc/initramfs-tools/modulesforce_drivers+=" MODULE " (en conf.d)Forzar la inclusión de un módulo del kernel

Operaciones comunes

# Rebuild the initramfs for the current kernel sudo dracut -f # Rebuild for all installed kernels (common after changing drivers, encryption, resume, etc.) sudo dracut -f --regenerate-all # Build for a specific kernel version to a specific path sudo dracut -f /boot/initrd.img-7.0.0-10-generic 7.0.0-10-generic

Inspeccionando el initramfs

# View the contents of the current kernel's initramfs (defaults to the current kernel) lsinitrd # Inspect a specific file lsinitrd /boot/initrd.img-$(uname -r) # Confirm whether a kernel module is packed in (e.g. resume, encryption, NIC driver) lsinitrd | grep -i resume lsinitrd | grep -i nvme

Configurando Dracut

La configuración de Dracut se encuentra en los archivos *.conf en /etc/dracut.conf.d/. Los cambios solo entran en vigor después de reconstruir initramfs.

# Example: force-pack certain drivers into the initramfs echo 'force_drivers+=" nvme nvme_core "' | sudo tee /etc/dracut.conf.d/90-nvme.conf sudo dracut -f --regenerate-all

Opciones de configuración comunes:

# /etc/dracut.conf.d/zz-local.conf # Pack only modules needed by this host (smaller, the default behavior) hostonly="yes" # Force-include specific kernel drivers force_drivers+=" MODULE " # Add specific dracut modules (such as crypt, lvm, network) add_dracutmodules+=" crypt lvm " # Include extra executables in the initramfs install_items+=" /usr/bin/vi "
Tip

Después de cambiar la reanudación (hibernación), el cifrado del disco o el controlador del controlador que contiene el sistema de archivos raíz, recuerde ejecutar sudo dracut -f --regenerate-all o es posible que el sistema no arranque.

Artículos relacionados

Last updated on