canonical / core-initrd

initrd implementation in ubuntu core
https://ubuntu.com/core/docs
GNU General Public License v3.0
10 stars 29 forks source link

ubuntu-core-initramfs fails in oracular: /etc needs to be created before ldconfig is run #254

Open tjaalton opened 2 months ago

tjaalton commented 2 months ago

Hi,

Installing kernels (with u-c-i installed) on oracular fails as ldconfig fails to run:

Processing triggers for linux-image-unsigned-6.10.0-20-generic (6.10.0-20.20) ...
/etc/kernel/postinst.d/ubuntu-core-initramfs:
/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: No such file or directory
Traceback (most recent call last):
  File "/usr/bin/ubuntu-core-initramfs", line 875, in <module>
    main()
  File "/usr/bin/ubuntu-core-initramfs", line 871, in main
    globals()[args.subcmd.replace("-", "_")](parser, args)
  File "/usr/bin/ubuntu-core-initramfs", line 650, in create_initrd
    install_misc(main, rootfs)
  File "/usr/bin/ubuntu-core-initramfs", line 482, in install_misc
    check_call(["ldconfig", "-r", dest_dir])
  File "/usr/lib/python3.12/subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ldconfig', '-r', '/tmp/tmpg_hc5zl_.ubuntu-core-initramfs/main']' returned non-zero exit status 1.
run-parts: /etc/kernel/postinst.d/ubuntu-core-initramfs exited with return code 1

creating /etc by adding it to the files installed by install_misc makes sure it exists before ldconfig, so it seems as if it used to be included there indirectly by something else.

This is easy to reproduce on a chroot as well.

alfonsosanchezbeato commented 2 months ago

Fix in https://github.com/snapcore/core-initrd/pull/255

valentindavid commented 2 months ago

@tjaalton Make sure you have /etc/initrd-release though. Otherwise your system will not boot. You probably pass --skeleton to a directory that does not really enough to boot.

tjaalton commented 2 months ago

yeah etc/ gets populated later on in create_initrd, and includes etc/initrd-release, so that part is covered