Powered by Invision Power Board


  
 
Reply to this topicStart new topicStart Poll

> Failed to set clock
R2D2
Geschrieben am: Samstag, 27.September 2008, 10:27 Uhr
Quote Post


Prinz
****

Gruppe: Moderators
Beiträge: 6149
Mitgliedsnummer.: 1131
Mitglied seit: 2005-10-30



Hallo Zusammen,

eigentlich ist es ja kein richtiger Bug, sondern eher eine kleine Unschönheit, aber ich wüsste nicht, wo ich es sonst posten sollte...

Bei, vorallem neueren, Mainboards kann es vorkommen, dass beim Booten unter dem Punkt:

Setting system clock using the hardware clock

folgende Fehlermeldung erscheint:

Failed to set clock
You will need to set the clock yourself


Abhilfe:

Als erstes sollte geprüft werden, ob /dev/rtc vorhanden ist.
Das geht so:

CODE
vdr01 ~ # ls -la /dev/rtc

Da sollte dann diese Ausgabe kommen:
CODE
vdr01 ~ # ls -la /dev/rtc
lrwxrwxrwx 1 root root 8 2008-09-27 20:43 /dev/rtc -> misc/rtc


Ein weiterer Test:

Wenn bei.

CODE
hwclock --systohc


folgender Fehler erscheint:

CODE
select() to /dev/rtc to wait for clock tick timed out



Dann muss der Parameter --directisa mit gegeben werden:

Auszug aus der man hwclock

QUOTE
--directisa
              is  meaningful  only  on  an  ISA  machine  or  an Alpha (which implements enough of ISA to be, roughly speaking, an ISA machine for hwclock's purposes).  For other
              machines, it has no effect.  This option tells hwclock to use explicit I/O instructions to access the Hardware Clock.  Without this option, hwclock will try to  use
              the  /dev/rtc device (which it assumes to be driven by the rtc device driver).  If it is unable to open the device (for read), it will use the explicit I/O instruc-
              tions anyway.

              The rtc device driver was new in Linux Release 2.




CODE
hwclock --systohc --directisa


Sollte nun keine Fehler mehr ausgeben.

Jetzt muss nur noch die /etc/init.d/clock angepasst werden.
Dazu einfach das rot geschriebene einfügen:

QUOTE
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

opts="save"

depend() {
need localmount
}

setupopts() {
if is_uml_sys ; then
  TBLURB="UML"
  fakeit=1
elif is_vserver_sys ; then
  TBLURB="VServer"
  fakeit=1
elif is_xenU_sys ; then
  TBLURB="xen"
  fakeit=1
elif [[ -d /proc/vz ]] ; then
  TBLURB="VZ"
  fakeit=1
elif grep -q ' cobd$' /proc/devices ; then
  TBLURB="coLinux"
  fakeit=1
elif [[ $(uname -m) == s390* ]] ; then
  TBLURB="s390"
  fakeit=1
elif [[ ${CLOCK} == "UTC" ]] ; then
  myopts="--utc"
  TBLURB="UTC"
else
  myopts="--localtime"
  TBLURB="Local Time"
fi
[[ ${fakeit} -eq 1 ]] && return 0

if [[ ${SRM} == "yes" ]] ; then
  myopts="${myopts} --srm"
fi
if [[ ${ARC} == "arc" ]] ; then
  myopts="${myopts} --arc"
fi
myopts="${myopts} ${CLOCK_OPTS}"

# Make sure user isn't using rc.conf anymore.
if grep -qs ^CLOCK= /etc/rc.conf ; then
  ewarn "CLOCK should not be set in /etc/rc.conf but in /etc/conf.d/clock"
fi
# Make sure people set their timezone ... we do it here
# even though we don't actually use the variable so that
# people see the warning on boot.
if [[ ${TIMEZONE-Factory} == "Factory" ]] ; then
  ewarn "Your TIMEZONE in /etc/conf.d/clock is still set to Factory!"
fi
}

start() {
local myopts=""
local myadj=""
local TBLURB="" fakeit=0
local errstr=""
local readonly="no"
local ret=0

if ! touch /etc/adjtime 2>/dev/null ; then
  readonly="yes"
elif [[ ! -s /etc/adjtime ]] ; then
  echo "0.0 0 0.0" > /etc/adjtime
fi

setupopts

if [[ ${fakeit} -ne 1 && -e /proc/modules && ! -e /dev/rtc ]] ; then
  modprobe rtc &> /dev/null || modprobe genrtc &> /dev/null
fi
ebegin "Setting system clock using the hardware clock [${TBLURB}]"
if [[ ${fakeit} -eq 1 ]] ; then
  ret=0

elif [[ -x /sbin/hwclock ]] ; then
  # Since hwclock always exit's with a 0, need to check its output.
  errstr=$(/sbin/hwclock ${myadj} --directisa ${myopts} 2>&1 >/dev/null)
  errstr="${errstr}$(/sbin/hwclock --hctosys --directisa ${myopts} 2>&1 >/dev/null)"

  if [[ -n ${errstr} ]] ; then
   ewarn "${errstr}"
   ret=1
  else
   ret=0
  fi
  errstr="Failed to set clock"
else
  ret=1
  errstr="/sbin/hwclock not found"
fi
eend ${ret} "${errstr}" "You will need to set the clock yourself"

return 0
}

stop() {
# Don't tweak the hardware clock on LiveCD halt.
[[ -n ${CDBOOT} ]] && return 0

[[ ${CLOCK_SYSTOHC} != "yes" ]] && return 0

local myopts=""
local TBLURB=""
local errstr=""
local ret=0

setupopts

ebegin "Setting hardware clock using the system clock [${TBLURB}]"
if [[ ${fakeit} -eq 1 ]] ; then
  ret=0

elif [[ -x /sbin/hwclock ]] ; then
  errstr=$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null)

  if [[ -n ${errstr} ]] ; then
   ret=1
  else
   ret=0
  fi
  errstr="Failed to sync clocks"
else
  ret=1
  errstr="/sbin/hwclock not found"
fi
eend ${ret} "${errstr}"
}

save() {
CLOCK_SYSTOHC="yes"
stop
}


# vim:ts=4



..Oder einfach die von mir modifizierte aus den Anhang nehmen. ;)

angehängte Datei ( Anzahl der Downloads: 341 )
angehängte Datei  clock
Email PosterUsers WebsiteICQ
Top
Thema wird von 1 Benutzer(n) gelesen (1 Gäste und 0 Anonyme Benutzer)
0 Mitglieder:

Topic Options Reply to this topicStart new topicStart Poll