You are not logged in.

#1 2016-07-13 02:27:35

rabcor
Banned
Registered: 2013-02-09
Posts: 500

[Solved]Weird behavior after enabling autologin

So I've been using my system for a while slowly setting this and that as I feel like it when the time comes... my last thing was enabling autologin and something strange happened.

Basically for a while now I've had bash_profile configured to start X11 upon login with no issues (just a simple startx& command) and that's never been a problem.

Then I enabled auto-login as detailed here: https://wiki.archlinux.org/index.php/au … al_console

I put:

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM

in /etc/systemd/system/getty@tty1.service.d/override.conf...

And sure enough this works, I autologin, X starts, I'm using KDE, the normal behavior for startx from TTY1 seems to be to start X and run all sort of output in TTY1 while running the display on TTY2.

And sure enough this happens too, but here's the strange bit, normally how it happens is that the screen is switched to TTY2 as soon as startx is run, and then stays there through the DE startup process, then everything just works and I go on about my business. But when I have autologin enabled, it will immediately switch back from TTY2 to TTY1 as soon as it's switched over, and to make matters worse, when I switch back to TTY2 for the display, I just have a cursor on a black screen, and I can see my autostarted Krita on my secondary display, but if I shut that down I also get just a black screen there with nothing but a cursor.

So basically X works, but most of the important bits of KDE seem to crash in this chaos.

What I would guess is happening is that the autologin command tries to lock the user down to TTY1 throughout any login commands provided in bash_profile and so switches back to TTY1 as soon as startx has been run just because it can. I then have to terminate X and start it again and everything will work as normal.

Is there any way I could fix all this?

Last edited by rabcor (2016-07-13 18:20:16)

Offline

#2 2016-07-13 03:07:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: [Solved]Weird behavior after enabling autologin

There are many things wrong here.  First you definitely shouldn't background startx.  Second, running X on tty2 is definitely not normal and should not even work.  X needs to run on the tty it was launched from or you will not have an active login session.

Please post the code used to startx in your ~/.bash_profile.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-07-13 18:20:02

rabcor
Banned
Registered: 2013-02-09
Posts: 500

Re: [Solved]Weird behavior after enabling autologin

The code was:

[[ -f ~/.bashrc ]] && . ~/.bashrc

startx&

I don't know why it runs on TTY2, it must be some KDE thing...

ANyhow after reading this https://wiki.archlinux.org/index.php/Xi … X_at_login I saw another way to do it, and I tried to do that instead.

[[ -f ~/.bashrc ]] && . ~/.bashrc

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

And with this it seems like X is forced to stay on tty1 which solved the problem smile so it is solved.

Offline

Board footer

Powered by FluxBB