特殊:Badtitle/NS100:UbuntuDateBug:修订间差异
小 新页面: {{From|https://help.ubuntu.com/community/UbuntuDateBug}} {{Languages|UbuntuHelp:UbuntuDateBug}} There is a rather annoying bug in Ubuntu which causes it to hang if the date is set badly (... |
小无编辑摘要 |
||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:UbuntuDateBug}} | {{Languages|UbuntuHelp:UbuntuDateBug}} | ||
There is a rather annoying bug in Ubuntu which causes it to hang if the date is set badly (before 1970 I think). It is simple to fix, but it's rarely diagnosed properly. It has been reported here: https://launchpad.net/distros/ubuntu/+source/gnome-session/+bug/23426 . It crops up occasionaly in the forums so I have put the info here to point people to. | There is a rather annoying bug in Ubuntu which causes it to hang if the date is set badly (before 1970 I think). It is simple to fix, but it's rarely diagnosed properly. It has been reported here: https://launchpad.net/distros/ubuntu/+source/gnome-session/+bug/23426 . It crops up occasionaly in the forums so I have put the info here to point people to. | ||
== Symptoms == | == Symptoms == | ||
The system boots fine, and gets to the gdm login screen. The user types name and password and presses enter. The screen goes and the user is left on a brown screen. | The system boots fine, and gets to the gdm login screen. The user types name and password and presses enter. The screen goes and the user is left on a brown screen. | ||
That's it, just a brown screen of death. | That's it, just a brown screen of death. | ||
If the user is savvy they will try ctrl-alt-f1 and get a text terminal. They might try restarting gdm, reinstalling gnome, creating a new user, deleting all their gnome preference files, reinstalling the whole sytem. They probably won't check the computer clock. | If the user is savvy they will try ctrl-alt-f1 and get a text terminal. They might try restarting gdm, reinstalling gnome, creating a new user, deleting all their gnome preference files, reinstalling the whole sytem. They probably won't check the computer clock. | ||
== How to fix == | == How to fix == | ||
Simple, set the date right. | Simple, set the date right. | ||
Boot to the point of the brown screen, then press crtl+alt+f1 (ctrl-option-F1 on a Mac) to get a terminal, and log in. Type: | Boot to the point of the brown screen, then press crtl+alt+f1 (ctrl-option-F1 on a Mac) to get a terminal, and log in. Type: | ||
<pre><nowiki> | <pre><nowiki> | ||
date | date | ||
</nowiki></pre> | </nowiki></pre> | ||
if you get something like | if you get something like | ||
<pre><nowiki> | <pre><nowiki> | ||
Fri Jan 11 19:11:32 GMT 1970 | Fri Jan 11 19:11:32 GMT 1970 | ||
</nowiki></pre> | </nowiki></pre> | ||
then run the command | then run the command | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo date -s "Fri Nov 11 19:11:32 GMT 2005" | sudo date -s "Fri Nov 11 19:11:32 GMT 2005" | ||
</nowiki></pre> | </nowiki></pre> | ||
(you will need to put in your password) | (you will need to put in your password) | ||
now do the command | now do the command | ||
<pre><nowiki> | <pre><nowiki> | ||
sudo /etc/init.d/gdm restart | sudo /etc/init.d/gdm restart | ||
</nowiki></pre> | </nowiki></pre> | ||
and hopefully you can log in. | and hopefully you can log in. | ||
== Why this happens == | == Why this happens == | ||
I believe the bug is related to the way the date is stored and the way c deals with numbers. In unix (and macs) the date is store as the number of seconds since the epoch (1 jan 1970). Negative values represent dates back to 1904. Now of course it is well after 1970, so why bother with being able to set your clock to before 1970. (if you want to store birthdays in a program you might need to, but not for the current date). In c you can store numbers as signed or unsigned. If they are signed they can be negative or positive. Most computers store their time in a signed number, gnome seems to use a signed number, but the kernel seems to use unsigned. So if your computer clock can be set before 1970, most stuff will work fine, however gnome will not boot. | I believe the bug is related to the way the date is stored and the way c deals with numbers. In unix (and macs) the date is store as the number of seconds since the epoch (1 jan 1970). Negative values represent dates back to 1904. Now of course it is well after 1970, so why bother with being able to set your clock to before 1970. (if you want to store birthdays in a program you might need to, but not for the current date). In c you can store numbers as signed or unsigned. If they are signed they can be negative or positive. Most computers store their time in a signed number, gnome seems to use a signed number, but the kernel seems to use unsigned. So if your computer clock can be set before 1970, most stuff will work fine, however gnome will not boot. | ||
Apple Mac computers can be set to dates back to 1904. If the clock in a mac is reset it will go to 1904. The clock in a mac is kept going by the PRAM battery, which runs out after about 5 years. After this time if the mains goes off then the clock will reset, and gnome wont boot. (It can also be reset after a bad crash.) | Apple Mac computers can be set to dates back to 1904. If the clock in a mac is reset it will go to 1904. The clock in a mac is kept going by the PRAM battery, which runs out after about 5 years. After this time if the mains goes off then the clock will reset, and gnome wont boot. (It can also be reset after a bad crash.) | ||
The long term fix on a mac is to replace your PRAM battery. | The long term fix on a mac is to replace your PRAM battery. | ||
[[category:CategoryDocumentation]] [[category:CategoryCleanup]] | [[category:CategoryDocumentation]] [[category:CategoryCleanup]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2007年11月30日 (五) 21:49的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/UbuntuDateBug }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/af | • {{#if: UbuntuHelp:UbuntuDateBug|Afrikaans| [[::UbuntuDateBug/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ar | • {{#if: UbuntuHelp:UbuntuDateBug|العربية| [[::UbuntuDateBug/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/az | • {{#if: UbuntuHelp:UbuntuDateBug|azərbaycanca| [[::UbuntuDateBug/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/bcc | • {{#if: UbuntuHelp:UbuntuDateBug|جهلسری بلوچی| [[::UbuntuDateBug/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/bg | • {{#if: UbuntuHelp:UbuntuDateBug|български| [[::UbuntuDateBug/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/br | • {{#if: UbuntuHelp:UbuntuDateBug|brezhoneg| [[::UbuntuDateBug/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ca | • {{#if: UbuntuHelp:UbuntuDateBug|català| [[::UbuntuDateBug/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/cs | • {{#if: UbuntuHelp:UbuntuDateBug|čeština| [[::UbuntuDateBug/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/de | • {{#if: UbuntuHelp:UbuntuDateBug|Deutsch| [[::UbuntuDateBug/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/el | • {{#if: UbuntuHelp:UbuntuDateBug|Ελληνικά| [[::UbuntuDateBug/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/es | • {{#if: UbuntuHelp:UbuntuDateBug|español| [[::UbuntuDateBug/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/fa | • {{#if: UbuntuHelp:UbuntuDateBug|فارسی| [[::UbuntuDateBug/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/fi | • {{#if: UbuntuHelp:UbuntuDateBug|suomi| [[::UbuntuDateBug/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/fr | • {{#if: UbuntuHelp:UbuntuDateBug|français| [[::UbuntuDateBug/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/gu | • {{#if: UbuntuHelp:UbuntuDateBug|ગુજરાતી| [[::UbuntuDateBug/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/he | • {{#if: UbuntuHelp:UbuntuDateBug|עברית| [[::UbuntuDateBug/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/hu | • {{#if: UbuntuHelp:UbuntuDateBug|magyar| [[::UbuntuDateBug/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/id | • {{#if: UbuntuHelp:UbuntuDateBug|Bahasa Indonesia| [[::UbuntuDateBug/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/it | • {{#if: UbuntuHelp:UbuntuDateBug|italiano| [[::UbuntuDateBug/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ja | • {{#if: UbuntuHelp:UbuntuDateBug|日本語| [[::UbuntuDateBug/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ko | • {{#if: UbuntuHelp:UbuntuDateBug|한국어| [[::UbuntuDateBug/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ksh | • {{#if: UbuntuHelp:UbuntuDateBug|Ripoarisch| [[::UbuntuDateBug/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/mr | • {{#if: UbuntuHelp:UbuntuDateBug|मराठी| [[::UbuntuDateBug/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ms | • {{#if: UbuntuHelp:UbuntuDateBug|Bahasa Melayu| [[::UbuntuDateBug/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/nl | • {{#if: UbuntuHelp:UbuntuDateBug|Nederlands| [[::UbuntuDateBug/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/no | • {{#if: UbuntuHelp:UbuntuDateBug|norsk| [[::UbuntuDateBug/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/oc | • {{#if: UbuntuHelp:UbuntuDateBug|occitan| [[::UbuntuDateBug/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/pl | • {{#if: UbuntuHelp:UbuntuDateBug|polski| [[::UbuntuDateBug/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/pt | • {{#if: UbuntuHelp:UbuntuDateBug|português| [[::UbuntuDateBug/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ro | • {{#if: UbuntuHelp:UbuntuDateBug|română| [[::UbuntuDateBug/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/ru | • {{#if: UbuntuHelp:UbuntuDateBug|русский| [[::UbuntuDateBug/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/si | • {{#if: UbuntuHelp:UbuntuDateBug|සිංහල| [[::UbuntuDateBug/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/sq | • {{#if: UbuntuHelp:UbuntuDateBug|shqip| [[::UbuntuDateBug/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/sr | • {{#if: UbuntuHelp:UbuntuDateBug|српски / srpski| [[::UbuntuDateBug/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/sv | • {{#if: UbuntuHelp:UbuntuDateBug|svenska| [[::UbuntuDateBug/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/th | • {{#if: UbuntuHelp:UbuntuDateBug|ไทย| [[::UbuntuDateBug/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/tr | • {{#if: UbuntuHelp:UbuntuDateBug|Türkçe| [[::UbuntuDateBug/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/vi | • {{#if: UbuntuHelp:UbuntuDateBug|Tiếng Việt| [[::UbuntuDateBug/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/yue | • {{#if: UbuntuHelp:UbuntuDateBug|粵語| [[::UbuntuDateBug/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/zh | • {{#if: UbuntuHelp:UbuntuDateBug|中文| [[::UbuntuDateBug/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/zh-hans | • {{#if: UbuntuHelp:UbuntuDateBug|中文(简体)| [[::UbuntuDateBug/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuDateBug | UbuntuHelp:UbuntuDateBug | {{#if: | :}}UbuntuDateBug}}/zh-hant | • {{#if: UbuntuHelp:UbuntuDateBug|中文(繁體)| [[::UbuntuDateBug/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:UbuntuDateBug|:UbuntuDateBug|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :UbuntuDateBug/zh | | {{#ifexist: UbuntuDateBug/zh | | {{#ifeq: {{#titleparts:UbuntuDateBug|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:UbuntuDateBug|1|-1|}} | zh | | }}
There is a rather annoying bug in Ubuntu which causes it to hang if the date is set badly (before 1970 I think). It is simple to fix, but it's rarely diagnosed properly. It has been reported here: https://launchpad.net/distros/ubuntu/+source/gnome-session/+bug/23426 . It crops up occasionaly in the forums so I have put the info here to point people to.
Symptoms
The system boots fine, and gets to the gdm login screen. The user types name and password and presses enter. The screen goes and the user is left on a brown screen. That's it, just a brown screen of death. If the user is savvy they will try ctrl-alt-f1 and get a text terminal. They might try restarting gdm, reinstalling gnome, creating a new user, deleting all their gnome preference files, reinstalling the whole sytem. They probably won't check the computer clock.
How to fix
Simple, set the date right. Boot to the point of the brown screen, then press crtl+alt+f1 (ctrl-option-F1 on a Mac) to get a terminal, and log in. Type:
date
if you get something like
Fri Jan 11 19:11:32 GMT 1970
then run the command
sudo date -s "Fri Nov 11 19:11:32 GMT 2005"
(you will need to put in your password) now do the command
sudo /etc/init.d/gdm restart
and hopefully you can log in.
Why this happens
I believe the bug is related to the way the date is stored and the way c deals with numbers. In unix (and macs) the date is store as the number of seconds since the epoch (1 jan 1970). Negative values represent dates back to 1904. Now of course it is well after 1970, so why bother with being able to set your clock to before 1970. (if you want to store birthdays in a program you might need to, but not for the current date). In c you can store numbers as signed or unsigned. If they are signed they can be negative or positive. Most computers store their time in a signed number, gnome seems to use a signed number, but the kernel seems to use unsigned. So if your computer clock can be set before 1970, most stuff will work fine, however gnome will not boot. Apple Mac computers can be set to dates back to 1904. If the clock in a mac is reset it will go to 1904. The clock in a mac is kept going by the PRAM battery, which runs out after about 5 years. After this time if the mains goes off then the clock will reset, and gnome wont boot. (It can also be reset after a bad crash.) The long term fix on a mac is to replace your PRAM battery.