Klystron has a Severe Issue, when Suspending.

In This Earlier Posting, I had written that my Linux laptop named ‘Klystron’ is able to suspend to RAM well and to Resume.

As it turns out, after lengthy experimentation, this was not true. What that system tends to do, after having woken up from Sleep, is to have its clock set ahead by 68 hours. This is a Known Bug. And although there is a script which has been suggested, and which I have gotten to run, which tries to repair this damage in a crude way, that script failed to do so in a complete way.

Even after I have set up This Script to run on Resume, after the first Suspend operation, everything seems to work again well. But after waking up for a second time, I found that the clock is set 136 hours ahead, instead of only being 68 hours ahead. And one reason fw this may happen, could be the fact that the script commands the system clock be set:

date -R --date="-68 hours ago"

This seems to have been a careless mistake, since to set the time to -68 Hours Ago, will actually set the time an additional 68 hours ahead. This can be verified, simply by running the above command from the command-line.

And so I have edited this script, into one which must be compliant with SystemD-based Suspend, instead of with Upstart-based Sleep and Hibernate, and my script needs to be placed into ‘/lib/systemd/system-sleep‘ in order even to get run. And here it is:

 


#!/bin/bash
#
# fixing https://bbs.archlinux.org/viewtopic.php?id=173487

case "$1" in
  pre)
    date +%s > /tmp/suspend.log
    ;;
  post)
    was=`cat /tmp/suspend.log`
    now=`date +%s`
    # time shifts for 68 hours
    if [ $now -gt `expr $was + 244800` ]; then
      date -s "`date -R --date="68 hours ago"`"
    fi
    /etc/init.d/nmbd restart
    ;;
  *)
    ;;
esac

 

The simple fact that my networking client could be connecting to the network, with false time information, can ‘discredit’ my client in the computerized mind of the router or server. And when a LAN client etc. is discredited, this can lead to connection problems…

For now, I am going to experiment further with trying to correct this. But if I run into further problems with this project, I am likely to abandon it.

Dirk