Posts by Pretoriano

    I've found this PR for RPi - > https://github.com/raspberrypi/linux/pull/4832 <- and i may attempt to port it to kernel 5.15.y, but i wonder if anything else is required on LibreELEC to "just work" or it may require some other userland stuff (considering that LibreELEC is a slimmed down OS).

    Am asking mostly because i merged that on LE10 (5.10.y)and did a quick test, but unfortunately it didn't worked out of the box, meaning that fstrim only worked after tinkering with udev rules.

    Just finished testing on LE10,it's all good with your RTC fix.

    Code
    LibreELEC (HiassofT): devel-20220328220759-4d9d4e2 (RPi4.arm)
    LibreELEC:~ # journalctl | grep rtc-ds1307
    Mar 29 00:02:39 LibreELEC kernel: rtc-ds1307 1-0068: registered as rtc0
    Mar 29 00:02:39 LibreELEC kernel: rtc-ds1307 1-0068: setting system clock to 2022-03-28T21:02:39 UTC (1648501359)

    Tried to reproduce this on my RPi4, but i couldn't.

    LibreELEC - LE 10.2

    Raspberry - RPi4 8GB rev. 1.4

    Overclock - CPU 1800MHz GPU 600 Mhz

    Tested :

    - inputstream.adaptive VP9 (SW) - Netflix stream

    - drmprime HEVC (HW) - local video

    - ff-h264 drm_prime (HW) - local video

    bcmstat - ovorclock is working

    Code
    22:14:21 1800Mhz  600Mhz    0Mhz 33.10C (36.51C) 12,106   4,546,123     101,927
    22:14:23 1800Mhz  600Mhz    0Mhz 33.10C (36.51C) 13,138   4,985,402     113,389
    22:14:25 1800Mhz  600Mhz    0Mhz 34.08C (36.51C) 14,350   5,559,116     125,401
    22:14:27  900Mhz  499Mhz    0Mhz 33.10C (36.51C) 11,662   5,026,492     100,140
    22:14:29  900Mhz  499Mhz    0Mhz 32.62C (36.51C) 10,341   4,619,576      82,231^C
    Peak Values: IRQ: 17612, RX: 7546972, TX: 158784

    config.txt

    The forum complained about a censored word (really?) so on arm_b00st replace 00 with oo

    Perfect, thanks!

    The "slow update" issue is new, on older LE11 builds update was very quick.

    That kernel bug was fixed so it will be easy to check if that's the cause.

    If it's still there, i will enable the cmdline debug. And i have several USB - SATA adapters to test.

    Hopefully i will be able to find as many bugs i can with LE11, which probably will enter a "feature freeze" at some point! xD

    Nope, no changes from me, those lines are there even after a clean install of LE11.

    I don't remember if those were there prior to the systemd bump.

    Another strange thing is that manually updating takes a lot longer than older LE11 builds and i'm using a SSD here. After "Update Kernel 100%" it seems to get stuck there for minutes.

    Let me know if there's a way to debug the update process and will check.

    Yes, i will test it tomorrow and will return with feedback.

    BTW, while i was testing the RTC thing, i noticed these 3 lines during shutdown :

    Code
    systemd-shutdown[1]:Failed to set timeout to 10min:Invalid argument
    
    failed to unmount /flash:Device or resource busy
    
    systemd-shutdown[1]:Failed to finalize file systems, loop devices, ignoring.

    Ok,after more testing i managed to gather more informations.

    1) It seems that LibreELEC it's using busybox's hwclock

    2) Libreelec use /usr/lib/udev/rules.d/80-clock.rules but current hwclock can't handle that command

    Code
    ACTION=="add", SUBSYSTEM=="rtc", RUN+="/sbin/hwclock --hctosys --utc --rtc=/dev/%k"
    ACTION=="add", ENV{MAJOR}=="10", ENV{MINOR}=="135", RUN+="/sbin/hwclock --hctosys --utc --rtc=/dev/%k"

    3) I disabled hwclock in busybox target configuration and enabled it in sys-utils

    4) With the new hwclock binary the command works just fine

    5) However the 80-clock.rules still fails so i had to use systemd as a workaround.

    Code
    LibreELEC:~ # journalctl -b -o short-precise | grep hwclock
    Mar 11 09:33:35.753542 LibreELEC systemd-udevd[339]: rtc0: Process '/sbin/hwclock --hctosys --utc --rtc=/dev/rtc0' failed with exit code 1.
    Mar 11 09:33:45.004166 LibreELEC systemd[1]: Starting hwclock-start to read rtc and write to system clock...
    Mar 27 20:42:27.001309 LibreELEC systemd[1]: hwclock-start.service: Deactivated successfully.
    Mar 27 20:42:27.001775 LibreELEC systemd[1]: Finished hwclock-start to read rtc and write to system clock.

    6) Initially i used After= sysinit.target but again,hwclock failed and i managed to get it working only after using After= kodi.target

    Code
    [Unit]
    Description=hwclock-start to read rtc and write to system clock
    After= kodi.target
    
    [Service]
    Type=oneshot
    ExecStart=/sbin/hwclock --hctosys --utc --rtc=/dev/rtc0
    
    [Install]
    WantedBy=basic.target

    This workaround was just for testing and it work indeed,but it would be much better if we managed to fix the udev rule.

    These days,while checking various logs i noticed that all the logs from before the network time sync are wrong (that's normal,RPi doesn't have RTC) so i remembered that i still have a DS3231 module around the house and decided to hook it to my RPi4.

    So after adding dtoverlay=i2c-rtc,ds3231 and rebooting LibreELEC i proceed with the hwclock .using hwclock -w and rebooted ,this time with no network cable attached,but unfortunately the time and date were completely wrong.

    Code
    LibreELEC:~ # journalctl | grep hwclock
    Mar 11 09:33:35 LibreELEC systemd-udevd[336]: rtc0: Process '/sbin/hwclock --hctosys --utc --rtc=/dev/rtc0' failed with exit code 1.
    Code
    LibreELEC:~ # hwclock --hctosys --utc --rtc=/dev/rtc0
    hwclock: settimeofday: Invalid argument

    And this is the hwclock -r  output.notice that RTC time is UTC

    Quote

    LibreELEC:~ # hwclock -r

    Sun Mar 27 12:18:34 2022 0.000000 seconds

    To make sure that everything is fine with the hw,i tested the module on Raspbian OS (bullseye) and there everything worked as intended (see image),after rebooting the OS without network ,RTC time (UTC) was used and adjusted according to my TZ.

    Note: I also tested on LE 10.2 and it's not working either.