Skip to main content
5 of 6
comment formatting
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 263

login loop after editing /etc/profile and /etc/login.defs

I am relatively new to Linux/Unix and I have a Debian Jessie 8 distribution installed in my laptop. I tried to install tex-live following the instructions in this TeX.stackexchange.com post

At some point it says the following

Finalising the installation

If the installation completes successfully you will want to make sure your operating system can find it. This can be done by creating a symbolic link:

mkdir -p /opt sudo ln -s /usr/local/texlive/2015/bin/* /opt/texbin (Note: there should only be one subdirectory in /usr/local/texlive/2015/bin.)

Now you'll have to add /opt/texbin to your $PATH variable. This can be done by editing /etc/environment:

gksudo gedit /etc/environment (It is said that /etc/login.defs is the equivalent of /etc/environment, in debian systems. You may want to keep this in mind if you are a debian user.)

You'll see something like:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" You can change this to:

PATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

which I did, and unfortunately, it didn't work, so then I continued in trying to edit /etc/profile in the same way because I read that it is the one that sets globally the Environment Path.

I commented all the existing commands for the paths in both files, put mine and rebooted. Debian starts, it asks for password and when I give it, it tries to login but it returns back to password prompt after some seconds.

I then rebooted in recovery mode and deleted my lines in both files and uncommented the ones that existed, hopefully reaching the default state but the problems persists.

I even tried to boot adding in grub the option init=/bin/bash rw and then modify the files, trying to put them in their initial state, but nothing happens.

In /etc/login.defs the environment path now is set to

ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

and in /etc/profile

if ["`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi

export PATH

Since I changed the files back to their original state, it should work, but it doesn't. What can I do?