Ask Your Question
1

Something in my .bashrc is preventing gdm logins

asked 2019-03-01 14:55:58 -0600

davidga gravatar image

When I try to login using gdm, I get a very brief black screen, and then I'm dumped right back at the login prompt. Doesn't matter if I choose wayland or X, same thing.

If I login from a tty with "startx", that works fine.

If I rename my ".bashrc" file (with years of accumulated aliases and exports), then gdm starts working again.

How can I figure out what is breaking it?

Fedora 28 on a ThinkPad T480s.

edit retag flag offensive close merge delete

Comments

You could try to add exec &> /tmp/bashrc.log to your .bashrc file at the top. Then try to login and check the file /tmp/bashrc.log.

thomaswood gravatar imagethomaswood ( 2019-03-02 04:49:20 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-03 15:11:31 -0600

davidga gravatar image

OK, I figured it out, but I do not understand the reason.

My .bashrc has an "exit 0" at one point, to prevent further commands from executing.

With this exit 0 in place, logging in via gdm is impossible. I just get barfed back to the login screen, with no error.

Removing it solves the problem, and everything works fine.

This doesn't make sense to me. Exit code 0 is "success", and isn't that returned anyway by default?

edit flag offensive delete link more

Comments

Whell exit 0 tells bash to terminate. .bashrc is not an ordinary bash script but act as if it was run in the main bash process, socalled sourced. Therefore, the exit 0 will terminate the main bash process. Try

bash .bashrc

versus

.    .bashrc

In the first case you run bashrc in a subshell and the exit command will terminate the subshell only. Also any variable and aliases defined in this subshell does not affect the main hash process.

In the second case .bashrc is sourced and you will see bash terminating.

villykruse gravatar imagevillykruse ( 2019-03-04 01:05:20 -0600 )edit

Question Tools

Stats

Asked: 2019-03-01 14:55:58 -0600

Seen: 61 times

Last updated: Mar 03 '19