I'm using Ubuntu 12.04. By accident I deleted /etc/profile.d/bash_completion.sh. I then restored it by copying that same file from another similar Linux machine (same OS).

Now I can't login because the login screen keeps coming back after each successful login. I tried both Xubunto session and Xfce.

Any suggestions will be greatly appreciated.

  • Please edit your question and include i) the output of ls -l /etc/profile.d/bash_completion.sh and ii) the contents of your ~/.xsession-errors file. You can use a live CD to get these if needed.
    – terdon
    Jan 30, 2015 at 15:52

2 Answers 2


If you think it's that file that's responsible, you could reset it back to the packaged defaults by reinstalling the bash-completion package. We have to be a little more forceful to get it to copy the configuration back, but this should work:

sudo rm /etc/profile.d/bash_completion.sh
sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall bash-completion

Reboot and see where that gets you.

It has just struck me that you might have problems getting to a terminal to enter this! There are several options there but here are my favourite:

They should both set you up as root on your install, and from there you should be able to action a change. If nothing else just delete the current bash_completion.sh file. That should allow you to log back in normally, albeit without Bash autocompletes.


I've tried a lot of different things including removing that file but it didn't work.

Finally I solved my problem by deleting the .dmrc file in my home directory. I accessed tty1 console (Ctrl+Alt+F1) and did it from there.

Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.