2

Recently, due to some messy stuff with master boot record, I have to re-install my Ubuntu. Before doing that, I back up all folder (exclude root, bin, sbin, tmp, media, mnt) to a NTFS partition. After installation of Ubuntu, I copied back all the folder using a nautilus (running by sudo nautilus). After that, I reboot my computer. And boom, now I cannot run sudo any more, my network services cannot run. When I run sudo from a terminal, I ge "must be setuid root" error. In ubuntu, root account is disabled by default, I don't know why all these files is no longer under ownership of my account. How would I recover back?

3
  • 1
    How did you back up the data? tar (or similar) or simple copy? Feb 4, 2010 at 10:18
  • I used simple copy. When I tried tar it always said: "cowardly refuse to create empty archive". Don't know what the hell is that, though. Feb 4, 2010 at 12:02
  • You get that message from tar when you do tar -czf file.tar.gz. It is a good thing too, since you meant to type tar -xf file.tar.gz to extract the stuff from the archive. Mar 17, 2010 at 4:30

4 Answers 4

1

sudo command must have setuid permission bit set on it's executable. But in Ubuntu you currently cannot become root. I think you can boot from emergency disk and set this bit on sudo using chmod.

3
  • chmod? My account was not in the account list of the rescue ubuntu, how can I recover my ownership? Feb 4, 2010 at 12:04
  • chmod is not about ownership, but about file permissions. you mean chown. chmod can be used without specifying an account.
    – Christian
    Feb 4, 2010 at 12:50
  • You cannot chmod protected files like sudo being not root. You need to use chmod, not chown to set permission bit "setuid" en.wikipedia.org/wiki/Setuid Feb 9, 2010 at 8:01
1

As Fractalizer said, this is an issue with the setuid bit on sudo. A detailed explanation of how to fix it can be found here: http://ubuntuforums.org/showthread.php?t=219767

There's a pretty good chance there will be other issues beyond this program. So you may find other things blowing up once you resolved the specific problem with sudo. Unfortunately, cp'ing to an NFS share isn't going to retain all the permissions you'll need for a fully functioning system. Especially in places like /usr/bin.

0

your files no longer belong to your account, because you copied them as root. this way root became the owner.

to get back to sudo, mount your root partition from a rescue environment and edit etc/group. add your user account to the admin group and you should have sudo access again.

after that you can change ownership of the copied files. do you have another ubuntu installation where to look for the correct ownership?

2
  • My account was the same across two installation (i.e. phuongnd08). Even the password are same. I checked /etc/group and saw my account was set as adm (I guess it is administration). Feb 4, 2010 at 12:04
  • when you have another machine with the same accounts: boot your "failed" machine with a working network in rescue mode and do a rsync -av <working host>:'/root /bin /sbin /tmp /media /mnt' /mnt/. this way you will get the files with correct ownership and permissions.
    – Christian
    Feb 4, 2010 at 12:56
0

As the others have already said, this is a permissions issue.

First, you copied to a NTFS partition, which has different permissions, so yo are likely to lose some information in the process, although I have never tried it.

Second, you probably should have copied the files with cp -p to preserve mode and ownership.

The best option is to use tar (or equivalent) and I guess you mistyped the command with its options. A simple way to do a backup is something like

tar cf /path/to/backup.tar /usr /bin /var 

Also, as others have mentioned, rsync is a valid option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .