2

For the sake of learning, I wanted to start a new terminal (let's say tty10) from the command prompt. I know I can just run sudo systemctl start [email protected], but I want to run it manually for now. I checked systemd service getty@ and it uses the following command line:

/sbin/agetty -o '-p -- \\u' --noclear %I $TERM

So, trying to replicate that from a terminal (tty1) I ran this:

sudo /sbin/agetty -o '-p -- <username>' --noclear tty10 linux

It indeed started a new login prompt at terminal 10, I enter the username but it never prompts for a password. Besides, when I go back to terminal 1 I see it logged out. What am I doing wrong?

Adriano_epifas
  • 196
  • 2
  • 13

1 Answers1

0

Unfortunately, agetty should be in inittab or as systemd unit to persist.

As for agetty in a shell, it really was not designed to run in the foreground and control some other terminal, as mentioned in another post here.

Doing it as a systemd unit would allow it to persist with stability and not close the connection or the parent shell you used to execute agetty.

If you want to just check that you are able to establish a connection between a server and client you can do the following:

  • On server: # /sbin/agetty -L 115200 ttyS0 vt102
  • On client: # screen /dev/ttyS0 115200

Where /dev/ttyS0 is where your serial connection is. If you get a login prompt, the connection is good. For it to persist, has to be a systemd unit. For more info:

brother-bilo
  • 101
  • 4