Alpine: wrong timestamp (Dec 31 23:59:59) for all /var/log/messages entries

lxd

(Gilles) #1

Hi,

I’m having a strange (and annoying) issue with all my Alpine Linux containers (various versions): The log entries in /var/log/messages all show a timestamp of “Dec 31 23:59:59”.

Is this a known issue? Is anyone else experiencing this?

I’m not sure how to track this one down, so any help would be appreciated.

Here’s some output from lxc info:

  driver: lxc
  driver_version: 2.0.8
  kernel: Linux
  kernel_architecture: i686
  kernel_version: 4.13.0-38-generic
  server: lxd
  server_pid: 1513
  server_version: "2.21"
  storage: btrfs
  storage_version: "4.4"

(Stéphane Graber) #2

I’ve never heard of this before so it’s certainly a new one for us :slight_smile:
Can you confirm that running date inside your container shows a reasonable timestamp?

If so, then it’s likely the syslog logger in Alpine doing something funny to grab its time or timezone.


#3

Its a known bug in Alpine.
You can comment out SYSLOGD_OPTS="-Z" in /etc/conf.d/syslog so you get at least working UTC times (without local time shift) instead of fixed timestamps.

https://bugs.alpinelinux.org/issues/8028


(Gilles) #4

Thanks a lot for pointing me to this workaround!

@stgraber: I don’t know what this project’s policy is concerning upstream bugs in the images you provide. Should I file an issue on the lxc/lxd github tracker? After all it’d be a rather simple fix.

And there’s a second annoying logging bug:

$ lxc launch images:alpine/edge test
Creating test
Starting test
$ lxc exec test tail /var/log/messages
Dec 31 23:59:59 test daemon.info init: can't open /dev/tty3: No such file or directory
Dec 31 23:59:59 test daemon.info init: can't open /dev/tty4: No such file or directory
Dec 31 23:59:59 test daemon.info init: process '/sbin/getty 38400 tty1' (pid 973) exited. Scheduling for restart.
Dec 31 23:59:59 test daemon.info init: process '/sbin/getty 38400 tty2' (pid 974) exited. Scheduling for restart.
Dec 31 23:59:59 test daemon.info init: process '/sbin/getty 38400 tty3' (pid 975) exited. Scheduling for restart.
Dec 31 23:59:59 test daemon.info init: process '/sbin/getty 38400 tty4' (pid 976) exited. Scheduling for restart.
Dec 31 23:59:59 test daemon.info init: can't open /dev/tty1: No such file or directory
Dec 31 23:59:59 test daemon.info init: can't open /dev/tty2: No such file or directory
Dec 31 23:59:59 test daemon.info init: can't open /dev/tty3: No such file or directory
Dec 31 23:59:59 test daemon.info init: can't open /dev/tty4: No such file or directory

The solution for this constant syslog spamming is just as simple: comment out the 4 tty lines in /etc/inittab.

I guess I’ll just go ahead and file the 2 bug reports. Anyway, the last few months I’ve been containerizing more and more of my servers, daemons, etc.
Using LXD has been both a revelation and a revolution in how I’m handling those admin tasks. Thanks!