RHEL 7 TimeZone lost after reboot

Translated with Gtrans, it says something interesting.
It talks about metadata on OpenStack, and clock configuration. Unfortunately, for now, I don't have access to OpenStack server, nor its hypervisor, I'll ask people from infrastructure to do a double check. Honestly they already told me that everything should be properly configured, but at this point I don't think so.
I searched on the whole system, but till now I can't find any script or command who changes the TZ at boot time.

For now thank you, I'll keep you informed :slight_smile:

Okay, we'll wait for your update then.

At least we now seem to know that your problem ain't unique and it has been seen before.

Good luck.

PS. I"ve got a translation into English too now.

1 Like

If I understand this topic correctly, "something" is changing the symbolic link for the system to specify the local timezone.

If this is the case, or something similar, another approach (since you are on a Linux platform) is to set the access control attributes so that your file cannot be changed by the system (even root user).

For example:

cp  /usr/share/zoneinfo/Europe/Rome /etc/localtime
chattr +i  /etc/localtime

Now, there is no symlink (since you do not actually need to use a symlink) and the file /etc/localtime is now immutable.

So (untested, but seems OK), that since the file attribute is immutable, the system, even as root, cannot change this file.

Try it and let us know if it works!

See also:

2 Likes

Linux uses 2 files... what do you have in /etc/timezone ?

Wonder if there is not some side effects if you have the 2 files set differently...
My 2 cents: What if it set that ( on hypervisor: using UTC so all servers in same company but maybe not in same timezone...) as general system time and, uses TZ environment variable for local time, when you pass your commands what would you see? As I have no linux under the hand... I remembered seeing TZ in /etc/profile.d
Just thoughts... ( and maybe no applicable, trying to remember what OS it was... wonder if not Debian or Suse ...)

@vbe I don't have such file:

ll /etc/timezone
ls: cannot access /etc/timezone: No such file or directory

@Neo This could be a good workaround for now, but this is what I got executing it:

cp  /usr/share/zoneinfo/Europe/Rome /etc/localtime
cp: overwrite ‘/etc/localtime’? y
chattr +i  /etc/localtime
chattr: Operation not supported while reading flags on /etc/localtime

Did you remove the symlink first?

What does ls -l /etc/timezome give you?

Damn, you have right, I forgot to remove the symlink, sorry.
However, now I setup the immutable flag and reboot, now I have this:

timedatectl status
      Local time: Sat 2021-06-19 17:16:56 CEST
  Universal time: Sat 2021-06-19 15:16:56 UTC
        RTC time: Sat 2021-06-19 15:16:56
       Time zone: n/a (CEST, +0200)

I got strange timezone, but at least now I have CEST, +0200 that is correct.
The problem is on the time, now it's 13:16 but os time is setup as 17:16... DAMN!

EDIT: Well it was RTC time, I did:
hwclock --utc --systohc

and now I have

      Local time: Sat 2021-06-19 13:23:36 CEST
  Universal time: Sat 2021-06-19 11:23:36 UTC
        RTC time: Sat 2021-06-19 11:23:36
       Time zone: n/a (CEST, +0200)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes

let's see if survives from boot and if something change it

1 Like

Yeah, hopefully your boot process will not hang if / when some process tries to create that symlink and it fails....

... but on-the-other-hand, then you will know what process is mess'in around with your TZ :slight_smile:

Nope, system bootup without issue, and TZ survive to boot!!

I check the dmesg to search if something tried to change the TZ at boot time, but I don't find anything. Do you have any other place/idea where I can check?
I'm just curious to check if it's the OS that changes the TZ in any way like script, or is openstack that push this value at boot time.

1 Like

Totally agree.

Making that config file immutable is a hack and better to find the offending process.

Assuming the “rouge process” uses /bin/ln to create the symlink, you could write a little wrapper script around it to log some info from the calling process before ln creates the link.

Do you have an idea on how to do that?

I have an example I use for curl that I use for trapping hackers who try to use curl to load malicious code.

But that example assumes the malicious process is a web client.

Well, at this point, because I'm stubborn, I want to know if is the OS who change the TZ.
So, I'm cloning the whole OS disk using rear (relax and recover), and I'll restore it on my VMWare environment where the fuc****ng openstack environment is not present (I HATE OPENSTACK, and I don't know how people and companies can use it).

I'll report back the result of the operation.

1 Like

Hi,

Do you have access to some kind of Web-based control panel or management interface for your OpenStack-hosted VM ? Depending on your hosting provider, they may provide some kind of customer control panel or something similar that you can use to view or change the settings for your VM or container. If you do, then if you log in to that is there a section that deals with time zone settings, or location/locale settings, or something similar ? It could just be as simple as you needing to change a setting in your service provider's GUI to make this stop happening.

Alternatively you could contact your hosting provider's support department and see if they could shed any light on it also, as this may be a matter that they are familiar with, or which they see happening with enough regularity to quickly know the cause.

1 Like

@drysdalk no, for now I don't have access to hypervisor, only VM

However, I did what I wrote above. I cloned the OS and restore it to (both) my VMWare and Proxmox environment, I restored also the TZ symlink, and after multiple reboot the TZ stays there. So, definitely is OpenStack who pushes the UTC TZ at boot!!
I would like to thank all people involved in this thread, thank you for your time guys!
Lucas

5 Likes

You are very welcome. Yes, well, this topic demonstrates the classic power of this community and all the input you can get from all the experience available here when you present a problem and allow it to just get "kicked around".

This is exactly why this forum is just the best!

Looks like you had 6 respondees in all.

2 Likes

Confirmed! :slight_smile: