3

I created a daemon-bash-script on a Debian, which copies an .img to an external disk. The script copies the .img with dd to the external disk and afterward it mounts the disk to check the filesystem.

Is there a possibility to change the date and time in a file somewhere? My problem is that after the first boot (without an internet link) the year is in 2033.

I tried to change the timestamp in /etc/adjtime. But after a reboot, it only set's back to 2033:

0.000000 2001162716 0.000000
2001162716
UTC

Thanks :)

EDIT 1

I just found out that my Alix has two different dates:

~# hwclock
Sat Jan  1 01:01:04 2000  -0.521995 seconds
~# date
Tue May 31 20:49:59 CEST 2033

How's that possible?

5
  • What's your BIOS date ?
    – SHW
    Sep 15, 2016 at 7:45
  • Hmm. I'm using a ALIX board link. I don't know how to enter the BIOS. But in fact, I'm using like 50 of them, so entering every BIOS to change the date is probably not the best solution :) Sep 15, 2016 at 8:02
  • That value in adjtime is not used to set the time. Normally, at boot the kernel discovers the hardware rtc device, reads it and sets the system time to that value. cat /sys/class/rtc/rtc0/hctosys should be 1 if it did this. Use hwclock to read the rtc. Perhaps your board doesnt have an rtc, or no battery?
    – meuh
    Sep 15, 2016 at 9:04
  • Probably it has a battery, or at least is a tiny BIOS (which I found out right now) in the ROM saved. But not that many functions, like no function for date/time. The BIOS settings are these Sep 15, 2016 at 9:12
  • 1
    You should probably add debian package fake-hwclock to your setup. It is supposed to handle boards with no battery-backed rtc.
    – meuh
    Sep 15, 2016 at 9:51

1 Answer 1

1

Thanks to @meuh I installed

fake-hwclock

on my system and now I can write date-time into a config file

/etc/fake-hwclock.data

and the system boots with that time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.