root shell bash commands not working

15,235
mount -o remount,rw /
mount /usr
/usr/bin/passwd root

reboot

where

  • you need to mount / with rw to mount /usr
  • you need /usr for passwd command.
Share:
15,235

Related videos on Youtube

srinivasu u
Author by

srinivasu u

Updated on September 18, 2022

Comments

  • srinivasu u
    srinivasu u over 1 year

    I attempted to change my sudo password(I removed myself from sudoers list by mistake). I tried following.

    1. In recovery mode, I dropped down to root shell. It is still asking root password. Ctrl D did not work. I went to generic e mode then.
    2. I replaced ro quite splash with rw init=/bin/bash and pressed F10 to enter in to root shell.

      root@nouser$ passwd vasu  
      bash : passwd command not found  
      root@nouser$ sudo passwd vasu  
      bash : sudo command not found  
      

    I know commands like sudo and passwd are in /usr/bin. But I found /usr folder to be empty. ls /home is empty as well . But infact I have three users in home folder. I can execute passwd command in general boot. (of course, It is telling I can't do that).
    Can some one tell me what could be the problem?

    • kevy
      kevy about 9 years
      Have you tried mount -o remount,rw /?
    • Νίκος Φυτίλης
      Νίκος Φυτίλης about 9 years
      did you use mount -a to well mount the tings that are listed in fstab?
    • Νίκος Φυτίλης
      Νίκος Φυτίλης about 9 years
      16 sec faster :P