Mate 18.04.1 on Raspberry pi 3 - broken modules

Hello,
I run a remote observatory for a couple of years with Pi 3 using Mate but recently it crashed, the SD card was corrupt. I recovered a backup of the data partition and cloned it to a clean boot partition.

It boots and all my setup and data :slight_smile: is there but I have issues with drivers and the modules specifically the wifi and ath9k.

Here is outline:

>     mate@RPi2:~$ uname -r
>     4.15.0-1032-raspi2
> 
>     mate@RPi2:~$  apt-cache search linux-firmware*
>     linux-firmware - Firmware for Linux kernel drivers
>     linux-firmware-raspi2 - Raspberry Pi 2/3/4 GPU firmware and bootloaders
> 
>     mate@RPi2:~$ sudo depmod
>     depmod: WARNING: could not open /lib/modules/4.15.0-1032-raspi2/modules.order: No such file or directory
>     depmod: WARNING: could not open /lib/modules/4.15.0-1032-raspi2/modules.builtin: No such file or directory
>     mate@RPi2:~$ sudo ls -la /lib/modules/4.15.0-1032-raspi2/
>     total 32
>     drwxr-xr-x 2 root root 4096 févr. 23 11:25 .
>     drwxr-xr-x 7 root root 4096 févr. 23 10:45 ..
>     lrwxrwxrwx 1 root root   41 févr.  6  2019 build -> /usr/src/linux-headers-4.15.0-1032-raspi2
>     -rw-r--r-- 1 root root   45 févr. 23 11:25 modules.alias
>     -rw-r--r-- 1 root root   12 févr. 23 11:25 modules.alias.bin
>     -rw-r--r-- 1 root root    0 févr. 23 11:25 modules.builtin.bin
>     -rw-r--r-- 1 root root    0 févr. 23 11:25 modules.dep
>     -rw-r--r-- 1 root root   12 févr. 23 11:25 modules.dep.bin
>     -rw-r--r-- 1 root root    0 févr. 23 11:25 modules.devname
>     -rw-r--r-- 1 root root   55 févr. 23 11:25 modules.softdep
>     -rw-r--r-- 1 root root   49 févr. 23 11:25 modules.symbols
>     -rw-r--r-- 1 root root   12 févr. 23 11:25 modules.symbols.bin

I noticed an issue in the kernel number

mate@RPi2:~$ modprobe brcmfmac
modprobe: ERROR: ../libkmod/libkmod.c:514 lookup_builtin_file() could not open builtin file '/lib/modules/4.15.0-1032-raspi2/modules.builtin.bin'
modprobe: FATAL: Module brcmfmac not found in directory /lib/modules/4.15.0-1032-raspi2
mate@RPi2:~$ sudo depmod
depmod: WARNING: could not open /lib/modules/4.15.0-1032-raspi2/modules.order: No such file or directory
depmod: WARNING: could not open /lib/modules/4.15.0-1032-raspi2/modules.builtin: No such file or directory
mate@RPi2:~$ 
mate@RPi2:~$ sudo dpkg --configure -a
Setting up linux-image-4.15.0-1055-raspi2 (4.15.0-1055.59) ...
Processing triggers for linux-image-4.15.0-1055-raspi2 (4.15.0-1055.59) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-1055-raspi2
E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.15.0-1055-raspi2 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.15.0-1055-raspi2 (--configure):
 installed linux-image-4.15.0-1055-raspi2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-1055-raspi2

Could anyone guide me on how to correct the modules error?

Thanks, Andrew