2

I'm running xfce on Arch without a DM. Using xorg-xinit to startx. Per default, after startup, I get a login prompt on tty1 and all is good.

However, I'd like to change the default behavior to be dropped at a login prompt on tty6 (or whatever) without having to manually Ctrl+Alt+F6.

I've spent a bunch of time reading various sources, Arch wiki, man pages, http://0pointer.de/blog/projects/systemd-docs.html, etc.

However, I'm still not getting it.

I've tried both manually adding and deleting the files, /etc/systemd/system/getty.target.wants/getty@tty1.service and getty@tty6.service. Alternatively also used systemctl to enable and disable them.

As a test, also editing last line of /usr/lib/systemd/system/getty@.service DefaultInstance=tty1 to DefaultInstance=tty7, and combinations of all the above. Would have created in /etc/systemd/system if it worked.

I asked on the Arch forums and got one very general reply, mostly crickets chirping. Is what I'm trying to do frowned upon for some reason?

I ended up just creating a service file in /etc/systemd/system that calls a bash one liner with chvt in it. This gives me what I wanted, but now I can't scroll the boot messages I have setup to not clear on tty1. This solution also seems like a bad add on hack.

What would be the proper way to do this?

2

The DefaultInstance refers to systemd instances of a service not which one should be parent. On many Linux distros including Debian inittab is still what spawns ttys. The service file is there more or less to keep track of it.

Usually the display manager decides the starting tty and spawns one on tty7 or above then switches to it much like chvt. Since you aren't using one xinit DOES NOT spawn a new tty it will only open X on the current TTY. Note that X is usually using tty7 not tty6. You should refer to the Arch Linux wiki here: https://wiki.archlinux.org/index.php/Xinit on how to use xinit.

So your choices are:

  • Use a Window Manager
  • Use multi seat
  • auto login

To put this another way your window manager is what handles session authentication. Without it you rely on the tty as logined in for this purpose. So switching to another requires it also be logged in which case you'd have to switch to it and login anyway (or use autologin) Thats why the display manager is what asks for your login credentials.

Given your setup the proper way would be, you can't switch ttys unless they auto login because startx is tied to the tty unless you reauthenticate which is what a window manager does.

  • Thanks for the clear explanation. So given my options, I guess my add on hack is the only option. – Dom Oct 24 '17 at 3:26
  • The statement here about inittab is untrue, for starters. inittab is history, on Debian and elsewhere. – JdeBP Oct 24 '17 at 3:54
  • I guess my add on hack is the ONLY option. When I start up, I end up on tty7 for login, and startx there. I've set up live Arch iso's to auto login both into cli and gui. I really prefer to log into my regular systems, and don't want to go back to using a display manager. As for multi seat, I'll be looking more into that. I'm still trying to get a solid grasp on systemd. The reference to tty6 was a copy paste from an earlier post, before I learned of the special characteristics of tty6 on Arch. – Dom Oct 24 '17 at 4:42
  • So here's what I'm currently doing... I created a service file that calls a one line bash script with chvt 7 in it that's ran upon startup, and configured systemd to manually start getty on tty7. I also have .xinitrc and .xserverrc set up. Here are more details: bbs.archlinux.org/viewtopic.php?id=231082 I thought there would be a config hidden somewhere in systemd that I wasn't able to locate, to default to tty7. – Dom Oct 24 '17 at 4:43
  • So far, I don't notice any problems with my setup, other than I can no longer scroll the systemd startup messages. The [ OK ] of [ ERROR ] followed by a message. Set up tty1 to not clear them, so they could be scrolled back if needed. Scrolling no longer works, but I can live with that. You see any potential issues with what I'm currently doing? – Dom Oct 24 '17 at 4:43
1

Solved!

OK, due to the lack of any more replies, I'll share the details of what I did, to end up at a login prompt on tty7 after rebooting.

1) Created a one line script "change.login.tty" in ~/bin

2) Created a systemd service file, "change.login.tty.service" in /etc/systemd/system/

3) Enabled "change.login.tty.service"

$ systemctl enable change.login.tty.service

4) Edited /etc/systemd/logind.conf to, #NAutoVTs=7 and #ReserveVT=6

5) Start getty on tty7, (likely not necessary)

$ systemctl enable getty@tty7

6) Reboot, login at prompt on tty7 and enjoy.

~/bin/change.login.tty

#!/bin/bash
# This changes the login tty #
chvt 7

/etc/systemd/system/change.login.tty.service

[Unit]
Description=Change login tty number.

[Service]
Type=idle
ExecStart=/home/[user name]/bin/change.login.tty

[Install]
WantedBy=multi-user.target

/etc/systemd/logind.conf

#  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.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See logind.conf(5) for details.

[Login]
#NAutoVTs=7
#ReserveVT=7
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%

Please correct errors or explain simpler solutions via posting, rather that just down voting or pointing out errors.

It worked for me, your results may vary.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.