Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Prompt only the password for a default user in virtual console login (Read 283 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Prompt only the password for a default user in virtual console login

Hello Artix people! I recently migrated from Arch, and first of all, hello to the entire community! I'm loving Artix!

Anyway, I'm using dinit as my init system, but I can't log in by simply entering my user's password (the only user) like I did before, and I don't understand where I'm going wrong.

Useful info:
I don't use login or display manager but I log in from tty.
I use River compositor (Wayland) which starts automatically because of these lines in my .zprofile:
Code: [Select]
if [ -z "$WAYLAND_DISPLAY"] && [ $(tty) = "/dev/tty1" ]; then
  exec river > ~/.config/river/.river.log 2>&1
fi

Here's what I did
I created and saved the file agetty-tty1 at the following path:
Code: [Select]
/etc/dinit.d/config/agetty-tty1.conf
with the following content:
Code: [Select]
#!/bin/sh

# DO NOT REMOVE THIS FILE!
# Note: You can copy and rename this file to the name of the tty you
#       want (e.g.: /etc/dinit.d/config/agetty-tty1.conf will make a
#       configuration specific to tty1)

GETTY_BAUD=38400
GETTY_TERM=linux
GETTY_ARGS="--skip-login -o '-p -- artix_peter' --noclear"

Heres's the content of /etc/dinit.d/config/agetty-default.conf:
Code: [Select]
#!/bin/sh

# DO NOT REMOVE THIS FILE!
# Note: You can copy and rename this file to the name of the tty you
#       want (e.g.: /etc/dinit.d/config/agetty-tty1.conf will make a
#       configuration specific to tty1)

GETTY_BAUD=38400
GETTY_TERM=linux
GETTY_ARGS=

With this configuration when I boot the system, I see the boot messages normally, but when I get to the point where It usually asked me for the user's name, nothing happens. I can type on the keyboard, but the system doesn't respond. I need to change my tty to be able to control the system again.

Could somone can help me figured out where I went wrong?
I'm quite a noob so I apologize if there are some useful informations missing.
Thanks in advance for any kind of help :)

Re: Prompt only the password for a default user in virtual console login

Reply #1
Due to how the agetty service script is written (see here — more specifically, it splices the variable in instead of using eval), quoting within GETTY_ARGS doesn't work; it is simply split by spaces, quotes left as-is, which means getty sees something like:

Code: [Select]
agetty --skip-login -o "'-p" -- "artix-peter'" tty1 38400 linux

Doesn't look much like a valid command; there's four non-option arguments when agetty only wants 3 (remember Linux commands usually stop trying to find options after --, and the -- you intended for login "leaked" to agetty), and -o gives a weird argument to login.

Anyhow, I tried invoking agetty from another terminal with your intended command line, and it didn't work either (asked for username and password all the same). What worked was:

Code: [Select]
sudo setsid agetty --skip-login -a user -o '\u' tty1 38400 linux 

I guess you can use GETTY_ARGS='--skip-login -a user -o \u', without quotes, and no changes to the distro script needed (but they'd certainly be welcome in case a user wants a -o option with embedded spaces).

Caveat: I do not use dinit as PID 1 (only as user services manager)

Re: Prompt only the password for a default user in virtual console login

Reply #2
Thank you so much @capezotte !!

Quote from: capezotte
I guess you can use GETTY_ARGS='--skip-login -a user -o \u', without quotes, and no changes to the distro script needed (but they'd certainly be welcome in case a user wants a -o option with embedded spaces).
This finally worked!

I'm marking this topic as 'solved'.