openvt -c 40 /bin/agetty tty40 linux
runs openvt
, directing it to use VT 40; so it opens that VT, and runs agetty
on it. But specifying tty40
as an argument to agetty
tells the latter to use VT 40 (regardless of where it was started), so it opens VT 40 itself and runs there.
Thus,
openvt -c 41 /bin/agetty tty40 linux
opens VT 41, but then agetty
opens VT 40 itself.
You should just use one program to open the VT. You can either run agetty
directly on whichever VT you want, or tell it to run wherever it’s been started:
agetty tty40 linux
openvt -c 40 agetty - linux
If you remove the -c
option, openvt
will pick the first available VT.