# Time isn't getting written (correctly) on shutdown

## Featherfoot

My system has just started doing a file system check when it reboots, claiming that the disk was dismounted in the future. I don't understand how to correct this problem.

I would appreciate some advice;

emerge --info follows:

\

bopper jc # emerge --info 

Portage 2.2.20.1 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop, gcc-4.9.3, glibc-2.20-r2, 4.0.5-gentoo x86_64)

=================================================================

System uname: Linux-4.0.5-gentoo-x86_64-AMD_Phenom-tm-_II_X4_970_Processor-with-gentoo-2.2

KiB Mem:     4043444 total,    565072 free

KiB Swap:    1021948 total,    944488 free

Timestamp of repository gentoo: Fri, 02 Oct 2015 22:30:01 +0000

sh bash 4.3_p39

ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1

app-shells/bash:          4.3_p39::gentoo

dev-java/java-config:     2.2.0::gentoo

dev-lang/perl:            5.20.2::gentoo

dev-lang/python:          2.7.10::gentoo, 3.3.5-r1::gentoo, 3.4.3::gentoo

dev-util/cmake:           3.3.1-r1::gentoo

dev-util/pkgconfig:       0.28-r2::gentoo

sys-apps/baselayout:      2.2::gentoo

sys-apps/openrc:          0.17::gentoo

sys-apps/sandbox:         2.6-r1::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo

sys-devel/automake:       1.10.3-r1::gentoo, 1.11.6-r1::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo

sys-devel/binutils:       2.25.1-r1::gentoo

sys-devel/gcc:            4.9.3::gentoo

sys-devel/gcc-config:     1.7.3::gentoo

sys-devel/libtool:        2.4.6::gentoo

sys-devel/make:           4.1-r1::gentoo

sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)

sys-libs/glibc:           2.20-r2::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

x-portage

    location: /usr/local/portage

    masters: gentoo

    priority: 0

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

USE="3dnow X Xaw3d a52 aac aalib acl acpi aim alsa amd64 ao apache2 apm audiofile avahi berkdb bidi blas bluetooth branding bzip2 cairo calendar caps cdda cddb cdinstall cdparanoia cdr cgi clamav cli consolekit cracklib crypt css ctype cups curl cvs cxx dbi dbm dbus dbx dga directfb dri dts dv dvb dvd dvdr emboss encode enscript evo examples exif expat fam fastcgi fbcon firefox flac fontconfig foomaticdb fortran freetype ftp gcj gdbm gif gimp glamor glu gmp gnuplot gnutls gphoto2 gpm graphviz gsl gsm gstreamer guile gzip hal handbook hddtemp httpd iconv icq icu idn ieee1394 imagemagick imlib innodb introspection iodbc ipv6 jabber java java6 javascript jbig jingle jpeg jpeg2k kde kontact lapack lcms ldap libcaca libedit libgda libnotify libwww lm_sensors lua lzma lzo mad maildir matroska mikmod milter mime mmap mmx mmxext mng modules motif mozilla mp3 mp4 mpeg mpi mplayer msn multilib musepac mysql mysqli nas ncurses networkmanager nls nntp nptl nsplugin odbc offensive ofx ogg oggvorbis opengl openmp osc oscar oss pam pango pch pcntl pcre pdf perl php plasma plotutils png policykit portaudio posix postgres ppds pulseaudio python qt3support qt4 quicktime raw rdesktop readline rss ruby samba sasl sdl seccomp semantic-desktop session sharedext sharedmem simplexml smp sndfile snmp soap sockets socks5 speex spell sqlite sqlite3 sse sse2 ssl startup-notification stream subversion suid svg symlink syslog sysvipc szip tcl tcpd theora threads tidy tiff timiditytk tokenizer truetype udev udisks unicode upower usb v4l v4l2 vcd vlm vorbis win32codecs wmf wxwidgets x264 xcb xcomposite xft xine xinerama xinetd xml xnlrpc xosd xv xvid yahoo zeroconf zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau" XFCE_PLUGINS="brightness menu trash" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

bopper jc # 

----------

## roki942

Also been happening for me. Don't remember what was updated before before it started happening.

----------

## russK

Featherfoot,

Sorry I don't have a definite answer but it might be related to whether your hardware clock is set to your local timezone or UTC, and/or some mixture of timezone and hwclock and NTP settings.     :Smile: 

I suggest studying this wiki page and looking at how your settings are.  https://wiki.gentoo.org/wiki/System_time

HTH

----------

## Featherfoot

I have used local time for many years. I have used ntp for many years.

I admit to having had occasional issues with local time staying unchanged.

I don't see that this should affect how the system stores time--and it isn't a 5 hour error.

----------

## John R. Graham

Merged duplicate threads, deleted duplicate posts.

- John

----------

## Featherfoot

I can confirm that I do have the option, 

 CLOCK_SYSTOHC="yes" 

in /etc/conf.d

----------

## russK

It's interesting this thread mentions recent changes to util-linux:

https://forums.gentoo.org/viewtopic-p-7724116.html

----------

## russK

FWIW,

my /etc/conf.d/hwclock

```
# Set CLOCK to "UTC" if your Hardware Clock is set to UTC (also known as

# Greenwich Mean Time).  If that clock is set to the local time, then

# set CLOCK to "local".  Note that if you dual boot with Windows, then

# you should set it to "local".

clock="UTC"

# If you want the hwclock script to set the system time (software clock)

# to match the current hardware clock during bootup, leave this

# commented out.

# However, you can set this to "NO" if you are running a modern kernel

# and using NTP to synchronize your system clock.

#clock_hctosys="YES"

# If you do not want to set the hardware clock to the current system

# time (software clock) during shutdown, set this to no.

#clock_systohc="YES"

# If you wish to pass any other arguments to hwclock during bootup,

# you may do so here. Alpha users may wish to use --arc or --srm here.

clock_args=""

```

my results:

'hwclock' is correct

'hwclock --utc' is correct

'hwclock --localtime' is wrong

I use NTP and I have had no issues

----------

## Featherfoot

My hwclock is upper case. It was written back when that was standard. Is it now supposed to be lower case?

----------

## roki942

 *russK wrote:*   

> It's interesting this thread mentions recent changes to util-linux:
> 
> https://forums.gentoo.org/viewtopic-p-7724116.html

 

Thank you, it was that upgrade that started it on my system.

----------

## russK

 *Featherfoot wrote:*   

> My hwclock is upper case. It was written back when that was standard. Is it now supposed to be lower case?

 

Not sure, but I get this from 'equery files openrc'

```
$ equery files openrc | grep -i hwclock

/etc/conf.d/hwclock

/etc/init.d/hwclock

/usr/share/openrc/runlevels/boot/hwclock

```

Maybe you should move your settings to the lower case name

----------

## Section_8

I also suddenly had this start happening.  I tracked it down to an /etc/adjtime  file that had been sitting on my system from several years ago.  The util-linux update mentioned above changed hwclock so by default it does hwclock --adjust (uses /etc/adjtime to adjust system time).  So the hwclock at startup is suddenly using the old /etc/adjtime to incorrectly change system time.

Deleting /etc/adjtime  fixed it.

----------

