I have a login loop error on Debian 12 The final edit on the system that I made was:su root nano /etc/sudoers user_name ALL=(ALL) ALL Since I can't use sudo command I did so according to the instructions on the internet, after I shutdown and reopened I couldn't login, I've seen a few solutions online, but none of them work. i used (Ctrl+Alt+F2) but can't use any command there except "cd" command Ls command not found Nano command not found Sudo command not found Apt command not found Anyone know about this incident? My ssd drive is more than 100Gb free and hhd drive is 1Tb free.

  • 2
    The GUI login is probably failing for the same reason you are getting the command not found errors. At a guess, either your path is corrupt or you have destroyed something critical to running commands. Can you type /bin/ls or similar to run the commands directly?
    – user10489
    Jun 26, 2023 at 1:24
  • have you tried booting in recovery mode? Jun 26, 2023 at 1:46

2 Answers 2


Just to be clear: Apt, should be apt, Ls should be ls, and Nano should be nano.

A remedy for login loop used here some time ago:

rm ~/.Xauthority

and then:

service lightdm restart

Replace lightdm in the command with the relevant display manager if necessary.

If the filesystem isn't accessible via a console terminal, then a live distro or rescue disk can gain the required access. System may need a reboot after removing .Xauthority.


This seems to be related to a PATH issue. The cd command is working, because it is probably the bash builtin version used on your system.

If you can log in as user_name to other tty (using CTRL+ALT+Fx as you said), check content of your path by typing:

echo $PATH

If this command fails, as suggested in the comments, try passing full path to your command, eg:

/bin/echo $PATH

For comparison, here is the content of my $PATH:


Does the problem appears for all users ?

I don't know if you're familiar with UNIX/Linux environnements, but just in case, be sure to type your commands all lowercase (in your question you say Sudo instead of sudo), as the bash interpreter is case sensitive.

Try also to check the content of your /bin directory, just to check if everything is fine:

ls /bin # or /bin/ls /bin

It is a lot safer to use visudo when modifying the sudoers file:

su - root
# or to use a non-default editor
EDITOR=vim visudo

Why ? Because it will check you didn't made any mistake in the file, preventing system break. If it finds some error, it will not save the file, keeping your system's rights fine.

In case all of these tries above fails, use a livecd to recover your system:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .