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.

  • 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.) Jun 18 '12 at 22:30

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.

  • 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. Jun 18 '12 at 20:05
  • 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
  • @psusi: the only "root access" I've needed with a live CD was to run gparted, and it runs without any mention of needing root access, unlike the normal installation. This is why I thought it might not be required. But I knew, obviously, that a password could not be required. I did mention in the comment later that there may be something wrong with the disk, and I helped guide him to the easiest way to fix the problem, so I don't understand why the downvotes. Jun 18 '12 at 23:42
  • 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). 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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