Auto login and `startx` without a display manager — jessie

Share your own howto's etc. Not for support questions!

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

Postby Head_on_a_Stick » 2016-05-09 19:43

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 ;)
"Yes Linus [Torvalds], our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6540
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby lachlanp » 2016-05-10 07:45

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
lachlanp
 
Posts: 2
Joined: 2016-05-09 12:07

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

Postby milomak » 2016-05-21 19:44

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
iMac - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1674
Joined: 2009-06-09 22:20

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

Postby Head_on_a_Stick » 2016-05-21 20:18

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.
"Yes Linus [Torvalds], our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6540
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby milomak » 2016-05-21 21:17

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
iMac - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1674
Joined: 2009-06-09 22:20

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

Postby rayandrews » 2016-12-05 19:14

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/ ... y1.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?
rayandrews
 
Posts: 27
Joined: 2014-01-31 21:32

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

Postby GarryRicketson » 2016-12-05 20:11

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?f=16&p=630662#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
GarryRicketson
 
Posts: 4219
Joined: 2015-01-20 22:16
Location: Durango, Mexico

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

Postby Head_on_a_Stick » 2016-12-06 07:57

rayandrews wrote:Running testing

Please read the thread title again and start your own version for testing...

:roll:
"Yes Linus [Torvalds], our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6540
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby milomak » 2016-12-18 22:39

rayandrews wrote:Gentlemen:

Running testing,

i run sid . and this works
iMac - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1674
Joined: 2009-06-09 22:20

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

Postby milomak » 2017-09-15 22:40

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
iMac - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1674
Joined: 2009-06-09 22:20

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

Postby Head_on_a_Stick » 2017-09-19 20:25

milomak wrote:it boots into x when it's set to graphical.target

Will it startx from a console log in?
"Yes Linus [Torvalds], our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6540
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby milomak » 2017-09-20 17:06

yes startx works when it loads into console
iMac - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1674
Joined: 2009-06-09 22:20

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

Postby Head_on_a_Stick » 2017-09-20 17:19

Can we see:
Code: Select all
systemctl cat getty@tty1
"Yes Linus [Torvalds], our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6540
Joined: 2014-06-01 17:46
Location: /dev/chair

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

Postby milomak » 2017-09-20 20:57

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
iMac - MacOS and Windows 10 (Bootcamp)/ Debian Sid (External SSD)
Laptop (64-bit) - Debian Sid, Win10,
Kodi Box - Debian Sid
milomak
 
Posts: 1674
Joined: 2009-06-09 22:20

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

Postby Head_on_a_Stick » 2017-09-21 05:35

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 ;)
"Yes Linus [Torvalds], our patches are such garbage the KSPP can't manage to do anything other than copy+paste from them, and you're slowly merging them (along with our registered copyrights). How do our table scraps taste?" — Brad Spengler, grsecurity
User avatar
Head_on_a_Stick
 
Posts: 6540
Joined: 2014-06-01 17:46
Location: /dev/chair

Previous

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable