Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I had to reinstall windows. Unfortunately, this means that grub isn't working. Booted from live CD, opened terminal and typed:

sudo update-grub

But got the message returned

sudo: can't stat /etc/sudoers: Input/output error
sudo: no valid sudoers sources found, quitting

Tried without sudo, it told me I had to be root to do it.

share|improve this question
    
Did you try reinstalling grub? –  Alen Jun 18 '12 at 19:57
    
@Alen That's what he is trying to do! (The method he's using seems wrong, but no method will work if sudo won't work.) –  Eliah Kagan Jun 18 '12 at 22:30

2 Answers 2

There must be some error with the liveCD. As suggested by @psusi, you should check the disk. If there's an error, you may want to replace it before using it for anything else. And it's a good idea to check the ISO before burning.

Originally, I had thought that sudo was not required since there's no password, but I found that this is not the case. Programs like gparted, that normally prompt for a password, will run from the menu without prompting; but commandline programs still require sudo, although they don't prompt for a password.

But you should be aware that update-grub would not be the correct method to fix this in any case; it simply generates the menu configuration file (/boot/grub/grub.cfg) in the partition that the GRUB MBR code reads (in this case, the CD, which can't even be written). In your case, the GRUB code is not in the MBR, so it is not being run; therefore, it never reads the menu configuration file.

What you need to use is grub-install to fix your problem, which is a bit more complex, and requires mounting the disk. It may be easier for you to use the boot repair disk . This disk will automatically fix this problem.

In order to actually put GRUB on the MBR, you need to run grub-install, specifying which directory to use for grub.cfg (it will default to /boot/grub/grub.cfg), and specifying the disk for the MBR code, such as sudo grub-install --root-directory = /media/sda2 /dev/sda; assuming /dev/sda2 is mounted at /media. The main point is that the partition must be mounted to have grub.cfg installed.

The syntax for grub-install is basically:

sudo grub-install < mounted location of grub.cfg > < name of disk MBR for GRUB itself >

So, in my example it assumes /dev/sda2 is mounted at /media/sda2, and will put grub.cfg in /media/sda2/boot/grub.

share|improve this answer
    
Just tried it without sudo, it tells me: grub-mkconfig: You must run this as root –  Matthew Jun 18 '12 at 19:57
    
I don't know that I ever had to run that particular program, but others have worked fine without sudo. Don't know how can you possibly use it if you don't have a password. Maybe there's something wrong with the sudoers file, There's a Boot Repair Disk that fixes this problem automatically, if you want to burn one. That's what I usually use due to laziness. You can read about it here. –  Marty Fried Jun 18 '12 at 20:05
    
Ok, thanks, am in process of burning CD. –  Matthew Jun 18 '12 at 20:21
1  
sudo is always required for root access. Since there is no password on the livecd, it doesn't prompt for one. –  psusi Jun 18 '12 at 22:15
1  
@psusi It would be more accurate to say that sudo or PolicyKit is always required for root access. A lot of what people tend to think is a graphical frontend for sudo is actually PolicyKit (which is completely independent of sudo). –  Eliah Kagan Jun 18 '12 at 23:47

It seems that your cd is damaged. You can run the disc check at the boot menu to confirm.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.