-2

I have 2 files created in Linux and to work in Linux. When I go on the Internet, the time automatically changes (time zone) on Asia (Shanghai) and this is due to these files. I found (with winhex) that there is a file \Usr\Share\Zoneinfo\Asia\Shanghai inside the files. But I cannot unpack these files in Linux and replace the time zone.

Files https://drive.google.com/file/d/1QSYSD1Tto3pJZpK6EwIO_ljK6H0JeNZQ/view?usp=sharing

I try replace the file (Shanghai) with another using the "DD" command, but not luck. Therefore, it is possible in Linux unpack/replace and pack a file?

head a file

  • 2
    Not got a clue what you are doing or why since you seem to want to change the timezone from Shanghai to Shanghai. Regardless, for the system, the file `/etc/localtime` should be symlinked to the correct timezone file somewhere under `/usr/share/zoneinfo`. This can be modified under a process by setting the `TZ` variable to point some other timezone file. And you really do not want to `dd` into any of the tz files. That really is a no-no. – Bib Jun 21 '23 at 20:43
  • I want to change the time zone from Asia/Shanghai to Europe/Madrid, example. With winhex i found in initfs.img and corefs.img link to file initroot/usr/share/zoneinfo/Asia/Shanghai and i want change it's – Fokacha Im Jun 21 '23 at 21:08
  • Well like I said, you point `/etc/localtime` to the correct timezone file, which in this case should be `/usr/share/zoneinfo/Europe/Madrid`. Again, do not overwrote or modify any of the timezone files. Nor should you need to modify anything in the initroot file system. This change should be done when your system is fully up and running. – Bib Jun 21 '23 at 21:18
  • 1
    without any code of your attempts to solve this problem, it is not an `if/then/else` programming code suitable for StackOverflow. Did you want something like `sed '/Shanghi/Madrid/g' myIncorrectTimeZonedDATAfile` . WIthout code, voting to close. Maybe delete here and repost to [unix.se]. (And, sorry to say, agree with comments above, hard to understand what you are trying to acomplish ... A good S.O. Q has sample data, required output, code, error output, error msgs (exact text). ) . Good luck. – shellter Jun 22 '23 at 16:08
  • 1
    There's a lot of stuff going wrong here. Case matters on Unix, so use `dd`, not `DD`. Use `/` not `\`` for paths (which are also case-sensitive). What do you mean by packing and unpacking? Most configuration files in `/etc` are just plain text; you can change them with any editor. No need for whatever packing and unpacking you may try. There's also `sudo timedatectl set-timezone Europe/Berlin` to set the time zone. See the [timedatectl man page](https://man.archlinux.org/man/timedatectl.1.en) – Robert Jun 22 '23 at 16:28
  • I was mistaken - use "dd". Nothing succeeded. I think this is a packed file in the Linux system - see "head a file" and just unpack it, such as a winrar in Windows. When replace file "Shanghai" on "Madrid". – Fokacha Im Jun 22 '23 at 19:43
  • 2
    WILL YOU STOP dd'ing INTO THE TIMEZONE FILES! You have been told twice how to set the correct timezone by myself & @Robert. – Bib Jun 23 '23 at 20:47

1 Answers1

-2

Ok. I unpacked the file and it contained many other files, found the Zoneinfo/Asia/Shanghai file and replaced it with Madrid. I packed everything back. And now during work time does not change to Asian