[Solved] Mint 18 assumes UTC timestamps on SD cards

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read how to get help
Post Reply
jcoles
Level 1
Level 1
Posts: 49
Joined: Wed Feb 08, 2012 11:22 pm

[Solved] Mint 18 assumes UTC timestamps on SD cards

Post by jcoles »

Mint 18 beta (MATE) is running very well, but I've noticed a change when working with SD cards: the file timestamps are 4 hours early as if they have been adjusted for EDT from UTC. This is evident at the command line as well as in Caja. External devices such as cameras record local timestamps on the SD card and Linux should report them without timezone adjustment. Previous versions of Linux Mint handled this correctly.

I have confirmed that my PC hardware clock is in fact set to UTC. Timestamps on the hard disk are correctly reported in EDT.

Is this a minor bug in Mint18? Or, have I inadvertently misconfigured something?
Last edited by jcoles on Mon Jun 13, 2016 6:15 pm, edited 1 time in total.

Mute Ant
Level 14
Level 14
Posts: 5132
Joined: Tue Sep 03, 2013 7:45 pm
Location: Norfolk UK

Re: Mint 18 assumes UTC timestamps on SD cards

Post by Mute Ant »

"Linux should report them without timezone adjustment" Really? There's no way your machine can know the physical location of files, it's just not part of the file system metadata, so you get GMT as the global reference for time stamps, adjusted for display to the Local Machine, if that's what you want.
While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named "manual".

jcoles
Level 1
Level 1
Posts: 49
Joined: Wed Feb 08, 2012 11:22 pm

Re: Mint 18 assumes UTC timestamps on SD cards

Post by jcoles »

Mute Ant wrote:"Linux should report them without timezone adjustment" Really? There's no way your machine can know the physical location of files, it's just not part of the file system metadata, so you get GMT as the global reference for time stamps, adjusted for display to the Local Machine, if that's what you want.
All Linux distributions I have used before have handled this correctly. You can't tell me this is impossible.
My research so far leads me to think it's buried somewhere in udev rules. I'm hoping somebody smarter than me already knows the answer.

jcoles
Level 1
Level 1
Posts: 49
Joined: Wed Feb 08, 2012 11:22 pm

Re: Mint 18 assumes UTC timestamps on SD cards

Post by jcoles »

The work-around is to run these commands as root:

Code: Select all

hwclock --systohc --utc
hwclock --hctosys --utc
This needs to be done in every session, so add the commands to /etc/rc.local.

Linux Mint 18 is not the only new distro with this issue.

rene
Level 14
Level 14
Posts: 5135
Joined: Sun Mar 27, 2016 6:58 pm

Re: [Solved] Mint 18 assumes UTC timestamps on SD cards

Post by rene »

This would probably be very welcome as a bugreport, and those seem to be expected as comments to the announcement http://blog.linuxmint.com/?p=3035 (as per the Bugreports section of that announcement). Not sure if it's going to find its way up if it's only posted here.

cdgoldin
Level 1
Level 1
Posts: 29
Joined: Tue Jul 21, 2015 6:14 am

Re: [Solved] Mint 18 assumes UTC timestamps on SD cards

Post by cdgoldin »

I have a similar problem with Linux Mint 18 that did NOT occur with previous versions of Mint or Ubuntu.
I have a dual-boot (Windoze/Linux) system, and thus have specified UTC=no in /etc/default/RCS. My time-zone is MST (UTC-7).
All the file dates on all the VFAT volumes are reported as 7 hours earlier than the actual file date, i.e. Linux is subtracting 7 hours as if the file dates were in UTC rather than local format.
This occurs whether the files are on HDD or USB drives. It does NOT occur for NTFS volumes, indicating there is a bug in Mint 18's determination of whether the volume is a Windoze volume or a Linux volume.
The work-around suggested above (
hwclock --systohc --utc
hwclock --hctosys --utc
) does NOT seem to make any difference. Nor do I understand why it should make a difference, since the first command simply sets the hardware clock equal to the system timer, and the second command does the inverse.

rene
Level 14
Level 14
Posts: 5135
Joined: Sun Mar 27, 2016 6:58 pm

Re: [Solved] Mint 18 assumes UTC timestamps on SD cards

Post by rene »

cdgoldin wrote:Nor do I understand why it should make a difference, since the first command simply sets the hardware clock equal to the system timer, and the second command does the inverse.
The first hwclock command also updates the hardware clock to in fact be kept in UTC and records the fact in the /etc/adjtime file. While as far as I'm aware on non-systemd systems hwclock is also the only thing that ever concerns itself with the /etc/adjtime file, on systemd systems such as Mint 18 certainly the new "timedatectl" clock administration interface also does. In which sense I expect that it may in your case work to run

Code: Select all

sudo timedatectl set-local-rtc 1
Interestingly, I do not in fact seem to need "sudo" to toggle the UTC/LOCAL setting in /etc/adjtime when using timedatectl. Am I looking at one of the first significant systemd privilege escalation bugs here? The timedatectl binary is certainly not setuid root or anything of the sort, and while systemd itself clearly has the proper privilege -- allowing users to change this seems... strange. I'll open a bug for it if google doesn't in a bit tell me I'm wrong.

In any case; it may work for you? I recently heard someone else say on this forum that "the old rcS method" also still worked but I expect that when doing that, various parts of the system will start disagreeing as to the hardware clock being kept in local time or UTC, as could be the problem in your case? If it works, please report so, so that we feel confident about reiterating it as advice.

rene
Level 14
Level 14
Posts: 5135
Joined: Sun Mar 27, 2016 6:58 pm

Re: [Solved] Mint 18 assumes UTC timestamps on SD cards

Post by rene »

rene wrote:Am I looking at one of the first significant systemd privilege escalation bugs here?
Darn. I am not. A newly added "Standard" user has no such access; only "Administrator" users do.

Such as the standard and generally one and only Mint user, and anyone may decide if this behaviour is a good idea to begin with for himself, but it would appear to at least be on purpose. Standing down from defcon 3...

cdgoldin
Level 1
Level 1
Posts: 29
Joined: Tue Jul 21, 2015 6:14 am

Re: [Solved] Mint 18 assumes UTC timestamps on SD cards

Post by cdgoldin »

rene wrote:The first hwclock command also updates the hardware clock to in fact be kept in UTC and records the fact in the /etc/adjtime file...
Thank you for the explanation.
Somehow I solved the problem, but I'm not sure how. "hwclock --utc" didn't help, and in fact I want the hardware clock to be in local time (for compatibility with Windoze and existing file dates). I tried "hwclock --localtime", but it didn't seem to make any difference either. I made a few changes to my Mint 18 fstab (so that it was identical to my Mint 17 fstab), rebooted, and the problem disappeared. I then backed out those changes, one by one, trying to determine which (if any) caused/solved the problem, and the problem did NOT re-appear. So I'm thinking it must have been "hwclock --localtime", but that it required a reboot to take effect for some reason. It's still a mystery why only the vfat volumes were affected, but not the ntfs volumes.

Further research reveals the following: In systemd-based versions (Ubuntu 15.04 and above), the UTC=yes|no setting in /etc/default/rcS is ignored! The alternative is:
timedatectl | grep local #displays current setting
timedatectl set-local-rtc 1 #hardware clock is in localtime
timedatectl set-local-rtc 0 #hardware clock is in UTC

hwclock ... --utc or --localtime also works.

(Both store the UTC|localtime setting in /etc/adjtime, which presumably could be edited manually)

Post Reply

Return to “Hardware Support”