Red Hat Bugzilla – Bug 182188
libblkid fails to gather info on systems with clocks set before the epoch
Last modified: 2007-11-30 17:11:24 EST
I did an install of FC5t3 on an iMac and noticed that blkid(8) showed nothing.
The /etc/blkid.tab file was empty. Digging deeper I discovered that since
libblkid uses a cache file, time stamps are compared to determine if anything
needs to be reread. The iMac had a dead battery and it's date was set to the
Mac epoch, which is in 1904. The negative time was throwing off the test and
libblkid just failed to see anything.
I created a patch for libblkid to let it gather info if time(0) is less than
zero. Correct info is returned when the clock is set before or after the epoch.
The major problem this caused on the iMac was an unbootable system after a fresh
install. /etc/fstab contained a LABEL=/boot line to mount the /boot filesystem,
but since libblkid gathered nothing, mounting /boot failed.
The patch I created is attached.
Created attachment 124914 [details]
Also, other users have noticed this behavior in the past. Bugzilla #158499
shows it happening.
Isn't this basically goin to disable blkid caching in that case, forcing probing
Probe each time is probably less problem than failed fsck/mount when the system
boots. IMHO the patch (or some other way how ignore blk.tab on system where
time() ==(time_t)-1) has sense.
That was my reasoning too. If the clock is useless, blkid should just probe
I've added this patch to e2fsprogs-1.38-10.
Created attachment 126011 [details]
Better fix for the bug
Here is a more elegant fix to the problem which was reported. There was a bug
in blkid's test to see whether or not a device needs to be verified. The
device should always be checked if current time is less than the last
verification time recorded for the device. Your proposed patch works around
the problem, but doesn't fix the root cause of the problem. (For example, if
the system clock gets set backwards, there are lossage cases that don't get
fixed with your proposed patch, which is fixed with mine.)
Ted's patch has been added to devel/ CVS.