#3137 Issue open: Failed to create rescue image on Ubuntu 22.04 with ERROR: Module pata not found

schlomo opened issue at 2024-01-26 09:33:

Found in current master:

Copying only currently loaded kernel modules (MODULES contains 'loaded_modules') and those in MODULES_LOAD
ERROR: pata loaded or to be loaded but no module file?
Some latest log messages since the last called script 400_copy_modules.sh:
  scsi_transport_spi
  vmxnet3
  i2c_piix4
  pata_acpi'
  modinfo: ERROR: Module pata not found.
  modinfo: ERROR: Module pata not found.
  readlink: missing operand
  Try 'readlink --help' for more information.

The root cause is the way how we read the modules to be loaded in initramfs:
https://github.com/rear/rear/blob/58d6ec23941557af097def87ea25b13d340f834a/usr/share/rear/rescue/GNU/Linux/220_load_modules_from_initrd.sh#L36-L40

The sed there means to take only the module name and ignore comment lines and module args. However, it lacks _ (underscore) and mangles all module names with underscore:

root@linux-03:~# cat /etc/initramfs-tools/modules
#
# Examples:
# List of modules that you want to include in your initramfs.
# Syntax:  module_name [args ...]
# They will be loaded at boot time in the order below.
# You must run update-initramfs(8) to effect this change.
# raid1
# sd_mod
ahci
libahci
mptbase
mptscsih
mptspi
pata_acpi
scsi_transport_spi
root@linux-03:~# sed -n -e 's/^\([a-z0-9]\+\).*/\1/p' < /etc/initramfs-tools/modules
ahci
libahci
mptbase
mptscsih
mptspi
pata
scsi

The part that really confuses me is why this worked before???

Anyway, fixing it is simple: Add _ to the sed expression 😄


[Export of Github issue for rear/rear.]