Raspberry Pi 4: clock sync issue prevent Yunohost to update after fresh install

My YunoHost server

Hardware: Raspberry Pi 4B at home
YunoHost version: 11.0.10.2 (stable).
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

I’m doing a fresh install of Yunohost on a Raspberry Pi 4B. I completed the post-install setup.

Problem #1: The date and time is set nearly 1 year in the past. So I manually updated the date. I also had to use raspi-config to setup the time zone.

Problem #2: I can’t update YNH.

Error displayed:

YunoHost a rencontré une erreur interne
Vraiment désolé de cela.
Vous devez chercher de l'aide sur le forum ou le chat pour corriger la situation, ou signaler le bug sur le bugtracker.
Les informations suivantes peuvent être utiles à la personne qui vous aide :

Erreur: "500"

Action: "PUT" /yunohost/api/update/all

Message d'erreur :
Impossible de mettre à jour le cache APT (gestionnaire de paquets Debian). Voici un extrait du fichier sources.list qui pourrait vous aider à identifier les lignes problématiques :
sources.list:deb http://deb.debian.org/debian bullseye main contrib non-free
sources.list:deb http://security.debian.org/debian-security bullseye-security main contrib non-free
sources.list:deb http://deb.debian.org/debian bullseye-updates main contrib non-free
sources.list.d/raspi.list:deb http://archive.raspberrypi.org/debian/ bullseye main
sources.list.d/extra_php_version.list:deb https://packages.sury.org/php/ bullseye main
sources.list.d/yunohost.list:deb [signed-by=/usr/share/keyrings/yunohost-archive-keyring.gpg] http://forge.yunohost.org/debian/ bullseye stable

Pendant le traitement de l'action, le serveur a dit :
Récupération des mises à jour disponibles pour les paquets du système...
W: GPG error: https://packages.sury.org/php bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B188E2B695BD4743
E: The repository 'https://packages.sury.org/php bullseye InRelease' is not signed.

I tried to SSH connect and update with sudo apt update:

Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://forge.yunohost.org/debian bullseye InRelease           
Hit:3 http://deb.debian.org/debian bullseye InRelease               
Get:4 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease       
Get:6 https://packages.sury.org/php bullseye InRelease [7,551 B]    
Get:7 http://security.debian.org/debian-security bullseye-security/main arm64 Packages [254 kB]
Err:6 https://packages.sury.org/php bullseye InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B188E2B695BD4743
Get:8 http://security.debian.org/debian-security bullseye-security/main armhf Packages [256 kB]
Reading package lists... Done 
W: GPG error: https://packages.sury.org/php bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B188E2B695BD4743
E: The repository 'https://packages.sury.org/php bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Any idea??

(vous pouvez répondre dans la langue de votre choix) :wink:

Hmkay then let’s try to re-fetch sury’s apt key with :

(as root, after for example sudo -i)

wget --timeout 900 --quiet "https://packages.sury.org/php/apt.gpg" --output-document=- | gpg --dearmor >"/etc/apt/trusted.gpg.d/extra_php_version.gpg"
2 Likes

Seems like it worked. I was able to fetch the list of packages to update and it’s now updating!

Thanks!

PS: Should I maybe file a bug report about this?

My guess is that some network error happened during the postinstall (or install maybe idk) so it’s gonna be difficult to reproduce and fix this bug unless you have the install / postinstall log

I think the 2 problems are related. The Pi couldn’t connect and get certificate because the clock was off by nearly a year?

By the way, the NTP service still isn’t working properly after the update. This isn’t the first time that I had time issues after installing YNH on the Pi 4. See: Ajuster automatiquement la date et l'heure

But this time, the solution from that old conversation doesn’t work. Here are my outputs:

# timedatectl status
               Local time: Mon 2023-11-27 11:25:56 EST
           Universal time: Mon 2023-11-27 16:25:56 UTC
                 RTC time: n/a
                Time zone: America/Montreal (EST, -050…
System clock synchronized: no
              NTP service: n/a
          RTC in local TZ: no
# sudo timedatectl set-ntp true
Failed to set ntp: NTP not supported
# sudo service systemd-timesyncd status 
● systemd-timesyncd.service
     Loaded: masked (Reason: Unit systemd-timesyncd.se>
     Active: inactive (dead)

Any idea how to fix this?

bump
Any idea why the clock doesn’t auto-sync and how to fix it?

Is it normal that systemd-timesyncd.service is masked?

$ sudo systemctl start systemd-timesyncd.service
Failed to start systemd-timesyncd.service: Unit systemd-timesyncd.service is masked.

On my server, I do not have exactly this service, but time-sync.target is inactive.

The service handling the time service is ntp.service

~ sudo systemctl status ntp.service  
● ntp.service - Network Time Service
     Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/ntp.service.d
             └─ynh-override.conf
     Active: active (running) since Tue 2023-12-12 11:08:43 CET; 6 days ago
       Docs: man:ntpd(8)
   Main PID: 6132 (ntpd)
      Tasks: 2 (limit: 4542)
     Memory: 1.3M
        CPU: 1min 34.538s
     CGroup: /system.slice/ntp.service
             └─6132 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 125:131
1 Like

Was that something you manually changed @Mamie ?

It seems I have the same thing…

$ systemctl status ntp.service 
● ntp.service - Network Time Service
     Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor p>
    Drop-In: /etc/systemd/system/ntp.service.d
             └─ynh-override.conf
     Active: active (running) since Sun 2023-12-17 00:14:20 EST; 1 day >
       Docs: man:ntpd(8)
    Process: 7323 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exit>
   Main PID: 7330
      Tasks: 2 (limit: 3933)
        CPU: 32.348s
     CGroup: /system.slice/ntp.service
             └─7330 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 121:127

However, it seems that it can’t get a sync: in /var/log/daemon.log, I have a ton of those:

Dec 18 17:40:34 yuno ntpd[7330]: Soliciting pool server 93.113.207.65
Dec 18 17:40:55 yuno ntpd[7330]: Soliciting pool server 2a01:e0a:b44:1250:a447:b6ff:fee7:569e
Dec 18 17:41:04 yuno ntpd[7330]: Soliciting pool server 82.64.45.50
Dec 18 17:41:24 yuno ntpd[7330]: Soliciting pool server 164.132.80.137
Dec 18 17:41:41 yuno ntpd[7330]: Soliciting pool server 129.151.225.244
Dec 18 17:42:01 yuno ntpd[7330]: Soliciting pool server 2001:19f0:6801:7ed::123
Dec 18 17:42:08 yuno ntpd[7330]: Soliciting pool server 212.83.187.62
Dec 18 17:42:30 yuno ntpd[7330]: Soliciting pool server 5.196.160.139

It seems I can’t get it to sync with any ntp server.

$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 1.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 2.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 3.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.000

What could be causing this??

Me too can’t connect to debian.pool.* but I have some more servers to connect

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.008
 1.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.008
 2.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.008
 3.debian.pool.n .POOL.          16 p    -   64    0    0.000   +0.000   0.008
-51.38.81.135    131.188.3.220    2 u  331 1024  377   31.871   +1.745  10.769
+162.159.200.123 10.26.8.185      3 u  593 1024  377   23.886   -0.087   0.164
-91.224.149.41   145.238.203.14   2 u  237 1024  377   34.611   +1.270   1.828
+5.196.160.139   145.238.203.14   2 u   81 1024  377   32.734   -1.280   0.247
*2a01:e34:ec2a:9 .PPS.            1 u  868 1024  377   25.366   +1.371   0.112
-2001:41d0:8:ed9 79.143.250.33    2 u  179 1024  377   27.579   +1.247   0.199

I added a few other servers in my ntp config file, but it still doesn’t sync.

I tried to plug my raspberry directly into the modem (to make sure that it’s not caused by the router’s firewall) but that didn’t help either.

I contacted my ISP to ask if they are blocking port 123 for NTP. We’ll see what they say…

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.