14

I have a live USB persistent version of Ubuntu 11.04 installed with Unetbootin.

After some time I experienced some bugs while upgrading the kernel and trying to use my second screen on my laptop. Later then I noticed a strange, apparently unrelated problem: each time i tried to sudosomething i got the same response :

sudo: can't open /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting

Unable to do anything requiring root privileges, I rebooted using the single boot option and was able to access the root console.

I noticed the following behavior :

# ll /etc/sudoers
-r--r----- 0 root root 1014 2011-05-31 16:23 /etc/sudoers
# cat /etc/sudoers
cat: /etc/sudoers: No such file or directory

Is there something wrong with the hard link count being zero ? How can i change it ? The hard link count is 1 on my other computer which work correctly.

The live session user still belongs to the admin group if it matters.

Jorge Castro
  • 71,754
Maxime R.
  • 3,820
  • Check your .bash_history file in the home directory of your USB drive, your command should show up in there. – Lekensteyn Jun 01 '11 at 17:59

3 Answers3

12

A hard link count of zero means that the directory entry doesn't belong to any file. That sounds like a damaged file system.

  • Seems you're right. I got some weird messages from ext2-fs about deleted inodes. I used testdisk to check the usb stick partition but i may have screwed something in the process and am now just unable to boot the system. I'm going to make a clean reinstall. The usb stick is formatted with one FAT32 partition, do you think it would be better to partition it in another way ? I still don't think it's an hardware problem because the usb stick is new. – Maxime R. Jun 02 '11 at 12:17
5

As @Florian Diesch said, I also suggest to perform a fsck on that partition.

Moreover, while in single user mode, and if you can access the network, reinstall sudo package:

apt-get --reinstall install sudo
Eliah Kagan
  • 117,780
enzotib
  • 93,831
  • Good tip, i tried to copy the sudoers file from another computer (did not work) but did'nt thought to reinstall the packet. Unfortunately i'm no more able to boot this system, so i'll make a clean reinstall. – Maxime R. Jun 02 '11 at 11:56
2

There are other forums/errors about the LiveCD/LiveUSB's persistent file system getting corrupted over time, it's an old error going back 3 or 4 years in ubuntu?

A Live USB / Live CD version only uses the casper-rw file to save all the persistent data, if you wanted to "re-install" or "clean install" then erasing the old casper-rw file and making a new empty file will do that (though it would probably eventually get corrupted again)?

Should be able to boot to the "regular" Live CD without persistence from the boot menu, in mine I press Tab on the boot menu to edit and erase the word "persistence" (or maybe persistent, don't remember) and it boots plain old LiveCD, even when my persistent file system has errors (like sudo doesn't work, other misc problems crop up until I erase casper-rw, make a new empty one and start over for the next month)

PS. the file system errors are all inside the casper-rw file, the usb stick (or memory card, etc) file system & "disk" remains in good condition, just inside the casper-rw goes bad. Mine has a FAT or FAT32 file system on the memory card, but the casper-rw uses ext2 fyi

Randy
  • 21