Switching clock synchronization off under Debian

In summary, the person is working on a project in which they need to fake a pendrive so that it looks like if it was used for several years. They are having trouble stopping the clock from synchronizing.
  • #1
Borek
Mentor
28,930
4,217
I am working on a project* in which I need to fake a pendrive so that it looks like if it was used for several years. That means copying files, making directories, removing them and so on. It needs to be done in such a way that all dates looks OK, which makes it less trivial than it sounds.

While the pendrive is FAT formatted and tries to look as if it was used under Windows, it is easier to script the operation under Unix. I have Debian installed in VBox. And here is the problem - I am unable to stop Debian from synchronizing time.

I already did it in the spring, then using timedatectl set-ntp false to stop NTP was enough. For some reason now after several operations/seconds (not sure yet what it is that triggers synchronization) my system clock is back to the current.

Any idea how to stop the clock from synchronizing?

Note: the most obvious approach to setting up dates (using touch) doesn't work - it sets up only one of three dates assigned to every file in FAT, so for someone savvy it is obvious it was tampered with.

*In case you wonder - here is the project page: facebook.com/PDZWT (in Polish), first version was published in June, but it contained some mistakes and I want to start from scratch.
 
Computer science news on Phys.org
  • #2
touch -d date doesn't work?
 
  • #3
Borek said:
Note: the most obvious approach to setting up dates (using touch) doesn't work - it sets up only one of three dates assigned to every file in FAT, so for someone savvy it is obvious it was tampered with.

Actually it sets two of the three dates. Still, one to go.
 
  • #4
To answer the question you asked, the most sureproof way to do this is to disconnect the network, reboot the machine, enter the time in the BIOS, and go. This is probably slow. A less foolproof way is to disable whichever network time package is being used (ntpd and chrony are the most popular, but it sounds like you have at least one more running than you think) and then reset the time through the shell. This is less foolproof since a) the system still keeps track of time internally, and b) there are certain expectations that are no longer the case (i.e. "safe to delete this temporary file").

To answer the question you want to ask, the WindowsAPI has a function SetFileTime that allows for setting all three times. Maybe you can use WINE, but I don't think "easier to script" trumps "missing in the kernel API".
 
  • #5
Vanadium 50 said:
To answer the question you asked, the most sureproof way to do this is to disconnect the network, reboot the machine, enter the time in the BIOS, and go.

No go, as I wrote in the opening post I am using Virtual Box. If I had a spare computer it would be a no-brainer.

Vanadium 50 said:
A less foolproof way is to disable whichever network time package is being used

That's what timedatectl set-ntp false does.

Vanadium 50 said:
To answer the question you want to ask, the WindowsAPI has a function SetFileTime

And I am using it in a different part of the project, where there are just a few files to generate and copy, not hundreds in tens of directories and directory trees.
 
  • #6
Borek said:
timedatectl set-ntp false does.

But apparently it's not doing this.

I don't see any way to do this subject to all of your constraints. The fundamental problem on the linux side is that "creation date" is not part of the Posix standard, but is part of the FAT32 file system.

If you need linux only for scripting, why not use bash for Windows?
 
  • Like
Likes jim mcnamara
  • #7
Vanadium 50 said:
If you need linux only for scripting, why not use bash for Windows?

That's something new to check.
 
  • #8
Did you ever give bash for Windows a try? Did it work?
 
  • #9
Vanadium 50 said:
Did you ever give bash for Windows a try? Did it work?

Nope, I finally made the final version on Raspbian, where I was able to switch the ntpd down.

Bash for Windows sounds like an interesting project, I have it on my "check in a spare time" list.
 
  • #10
Update: Ubuntu for Windows. Haven't tested it thoroughly, but at least some basic things that I needed to automate collecting data from the Raspberry Pi camera mounted in the bird house worked as expected.

From what I understand it will be somehow further integrated into power shell soon, no idea about the details.
 

1. What is clock synchronization and why is it important under Debian?

Clock synchronization is the process of ensuring that all computer systems within a network are using the same time and date. It is important under Debian because it allows for accurate time-based operations, such as logging, scheduling, and network communication.

2. How can I switch off clock synchronization under Debian?

To switch off clock synchronization under Debian, you can use the command "timedatectl set-ntp off" in the terminal. This will disable the Network Time Protocol (NTP) service which is responsible for clock synchronization.

3. Are there any potential drawbacks to switching off clock synchronization?

Yes, there are potential drawbacks to switching off clock synchronization. Without synchronized clocks, time-based operations may become inaccurate and cause issues with scheduling, logging, and network communication. It may also make it difficult to troubleshoot and resolve issues within a network.

4. Can I switch off clock synchronization for specific systems or devices?

Yes, you can switch off clock synchronization for specific systems or devices within a network. This can be done by disabling the NTP service on those systems or devices, while keeping it enabled on others. However, it is generally recommended to have all systems within a network synchronized for consistency.

5. Is it possible to switch off clock synchronization permanently under Debian?

Yes, it is possible to switch off clock synchronization permanently under Debian. This can be done by modifying the configuration file for the NTP service. However, it is not recommended to do so as it may cause issues with time-based operations and can be difficult to troubleshoot in the future.

Similar threads

Replies
1
Views
782
  • Special and General Relativity
Replies
10
Views
2K
  • General Discussion
Replies
5
Views
1K
  • Special and General Relativity
Replies
25
Views
2K
Replies
10
Views
2K
  • Computing and Technology
Replies
2
Views
2K
  • Beyond the Standard Models
2
Replies
38
Views
8K
  • Special and General Relativity
Replies
13
Views
2K
Replies
14
Views
3K
  • Special and General Relativity
Replies
1
Views
2K
Back
Top