MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.81k stars 494 forks source link

Migration script causes failure to load device overlays on RPi 4B #6816

Open Kreeblah opened 9 months ago

Kreeblah commented 9 months ago

Creating a bug report/issue

Required Information

Additional Information (if applicable)

Steps to reproduce

  1. I have a GPS-based time server set up, per the instructions I wrote at https://github.com/Kreeblah/DietPiTimeServer
  2. After using dietpi-update to update to 8.25.1, I used the migration script per the instructions at https://github.com/MichaIng/DietPi/issues/6676#issuecomment-1856412915

Expected behaviour

Actual behaviour

Extra details

I do, however, see the PPS driver (which I have being loaded from /etc/modules) being loaded if I run dmesg | grep pps:

[    0.059924] pps_core: LinuxPPS API ver. 1 registered
[    0.059933] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>

So, it seems to be confined to the overlay part.

MichaIng commented 9 months ago

If the device tree overlay is loaded, /etc/modules(-load.d) entries shouldn't be required, since the overlays trigger the driver load.

So indeed it seems this overlay is broken with the new kernel packages. We'll need to have a look at and in case report it here: https://github.com/raspberrypi/linux/issues

Kreeblah commented 9 months ago

Yep, the overlays for these not working is the only thing that makes sense to me for what's causing the issue here.

I grabbed some additional info on this (in case it helps folks track it down) since I reflashed the microSD card with a fresh DietPi image. When I don't run the migration script, this is what I get for dmesg | grep pps:

[    0.060548] pps_core: LinuxPPS API ver. 1 registered
[    0.060558] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    2.049581] pps pps0: new PPS source pps@12.-1
[    2.049660] pps pps0: Registered IRQ 37 as PPS source

And those PPS source lines are missing afterwards. Similarly, running dmesg | grep rtc before I run the script gets me:

[    2.938576] rtc-rv3028 1-0052: registered as rtc0
[    2.939998] rtc-rv3028 1-0052: setting system clock to 2023-12-25T06:18:05 UTC (1703485085)

But it doesn't find any lines afterwards. Similarly, running i2cdetect -y 1 afterwards gets me this:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- 42 -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- 52 -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

That shows something (the RTC) is detected at 0x52, but the driver isn't loaded because the overlay hasn't been applied. When it's loaded (before running the migration script), that shows UU instead of 52 there.

Joulinar commented 9 months ago

How does it behaves on latest RPi OS 64 bit? Important to ensure all apt packages updated to latest version.

Kreeblah commented 9 months ago

How does it behaves on latest RPi OS 64 bit? Important to ensure all apt packages updated to latest version.

That's a good question. Interestingly enough, it works there. I just flashed a microSD card with the current minimal 64-bit RPi OS available in the imaging program, upgraded all the packages on it, and ran through installing/configuring it for my GPS hat, and it does detect the PPS device and RTC as I'd expect when getting things configured (using /boot/firmware/config.txt instead of /boot/config.txt).

root@ntp:~# uname -a
Linux ntp 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
root@ntp:~# ls /dev/pps0
/dev/pps0
root@ntp:~# ls /dev/rtc0
/dev/rtc0

So, just in case it was an issue with my previous installation, I just tried reflashing the current DietPi Bookworm image, unmarked the rpi-eeprom package so I could upgrade it, upgraded that package, ran the migration script, and then went through setting things up the same way I did on RPi OS, and I'm getting the same results as before. The PPS and RTC overlays aren't being applied and /dev/pps0 and /dev/rtc0 aren't being created.

Kreeblah commented 8 months ago

There's followup at https://github.com/MichaIng/DietPi/issues/6676#issuecomment-1870313108 and https://github.com/MichaIng/DietPi/issues/6676#issuecomment-1871731055 if anybody finds this later and is looking for context. Seems to be a case of the old kernel package removing some of the overlay files when it gets purged.