update-initramfs fails: /usr/share/initramfs-tools/hooks/dhcpcd failed wtih return 1

Asked by KcrPL

During the upgrade from Ubuntu 23.04 to Ubuntu 23.10 everything went fine except the last part where update-initramfs is being ran on the new kernel (6.5.0-1005-raspi).

Currently I restarted, everything seems to be working stable however I'm still on kernel 6.2.0-1014-raspi. Here's the error log when I run sudo apt upgrade:

`
kcrpl@raspberrypi-4-kcrpl:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.142ubuntu15) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-6.5.0-1005-raspi (6.5.0-1005.7) ...
Processing triggers for initramfs-tools (0.142ubuntu15) ...
update-initramfs: Generating /boot/initrd.img-6.2.0-1014-raspi
E: /usr/share/initramfs-tools/hooks/dhcpcd failed with return 1.
update-initramfs: failed for /boot/initrd.img-6.2.0-1014-raspi with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-6.5.0-1005-raspi (6.5.0-1005.7) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 6.5.0-1005-raspi
 * dkms: autoinstall for kernel 6.5.0-1005-raspi
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.5.0-1005-raspi
E: /usr/share/initramfs-tools/hooks/dhcpcd failed with return 1.
update-initramfs: failed for /boot/initrd.img-6.5.0-1005-raspi with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-6.5.0-1005-raspi (--configure):
 installed linux-image-6.5.0-1005-raspi package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
 linux-image-6.5.0-1005-raspi
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
`

I tried everything, purging initramfs-tools-core config etc. - nothing worked. I'm stuck on 6.2.0 until I can fix this.

Best regards.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
KcrPL
Solved:
Last query:
Last reply:
Revision history for this message
KcrPL (kcrpl) said :
#1
Revision history for this message
KcrPL (kcrpl) said :
#2

As a temporary solution I have moved /usr/share/initramfs-tools/hooks/dhcpcd out of the folder and update-initramfs has succeeded.
After restarting, I'm on kernel 6.5.0 and I have access to the Internet.

Can I leave it like this or is there a way to fix this?
(P.S: sudo netplan apply results in "Cannot call Open vSwitch: ovsdb-server.service is not running." Can I ignore this?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Make sure you update the bug KcrPL gave to say it affects you as well as your fix.

Revision history for this message
KcrPL (kcrpl) said :
#4