2

I'm stuck in a login loop because:

  1. My $HOME variable is being set incorrectly when I login. I logged into a shell via ttty1 and echo $HOME returned /usr/local/gradle
  2. .bashrc or .bash_profile isn't being sourced when I log in. I tried setting env HOME=/home/pyler, and set HOME=/home/pyler, logged out then logged back in only to find that $HOME was /usr/local/gradle - again

This pops up whenever I login graphically via unity:

enter image description here

The system then logs me out and I'm back to square one.

When and where exactly is $HOME being set to /usr/local/gradle?

update

Found this line in .xsession-errors

dbus-update-activation-environment: setting HOME=/usr/local/gradle

Question is how do I stop this.

pyler
  • 181
  • 1
  • 1
  • 7
  • Your home directory is normally set in `/etc/passwd` (you can edit it with `sudo vipd` – Nick Sillito Apr 25 '17 at 19:43
  • 1
    That should be `sudo vipw` – Will Apr 25 '17 at 20:01
  • What's the output of `getent passwd "$USER" | cut -d : -f 6` and `grep -Fe HOME= /etc/{environment,profile,bash.bashrc} /home/plyer/.{profile,bashrc,xsession}`? – David Foerster Apr 25 '17 at 20:34
  • Could you please post text files, dialogue messages, and program output listings as text, not as images? To achieve the latter two you can either 1) select, copy & paste the dialogue text or terminal content or 2) [save the program output to a file](//askubuntu.com/q/420981/175814) and use that. Longer listings (the editor will tell you what's too long) should be uploaded to a [pastie service](https://paste.ubuntu.com/) and linked to in the question. Thanks. – David Foerster Apr 25 '17 at 20:35
  • @DavidFoerster I ran getent passwd "$USER" | cut -d : -f 6" and got /home/pyler as output – pyler Apr 26 '17 at 00:40
  • @DavidFoerster I ran getent passwd "$USER" | cut -d : -f 6" and got /home/pyler as output. Running the second command produced (1) "/etc/environment:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:JAVA_HOME=/usr/lib/jvm/java-7-oracle:/Documents/programming/android-studio/bin" (2) "/home/pyler/.bashrc:export HOME=/home/$USER" (3) "/home/pyler/.bashrc:env HOME=/home/pyler" (4) "grep: /home/pyler/.xsession: No such file or directory." – pyler Apr 26 '17 at 01:16
  • 2
    @pyler Please edit that into your question. It's difficult to read in a comment. – wjandrea Apr 26 '17 at 05:04
  • @wjandrea I was being courteous to David but none of those results really helped. I had to edit the lightdm.conf file and examine .xsession-errors to really get anywhere. – pyler Apr 26 '17 at 21:51

2 Answers2

1

You should make sure the user was not created incorrectly. You can check the /etc/passwd file. It will be the second to last column. You can adjust it with this command:

usermod -d /home/pyler pyler

I'm assuming that the username is pyler based on the information you gave. The first column in /etc/passwd will be the exact username.

d a i s y
  • 5,411
  • 9
  • 41
  • 59
TopHat
  • 3,771
  • 2
  • 12
  • 12
0

So it turns out that lightdm was not sourcing /etc/X11/Xsession so I applied Paul Hebble's fix.

I also had a hunch that xorg or xauth were not working properly so I uninstalled them and installed them.

There was no .xsession file in /home/pyler so I created an empty one and sourced .bashrc to ensure that $HOME was set to /home/pyler before I reboot the system.

I ended up logging in without any major problems.

Thanks to all who helped.

pyler
  • 181
  • 1
  • 1
  • 7