Thanks for providing that script Sam. Jamie has nailed the problem in Comment #2. A *seemingly* obvious solution is to add code to the /etc/kernel/postinst.d/kdump-tools hook that detects when it is running in a chroot, and if so, exits before trying to make an initramfs. When the real system boots, the kdump-tools should detect that no initramfs for the running kernel exists, and it can generate a proper one at that time.
There are 2 tools in Debian/Ubuntu that packages use to detect if you are running in a chroot - `ischroot` and `systemd-detect-virt --chroot`. So I asked the team to test this out: https://salsa.debian.org/dannf/kdump-tools/-/commit/2b70360d6aeaa0874e2cbd917f39e3fcaa3f56be This seems to DTRT. But it appears not to work with your cm-chroot-sw- img script. That script fools both chroot detection tools. This is due to the use of `unshare --mount-proc`. I believe this is because that causes unshare to place everything in a new mount namespace, whereas these tools rely on pid 1's "/" being different than the chroot'd "/" to detect the chroot. If you'd be able to remove --mount-proc, then we can look into adding such code. An alternative option is to add a diversion for /etc/kernel/postinst.d/kdump-tools before installing packages in your chroot: $ sudo dpkg-divert --divert /etc/kernel/postinst.d/kdump-tools.disabled \ --rename /etc/kernel/postinst.d/kdump-tools run-parts won't exec hooks with a "." in the name, so this will prevent the hook from firing until the diversion is later removed. You can add this diversion whether or not kdump-tools is installed. If the diversion is in place, it will rename the file for you automatically when you do install kdump-tools. Once you are done installing packages, you can then remove the diversion to re-enable the hook: $ sudo dpkg-divert --rename --remove /etc/kernel/postinst.d/kdump-tools Removing 'local diversion of /etc/kernel/postinst.d/kdump-tools to /etc/kernel/postinst.d/kdump-tools.disabled' -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-nvidia in Ubuntu. https://bugs.launchpad.net/bugs/2043059 Title: Installation errors out when installing in a chroot Status in linux-nvidia package in Ubuntu: New Bug description: Processing triggers for linux-image-5.15.0-1040-nvidia (5.15.0-1040.40) ... /etc/kernel/postinst.d/dkms: * dkms: running auto installation service for kernel 5.15.0-1040-nvidia ...done. /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-5.15.0-1040-nvidia cryptsetup: WARNING: Couldn't determine root device W: Couldn't identify type of root file system for fsck hook cp: cannot stat '/etc/iscsi/initiatorname.iscsi': No such file or directory /etc/kernel/postinst.d/kdump-tools: kdump-tools: Generating /var/lib/kdump/initrd.img-5.15.0-1040-nvidia mkinitramfs: failed to determine device for / mkinitramfs: workaround is MODULES=most, check: grep -r MODULES /var/lib/kdump/initramfs-tools Error please report bug on initramfs-tools Include the output of 'mount' and 'cat /proc/mounts' update-initramfs: failed for /var/lib/kdump/initrd.img-5.15.0-1040-nvidia with 1. run-parts: /etc/kernel/postinst.d/kdump-tools exited with return code 1 dpkg: error processing package linux-image-5.15.0-1040-nvidia (--configure): installed linux-image-5.15.0-1040-nvidia package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: linux-image-5.15.0-1040-nvidia E: Sub-process /usr/bin/dpkg returned an error code (1) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2043059/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp