To add to #14 comment, a file in /var/lib/initramfs-tools also gets generated if the host kernel differs from the chroot environments kernel.
In my case I'm running a Debian system with the 4.9.0-6-amd64 kernel and a Ubuntu (Xenial) chroot environment with the 4.4.0-127-generic kernel. When installing the nvidia-384 package inside the chroot environment the /var/lib/initramfs-tools/4.9.0-6-amd64 file gets generated.
# ls -l /initrd.img
lrwxrwxrwx 1 root root 29 Apr 5 11:31 /initrd.img -> boot/initrd.img-4.9.0-6-amd64
# ls -l /target/initrd.img
lrwxrwxrwx 1 root root 33 Jun 8 23:03 /target/initrd.img -> boot/initrd.img-4.4.0-127-generic
# ls -l /target/var/lib/initramfs-tools/
total 8
-rw-r--r-- 1 root root 77 Jun 8 23:06 4.4.0-127-generic
-rw-r--r-- 1 root root 73 Jun 8 23:08 4.9.0-6-amd64
(/target is the chroot environment)
The /var/lib/initramfs-tools/4.9.0-6-amd64 file is dangerous since update-initramfs will think that it's a valid existing kernel and produce errors as the following that will prevent updating the initrd in the future.
# chroot /target
sh-4.3# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.9.0-6-amd64
WARNING: missing /lib/modules/4.9.0-6-amd64
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.9.0-6-amd64: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_s6nF9f/lib/modules/4.9.0-6-amd64/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_s6nF9f/lib/modules/4.9.0-6-amd64/modules.builtin: No such file or directory
To add to #14 comment, a file in /var/lib/ initramfs- tools also gets generated if the host kernel differs from the chroot environments kernel.
In my case I'm running a Debian system with the 4.9.0-6-amd64 kernel and a Ubuntu (Xenial) chroot environment with the 4.4.0-127-generic kernel. When installing the nvidia-384 package inside the chroot environment the /var/lib/ initramfs- tools/4. 9.0-6-amd64 file gets generated.
# ls -l /initrd.img img-4.9. 0-6-amd64 img-4.4. 0-127-generic var/lib/ initramfs- tools/
lrwxrwxrwx 1 root root 29 Apr 5 11:31 /initrd.img -> boot/initrd.
# ls -l /target/initrd.img
lrwxrwxrwx 1 root root 33 Jun 8 23:03 /target/initrd.img -> boot/initrd.
# ls -l /target/
total 8
-rw-r--r-- 1 root root 77 Jun 8 23:06 4.4.0-127-generic
-rw-r--r-- 1 root root 73 Jun 8 23:08 4.9.0-6-amd64
(/target is the chroot environment)
The /var/lib/ initramfs- tools/4. 9.0-6-amd64 file is dangerous since update-initramfs will think that it's a valid existing kernel and produce errors as the following that will prevent updating the initrd in the future.
# chroot /target img-4.9. 0-6-amd64 4.9.0-6- amd64 4.9.0-6- amd64: No such file or directory mkinitramfs_ s6nF9f/ lib/modules/ 4.9.0-6- amd64/modules. order: No such file or directory mkinitramfs_ s6nF9f/ lib/modules/ 4.9.0-6- amd64/modules. builtin: No such file or directory
sh-4.3# update-initramfs -u
update-initramfs: Generating /boot/initrd.
WARNING: missing /lib/modules/
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/
depmod: WARNING: could not open /var/tmp/