The output from the
file command suggests that the
sudo file has become corrupt and is not recognised as an executable. For comparison here's what I get if I run the same command:
/usr/bin/sudo: setuid ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=02ae0f4b730edb6e01fb34a818cd7ee4a58fc033, stripped
Correcting the problem on a "live" system is not going to be easy as you no longer have a means of elevating your privileges in order to change the file (I think the graphical versions are just wrappers around
If you have another Linux OS to hand you can just mount the SD card and copy the file over. Otherwise you could...
- Copy the file to the first partition on the SD.
init=/bin/sh to the end of
cmdline.txt to enable the emergency shell.
- Boot your Raspberry Pi and wait for the shell prompt.
- Mount the second partition of the SD card:
mount /dev/mmcblk0p2 /mnt
- Move the new file over:
mv /mnt/usr/bin/sudo /mnt/usr/bin/borked_sudo # backup of bad file
mv /boot/sudo /mnt/usr/bin/sudo # copy new file
chown root:root /usr/bin/sudo && chmod u=rws g=rx o=rx /usr/bin/sudo # set permissions
- Shutdown the Pi, revert
cmdline.txt and then re-boot the Pi as normal.
Even if you did have a means of gaining the required privileges for swapping the file, where would you get a good copy of
sudo to replace it with? Possible steps to do this would be to download the Raspbian image corresponding to your install and extract the file from it. I'm not aware of a way to do this on Windows but you can mount the image using a loop-back with Linux. If you have a spare USB drive or SD card you could burn the image to that but you'd still need somehow to mount it on Windows to copy the file.
All told it might be easier to just flash the SD card with a new image?
You mention you have another Linux OS to hand. If this is the case could download the DEB package containing the latest
sudo for Wheezy and extract the binary to the SD card, something along the lines of...
wget "wget http://raspbian.raspberrypi.org/raspbian/pool/main/s/sudo/sudo_1.8.5p2-1+nmu3+deb7u4_armhf.deb"
ar xv "sudo_1.8.5p2-1+nmu3+deb7u4_armhf.deb"
mount "/dev/RasperryPiSDCardp2" "/mount/point"
tar xzvf "data.tar.gz" -C "/mount/point" "./usr/bin/sudo"
rm control.tar.gz data.tar.gz debian-binary
It's a filthy hack but it might get you out of a bind. The URL for the DEB was found by grepping this for "Package: sudo". For refence running
file should then give you:
ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=be4082fba3219f9b829d2a9e0def8d5114161574, stripped