Reset root password for Ubuntu 16.04 - recovery mode asks for root password [duplicate]












8
















This question already has an answer here:




  • How do I reset a lost password (using recovery mode requires me to type the password)?

    4 answers



  • How do I reset a lost administrative password?

    15 answers




We've lost the root password from our file server from supermicro server.



I tried to follow the common instructions to reboot with left shift and drop to root shell as it is described in this answer.



When I choose root in this menu:



menu



Ubuntu still asks for root password or propose to press Ctrl+D to return to Recovery menu.



Are there any other ways to reset root password?










share|improve this question















marked as duplicate by Zanna, muru, Eric Carvalho, Eliah Kagan, Charles Green Nov 28 '17 at 14:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • You have physical access to this machine? Boot it with a life USB is an option too.

    – Videonauth
    Nov 25 '17 at 12:38











  • Yes I have access. But what soul I do with usb?

    – zlon
    Nov 25 '17 at 12:42











  • in live CD after Ctrl-Alt-F1, I login as ubuntu and empty pass. then I do sudo mount /dev/sda1 /mnt. Then I do sudo chroot /mnt. This command did not work: "chroot: failed to run command '/bin/bash': No such file or directory. Nevertheless, chroot --help gives me a help.

    – zlon
    Nov 25 '17 at 13:20











  • seen unix.stackexchange.com/questions/128046/… for that. Chroot is not missing, it is missing stuff inside your chroot environment to properly start up

    – Videonauth
    Nov 25 '17 at 13:27








  • 1





    @zlon If sudo mount /dev/sda1 /mnt shows no errors and then sudo chroot /mnt fails with the error message chroot: failed to run command ‘/bin/bash’: No such file or directory, that means the bash shell was not found in the usual place inside the partition mounted in /mnt. Although there are several possible causes for that, in practice it simply means that you mounted the wrong partition. Your installed system's root partition is not always /dev/sda1. You've accepted an answer, indicating that this is now solved. Was that the cause? Was your root partition not /dev/sda1?

    – Eliah Kagan
    Nov 26 '17 at 18:12
















8
















This question already has an answer here:




  • How do I reset a lost password (using recovery mode requires me to type the password)?

    4 answers



  • How do I reset a lost administrative password?

    15 answers




We've lost the root password from our file server from supermicro server.



I tried to follow the common instructions to reboot with left shift and drop to root shell as it is described in this answer.



When I choose root in this menu:



menu



Ubuntu still asks for root password or propose to press Ctrl+D to return to Recovery menu.



Are there any other ways to reset root password?










share|improve this question















marked as duplicate by Zanna, muru, Eric Carvalho, Eliah Kagan, Charles Green Nov 28 '17 at 14:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • You have physical access to this machine? Boot it with a life USB is an option too.

    – Videonauth
    Nov 25 '17 at 12:38











  • Yes I have access. But what soul I do with usb?

    – zlon
    Nov 25 '17 at 12:42











  • in live CD after Ctrl-Alt-F1, I login as ubuntu and empty pass. then I do sudo mount /dev/sda1 /mnt. Then I do sudo chroot /mnt. This command did not work: "chroot: failed to run command '/bin/bash': No such file or directory. Nevertheless, chroot --help gives me a help.

    – zlon
    Nov 25 '17 at 13:20











  • seen unix.stackexchange.com/questions/128046/… for that. Chroot is not missing, it is missing stuff inside your chroot environment to properly start up

    – Videonauth
    Nov 25 '17 at 13:27








  • 1





    @zlon If sudo mount /dev/sda1 /mnt shows no errors and then sudo chroot /mnt fails with the error message chroot: failed to run command ‘/bin/bash’: No such file or directory, that means the bash shell was not found in the usual place inside the partition mounted in /mnt. Although there are several possible causes for that, in practice it simply means that you mounted the wrong partition. Your installed system's root partition is not always /dev/sda1. You've accepted an answer, indicating that this is now solved. Was that the cause? Was your root partition not /dev/sda1?

    – Eliah Kagan
    Nov 26 '17 at 18:12














8












8








8


1







This question already has an answer here:




  • How do I reset a lost password (using recovery mode requires me to type the password)?

    4 answers



  • How do I reset a lost administrative password?

    15 answers




We've lost the root password from our file server from supermicro server.



I tried to follow the common instructions to reboot with left shift and drop to root shell as it is described in this answer.



When I choose root in this menu:



menu



Ubuntu still asks for root password or propose to press Ctrl+D to return to Recovery menu.



Are there any other ways to reset root password?










share|improve this question

















This question already has an answer here:




  • How do I reset a lost password (using recovery mode requires me to type the password)?

    4 answers



  • How do I reset a lost administrative password?

    15 answers




We've lost the root password from our file server from supermicro server.



I tried to follow the common instructions to reboot with left shift and drop to root shell as it is described in this answer.



When I choose root in this menu:



menu



Ubuntu still asks for root password or propose to press Ctrl+D to return to Recovery menu.



Are there any other ways to reset root password?





This question already has an answer here:




  • How do I reset a lost password (using recovery mode requires me to type the password)?

    4 answers



  • How do I reset a lost administrative password?

    15 answers








password root recovery-mode






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '17 at 8:12









Zanna

50.7k13135241




50.7k13135241










asked Nov 25 '17 at 12:32









zlonzlon

147117




147117




marked as duplicate by Zanna, muru, Eric Carvalho, Eliah Kagan, Charles Green Nov 28 '17 at 14:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Zanna, muru, Eric Carvalho, Eliah Kagan, Charles Green Nov 28 '17 at 14:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • You have physical access to this machine? Boot it with a life USB is an option too.

    – Videonauth
    Nov 25 '17 at 12:38











  • Yes I have access. But what soul I do with usb?

    – zlon
    Nov 25 '17 at 12:42











  • in live CD after Ctrl-Alt-F1, I login as ubuntu and empty pass. then I do sudo mount /dev/sda1 /mnt. Then I do sudo chroot /mnt. This command did not work: "chroot: failed to run command '/bin/bash': No such file or directory. Nevertheless, chroot --help gives me a help.

    – zlon
    Nov 25 '17 at 13:20











  • seen unix.stackexchange.com/questions/128046/… for that. Chroot is not missing, it is missing stuff inside your chroot environment to properly start up

    – Videonauth
    Nov 25 '17 at 13:27








  • 1





    @zlon If sudo mount /dev/sda1 /mnt shows no errors and then sudo chroot /mnt fails with the error message chroot: failed to run command ‘/bin/bash’: No such file or directory, that means the bash shell was not found in the usual place inside the partition mounted in /mnt. Although there are several possible causes for that, in practice it simply means that you mounted the wrong partition. Your installed system's root partition is not always /dev/sda1. You've accepted an answer, indicating that this is now solved. Was that the cause? Was your root partition not /dev/sda1?

    – Eliah Kagan
    Nov 26 '17 at 18:12



















  • You have physical access to this machine? Boot it with a life USB is an option too.

    – Videonauth
    Nov 25 '17 at 12:38











  • Yes I have access. But what soul I do with usb?

    – zlon
    Nov 25 '17 at 12:42











  • in live CD after Ctrl-Alt-F1, I login as ubuntu and empty pass. then I do sudo mount /dev/sda1 /mnt. Then I do sudo chroot /mnt. This command did not work: "chroot: failed to run command '/bin/bash': No such file or directory. Nevertheless, chroot --help gives me a help.

    – zlon
    Nov 25 '17 at 13:20











  • seen unix.stackexchange.com/questions/128046/… for that. Chroot is not missing, it is missing stuff inside your chroot environment to properly start up

    – Videonauth
    Nov 25 '17 at 13:27








  • 1





    @zlon If sudo mount /dev/sda1 /mnt shows no errors and then sudo chroot /mnt fails with the error message chroot: failed to run command ‘/bin/bash’: No such file or directory, that means the bash shell was not found in the usual place inside the partition mounted in /mnt. Although there are several possible causes for that, in practice it simply means that you mounted the wrong partition. Your installed system's root partition is not always /dev/sda1. You've accepted an answer, indicating that this is now solved. Was that the cause? Was your root partition not /dev/sda1?

    – Eliah Kagan
    Nov 26 '17 at 18:12

















You have physical access to this machine? Boot it with a life USB is an option too.

– Videonauth
Nov 25 '17 at 12:38





You have physical access to this machine? Boot it with a life USB is an option too.

– Videonauth
Nov 25 '17 at 12:38













Yes I have access. But what soul I do with usb?

– zlon
Nov 25 '17 at 12:42





Yes I have access. But what soul I do with usb?

– zlon
Nov 25 '17 at 12:42













in live CD after Ctrl-Alt-F1, I login as ubuntu and empty pass. then I do sudo mount /dev/sda1 /mnt. Then I do sudo chroot /mnt. This command did not work: "chroot: failed to run command '/bin/bash': No such file or directory. Nevertheless, chroot --help gives me a help.

– zlon
Nov 25 '17 at 13:20





in live CD after Ctrl-Alt-F1, I login as ubuntu and empty pass. then I do sudo mount /dev/sda1 /mnt. Then I do sudo chroot /mnt. This command did not work: "chroot: failed to run command '/bin/bash': No such file or directory. Nevertheless, chroot --help gives me a help.

– zlon
Nov 25 '17 at 13:20













seen unix.stackexchange.com/questions/128046/… for that. Chroot is not missing, it is missing stuff inside your chroot environment to properly start up

– Videonauth
Nov 25 '17 at 13:27







seen unix.stackexchange.com/questions/128046/… for that. Chroot is not missing, it is missing stuff inside your chroot environment to properly start up

– Videonauth
Nov 25 '17 at 13:27






1




1





@zlon If sudo mount /dev/sda1 /mnt shows no errors and then sudo chroot /mnt fails with the error message chroot: failed to run command ‘/bin/bash’: No such file or directory, that means the bash shell was not found in the usual place inside the partition mounted in /mnt. Although there are several possible causes for that, in practice it simply means that you mounted the wrong partition. Your installed system's root partition is not always /dev/sda1. You've accepted an answer, indicating that this is now solved. Was that the cause? Was your root partition not /dev/sda1?

– Eliah Kagan
Nov 26 '17 at 18:12





@zlon If sudo mount /dev/sda1 /mnt shows no errors and then sudo chroot /mnt fails with the error message chroot: failed to run command ‘/bin/bash’: No such file or directory, that means the bash shell was not found in the usual place inside the partition mounted in /mnt. Although there are several possible causes for that, in practice it simply means that you mounted the wrong partition. Your installed system's root partition is not always /dev/sda1. You've accepted an answer, indicating that this is now solved. Was that the cause? Was your root partition not /dev/sda1?

– Eliah Kagan
Nov 26 '17 at 18:12










1 Answer
1






active

oldest

votes


















11














Since you have physical access to the machine you can do this via an Live USB/CD.





  1. Boot from your USB and chose 'Try Ubuntu' instead of 'Install Ubuntu'.



    enter image description here




  2. Open a terminal (Ctrl+Alt+T) and first look what device handle your machine disk has. You can do that with lsblk which should yield an output like this (I used a live CD for this since I am reproducing the steps in a VM):



    $ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    sda 8:0 0 119,2G 0 disk
    ├─sda1 8:2 0 16G 0 part [SWAP]
    └─sda2 8:3 0 103,2G 0 part /
    sr0 11:0 1 1024M 0 rom /cdrom


    So in this case it would be /dev/sda2 but this could differ for your installation.




  3. Now mount the partition in question with:



    sudo mount /dev/sda2 /mnt



  4. Now coming to the part where you can finally1chroot into it.



    sudo chroot /mnt


    You will see that your prompt has changed to something like root@ubuntu:/# and now the next steps are pretty straightforward.




  5. Change the password for your users with passwd:



    passwd root
    passwd <main-user>


    This should have done it already, but if that for whatever case setting passwords with the passwd command fails, you can go deep down the rabbit hole and change the /etc/shadow file, but Beware: this is quite dangerous and you do this at your own risk.



  6. Exit the chrootby pressing Ctrl+D or type exit. Unmount the machine with sudo umount /mnt and then reboot by sudo reboot. You want to take the USB/CD out and make sure you're actually booting the machine in question.





1 That chrooting method is sufficient to reset passwords, or even to add and remove users from groups, but it does not allow you to fully use the installed system through the chroot. Many other commands, such as apt, would fail if you ran them in a chroot set up that way.



If you ever need to perform more extensive repairs on an installed system that you are accessing from a live CD/DVD/USB--for example by installing, removing, or updating software--then you would want to set up some additional mounts before chrooting. You would do that by running these commands after running sudo mount /dev/sda2 /mnt but before running sudo chroot /mnt:



sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /dev/pts /mnt/dev/pts
sudo mount -t sysfs /sys /mnt/sys
sudo mount -t proc /proc /mnt/proc


If you have multiple partitions for the different parts of the OS, like for example a separate /boot partition, then you would want to mount them to the right positions. For example, where sdX is the device name for that particular drive and n is the partition number:



sudo mount /dev/sdXn /mnt/boot


It is fine if you run those commands before chrooting in to reset passwords with the passwd command. It is not necessary, though.






share|improve this answer
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    11














    Since you have physical access to the machine you can do this via an Live USB/CD.





    1. Boot from your USB and chose 'Try Ubuntu' instead of 'Install Ubuntu'.



      enter image description here




    2. Open a terminal (Ctrl+Alt+T) and first look what device handle your machine disk has. You can do that with lsblk which should yield an output like this (I used a live CD for this since I am reproducing the steps in a VM):



      $ lsblk
      NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
      sda 8:0 0 119,2G 0 disk
      ├─sda1 8:2 0 16G 0 part [SWAP]
      └─sda2 8:3 0 103,2G 0 part /
      sr0 11:0 1 1024M 0 rom /cdrom


      So in this case it would be /dev/sda2 but this could differ for your installation.




    3. Now mount the partition in question with:



      sudo mount /dev/sda2 /mnt



    4. Now coming to the part where you can finally1chroot into it.



      sudo chroot /mnt


      You will see that your prompt has changed to something like root@ubuntu:/# and now the next steps are pretty straightforward.




    5. Change the password for your users with passwd:



      passwd root
      passwd <main-user>


      This should have done it already, but if that for whatever case setting passwords with the passwd command fails, you can go deep down the rabbit hole and change the /etc/shadow file, but Beware: this is quite dangerous and you do this at your own risk.



    6. Exit the chrootby pressing Ctrl+D or type exit. Unmount the machine with sudo umount /mnt and then reboot by sudo reboot. You want to take the USB/CD out and make sure you're actually booting the machine in question.





    1 That chrooting method is sufficient to reset passwords, or even to add and remove users from groups, but it does not allow you to fully use the installed system through the chroot. Many other commands, such as apt, would fail if you ran them in a chroot set up that way.



    If you ever need to perform more extensive repairs on an installed system that you are accessing from a live CD/DVD/USB--for example by installing, removing, or updating software--then you would want to set up some additional mounts before chrooting. You would do that by running these commands after running sudo mount /dev/sda2 /mnt but before running sudo chroot /mnt:



    sudo mount -o bind /dev /mnt/dev
    sudo mount -o bind /dev/pts /mnt/dev/pts
    sudo mount -t sysfs /sys /mnt/sys
    sudo mount -t proc /proc /mnt/proc


    If you have multiple partitions for the different parts of the OS, like for example a separate /boot partition, then you would want to mount them to the right positions. For example, where sdX is the device name for that particular drive and n is the partition number:



    sudo mount /dev/sdXn /mnt/boot


    It is fine if you run those commands before chrooting in to reset passwords with the passwd command. It is not necessary, though.






    share|improve this answer






























      11














      Since you have physical access to the machine you can do this via an Live USB/CD.





      1. Boot from your USB and chose 'Try Ubuntu' instead of 'Install Ubuntu'.



        enter image description here




      2. Open a terminal (Ctrl+Alt+T) and first look what device handle your machine disk has. You can do that with lsblk which should yield an output like this (I used a live CD for this since I am reproducing the steps in a VM):



        $ lsblk
        NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
        sda 8:0 0 119,2G 0 disk
        ├─sda1 8:2 0 16G 0 part [SWAP]
        └─sda2 8:3 0 103,2G 0 part /
        sr0 11:0 1 1024M 0 rom /cdrom


        So in this case it would be /dev/sda2 but this could differ for your installation.




      3. Now mount the partition in question with:



        sudo mount /dev/sda2 /mnt



      4. Now coming to the part where you can finally1chroot into it.



        sudo chroot /mnt


        You will see that your prompt has changed to something like root@ubuntu:/# and now the next steps are pretty straightforward.




      5. Change the password for your users with passwd:



        passwd root
        passwd <main-user>


        This should have done it already, but if that for whatever case setting passwords with the passwd command fails, you can go deep down the rabbit hole and change the /etc/shadow file, but Beware: this is quite dangerous and you do this at your own risk.



      6. Exit the chrootby pressing Ctrl+D or type exit. Unmount the machine with sudo umount /mnt and then reboot by sudo reboot. You want to take the USB/CD out and make sure you're actually booting the machine in question.





      1 That chrooting method is sufficient to reset passwords, or even to add and remove users from groups, but it does not allow you to fully use the installed system through the chroot. Many other commands, such as apt, would fail if you ran them in a chroot set up that way.



      If you ever need to perform more extensive repairs on an installed system that you are accessing from a live CD/DVD/USB--for example by installing, removing, or updating software--then you would want to set up some additional mounts before chrooting. You would do that by running these commands after running sudo mount /dev/sda2 /mnt but before running sudo chroot /mnt:



      sudo mount -o bind /dev /mnt/dev
      sudo mount -o bind /dev/pts /mnt/dev/pts
      sudo mount -t sysfs /sys /mnt/sys
      sudo mount -t proc /proc /mnt/proc


      If you have multiple partitions for the different parts of the OS, like for example a separate /boot partition, then you would want to mount them to the right positions. For example, where sdX is the device name for that particular drive and n is the partition number:



      sudo mount /dev/sdXn /mnt/boot


      It is fine if you run those commands before chrooting in to reset passwords with the passwd command. It is not necessary, though.






      share|improve this answer




























        11












        11








        11







        Since you have physical access to the machine you can do this via an Live USB/CD.





        1. Boot from your USB and chose 'Try Ubuntu' instead of 'Install Ubuntu'.



          enter image description here




        2. Open a terminal (Ctrl+Alt+T) and first look what device handle your machine disk has. You can do that with lsblk which should yield an output like this (I used a live CD for this since I am reproducing the steps in a VM):



          $ lsblk
          NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
          sda 8:0 0 119,2G 0 disk
          ├─sda1 8:2 0 16G 0 part [SWAP]
          └─sda2 8:3 0 103,2G 0 part /
          sr0 11:0 1 1024M 0 rom /cdrom


          So in this case it would be /dev/sda2 but this could differ for your installation.




        3. Now mount the partition in question with:



          sudo mount /dev/sda2 /mnt



        4. Now coming to the part where you can finally1chroot into it.



          sudo chroot /mnt


          You will see that your prompt has changed to something like root@ubuntu:/# and now the next steps are pretty straightforward.




        5. Change the password for your users with passwd:



          passwd root
          passwd <main-user>


          This should have done it already, but if that for whatever case setting passwords with the passwd command fails, you can go deep down the rabbit hole and change the /etc/shadow file, but Beware: this is quite dangerous and you do this at your own risk.



        6. Exit the chrootby pressing Ctrl+D or type exit. Unmount the machine with sudo umount /mnt and then reboot by sudo reboot. You want to take the USB/CD out and make sure you're actually booting the machine in question.





        1 That chrooting method is sufficient to reset passwords, or even to add and remove users from groups, but it does not allow you to fully use the installed system through the chroot. Many other commands, such as apt, would fail if you ran them in a chroot set up that way.



        If you ever need to perform more extensive repairs on an installed system that you are accessing from a live CD/DVD/USB--for example by installing, removing, or updating software--then you would want to set up some additional mounts before chrooting. You would do that by running these commands after running sudo mount /dev/sda2 /mnt but before running sudo chroot /mnt:



        sudo mount -o bind /dev /mnt/dev
        sudo mount -o bind /dev/pts /mnt/dev/pts
        sudo mount -t sysfs /sys /mnt/sys
        sudo mount -t proc /proc /mnt/proc


        If you have multiple partitions for the different parts of the OS, like for example a separate /boot partition, then you would want to mount them to the right positions. For example, where sdX is the device name for that particular drive and n is the partition number:



        sudo mount /dev/sdXn /mnt/boot


        It is fine if you run those commands before chrooting in to reset passwords with the passwd command. It is not necessary, though.






        share|improve this answer















        Since you have physical access to the machine you can do this via an Live USB/CD.





        1. Boot from your USB and chose 'Try Ubuntu' instead of 'Install Ubuntu'.



          enter image description here




        2. Open a terminal (Ctrl+Alt+T) and first look what device handle your machine disk has. You can do that with lsblk which should yield an output like this (I used a live CD for this since I am reproducing the steps in a VM):



          $ lsblk
          NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
          sda 8:0 0 119,2G 0 disk
          ├─sda1 8:2 0 16G 0 part [SWAP]
          └─sda2 8:3 0 103,2G 0 part /
          sr0 11:0 1 1024M 0 rom /cdrom


          So in this case it would be /dev/sda2 but this could differ for your installation.




        3. Now mount the partition in question with:



          sudo mount /dev/sda2 /mnt



        4. Now coming to the part where you can finally1chroot into it.



          sudo chroot /mnt


          You will see that your prompt has changed to something like root@ubuntu:/# and now the next steps are pretty straightforward.




        5. Change the password for your users with passwd:



          passwd root
          passwd <main-user>


          This should have done it already, but if that for whatever case setting passwords with the passwd command fails, you can go deep down the rabbit hole and change the /etc/shadow file, but Beware: this is quite dangerous and you do this at your own risk.



        6. Exit the chrootby pressing Ctrl+D or type exit. Unmount the machine with sudo umount /mnt and then reboot by sudo reboot. You want to take the USB/CD out and make sure you're actually booting the machine in question.





        1 That chrooting method is sufficient to reset passwords, or even to add and remove users from groups, but it does not allow you to fully use the installed system through the chroot. Many other commands, such as apt, would fail if you ran them in a chroot set up that way.



        If you ever need to perform more extensive repairs on an installed system that you are accessing from a live CD/DVD/USB--for example by installing, removing, or updating software--then you would want to set up some additional mounts before chrooting. You would do that by running these commands after running sudo mount /dev/sda2 /mnt but before running sudo chroot /mnt:



        sudo mount -o bind /dev /mnt/dev
        sudo mount -o bind /dev/pts /mnt/dev/pts
        sudo mount -t sysfs /sys /mnt/sys
        sudo mount -t proc /proc /mnt/proc


        If you have multiple partitions for the different parts of the OS, like for example a separate /boot partition, then you would want to mount them to the right positions. For example, where sdX is the device name for that particular drive and n is the partition number:



        sudo mount /dev/sdXn /mnt/boot


        It is fine if you run those commands before chrooting in to reset passwords with the passwd command. It is not necessary, though.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 27 '17 at 20:26

























        answered Nov 25 '17 at 22:58









        VideonauthVideonauth

        24.1k1270100




        24.1k1270100















            Popular posts from this blog

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀