On Debian 13 GNOME running Virtual Machine Manager LineageOS 23.0 virtual machine how to update the virtual machine time after restoring a snapshot?
Jul 13, 10:02am
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:
1. Ensure Time Synchronization is Enabled in the VM
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:
Open a terminal in the VM (if available) or use ADB:
bash
adb shell
su
date -s YYYYMMDD.HHMMSS
Replace YYYYMMDD.HHMMSS with the current time.
2. Configure QEMU/KVM Time Synchronization
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:
Shut down the VM.
Open a terminal on the host (Debian 13) and run:
bash
virsh edit <vm-name>
Locate the <clock> section and ensure it includes:
If the above methods fail, manually set the time via ADB:
Connect to the VM:
bash
adb connect <vm-ip>:5555
Open a shell:
bash
adb shell
su
Set the time manually:
bash
date -s YYYYMMDD.HHMMSS
Example:
bash
date -s 20260713.143000
Verify:
bash
date
5. Check Host Timezone
Ensure your Debian 13 host has the correct timezone:
bash
timedatectl
If not, set it:
bash
sudo timedatectl set-timezone Europe/Paris
6. Restart the VM
After making changes, restart the VM to ensure all settings take effect.
Why This Happens
Restoring a snapshot reverts the VM's state, including its internal clock.
Android (LineageOS) does not always sync time automatically in a virtualized environment.
QEMU/KVM may not pass the host's time correctly without explicit configuration.
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.
Jul 13, 10:02am
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.