I currently have kernel version: 4.14.79-v7+ (and I am using Raspbian Stretch)
pi@pi:~ $ uname -a
Linux pi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
When I try to update and upgrade my system the packages raspberrypi-bootloader raspberrypi-kernel get upgraded:
root@pi:/etc/kernel/postinst.d# sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
base-files bluez-firmware curl dirmngr gnupg gnupg-agent gpgv hostapd influxdb libc-bin libc-dev-bin libc-l10n libc6 libc6-dbg libc6-dev libcurl3
libcurl3-gnutls libmosquitto1 libpam-systemd libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 libssl1.0.2 libsystemd0 libudev1
libwbclient0 libxapian30 locales mosquitto mosquitto-clients multiarch-support openssh-client openssh-server openssh-sftp-server openvpn python3-six
raspberrypi-bootloader raspberrypi-kernel raspi-config raspi-copies-and-fills samba-common ssh systemd systemd-sysv tzdata udev wireless-regdb
wpasupplicant
49 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 145 MB of archives.
After this operation, 810 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
...
The upgrade shows no suspicious warnings or errors (I omitted it here, as it is really long) and the returncode of the upgrade command is 0. BUT: The kernel upgrade was not successful as uname still shows the old version number.
pi@pi:~ $ uname -a
Linux pi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
But if I have a look e.g. in /lib/modules, there are only folders for the new version
pi@pi:/etc/kernel/postinst.d $ ls -l /lib/modules
total 8
drwxr-xr-x 3 root root 4096 Mar 14 10:47 4.14.98+
drwxr-xr-x 3 root root 4096 Mar 14 10:47 4.14.98-v7+
I am not the first one describing this problem, e.g. in Linux modules mismatch version the same problem occurred. The threads solution (sudo apt-get update; sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel
) did not help me. But another user gave me a hint what might cause the problem: He also had problems because of his modified /boot/cmdline.txt. Mine is also modified, as my system is full-disc encrypted (I enabled the encryption like it was shown in this tutorial).
My /boot/cmdline.txt looks like this: dwc_otg.lpm_enable=0 console=tty1 root=/dev/mapper/sdcard rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait cryptdevice=/dev/mmcblk0p2:sdcard
Can anyone help me how to fix my problems, the problem is that after the upgrade I am not able to build my custom initramfs as I am getting the following error because my system is still looking for the old kernel files:
mkinitramfs -o /boot/initramfs.gz
WARNING: missing /lib/modules/4.14.79-v7+
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.14.79-v7+: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_ePmCvg/lib/modules/4.14.79-v7+/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_ePmCvg/lib/modules/4.14.79-v7+/modules.builtin: No such file or directory
This is a huge problem because I use a very custom initramfs and as long as I am not able to build the initramfs my system will not boot correctly after the system upgrade.