Path Error In Environment File in Linux

12-02-2019    Hari Kondlapudi    Views 1089


There are many reasons for looping the login screen. But this case differs from others because of the PATH Which holds all the commands for our computer in their $path. If we do something wrong that causes us to loop the login screen. It won’t allow us to login into your computer.

Before logout from our computer, if we change the $path in the environment file, like if we removed the old PATH and added a new PATH (we accidentally removed  “/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin” from ubuntu)

    /bin/
           Which holds commands like ls, cat, cp, etc.. (for single-user mode).

   /sbin/
          Which holds commands like init, ip, mount, etc.

  /usr/bin/
             Which holds commands that are executed by users which are not needed for booting the system. Which are not installed locally should be placed here.
 

These are some of the file locations, like these, we add more file locations to execute commands.




 

Save your path like this and restart your environment file to apply changes.
If we did something wrong in our path like saving the file in the below picture


 

If we restart our file using a source command like below
              source /etc/environment

Now the environment file is updated and commands are not going to be executed.
 



To get all commands to be executed like previously we need to reset the path in the environment file.
Firstly set a temporary path so we can use commands in that terminal, once you close your terminal your path will be disabled.

            export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin”

Now open your environment file
             sudo nano /etc/environment
Now set your path like this




Now save file and update file using source.
             source /etc/environment
If we don't do this and restart or shut down your pc, it will go through a continuous loop and never allow you to login to your pc.

Solution for your continuous loop is:

Press ctrl+alt+f3 in your login screen which takes to your terminal, to login to your pc terminal




After login set a temporary path so we can use commands in that terminal as i said before

      export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin”

Now open your environment file
            sudo nano /etc/environment

Now after saving the file, update the file using source.
              source /etc/environment

Now come out of terminal using

                   ctrl+Alt+f1 or ctrl+Fn+Alt+f1
                                    (or)
                   ctrl+Alt+f2 or ctrl+Fn+Alt+f2

It varies based on pc’s
It returns to the login screen, and you can login to your pc as usual.










 




Subscribe to Email Updates

Subscribe


Add Comments

Submit Comments

More Blogs


What is Trade Finance Transaction?

Blockchain Technology In Trade Finance Transactions

Hari Kondlapudi        Views 2297
block-chain-transform-your-business

Blockchain to transform your business

Hari Kondlapudi        Views 2175
block-chain-transform-your-business

Localization with React

Hari Kondlapudi        Views 1335

Contact Us

US Address:

Do Systems Inc,
433 Plaza Real, Suite 275
Boca Raton, FL 33432 


India Address:

Jayeesha Software Pvt Ltd
Hitech City Rd, VIP Hills,
Silicon Valley, Madhapur,
Hyderabad, TS 500081


Email: sales@dosystemsinc.com
 

Navigation

Copyright © 2023 Do Systems Inc. All rights reserved. Privacy Policy