GNU/Linux >> Tutoriales Linux >  >> Cent OS

CentOS / RHEL 7:Cómo extraer la imagen de initramfs y editarla/verla

En algunos casos, es posible que desee extraer el archivo de imagen initramfs para comprobar el contenido integrado. Esta publicación proporciona los pasos para extraer archivos de imagen de initramfs para RHEL 7. A diferencia de la versión anterior, en RHEL 7, al usar el comando cpio para el archivo de imagen de initramfs, no se extraerán todos los archivos (o se generará algún error). Por ejemplo:

# ls -la /boot/initramfs-$(uname -r).img
-rw------- 1 root root 19602671 Feb  4  2016 /boot/initramfs-3.10.0-229.el7.x86_64.img
# file initramfs-3.10.0-229.el7.x86_64.img
initramfs-3.10.0-229.el7.x86_64.img: gzip compressed data, from Unix, last modified: Thu Feb  4 16:02:04 2016, max compression
# gzip -dc initramfs-3.10.0-229.el7.x86_64.img | cpio -id      --- will not extract all files or will give some error

Para extraerlo en RHEL7, use skipcpio :
1. copie el archivo de imagen initramfs en algún directorio.

# mkdir /tmp/initramfs
# cp /boot/initramfs-3.10.0-229.el7.x86_64.img

2. extraiga el contenido usando /usr/lib/dracut/skipcpio comando:

# cd /tmp/initramfs
# /usr/lib/dracut/skipcpio initramfs-3.10.0-229.el7.x86_64.img | zcat | cpio -ivd
.
var
var/lock
var/run
lib

donde skipcpio es la herramienta integrada de dracut .

Lista del contenido de la imagen initramfs

Para enumerar solo el contenido de un archivo de imagen initramfs, puede ejecutar lsinitrd :

# lsinitrd /boot/initramfs-3.10.0-229.el7.x86_64.img  | more
Image: /boot/initramfs-3.10.0-229.el7.x86_64.img: 19M
========================================================================
Version: dracut-033-359.el7

Arguments: -f

dracut modules:
bash
nss-softokn
i18n
network
ifcfg
drm
plymouth
dm
kernel-modules
lvm
resume
rootfs-block
terminfo
udev-rules
biosdevname
systemd
usrmount
base
fs-lib
shutdown
========================================================================
drwxr-xr-x  12 root     root            0 May 23 10:27 .
crw-r--r--   1 root     root       5,   1 May 23 10:27 dev/console
crw-r--r--   1 root     root       1,  11 May 23 10:27 dev/kmsg
crw-r--r--   1 root     root       1,   3 May 23 10:27 dev/null
CentOS / RHEL 6:Cómo extraer la imagen de initramfs y editarla/verla


Cent OS
  1. Cómo instalar TeamViewer en CentOS 6 / RHEL 6

  2. Cómo instalar MariaDB en CentOS 7 / RHEL 7

  3. Cómo instalar Python 3.5 en CentOS/RHEL y Fedora

  4. CentOS / RHEL 7:Cómo eliminar una imagen de rescate usando grubby

  5. Cómo Reconstruir los “initramfs” con Multipath en CentOS/RHEL 6 y 7

Cómo restablecer la contraseña de root perdida en CentOS 8 / RHEL 8

Cómo instalar MariaDB en CentOS 6 / RHEL 6

Cómo instalar y usar Firewalld en CentOS / RHEL

Cómo instalar Samba en RHEL y CentOS Stream

Cómo instalar y configurar Jenkins en CentOS 8 / RHEL 8

CentOS / RHEL 7:Cómo restablecer la contraseña de root