systemd-timesyncd.service inactive on Arch on VMWare

5,607

Just create a configuration file that unsets that parameter.

mkdir -p /etc/systemd/system/systemd-timesyncd.service.d
echo -e "[Unit]\nConditionVirtualization=" > /etc/systemd/system/systemd-timesyncd.service.d/allow_virt.conf
systemctl daemon-reload
systemctl start systemd-timesyncd.service

This technique is described in the systemd.unit man page:

Along with a unit file foo.service, a directory foo.service.d/ may exist. All files with the suffix ".conf" from this directory will be parsed after the file itself is parsed. This is useful to alter or add configuration settings to a unit, without having to modify their unit files. Make sure that the file that is included has the appropriate section headers before any directive.

Share:
5,607

Related videos on Youtube

Doug Richardson
Author by

Doug Richardson

Updated on September 18, 2022

Comments

  • Doug Richardson
    Doug Richardson over 1 year

    On Arch Linux running as a guest OS on VMWare Fusion, I noticed the system time of Arch falls behind when I sleep the host OS and never gets back in sync. It appears systemd-timesyncd is loaded but inactive.

    [root@arch1 ~]# systemctl status systemd-timesyncd
    * systemd-timesyncd.service - Network Time Synchronization
       Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
       Active: inactive (dead) since Tue 2014-09-30 11:04:42 PDT; 3min 7s ago
               start condition failed at Tue 2014-09-30 11:04:42 PDT; 3min 7s ago
               ConditionVirtualization=no was not met
         Docs: man:systemd-timesyncd.service(8)
     Main PID: 17582 (code=exited, status=0/SUCCESS)
       Status: "Idle."
    

    Update: The answers below explain how to get the systemd-timesyncd.service running under a VM, but it turns out that doesn't solve the time sync problem (which is probably why systemd-timesyncd is disabled under VMs). The Arch wiki page Installing Arch Linux in VMWare explains how to perform Time Synchronization between guest and host OS.

  • eyoung100
    eyoung100 over 9 years
    Although this works, please copy ` /usr/lib/systemd/system/systemd-timesyncd.service` to ` /usr/lib/systemd/system/systemd-timesyncd-custom.service`, update the custom file, and start the custom service
  • Doug Richardson
    Doug Richardson over 9 years
    That's a good point since what I did could impact pacman updates. That said, if I create a custom timesync service, I'd also need to create custom services for anything that depends on systemd-timesyncd, which might be a bigger management pain than dealing with the modified file.
  • eyoung100
    eyoung100 over 9 years
    The choice is yours, I just brought up the issue...
  • eyoung100
    eyoung100 over 9 years
    Please accept Davie's Answer, as he created a file for you that doesn't rewrite the original file.
  • nponeccop
    nponeccop over 9 years
    +1 for not copying entire config