Why can't linux read hwclock some month shift? - yocto

We have a linux system that we are building with yocto.
We can read our hardware clock after reboots, change both system time and hardware time without any error (most of the time). However; after some new month, every year that we have tried we are running in to this error. "hwclock: RTC_RD_TIME: Invalid argument".
Example 1:
root#:~# date
Thu Apr 30 23:59:50 UTC 2020
root#:~# hwclock
Thu Apr 30 23:59:52 2020 0.000000 seconds
root#:~#
root#:~#
root#:~# date
Fri May 1 00:00:10 UTC 2020
root#:~# hwclock
hwclock: RTC_TD_TIME: Invalid argument
root#:~#
This is not happening every new month, if I do the same test in January linux can read the hwclock without any issues. It does also not matter if the unit is powered or not. If I set the hwclock to first of May 00:00:00 it can keep track of the time.
The same error occurs on the following month shift:
Feb (it does not matter if it is leap year or not) -> Mar
Apr -> May
Jun -> Jul
Sep -> Oct
Nov -> Dec
Dec (Not sure because of new year or new month) -> Jan
In my understanding, this is happening because rtc-lib.c cannot verify the time correctly.
I have tried on multiple different hardware
Does anyone have any idea what might cause this?
Solution:
The fault was not in rtc-lib.c. The cause of the error was a faulty RTC implementation. The RTC month value is 1-indexed, but the kernel assumes it is 0-indexed. Added a patch for this to rtc-[my_rtc_model].c and now it seems to be working.

Related

Change date inside container

I have problem with dynamically date change inside container. What I have:
docker run -it --privileged myDocker
the command above run container with privilege to change date
I can change date by:
date --set "12-12-12"
but after a few seconds, the date and time are setted the same as the host
root#660acd776c6b:/# date --set "12-12-12"
root#660acd776c6b:/# date
Wed Dec 12 00:00:01 UTC 2012
root#660acd776c6b:/# date
Wed Dec 12 00:00:02 UTC 2012
root#660acd776c6b:/# date
Wed Dec 12 00:00:02 UTC 2012
root#660acd776c6b:/# date
Tue Jan 15 10:14:26 UTC 2019
root#660acd776c6b:/# date
Tue Jan 15 10:14:27 UTC 2019
The container doesn't have installed ntp.
I can't use faketime because I use the date in .net application which doesn't use time from faketime. I can't change system clock using faketime.
How could I disable synchronization between container and host ?

Timezone Changes won't apply on Debian-based System

I'm trying to apply the timezone Europe/Berlin on a Raspberry PI running the Debian-based Raspbian.
sudo dpkg-reconfigure tzdata
returns
Current default time zone: 'Europe/Berlin'
Local time is now: Sun Jun 25 20:26:51 CEST 2017.
Universal Time is now: Sun Jun 25 18:26:51 UTC 2017.
but
sudo date
still returns the British Summer Time (BST) instead of the Europe/Berlin Central European Summer Time (CEST)
Sun Jun 25 19:26:55 BST 2017
If there is internet connection available follow the steps to set the
date/time:
sudo raspi-config
Internationalization options
Change Time Zone
Select geographical area
Select city or region.
Reboot your pi.
This way, you will have accurate time. Need not set the date again for every boot.

How do I interpret dates like 1394862706?

I don't know how to interpret this date format:
1394862706,
1394862645,
1400258321,
1400258250 etc. (each block is a different date)
Does someone understand in which format are them?
I believe they're Unix timestamps. For example, 1400258250 maps to 4:37:30 May 16 2014. They represent the number of seconds that have elapsed since the Unix epoch, January 1, 1970.
Here's a nice timestamp converter.
As others have noted, the 10-digit numbers are Unix timestamps, the number of seconds since 1970-01-01 00:00:00 +00:00, the Unix Epoch.
If you have GNU date, you can use the -d option (or --date) and the # prefix to analyze them (here, with TZ=US/Pacific or TZ=America/Los_Angeles):
$ for ts in 1394862706 1394862645 1400258321 1400258250; do date -d #$ts; done
Fri Mar 14 22:51:46 PDT 2014
Fri Mar 14 22:50:45 PDT 2014
Fri May 16 09:38:41 PDT 2014
Fri May 16 09:37:30 PDT 2014
$
If you add the -u or --utc option, then you get the output:
Sat Mar 15 05:51:46 UTC 2014
Sat Mar 15 05:50:45 UTC 2014
Fri May 16 16:38:41 UTC 2014
Fri May 16 16:37:30 UTC 2014

Couchbase: 20k items stuck in Tap Queue

We are currently evaluating couchbase as a memcached replacement in the first place. Our setup looks like this:
php -> localhost moxi -> couchbase bucket (Total bucket size = 10240 MB (2048 MB x 5 nodes with replica count 1))
The Servers have 16GB RAM and are SSD backed.
We were inserting at about 400 ops/s and had no problem for a few days. When we reached about 13 million items. We found out that we forgot to implement the delete function in our testsetup and a lot of keys had no expiration set.
To start over again we flushed the bucket through the webinterface. This where our problems began.
We started to see that we had temp ooms, back-offs, and tap queue was filled with 20k items. the drain and fill rate was nearly the same. See attached screenshot
What also catched our eye was that node 4 had only 220k items, where everyone else had around 1.39M
Somehow it looks like the replication messed up something, but im relatively new to couchbase. Any hints, suggestions? - See more at: http://www.couchbase.com/communities/q-and-a/20k-items-stuck-tap-queue#sthash.v9MxNnTk.dpuf
The problem was solved for a short time, after removing the failing node from the cluster.
So now with this four nodes left in the cluster, after some hours the same happend again with another node. We tried setting the now failing node into FailOver state. That fixed the problem again, but after Re-Adding the node, the same phenomenon happened again on that node.
Other things we realized are:
* Three out of four nodes have thousands of items in their TAP replication queue, but one
("the failing one") has 0.
* Also three out of four nodes have a back-off rate of around 400, but one ("the failing one") has 0.
* Only the failing one has a massive amount of "Temp OOMs per second", but the other three have 0.
The phenomenon seems to disappear, if we lower the load to the servers by disabling the couchbase-writes for one out of two software project writing to couchbase.
But if we enable the writes again, after around 10 minutes we can see this in the memcached.log on the failing node:
Tue Dec 17 12:29:05.010547 CET 3: (CENSORED) Received error[86] from mccouch for unknown
Tue Dec 17 12:29:05.010576 CET 3: (CENSORED) Retry notify CouchDB of update, vbucket=277 rev=522
Tue Dec 17 12:29:08.748103 CET 3: (CENSORED) Received error[86] from mccouch for unknown
Tue Dec 17 12:29:08.748257 CET 3: (CENSORED) Retry notify CouchDB of update, vbucket=321 rev=948
Tue Dec 17 12:40:17.354448 CET 3: (CENSORED) Received error[86] from mccouch for unknown
Tue Dec 17 12:40:17.354476 CET 3: (CENSORED) Retry notify CouchDB of update, vbucket=303 rev=491
This error then happens around 5 times within four hours:
Tue Dec 17 14:19:32.145071 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
And after these four hours it starts spamming this instantly (Maybe, because the load increased heavily, because in the evening our page generates much more load than in the morning/noon) together with this "error from mccouch":
Tue Dec 17 16:42:30.875343 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:42:36.493317 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:43:25.239876 CET 3: (CENSORED) Received error[86] from mccouch for unknown
Tue Dec 17 16:43:25.240052 CET 3: (CENSORED) Retry notify CouchDB of update, vbucket=296 rev=483
Tue Dec 17 16:43:25.903997 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:43:31.906178 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:43:36.913045 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:43:42.919114 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:43:48.920354 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:43:54.924017 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
Tue Dec 17 16:44:00.928572 CET 3: (CENSORED) TAP (Producer) eq_tapq:replication_ns_1#10.65.20.12 - Suspend for 5.00 secs
We have no clue what is happening here, why this failing node seems to reject every replication and throwing this error.
Do you have any idea?
Thanks for all your help and greetings from Cologne,
Andy!
Seeing as you just want to delete all items in the Bucket have you tried just deleting and re-creating the bucket?
This will be much faster than flush, as flush actually needs to send a delete request for every document in the bucket.
I can't find it in the docs at the moment, but I think Flush is not really recommended with the latest versions.
you are not writing what is your operating system. If it's Linux try to check maximum amount of open sockets for user running the Couchbase. Check the file /etc/security/limits.conf.
the command for check on Linux is: ulimit -Hn.
Hope that helps.
Daniel
I think you should try these settings:
http://docs.couchbase.com/couchbase-manual-2.1/#specifying-backoff-for-replication

debian squeeze cannot use local timezones no matter what you do

I need to use the CLI to see the time in arbitrary timezones. However, Debian doesn't respond to the recommended solution.
First, I set the local timezone.
dpkg-reconfigure tzdata
Then, I set the system time.
ntpdate pool.ntp.org
I update the hardware clock to reflect the system time.
hwclock --systohc --utc
Now, I follow this post:
http://www.linuxquestions.org/questions/programming-9/display-different-timezones-in-command-line-927660/
Which says that I can complete my task using a command such as this:
TZ=UTC date && TZ=CDT date && TZ=IST date
However, this is the output I get:
dpkg-reconfigure tzdata && ntpdate pool.ntp.org && hwclock --systohc --utc && TZ=UTC date && TZ=CDT date && TZ=IST date
Current default time zone: 'America/Chicago'
Local time is now: Tue Apr 16 14:45:29 CDT 2013.
Universal Time is now: Tue Apr 16 19:45:29 UTC 2013.
16 Apr 19:45:38 ntpdate[12036]: adjust time server 199.102.46.73 offset -0.036668 sec
Tue Apr 16 19:45:39 UTC 2013
Tue Apr 16 19:45:39 CDT 2013
Tue Apr 16 19:45:39 IST 2013
CDT and IST aren't valid timezone names, so date is defaulting to show you UTC time if you attempt to use those as your timezone.
I'm not sure which timezones you actually meant to use, but try a couple of these. They are valid timezone names.
TZ=Asia/Shanghai date
TZ=America/Vancouver date
TZ=Europe/London date