You are not logged in.
Hello,
my gloal is:
- on every boot, automatic login and start x
- only one time automatic login, and one time startx per boot
- when exiting x, normal command prompt should be visible (like manual login wihtout startx in .zprofile (via zsh))
- when exiting zsh prompt, normal, manual login should be shown.
I'm not using a graphical login manager.
I've succsessfull setup a automatic login via systemd ( https://wiki.archlinux.org/index.php/au … al_console ), and startx (via .zprofil (i'm using zsh instead of bash).
But: startx respawns everytime, when i logout from x. Maybe i could make a "trick" via "touch /tmp/exec-startx" with another systemd-service and an file exist-check in .zprofile. But the automatic-login will still enabled. And when "stopping" the custom service, tty1 will be blank with an blinking cursor.
Edit:
I've created now an AUR-Package that do all the stuff:
https://aur.archlinux.org/packages/autologin-on-boot/
If you have any suggestions to the package, please let me know.
Greetings from Germany,
Sebastian
Last edited by Arakis (2013-12-15 04:13:38)
Offline
Have you tried starting X automatically?
Try using https://wiki.archlinux.org/index.php/Start_X_at_Login
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx
in your .zprofile.
Offline
I think the OP wants something else: Start X automatically on boot, do GUI stuff, log out, do TTY stuff. With the instructions you linked he will find himself in his DE/WM again after logout.
I had the same problem, my "workaround" is not using autostart but to manually start X every time.
Offline
Note the difference between the wiki and karol's recommendation: remove the "exec" and you will not be logged out.
This is *half* of what the OP is looking for. The other half is having the autologin to tty only run once. There is a parameter in the service file for this - though I don't remember off the top of my head what it is as I haven't used in it a while.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Hello guys,
i've found an working way. It would be interesting to know, if there is an more cleaner way.
nano /etc/systemd/system/onetimelogin.service
[Unit]
Description=Prepare one time login
[Service]
Type=oneshot
ExecStart=-/bin/touch /tmp/autologin
ExecStart=-/bin/chown sebastian:users /tmp/autologin
[Install]
WantedBy=basic.target
systemctl enable onetimelogin.service
nano /etc/systemd/system/getty@tty1.service.d/autologin.conf
[Service]
ExecStart=
ExecStart=-/bin/autologin.sh %I
nano /bin/autologin.sh
#!/bin/sh
if [ -f /tmp/autologin ]
then
exec /sbin/agetty --autologin sebastian --noclear $1
else
exec /sbin/agetty --noclear $1
fi
chmod +x /bin/autologin.sh
nano ~/.zprofile
if [ -f /tmp/autologin ]
then
rm /tmp/autologin
startx
fi
What is does: "before" getty-service will starte, an "marker" file (tmp/autologin) will be created (with the service onetimelogin.service), so the system knows now, its just booted.
When getty@tty1 will started, it's using /bin/autologin.sh instead of agetty. In autologin.sh, i start agetty with autologin, when /tmp/autologin exists, otherwise normal login.
In the .zprofile i check, too, if the /tmp/autologin exists. If so, i remove it (so autologin is disabled), and execute startx.
Short question: What makes [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx instead of only startx ?
Greetings from Germany,
Sebastian
Last edited by Arakis (2013-11-24 16:26:42)
Offline
Short question: What makes [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx instead of only startx ?
This starts X only if it is not already started ($DISPLAY is not set), and only if you are using tty1 ($XDG_VTNR = 1). If you just use "startx" in your .zprofile, it will try to start X every time you start a new zsh shell, even if X is already running. The "only on tty1" part means that if you switch to tty2 and log in, X will not start automatically.
Last edited by 2ManyDogs (2013-11-24 16:28:38)
Offline
Note the difference between the wiki and karol's recommendation: remove the "exec" and you will not be logged out.
Maybe I should have been more explicit about this, but the wiki article I linked to does say
If you would like to remain logged in when the X session ends, remove exec.
in the 'Tips and tricks' section.
Offline
Warning: shameless promotion of my own software.
I think you can do exactly what you want with xlogin. My latest installation instructions detail a fully systemd integrated installation. The end result will be a very clean automatic-login configuration.
Offline
Arakis wrote:Short question: What makes [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx instead of only startx ?
This starts X only if it is not already started ($DISPLAY is not set), and only if you are using tty1 ($XDG_VTNR = 1). If you just use "startx" in your .zprofile, it will try to start X every time you start a new zsh shell, even if X is already running.
Clarification: .zprofile is only read for a login shell, not for every interactive shell (as is the case with .zshrc).
Offline
...
Maybe I should have been more explicit about this, but the wiki article I linked to does say
...
I didn't read your post carefully enough, sorry. And neither the wiki, it seems.
Anyway, thank you for your help, it was exactly what I was looking for.
Offline
I have created now an AUR-Package that do all the stuff:
https://aur.archlinux.org/packages/autologin-on-boot/
If you have any suggestions to the package, please let me know.
It does the following:
Autologin once per boot and starts X. When you quit X and/or logoout, no relogin will be there and no auto-restart of X. If you reboot, you will be logged in again.
If you wish to start another app like "startx", simply modify the file /usr/share/autologin-on-boot/profile . Ok, /etc/autologin-on-boot.conf would be the bettr file, but i have no experience with parsing files with bash.
Short question: How to create a man-page file and how to contribute them wie makepkg or Makefile?
Greetings,
Sebastian
Offline