I'm trying to do a "chronyc sources" call but with faketime. When in a terminal, "chronyc source|cat" works fine, but when I do faketime 'last friday 5pm' chronyc sources|cat, it outputs nothing.

whats even more odd is that I have an identical computer that works when I call chronyc with fake time.

Does anyone know why this is happening? Is it maybe some setup config I have messed up? I've tried reinstalling chrony as well as faketime.

  • I have not used faketime, but just read the man. I have a question: Why are you piping to cat? What happens if you just do faketime 'last friday 5pm' /bin/date ?? does that work??
    – number9
    Feb 10, 2021 at 19:42
  • @number9 theres something odd about this one machine for some reason that I have to pipe to cat otherwise itll output nothing (if you know how to fix that issue, maybe thatll help). When I do date it works, but not with my code or chronyc sources
    – bchang32
    Feb 10, 2021 at 19:45
  • faketime works by monkey-patching time-related functions from the C library via a LD_PRELOAD hack. If that chronyc program is communicating with another server/daemon from where it gets its info, faketime chronym has a snowball's chance in hell of working correctly. At best, it will have no effect at all ;-)
    – user313992
    Feb 10, 2021 at 21:39
  • In general, all LD_PRELOAD hacks will not work with a) static executables b) setuid/setcap executables c) other programs which override LD_PRELOAD with total disregard for its previous value d) program which use alternate calling paths -- overriding open() via LD_PRELOAD will not override the open() call from the libc's fopen().
    – user313992
    Feb 10, 2021 at 21:44
  • @user414777 this may be a rookie/silly question, but what are static executables? I dont think I'm doing any of those? Regarding the latter of the first post, doesnt the system time get its time from a different source and then faketime have to apply the offset? so if ntp says its yesterday and I say -1d, then itll be 2 days from actual right?
    – bchang32
    Feb 11, 2021 at 20:27

1 Answer 1


The issue was with SELinux. Apparently chrony doesn't interact well when SELinux is in enforced mode. I switched it to permissive and it behaves as expected now. I can call faketime 'last friday 5pm' chronyc sources as well as use it in my popen code

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.