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
Nili
Posts: 441
Joined: 2014-04-30 14:04
Location: $HOME/♫♪
Has thanked: 5 times
Been thanked: 3 times

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

#21 Post by Nili »

Head_on_a_Stick wrote: From that thread:
I wrote:Disabling TTYs via /etc/logind.conf saves *no resources whatsoever*
Indeed there isn't any big memory benefits, simply an unnecessary fixation by my side :lol: I can bring back again as it was.

TTY1 = startx@WM || TTY2 = a backup console. This has been my goal. oK i'll leave so... manually auto login, automatically startx.
openSUSE Tumbleweed KDE/Wayland

♫♪ Elisa playing...
Damascus Cocktail ♪ Black Reverie ♪ Dye the sky.

User avatar
mzsade
Posts: 91
Joined: 2011-12-08 01:25

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

#22 Post by mzsade »

Had mentioned somewhere i'd done a full install of Jessie on a 32 GB pen drive. Well, i tried this out on that.. cut the boot time by more than half, now i get what you meant by lightdm bloat, thank YOU!
Linux User #481272 Reg: 15th Sept., 2008

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

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

#23 Post by milomak »

instead of startx, how can i get kodi to run?
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 -- jes

#24 Post by Head_on_a_Stick »

Code: Select all

startx `which kodi`
Or quote the full path to the binary explicitly ;)
deadbang

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

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

#25 Post by milomak »

like this?

Code: Select all

mythtv ~ # cat /etc/systemd/system/getty.target.wants/getty@tty1.service | grep ExecStart
ExecStart=-/sbin/agetty -a mythtv %I $TERM

Code: Select all

mythtv@mythtv:~$ cat ~/.profile 
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx 'which /usr/bin/kodi'
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 -- jes

#26 Post by Head_on_a_Stick »

milomak wrote:like this?
[...]

Code: Select all

mythtv@mythtv:~$ cat ~/.profile 
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx 'which /usr/bin/kodi'
Not quite, try:

Code: Select all

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx /usr/bin/kodi
deadbang

User avatar
ralph.ronnquist
Posts: 342
Joined: 2015-12-19 01:07
Location: Melbourne, Australia
Been thanked: 6 times

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

#27 Post by ralph.ronnquist »

.. or maybe

Code: Select all

[[ -z $DISPLAY -a $XDG_VTNR -eq 1 ]] && exec startx /usr/bin/kodi

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

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

#28 Post by milomak »

Head_on_a_Stick wrote:
milomak wrote:like this?
[...]

Code: Select all

mythtv@mythtv:~$ cat ~/.profile 
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx 'which /usr/bin/kodi'
Not quite, try:

Code: Select all

[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx /usr/bin/kodi
this worked. thanks
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

lachlanp
Posts: 2
Joined: 2016-05-09 12:07

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

#29 Post by lachlanp »

The topic is old and I have a slightly different need.

I have a touch display but no keyboard. I want to autologin and auto-run a gui based program built with QT

As suggested I have edited: /etc/systemd/system/getty.target.wants/getty@tty1.service to this:
ExecStart=-/sbin/agetty -a myname %I $TERM

As I still want to use the default gui console, I have not made any other changes.

However, I still get the login prompt on my default defaultgui display.

Can you suggest what I still need to change to get the auto-login

Regards
Lachlan

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

#30 Post by GarryRicketson »

I noticed this :
Docs, Howtos, Tips & Tricks
Share your own howto's etc. Not for support questions!
Is what it says , on the board/ topic title , and then :
Post by lachlanp » 2016-05-09 06:21
The topic is old and I have a slightly different need.
It seems that the logical conclusion would be to start a new topic, in the "support" discussions.

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

#31 Post by Head_on_a_Stick »

I agree with Gary but briefly:
lachlanp wrote:Can you suggest what I still need to change to get the auto-login
Try:

Code: Select all

# systemctl set-default multi-user.target
If there are any problems, open a new thread and link back to this one in the OP ;)
deadbang

lachlanp
Posts: 2
Joined: 2016-05-09 12:07

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

#32 Post by lachlanp »

Thanks. I thought since the concepts of the topic were the same, then the people who previously posted probably had the required knowledge.
I have posted on the MATE/Debian forum as I am using mate Desktop.
The systemctl is already set to muti-user.target. Thanks
lachlan

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

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

#33 Post by milomak »

I am finding after doing updates (using sid), that

Code: Select all

/etc/systemd/system/getty.target.wants/getty@tty1.service
reverts to default.

bear that in mind if you find it not starting x automatically after updating
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 -- jes

#34 Post by Head_on_a_Stick »

milomak wrote:I am finding after doing updates (using sid), that

Code: Select all

/etc/systemd/system/getty.target.wants/getty@tty1.service
reverts to default.
OK, thanks for bringing that up.

My original method is a tad on the hacky side :)

For a more "correct" solution, create a file at /etc/systemd/system/getty@tty1.service.d/override.conf with the following content:

Code: Select all

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin <user name> --noclear %I $TERM
This can be used instead of modifying the unit file and should survive upgrades ;)

EDIT: Note added to the end of the OP.
Last edited by Head_on_a_Stick on 2017-01-14 18:57, edited 1 time in total.
deadbang

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

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

#35 Post by milomak »

happy to help.

I assume that the upgrade of one or both of the below packages will have triggered this

Code: Select all

[UPGRADE] systemd:amd64 229-5 -> 229-6
[UPGRADE] systemd-sysv:amd64 229-5 -> 229-6
I'll keep a look out when next they update

edit - that should be /sbin/agetty
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

rayandrews
Posts: 112
Joined: 2014-01-31 21:32
Has thanked: 4 times
Been thanked: 1 time

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

#36 Post by rayandrews »

Gentlemen:

Running testing, I just did a full update today (haven't done one for a while) and it busted my auto login. Until now this worked in '/lib/systemd/system/getty@.service':

Code: Select all

#ExecStart=-/sbin/agetty --noclear %I $TERM
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM

I have read and tried everything below and nothing worked. In particular:
For automatic login, edit the file at /etc/systemd/system/getty.target.wants/getty@tty1.service and changed the "ExecStart=" line in the "[Service]" section to this:
... the above file did not exist. I created it and added the stated line with no luck.

There is however a file '/lib/systemd/system/getty-static.service' which contains:

Code: Select all

[Service]
Type=oneshot
ExecStart=/bin/systemctl --no-block start getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service
RemainAfterExit=true
They don't make this simple, do they?

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

#37 Post by GarryRicketson »

Docs, Howtos, Tips & Tricks
Share your own howto's etc. Not for support questions!
Did you notice and read, the Category /topic header, before posting ?
From:http://forums.debian.net/viewtopic.php? ... 62#p615329
Postby Head_on_a_Stick » 2016-05-09 13:43
I agree with Gary but briefly:
lachlanp wrote:
Can you suggest what I still need to change to get the auto-login [/qutoe]
Try:

Code: Select all

    # systemctl set-default multi-user.target
If there are any problems, open a new thread and link back to this one in the OP ;)
No big deal, but also did you actually read, carefully the entire thread,
especially the how to parts,..?
I know you said you did, but if you missed what it says, about
"Not for support questions!"
There is a pretty good chance you missed some other inportant
details, as well,....

They don't make this simple, do they?
No , they don't, it was easier on older Debian versions.
And it makes it a lot more complicated for someone
reading and trying to use the "How to" document,
when they have to try to sort through the posts, and figure
out which ones are actually good, valid code, and scripts,
and which ones are code or scripts that did not work, but
got posted here by someone that needs "support",......
Not trying to be rude, at all, and hope you and others
understand,...
None of this would have been necessary, if one just reads
things carefully,...so it just goes to show.

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

#38 Post by Head_on_a_Stick »

rayandrews wrote:Running testing
Please read the thread title again and start your own version for testing...

:roll:
deadbang

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

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

#39 Post by milomak »

rayandrews wrote:Gentlemen:

Running testing,
i run sid . and this works
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

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

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

#40 Post by milomak »

i'm not sure what is happening on this machine. but it boots into x when it's set to graphical.target

I then do as root (as i have done on another machine where it works - both sid)

Code: Select all

debian ~ # cat /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin mythtv --noclear %I $TERM
debian ~ #

Code: Select all

debian ~ # systemctl set-default multi-user.target
debian ~ # 
i exit from root into mythtv user

Code: Select all

$ cat ~/.profile 
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx /usr/bin/kodi
$
x is not starting when i reboot

------

there is no /var/log/Xorg.0.log and no xorg entries in journalctl -e

the same setup is working on one install. have i missed something?


journalctlb log
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

Post Reply