Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Auto login and `startx` without a display manager (systemd)

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto login and `startx` without a display manager -- jes

#41 Post by Head_on_a_Stick »

milomak wrote:it boots into x when it's set to graphical.target
Will it startx from a console log in?
deadbang

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: Auto login and `startx` without a display manager — jess

#42 Post by milomak »

yes startx works when it loads into console
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto login and `startx` without a display manager — jess

#43 Post by Head_on_a_Stick »

Can we see:

Code: Select all

systemctl cat getty@tty1
deadbang

milomak
Posts: 2158
Joined: 2009-06-09 22:20
Been thanked: 1 time

Re: Auto login and `startx` without a display manager — jess

#44 Post by milomak »

sure

Code: Select all

$ systemctl cat getty@tty1
# /lib/systemd/system/getty@.service
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
After=systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

# IgnoreOnIsolate causes issues with sulogin, if someone isolates
# rescue.target or starts rescue.service from multi-user.target or
# graphical.target.
Conflicts=rescue.service
Before=rescue.service

# On systems without virtual consoles, don't start any getty. Note
# that serial gettys are covered by serial-getty@.service, not this
# unit.
ConditionPathExists=/dev/tty0

[Service]
# the VT is cleared by TTYVTDisallocate
ExecStart=-/sbin/agetty --noclear %I $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELE

[Install]
WantedBy=getty.target
DefaultInstance=tty1

# /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin mythtv --noclear %I $TERM
Desktop: A320M-A PRO MAX, AMD Ryzen 5 3600, GALAX GeForce RTX™ 2060 Super EX (1-Click OC) - Sid, Win10, Arch Linux, Gentoo, Solus
Laptop: hp 250 G8 i3 11th Gen - Sid
Kodi: AMD Athlon 5150 APU w/Radeon HD 8400 - Sid

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto login and `startx` without a display manager — jess

#45 Post by Head_on_a_Stick »

Does the autologin itself work?

Try removing the `startx` line from ~/.profile and see if it will autologin to a TTY command line.

You could also try this logic in ~/.profile instead of the line you are using now:

Code: Select all

[ "$(tty)" = "/dev/tty1" ] && exec startx /usr/bin/kodi
That doesn't rely on $XDG_VTNR or $DISPLAY.

EDIT: the Xorg logs will be found in ~/.local/share/xorg/Xorg.0.log because the server is being run as your normal user ;)
deadbang

Peripatus
Posts: 3
Joined: 2018-11-22 12:47

Re: Auto login and `startx` without a display manager — jess

#46 Post by Peripatus »

Head_on_a_Stick, thank you!

FWIW, I can confirm that the procedure works, without modification, for my system running BunsenLabs Helium (i.e. ~Debian Stretch). :D

Makes for a real fast boot-to-GUI -- and near-instant resume from Suspend! Ideal for an older computer mainly used as an internet tv.

No upgrade-proofness tested yet.

[NB: To anyone else who initially mistypes their username in the override.conf file (no capital letters! :roll: ), and reboots to find only a blinking cursor: don't panic; hit Ctl+Alt+F2 to open an auxiliary terminal; login with the correct username and password; optionally start the GUI by typing startx; fix the typo in the file; reboot; enjoy the smoothness.]

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto login and `startx` without a display manager — jess

#47 Post by Head_on_a_Stick »

Peripatus wrote:I can confirm that the procedure works, without modification, for my system running BunsenLabs Helium (i.e. ~Debian Stretch). :D
BunsenWhat? :mrgreen:

But anyway, yes, I've had it working in stretch and buster as well so I've changed the OP to reflect this.
deadbang

Peripatus
Posts: 3
Joined: 2018-11-22 12:47

Re: Auto login and `startx` without a display manager — jess

#48 Post by Peripatus »

Head_on_a_Stick wrote: BunsenWhat? :mrgreen:
Are you kidding me? :) Just noticed a rather active head on a stick over at the BunsenLabs forums...

Either way, I installed it just recently -- it's wonderful!

cheerio

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto login and `startx` without a display manager — jess

#49 Post by Head_on_a_Stick »

Peripatus wrote:rather active
Not any more :mrgreen:
deadbang

Peripatus
Posts: 3
Joined: 2018-11-22 12:47

Re: Auto login and `startx` without a display manager — jess

#50 Post by Peripatus »

Head_on_a_Stick wrote:
Peripatus wrote:rather active
Not any more :mrgreen:
Oh :? Should we take heed?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Auto login and `startx` without a display manager — jess

#51 Post by Head_on_a_Stick »

Peripatus wrote:Should we take heed?
No, not at all, BL is one of the more excellent distributions out there, I just prefer vanilla Debian :)
deadbang

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: Auto login and `startx` without a display manager (syste

#52 Post by bedtime »

I like how you dealt with issuing the startx command:

Code: Select all

[ "$(tty)" = "/dev/tty1" ] && exec startx
You negated the need for an 'if' command—clever! Always nice to do a command as efficiently as possible! :)

Thanx!

nyu-98
Posts: 5
Joined: 2019-03-26 00:35

Re: Auto login and `startx` without a display manager (syste

#53 Post by nyu-98 »

It's work , but now i see this in auth.log

Code: Select all

gnome-keyring-daemon[640]: couldn't access control socket: /run/user/1000/keyring/control: No such file or directory
i'm using debian 10 with mate desktop.


EDIT:
fixed with https://wiki.archlinux.org/index.php/GN ... PAM_method

mrowl
Posts: 2
Joined: 2019-10-15 13:31

Re: Auto login and `startx` without a display manager (syste

#54 Post by mrowl »

Hello All,
I followed the original howto and it worked fine for me with Debian 10.1 + Enlightenment DR16. I wanted to go further, though, and I don't know where to look at. My ultimate goal is to have the same Plymouth "theme" as I have in Enlightenment in that way the auto-logon executes and X starts at "the background" of the Plymouth skin (I see the Plymouth boot screen during the whole time and don't see any console output until I finally arrive to my E desktop) and when E16 starts I'd start also screen lock - this would effectively replace any DM for me but also gives some security measures.

My "very big" problem is that when bootup finishes, Plymouth closes the bootup screen and I can see the console autologin, including hostname and "Last login" lines. (Of course I could hide startx messages and motd easily.)

I understand that starting X includes changing the video driver and screen resolution so I don't expect a seamless transition from Plymouth screen to X's screen but I want to make this transition as smooth as possible (e.g. black screen for a second is OK). I couldn't find agetty parameter that suppress output and putting " > /dev/null 2&1" at the end of the systemd override file Exec line didn't help.

Do you have a tip where I should continue, please?
Thanks,
Mr 0wl

User avatar
wizard10000
Global Moderator
Global Moderator
Posts: 557
Joined: 2019-04-16 23:15
Location: southeastern us
Has thanked: 76 times
Been thanked: 85 times

Re: Auto login and `startx` without a display manager — jess

#55 Post by wizard10000 »

Head_on_a_Stick wrote:No, not at all, BL is one of the more excellent distributions out there, I just prefer vanilla Debian :)
Same. My openbox install still uses a (slightly modified) #! theme :)
we see things not as they are, but as we are.
-- anais nin

mrowl
Posts: 2
Joined: 2019-10-15 13:31

Re: Auto login and `startx` without a display manager (syste

#56 Post by mrowl »

mrowl wrote:My ultimate goal is to have the same Plymouth "theme" as I have in Enlightenment in that way the auto-logon executes and X starts at "the background" of the Plymouth skin (I see the Plymouth boot screen during the whole time and don't see any console output until I finally arrive to my E desktop)
I somewhat solved the above.

/etc/systemd/system/getty@.service.d/override.conf:

Code: Select all

[Service]
ExecStart=
ExecStart=-/sbin/agetty -i -J --nohostname --skip-login --login-options "-f <username>" %I 38400 linux
...and I needed a touch ~/.hushlogin, too.

Now I only need to figure out how I can keep plymouth background on the screen further.

imazed
Posts: 4
Joined: 2021-08-15 17:39
Location: Oxfordshire
Has thanked: 2 times

Re: Auto login and `startx` without a display manager (systemd)

#57 Post by imazed »

Excellent information Thank you Head-on-a-stick.
I have just followed your instructions and works perfectly on my Debian "trixie" system.
So I was able to bin LightDM and Plymouth neither of which does anything useful.
I

vmclark
Posts: 187
Joined: 2008-07-30 15:16
Has thanked: 1 time

Re: Auto login and `startx` without a display manager (systemd)

#58 Post by vmclark »

Works perfectly on Xubuntu. Tried other methods. They either failed or took too long to boot up.

Post Reply