Friday 5th April 2024 7:22 PM

If you're running things in a VM, there is one serious problem - the time in the VM doesn't get synchronized with the host :-(

This page lists a bunch of things you should be doing, but it's more about how to keep time accurate, rather than it's not working at all :-|

The easiest way to fix this is to just install open-vm-tools[1]Which will also give you Shared Folders :clap: , and this is straight-forward:

rpm-ostree install open-vm-tools

although it's something we would like to avoid doing, being an immutable OS, and all.

This post suggests that it might be possible to run it in a container, but I wasn't able to get it to work, so update the base OS we shall.

We do it in a similar way to before: create a systemd service that runs once during provisioning, and then disables itself when it's done.

The install script looks like this:

#!/usr/bin/env bash
# Post-install tasks.

# install open-vm-tools
# NOTE: --apply-live seems to work, but we need a reboot anyway :-/
rpm-ostree install --apply-live -y open-vm-tools

# all done - disable the service (so that we don't run again)
systemctl disable post-install.service

We install it into the file system via the Butane config file:

storage:
  files:
    - path: /usr/local/bin/post-install.sh
      mode: 0755
      contents:
        local: files/post-install.sh

and create a systemd service to run it:

systemd:
  units:
  - name: post-install.service
    enabled: true
    contents_local: systemd/post-install.service

where the service is configured like this:

[Unit]
Description = Post-install tasks
Requires = network-online.target
After = network-online.target install-k3s.service
Before = systemd-user-sessions.service
OnFailure = emergency.target
OnFailureJobMode = replace-irreversibly

[Service]
Type = oneshot
RemainAfterExit = yes
ExecStart = /usr/local/bin/post-install.sh
StandardOutput = kmsg+console
StandardError = kmsg+console

[Install]
WantedBy = multi-user.target

The service has been configured to run synchronously during provisioning - it takes a while to run, which is a PITA, but if there are problems, I'd like to know about them at the time.

The server also needs to be rebooted - using --apply-live is accepted by rpm-ostree install, but things don't work until the system is bounced :? However, once you've done that, Shared Folders become available[2]You might to need to disable and enable them (in the VM's Settings dialog) after a reboot, but I find that I have to do that for desktop Fedora, as well., and the time is correct, even after suspending and resuming the VM (including inside the containers).





References

References
1 Which will also give you Shared Folders :clap:
2 You might to need to disable and enable them (in the VM's Settings dialog) after a reboot, but I find that I have to do that for desktop Fedora, as well.