อ๊ะหย๋า เวลา กับ นาฬิกาเครื่องไม่ตรงกัน /dev/rtc debian etch

หลังจากลงใช้งาน debian มาได้สามสี่วัน ก็มีปัญหาเรื่องนาฬิกาไม่ตรง ย้อนหลังไปเจ็ดแปดชั่วโมงแม้จะ set timezone ได้ถูกต้องแล้ว ทีนี้เพื่อนเลยบอกว่ามีปัญหาเกี่ยวกับ /dev/rtc (hardware clock) เลยลองมาแก้จริงๆ จังอีกที หลังจากเมลวิ่งส่งช้าไป เกือบวัน..

อาการที่เป็นเมื่อใช้คำสั่ง hwclock เพื่อที่จะใช้ access hardware clock แม้จะปรับเวลาตรงแล้วแต่พอ reboot เครื่อง เวลาก็กลับมาไม่ตรงเหมือนเดิม

newbies:~# hwclock
select() to /dev/rtc to wait for clock tick timed out

สาเหตุ

ตามเวบที่ได้อ้างอิงมาเขาบอกว่ามีปัญหากับมอดูลของเคอร์เนล

ทางแก้

ทางแก้ก็คือ คอมไพล์เคอร์เนลใหม่ หรือ เปลี่ยน(เพิ่ม) พารามิเตอร์บางตัวเข้าไปเพื่อให้ โปรแกรม hwclock access hardware โดยตรงเลย แทนที่จะเป็นการ access ผ่าน /dev/rtc ซึ่งผมเลือกอย่างหลังดีกว่า ขี้เกียจมานั่งคอมไพล์ kernel อีก เรียกว่าแก้ปัญหาเฉพาะหน้าไปก่อนไม่ใช่แบบยั่งยืน ;-P คงไม่ว่ากัน

หลังจากที่ตั้งเวลาโดยใช้ ntpdate หรือ อะไรก็แล้วแต่เรียบร้อยแล้วให้ใช้คำสั่ง hwclock --directisa เพื่อเป็นการ access hardware clock โดยตรงเลย และ ไปแก้ไขไฟล์ /etc/default/rcS และเพิ่มประโยคนี้เข้าไป

HWCLOCKPARS="--directisa"

reboot เครื่องเป็นอันเสร็จพิธีเท่านี้เวลาก็กลับมาตรงเหมือนเดิม โชคดีมีชัยกับนาฬิกาใหม่แล้วกัน :-)~

อ้างอิงจาก: http://www.thinkwiki.org/wiki/Problems_with_hwclock

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <blockquote> <img> <h3> <h4> <h5>
  • Lines and paragraphs break automatically.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.