To update the time in a LineageOS 23.0 virtual machine running under Virtual Machine Manager (virt-manager) on Debian 13 GNOME after restoring a snapshot, follow these steps:
LineageOS (Android) does not natively support NTP (Network Time Protocol) in the same way as a traditional Linux system. However, you can ensure time sync is enabled:
Check if NTP is enabled: On the LineageOS VM, go to Settings > System > Date & time and ensure "Use network-provided time" is enabled.
If not syncing automatically:
Replacebashadb shell su date -s YYYYMMDD.HHMMSS
YYYYMMDD.HHMMSS with the current time.Virtual Machine Manager uses QEMU/KVM, which can pass the host's time to the guest. Ensure the VM is configured to use the host's time:
Edit the VM's XML configuration:
bashvirsh edit <vm-name>
<clock> section and ensure it includes:
xml<clock offset="utc"> <timer name="hypervclock" present="yes"/> <timer name="hpet" present="no"/> </clock>
Alternative: Add a host time source by adding:
xml<clock offset="utc"> <timer name="hypervclock" present="yes"/> <timer name="kvm-clock" present="yes"/> </clock>
Restart the VM for changes to take effect.
If your LineageOS VM has the QEMU Guest Agent installed (unlikely by default for Android, but possible with custom kernels):
bashvirsh qemu-agent-command <vm-name> '{"execute":"guest-ping"}'
bashvirsh qemu-agent-command <vm-name> '{"execute":"guest-set-time", "arguments": {"time": "<current-utc-time>"}}'
If the above methods fail, manually set the time via ADB:
Connect to the VM:
bashadb connect <vm-ip>:5555
Open a shell:
bashadb shell su
Set the time manually:
bashdate -s YYYYMMDD.HHMMSS
Example:
bashdate -s 20260713.143000
Verify:
bashdate
Ensure your Debian 13 host has the correct timezone:
bashtimedatectl
If not, set it:
bashsudo timedatectl set-timezone Europe/Paris
After making changes, restart the VM to ensure all settings take effect.
Next Steps If the time still drifts, consider installing a custom kernel in LineageOS with better timekeeping support or using a time sync app from the Play Store.
Vibe can make mistakes. Check answers. Learn more