Sync clock with Google

No Comments

If the Linux VM was running at the time the host OS (Windows) hibernated then the clock in the guest VM will be left at the time of hibernation. If NTP is configured then the clock should resync gradually but most systems do not apply a big chunk of time correction by default.

If the Linux VM was configured with a VPN that implements a system-wide configuration then the DNS resolution might be unable to resolve the NTP server since the DNS of the VPN session will be unavailable. The alternate and work-around presented hinges on two things:

  • The guest VM has internet access at the time it was resumed.
  • The google.com domain name is already resolved and cached.

   sync-clock() {
     echo Current time before sync: `date`
     echo Current time after sync : `sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 \ 
       | grep Date: | cut -d' ' -f5-8)Z"`
    }

The work-around uses the time in the google headers to provide an anchor for the correction.  This is provided as a bash function to provide user feedback if a correction was done.

Snippet execution

Fix for crashing gnome-control-center

No Comments

The GNOME control center in my Manjaro system crashed while I was tweaking the details of the mouse settings. After it crashed, I was unable to bring it up again even after a reboot.

The solution was to reset the configuration files for it using the following command:

$ dconf reset -f /org/gnome/control-center/

After that, the control center UI is up and running again. Based on the search hits, visiting the details pane can sometimes caused the state that results to a segmentation fault whenever the control center initializes.

Docker image cleanup

No Comments

Running docker frequently can lead to mysteriously disappearing space. I kid, its not mysterious. Each image builds a layer which in turn eats up space. Logical but PITA!

Put this in your .bashrc or run it as cron on your docker host to clean up.


docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f “dangling=true” -q)

or do it in one alias (use at your own discretion)


alias docker_janitor='docker rm -v $(docker ps -a -q -f status=exited);docker rmi $(docker images -f “dangling=true” -q)'

sounds too easy..

ciao!