maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Troubleshooting (https://talk.maemo.org/forumdisplay.php?f=6)
-   -   Edited sudoers, now N800 won't finish booting (https://talk.maemo.org/showthread.php?t=15499)

LinuxStation 2008-01-21 23:19

Edited sudoers, now N800 won't finish booting
 
I have an N800 with OS2008, got it just last week. I was logged in as root via ssh from my PC and edited the sudoers file (using visudo). I then opened X-terminal as user and was able to log in as root using 'sudo su' and entering root's password. So all looked good at this point.

I then logged out and powered off the N800, then powered on to reboot it. It started to boot, screen lit up with 'NOKIA', but when the blue line reached the far right that's where it stopped. After some time the screen dims and then goes dark, turns bright again if I tap the screen. It's connected to the power supply so the battery won't run down.

What can be done to restore my original sudoers file? I saved a copy of the original sudoers on the N800 as well as on my PC.

I don't yet know much about how to use the sudoers file. Below is a copy of the one that's in there now, and probably caused the failed boot.
Code:

Defaults env_check+="HOME DISPLAY"
Defaults env_keep+="HOME DISPLAY"
Defaults env_reset
Defaults:user timestamp_timeout=-1, runaspw, passwd_tries=3
root ALL = (ALL) ALL
user ALL = (ALL) ALL


EIPI 2008-01-22 01:41

Re: Edited sudoers, now N800 won't finish booting
 
Did you change the file access permissions of the /etc/sudoers file, by chance?

It should be:

-r--r----- 1 root root

LinuxStation 2008-01-22 02:24

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by EIPI (Post 131757)
Did you change the file access permissions of the /etc/sudoers file, by chance?

I did not look at the permissions of the /etc/sudoers file after using visudo, so permissions are as visudo left them.

In order to power down, I had to remove and re-insert the battery. Then I tried to reflash OS2008, but the N800 would not go into the firmware upload mode. I phoned Nokia tech support, they told me to send it in for warranty repair.

TheGogmagog 2008-01-22 03:00

Re: Edited sudoers, now N800 won't finish booting
 
I don't 'know' but, I read there is a battery that keeps time, and perhaps other status info. Take the battery out for two hours and leave unplugged. Then you should be able to get to the update mode at least.

Milhouse 2008-01-22 06:01

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by LinuxStation (Post 131771)
Then I tried to reflash OS2008, but the N800 would not go into the firmware upload mode.

That sounds odd, to be honest. I can understand to some degree why your device might be hanging during the boot sequence - most likely because a script is either stuck at a password prompt or sudo is failing completely - but for the device to not go into flasher mode doesn't sound like it's connected with your sudo modifications. Could just be a coincidence.... have you tried holding the "Home" key while powering on?

Quote:

Originally Posted by LinuxStation (Post 131771)
I phoned Nokia tech support, they told me to send it in for warranty repair.

I think you're very lucky to get a repair under warranty, particularly if your inability to flash is due to your sudo changes! :)

pamadio 2008-01-22 06:30

Re: Edited sudoers, now N800 won't finish booting
 
Hmmm, so that could explain why i had to reflash my n800 4 time since i had it (yesterday)... It may well be the sudoers modification (done via visudo, in a way that used to work on n800). I was thinking one third party program was doing it, without finding wich one....

Note that reflashing the tablet always worked here.

LinuxStation 2008-01-22 06:57

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by Milhouse (Post 131825)
Could just be a coincidence.... have you tried holding the "Home" key while powering on?

Well yes, holding the Home key (Swap Key) while powering on is the only way I know to begin a firmware upload. After having the battery out for some hours I installed the battery and tried to enter flash mode one more time, but no joy. I usually don't break things this quickly, had it less than a week. Anyway, it's no big deal because it's still under warranty.

johnsto 2008-01-22 07:37

Re: Edited sudoers, now N800 won't finish booting
 
Hmm, my OS2008 sudoers file is MUCH longer than yours. I haven't touched it.

In case it helps:

Code:

### Automatically added by update-sudoers start ###
Defaults env_check+="HOME DISPLAY"
Defaults env_keep+="HOME DISPLAY"
Defaults env_reset
user ALL = NOPASSWD: /usr/sbin/gainroot
user ALL = NOPASSWD: /usr/sbin/mmc-mount /dev/mmcblk0 /media/mmc1
user ALL = NOPASSWD: /usr/sbin/mmc-mount /dev/mmcblk0p1 /media/mmc1
user ALL = NOPASSWD: /bin/umount /media/mmc1,/bin/umount -l /media/mmc1
user ALL = NOPASSWD: /usr/sbin/osso-usb-mass-storage-enable.sh, /usr/sbin/osso-usb-mass-storage-disable.sh
user ALL = NOPASSWD: /sbin/mkdosfs /dev/mmcblk0*, /usr/sbin/mmc-rename /dev/mmcblk0*
user ALL = NOPASSWD: /etc/init.d/af-base-apps stop , /etc/osso-af-init/gconf-daemon.sh stop
user ALL = NOPASSWD: /etc/init.d/af-base-apps start , /etc/osso-af-init/gconf-daemon.sh start
user ALL = NOPASSWD: /etc/init.d/osso-systemui restart
user ALL = NOPASSWD: /usr/sbin/gconf-clean.sh
user ALL = NOPASSWD: /usr/sbin/chroot /mnt/initfs /usr/bin/retutime *
user ALL = NOPASSWD: /sbin/insmod /mnt/initfs/lib/modules/current/g_file_storage.ko stall=0 file=/dev/mmcblk0
user ALL = NOPASSWD: /sbin/insmod /mnt/initfs/lib/modules/current/g_ether.ko
user ALL = NOPASSWD: /sbin/rmmod g_file_storage
user ALL = NOPASSWD: /sbin/rmmod g_ether
user ALL = NOPASSWD: /usr/sbin/osso-backup-restore-locale
user ALL = (install) NOPASSWD: /usr/bin/app-installer-tool
### Automatically added by update-sudoers end ###
### Automatically added by update-sudoers start ###
user ALL = NOPASSWD: /usr/libexec/apt-worker
user ALL = NOPASSWD: /usr/bin/hildon-application-manager-util restore-catalogues
user ALL = NOPASSWD: /usr/bin/hildon-application-manager-util restore-catalogues2
### Automatically added by update-sudoers end ###
### Automatically added by update-sudoers start ###
user ALL = NOPASSWD: /usr/bin/hildon-input-method-configurator.bin
### Automatically added by update-sudoers end ###
### Automatically added by update-sudoers start ###
user ALL = NOPASSWD: /etc/init.d/ke-recv start
user ALL = NOPASSWD: /etc/init.d/ke-recv stop
user ALL = NOPASSWD: /etc/init.d/alarmd start
user ALL = NOPASSWD: /etc/init.d/alarmd stop
user ALL = NOPASSWD: /etc/init.d/osso-hss start
user ALL = NOPASSWD: /etc/init.d/osso-hss stop
user ALL = NOPASSWD: /usr/bin/osso-product-info
user ALL = NOPASSWD: /bin/mv -f /tmp/.opi.tmp.tmp /tmp/.opi.tmp
### Automatically added by update-sudoers end ###
### Automatically added by update-sudoers start ###
user ALL = NOPASSWD: /bin/umount /media/mmc2
user ALL = NOPASSWD: /usr/sbin/osso-prepare-partition.sh *
user ALL = NOPASSWD: /sbin/mkdosfs *
user ALL = NOPASSWD: /etc/init.d/ke-recv stop
user ALL = NOPASSWD: /etc/init.d/hildon-desktop stop
user ALL = NOPASSWD: /etc/init.d/mediaplayer-daemon stop
user ALL = NOPASSWD: /etc/init.d/metalayer-crawler0 stop
### Automatically added by update-sudoers end ###
user ALL = NOPASSWD: /etc/osso-backup/restore.d/always/bluez-restore.sh
user ALL = NOPASSWD: /usr/bin/region
user ALL = NOPASSWD: /bin/mv /etc/rhapsody-install/rhapsody.desktop /usr/share/applications/hildon/


TheGogmagog 2008-01-22 13:39

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by LinuxStation (Post 131850)
Well yes, holding the Home key (Swap Key) while powering on is the only way I know to begin a firmware upload. After having the battery out for some hours I installed the battery and tried to enter flash mode one more time, but no joy. I usually don't break things this quickly, had it less than a week. Anyway, it's no big deal because it's still under warranty.

Not to be as condescending.... But (I think) I noticed that it only goes to firmware mode when actually connected to the computer (I don't think the flash program needs to be running).

I've had startup problems myself, so I won't try it to confirm for you.

Edit; guess I was wrong and removed rude comment.

Milhouse 2008-01-22 18:24

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by TheGogmagog (Post 131950)
Not to be as condecending as the 'hold home key' suggestion....

I wasn't being intentionally condescending - sigh.

Flashing usually works whether you hold the Home button or not, but it's one of those things which people can overlook so is worth asking. If you hold the Home button it will go to flash mode whether it's connected to a computer or not (or will wait longer for a computer to "appear") - if you don't hold the button it will only go to flash mode if it's connected to a computer. Or something like that - holding the button can make a crucial difference. The OP never mentioned it, so I asked. Maybe I shouldn't have bothered... :)

LinuxStation 2008-01-23 05:46

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by Milhouse (Post 132060)
The OP never mentioned it, so I asked. Maybe I shouldn't have bothered... :)

Not a problem. I didn't think your comment was condescending, but in fact it confirmed to me that I was doing it correctly. Some descending is in order as I did mention that I'd had the unit only a week, that implies I may not be familiar with it's operation.

[Middle English condescenden, from Old French condescendre, from Late Latin condēscendere : Latin com-, intensive pref.; see com- + dēscendere, to descend; see descend.]

mwiktowy 2008-01-23 05:59

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by Milhouse (Post 132060)
Flashing usually works whether you hold the Home button or not, but it's one of those things which people can overlook so is worth asking. If you hold the Home button it will go to flash mode whether it's connected to a computer or not (or will wait longer for a computer to "appear") - if you don't hold the button it will only go to flash mode if it's connected to a computer. Or something like that - holding the button can make a crucial difference.

Confirmed ... I have never had to hold down the home key to flash. I just have my tablet off, plug in the usb cable, start the flasher, it says it is waiting for the tablet, turn the tablet on and, presto, it starts to flash.

Like you said, the home key hold just forces it into that mode if your flasher isn't running.

Nokia is probably correct to suggest you send your tablet in for warranty even if you have been messing with sudoers as I can't see anything you could possibly do to sudoers file that would prevent reflashing of the firmware. Most likely a hardware failure.

Hope you get a replacement soon and it doesn't get caught in tablet limbo like some of the horror stories I have read here. You might do some searching of the forums to find the proper service place to send it.

LinuxStation 2008-01-23 06:36

Re: Edited sudoers, now N800 won't finish booting
 
Well, I sent it off today. When I tried to reload the firmware yesterday I had it connected to a USB port on my computer, but not the same port I used for the first firmware flash. The first time I flashed it using a USB 1.1 port which is built-in to my notebook computer. For this last attempt, I used a USB 2.0 PCMCIA card inserted into a PCMCIA slot. If the USB 2.0 PCMCIA card was somehow incompatible with the N800, or incompatible with Nokia's flash program, then the N800 would not have entered the firmware upload mode, which is of course what was observed. I should have tried it with the USB connected to the older USB 1.1 port that worked for the first flash operation, but of course I was following Nokia's flashing instructions which failed to mention that the firmware upload mode was entered by powering on while connected to a computer's USB port, and that holding Swap key was superfluous.

It will be interesting when the N800 comes back to me. I will check it out with both my USB 1.1 and 2.0 ports. If it won't go into flash mode while connected to my USB 2.0 PCMCIA card that would indicate that I need not have sent it off for warranty service.

wzzrd 2008-03-12 23:55

Re: Edited sudoers, now N800 won't finish booting
 
I'm pretty new here, but I thought I throw in my $0.02 at this problem (the sudoers problem that is, not the booting), since I have had it as well. I'm not too well at home in the N800's OS yet, but I've got my share of Linux experience and certs so here goes:

What I think the problem is, is that the N800 uses a passwordless sudo command sometime during the boot sequence, possibly at more than one point. What a lot of desktop Linux distro's do is place an item like

%wheel ALL = (ALL) ALL

in the sudoers file. It is very tempting to put such an entry in the sudoers on the N800. That way, you can log in and execute commands as root fairly securely. The last matching entry for a user in sudoers is used by sudo, so effectively, this means I can now execute all programs as root, but I need to *always* enter a password.

And there is your problem: during boot, the N800 needs to be able to execute some stuff by sudo *without a password*. But since we just overrode this by putting '%users ALL = (ALL) ALL' at the bottom of the sudoers file, sudo is now waiting for our input during boot, which will never arrive :D

Someone opted earlier that the permissions on the sudoers file might have been wrong or that the syntax was faulty. visudo is supposed to protect you from both and afaik does a pretty good job at it. I don't think any of these options were part of the problem here.

Anyway, I reckon that putting the entry at the top of the sudoers file would be safe, but I haven't tested this. Hope this helps some of you and hope it saves you from flashing your device 17.000 times during the first days you own it ;-)

And that just leaves me, with all my certifications, bashing my head against the wall for being such an a**e for taking so long to solve this :)

LinuxStation 2008-03-13 02:43

Re: Edited sudoers, now N800 won't finish booting
 
Hi wzzrd,

Thanks for the insight into what was most likely happening. I just want to be able to use su to become root as I normally do in my desktop Linux. I maintain a Linux repository and am pretty good with rsync, but other than that my Linux knowledge is limited. Do you think you could come up with an N800 sudoers file that will do the trick?

wzzrd 2008-03-13 09:25

Re: Edited sudoers, now N800 won't finish booting
 
I'll give it a shot today. Hope I don't end up flashing the device. Again. :)

If it works, I'll let you know.

By the way, personally, I would go for using sudo whenever possible and refrain from working as root, but that's a choice you have to make for yourself.

If this won't work, you can install openssh, create an ssh key, and enable login with that key as root. Than you create an alias for the user account like:

alias beroot='ssh root@localhost'

That should do the trick as well. But: I need the sudoers file as well, so I'll get back to you.

wzzrd 2008-03-13 13:51

Re: Edited sudoers, now N800 won't finish booting
 
As i thought: it works for me with

user ALL = (ALL) ALL

at the *top* of /etc/sudoers. After reboot I can still use the device :-)

beware though! ymmv!

LinuxStation 2008-03-13 15:19

Re: Edited sudoers, now N800 won't finish booting
 
In the beginning I was trying to run a WiFi scanning program that needs to be root in order to display full data, that's how I got into the sudoers problem. I had in fact set up ssh access (using a key pair) from user to root account and it worked, but thought it would be using CPU time to encrypt the data between root and user so I tried the sudoers method. I have now received my N800 back from warranty repair and will have some time to work with it again within the next week.

So you took the 2008 OS factory sudoers and added
user ALL = (ALL) ALL
at the top? I just want to make sure I do it exactly as you did. If I have
user ALL = (ALL) ALL
at top of my sudoers, is there any reason to leave the remaining lines in the sudoers?

qwerty12 2008-03-13 17:15

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by LinuxStation (Post 154444)
is there any reason to leave the remaining lines in the sudoers?

I don't think there is but it doesn't hurt to have them there.

BTW: you should install openssh. I once locked myself out of sudo and ssh saved my ***.

wzzrd 2008-03-13 21:32

Re: Edited sudoers, now N800 won't finish booting
 
Quote:

Originally Posted by LinuxStation (Post 154444)
In the beginning I was trying to run a WiFi scanning program that needs to be root in order to display full data, that's how I got into the sudoers problem. I had in fact set up ssh access (using a key pair) from user to root account and it worked, but thought it would be using CPU time to encrypt the data between root and user so I tried the sudoers method. I have now received my N800 back from warranty repair and will have some time to work with it again within the next week.

So you took the 2008 OS factory sudoers and added
user ALL = (ALL) ALL
at the top? I just want to make sure I do it exactly as you did. If I have
user ALL = (ALL) ALL
at top of my sudoers, is there any reason to leave the remaining lines in the sudoers?

To start with the last: yes, the rest of the sudoers file is there with a reason. Leave it there! I cannot stress this enough: do not remove the other lines, just add the one line as the very first. If you remove other lines, you might render the device unbootable.

Second: yes, an ssh connection will put some (minor) burden on the cpu.

Third: Please, if you have important data on your n800, make a backup before toying with your sudoers file: I cannot guarantee that it will not break your os, forcing you to reflash...

Good luck. ;-)


All times are GMT. The time now is 17:02.

vBulletin® Version 3.8.8