If you follow the posts on this site, you'd have noticed my issues with the recent Hardy upgrade. While I thought they'd been fixed in my fstab, this was apparently not the case. When I rebooted the machine next, I couldn't even get to the shell as I encountered the message - Unable to execute /bin/sh - Permission Denied.
The error message essentially means that you have fucked up your fstab and set the root partition to read-only. To fix this, you will need to access the fstab and amend it to be writable or in the more plausible scenario, remove the duplicate read-only mount for the root partition from your fstab. To access the fstab, you will need to either move the drive to another machine or boot-up using a Live CD like Knoppix or even that of your distro, mount the root partition and perform the amendments.
In my case, this whole affair occurred because of the aforementioned upgrade - this is not Kubuntu's fault btw - where the new version of the Linux kernel decided to standardise all hard disc denotations to sdX rather than use hdX for PATA and sdX for SCSI (and SATA) drives. This wreaked havoc on my box where my mount point all got messed up due to the fact that my hda drive was now my sda, my sda was now my sdb ad infinitum. Furthermore, this happened because my fstab mount entries were based on partition denotations rather than their UUIDs. UUIDs are effectively constants whereas partition denotations can be variable as seen here.
The UUIDs for each partition can been seen by typing blkid in a terminal.
- Boot up using a Live CD.
- Open a command prompt / terminal. In KDE, this would be done using something like Konsole. On Live CDs this is usually a root shell. If not, you will need to prefix a sudo to each of the commans below.
- Type cd /media to change the directory to /media. This location might vary from distribution to distribution.
- Type mkdir temp1 to create a mount point for the root partition.
- Type mount /dev/sda1 temp1 which will mount the partition /dev/sda1 as the temp1 directory. /dev/sda1 is assumed to be your root partition. It could also be something else like /dev/hda1.
- Edit the fstab file using nano temp1/etc/fstab where nano is the name of the editor of choice. You might want to back-up this file first just in case.
- Try to understand how these entries are set up. Look for a duplicate entry for the partition named "/" where the "/" denotes the root partition. If there is one, comment it out by prepending the line with a #. You should only have one mount point for each partition.
- If there are no duplicates, check to see if the root partition is being mounted automatically (look for the term "auto") and has write access (look for the term "rw"). Amend as necessary.
- Finally, to prevent this screw-up from ever happening again, ensure that each entry is based on the UUID rather than the partition denotation. For e.g.,
/dev/sdb1 /media/video auto nouser,atime,auto,rw,nodev,noexec,nosuid 0 0
UUID=2b12354a-4fbf-4540-9913-d2a349732b1e /media/video auto nouser,atime,auto,rw,nodev,noexec,nosuid 0 0
As mentioned above, use the blkid command to find the UUIDs for each partition. You can open another terminal window to do this.
- Save the file and reboot to see if everything is back to normal.
Hope this helps somebody out there!
- Log in to post comments
Went half crazy for a couple
Went half crazy for a couple of hours until finding this post. If it were not for your tip of a scrambled fstab I would never, ever have found the problem. Your tip has transformed what was going to be a reinstall fest into a very simple fix.