1

I have an Ubuntu 16.04 system on my laptop. I had installed the program redshift on it which adjusts the screen light to make it easier on the eyes. Today in a bid to always start it up automatically I just added the command "redshift" to the .profile file in my home directory. Unfortunately that has resulted in my being unable to log in since then.

Each time I tried to log in, the system would just get stuck at the post-entering-password screen. Trying to solve the problem, I came across a few other posts on the internet describing similar troubles, the two most closely-matching of those being at Ubuntu 14.04 Login Loop problem after appending .profile file in home folder and even more exactly at https://forums.linuxmint.com/viewtopic.php?t=226498 .

Following the advice there, I have so far done the following:

  1. Entered as root using the Recovery Mode, then made things writable using the command mount -o remount,rw / and from there copied the .profile and .bashrc files from /etc/skel/ to my home directory (i.e. to /home/teepee/ , where teepee is my username). These two files were incidentally not present in my home directory when I checked after entering as root (although they most certainly used to be present whenever I actually logged in to my account earlier). That is why I copied them from the /etc/skel/ directory.

  2. Since that did not help, I tried adding this to the end of /home/teepee/.profile:

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

    as suggested in one of the comments in the above-mentioned pages. That has not helped either.

Kindly let me know what else I may do. I do not wish to reinstall my system as I have lots of significant data on it.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Jayant
  • 11
  • Do you have a backup of your home directory from which you can reload the file that you modified? ( I understand you can't log in, but you could reload it somewhere else in a live session and copy it) – Organic Marble Sep 11 '18 at 00:40
  • Can you switch to terminal (ctrl+alt+f4 or other fn key) and login there? You mention .profile & .bashrc files, but did you make the change to .bash_profile? or another file? (there are 5 such files for slightly different circumstances). If you can login, I'd suggest ls -ltrha and hopefully you'll note the file you edited by date/time, in case it's not in your history – guiverc Sep 11 '18 at 00:46
  • @Organic Marble: Unfortunately I don't. Whenever I did take a backup, it would simply be of my Documents and Downloads directories, as they were the ones with my data. I never thought a backup of the full home directory would be useful (though now I see how it would). – Jayant Sep 11 '18 at 00:48
  • What does happen if you completely revert your changes you did? (i.e.) remove the lines from .bashrc? – Videonauth Sep 11 '18 at 00:53
  • @guiverc: I did not change .bash_profile or .bash_login. In fact neither of these files was present in my home directory prior to my troubles, which is why I had added the command I wanted to run automatically, "redshift", to my .profile file in the home directory (for if I understand correctly, the .profile file is overridden by the two .bash_ files if they are present). Neither of the two files is present now in my home directory either. I do not fully understand what you mean by switching to terminal. I made all these changes as root in a terminal itself. – Jayant Sep 11 '18 at 00:55
  • @Videonauth: Well, the change I had made was to the .profile file, not the .bashrc. However, later, when my login attempt failed and I entered as root through the recovery mode, I found that both the .bashrc and .profile files were missing in my home directory, which is why I then copied them from /etc/skel. So there's not really a question of undoing the changes. As far as I can tell, the home directory now contains fresh copies of .bashrc and .profile, copied from /etc/skel/, so the guilty line I added is no longer there. As for what happens now, it still gets stuck on entering the password. – Jayant Sep 11 '18 at 01:00
  • Is your home directory encrypted? – steeldriver Sep 11 '18 at 01:09
  • @steeldriver: Yes. I was not sure, but I see that I have a .ecryptfs file in the home directory, so I believe it is. – Jayant Sep 11 '18 at 01:15
  • In that case you will likely need to decrypt and mount it so that you can revert the actual .profile that's inside (rather than simply dropping a fresh copy outside of the encrypted container) – steeldriver Sep 11 '18 at 01:22
  • @steeldriver: Okay, thank you. How do I do that? – Jayant Sep 11 '18 at 01:23
  • Let's wait for someone with ecryptfs knowledge (I don't use it myself) – steeldriver Sep 11 '18 at 01:25

2 Answers2

0

There will be someone who will eventually find a solution but if you are trying so hard avoiding to loose your data, I suggest something in another way...

You can make a back up of your profile and save it in a disk or memory stick and then reinstall and copy the files you want to keep.

I leave you a link where you can see how to make a back up...

Sometimes... you should start again... to make a clear path... Hope it helps...

ft18
  • 441
  • 1
    I see. Thanks for the suggestion. Perhaps I will ultimately have to do as you suggest, though I hope that the issue can be resolved more simply. – Jayant Sep 11 '18 at 01:36
  • In my experience when you install a lot of things you are able to do it again and in a better way of looking at it... you can make it without failing packages... And you can try Ubuntu 18.04.1 LTS... Works fine... and you will be able to transfer all your data... – ft18 Sep 11 '18 at 01:42
0

The solution for me was found after more than a day of trying to enter as root and decrypt my home directory. I finally took my laptop physically to someone who knows more than I do, and with him the trouble lasted about 12 seconds in all.

Solution: when the screen again got stuck right after I entered the login password, all I needed to do was to press Ctrl+Alt+F1 (or some other Fn key) in order to enter the login shell directly (i.e. in the command line interface). That was all. There I could see precisely where the program was stuck at and terminate it with a Ctrl+C. (It was the program "redshift" trying to connect automatically to the internet, except that connecting to the internet required me to be logged in first.) Then I could simply modify my .profile file directly and everything was resolved.

Thanks to all who commented, for I learned much and my data is still safe.

Jayant
  • 11