Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Clock skew detected.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Tue Sep 14, 2021 1:16 am    Post subject: Clock skew detected. Reply with quote

Hello,

I work with a Pi-Model-B-Rev-2 and I just come to install stage3 armv6 on it. I have almost resolv all difficulties including the clock skew who was spreading at bootime. I checked on Internet. Some says rc-update -u, other said to touch all the system files to up to date the access time of the files. Others again said to edit /lib/rc/sh/init.sh.

This problem is related to the fact that this Pi and others do not have an hardware clock. The save of the time at shutdown is older than the time of the files at boot time before Internet is up and Rc can set the system clock correctly using ntp-client. Something like that, I found a solution.

It is to configure the network as the first task of Rc and than call ntpdate so, the system time is always the newest. I did it manually at the head of /lib/rc/sh/init.sh and remove ntp-client swclock and hwclock and here net.eth0.

I disabled too net.ifnames=0 kernel parameter and the eth0 Udev rule to always use the kernel naming for my Ethernet card so, Rc always recognise the kernel name of the configuration I added to it. Here it is
Code:
#!/bin/sh
  2 # Copyright (c) 1999-2007 Gentoo Foundation
  3 # Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
  4 # Released under the 2-clause BSD license.
  5
  6 ip a add 111.111.111.111/11 dev eth0
  7 ip l set dev eth0 up
  8 ip r add default via 000.000.000.000 dev eth0
  9 ntpdate -b 3.gentoo.pool.ntp.org
...


/etc/resolv.conf is fill with Dns servers ip adresses. No need to configure it manually more. Simple but it work when all other approchs I have found have fail. As you can see the Pi is not my gateway. It would work with a dhcp client or to connect to an access point. Ntpdate only need to receive the time from Internet.
_________________
Paul
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Tue Sep 14, 2021 8:20 pm    Post subject: Reply with quote

I completely fail to understand how this
Code:
ip a add 111.111.111.111/11 dev eth0

and this
Code:
ip r add default via 000.000.000.000 dev eth0

can work.

Seems to be some kind of Vodoo...? :roll:
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Tue Sep 14, 2021 8:40 pm    Post subject: Reply with quote

Logicien

Remove hwclock from the startup sequence.
Add swclock in its place.

swclock only ensures that time is monotonic. It does not correct the time. That needs a network connection and ntp.
swclock saves the time at shutdown and restores it at startup. Its enough to avoid clock skew but not enough for make.

You can still get problems with generated files are older than source files, so you must set the time on every boot somehow.

If your Pi has an IP address that depends on NAT to get to the outside world, there is no need to obscure it as its not public.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Fri Sep 17, 2021 1:49 pm    Post subject: Reply with quote

Thank-you NeddySeagoon for the answer.

I can put back swclock. hwclock is already disabled. I must say that I have two ways to get Internet on my Pi, Ethernet and wireless. By Ethernet it work perfectly fine when Internet is available before rc start his task. The Pi do not have the direct connexion to Internet. This is at the head of /lib/rc/sh/init.sh as I explain before. I could use the dhcpcd service instead if I want to connect to my access point in wireless.

What I try to do is to have a full none X Gentoo on Armv6. If I have an higher processor, arvm7 or armv8 I will be able to use this Gentoo and eventually upgrade. This Pi-Model-B-Rev-2 work and compile well but at a slow speed. When came the time to format the root partition I choosed Ext4 by habitude but there is F2fs that this link say it have many advantages. Is this true?

I would like to increase the performances of my Pi. I give only 16 mg of ram to the video card, I have a swap partition of 1 gb, what else can I do to speed this Pi a bit?

mike155, the ip addresses I give are only dummy to not show the real ones to protect myself like many do even if I trust this site.
_________________
Paul
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Fri Sep 17, 2021 4:15 pm    Post subject: Reply with quote

Logicien,

You can cheat. There are three ways.

1. Use cross distcc, so that some other systems of any architecture you like, build your C and C++ code.
The Pi still does the preprocessing and linking.

2. Once you have a cross compiler, as you need for the above, try cross compiling binary packages for the Pi.
That will have miked success.

3. Use a QEMU build root. This allows you main Gentoo install to execute the arm6 code for the Pi.
Copy your Pi install to the QEMU build root and build binaries that you install on the Pi.
QEMU does software emulation of the arm CPU, which imposes a speed penalty but you start out with a faster CPU and more RAM, so its faster than the Pi.

With regards to filesystems and F2FS, that depends on what your SD card does by way of a FLASH translation layer.
It it does nothing, then F2FS will help SD card life. It the SD card does everything, then you have both hardware and software FLASH translation layers.
Its unlikely you will discover the internal workings of your SD cards.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Fri Sep 17, 2021 6:20 pm    Post subject: Reply with quote

Ok,

for the clock skew swclock never did the job of preventing this message. Only Ethernet fast IP configuration followed by an Ntp call on Internet on top of rc stop the message. I have try with dhcpcd on top of rc but I would need a sleep time before ntpdate to let dhcpcd receive and IP configuration from my wireless Access Point. So Ethernet instant IP config is faster and better.

For distcc I will check. I have to study on that. I have an ArchLinux aarch64 installation who run in qemu-system-aarch64. The system work without flaw. It support armv6 but with Gentoo armv6 in chroot it freeze. Maybe I need to use qemu-system-arm only instead. My Raspbian armv6 succeed to upgrade in chroot with ArchLinux aarch64 virtual host.

I think I am gone turn myself to distcc or continue to use this Pi at it's maximum cpu speed 1000 mhz giving the maximum memory of 512 mhz to the system keeping 16mhz to the video card. Time is relative when you don't depend on the Pi for everything. Days instead of hours can be acceptable than.
_________________
Paul
Back to top
View user's profile Send private message
user
Apprentice
Apprentice


Joined: 08 Feb 2004
Posts: 211

PostPosted: Wed Aug 16, 2023 12:07 pm    Post subject: Reply with quote

For devices without hardware clock openRC swclock init script runs too late.

Currently there is no early script run hook/support (runlevel sysinit is too late also).
Hence you must edit /lib/rc/sh/init.sh itself.
Assume openRC shutdown file /var/lib/misc/openrc-shutdowntime exist and resist on same filesystem.

Code:
--- a/lib/rc/sh/init.sh
+++ b/lib/rc/sh/init.sh
@@ -101,4 +101,6 @@
 
 echo sysinit >"$RC_SVCDIR"/softlevel
 [ -x /sbin/restorecon ] && /sbin/restorecon -rF /run
+# custom hack: early clock set on system without hardware clock
+/lib/rc/sbin/swclock /var/lib/misc/openrc-shutdowntime
 exit 0
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum