I'd like to access an agetty
terminal, which I'd normally access with ⎈ Control+⎇ Alt+F2
There are two errors in that, one of which points to an answer, one of several possible answers.
The first error is that FreeBSD does not have Wietse Venema's agetty
("alternative getty"). It has ordinary BSD getty
. So that nomenclature is wrong. Indeed, there is not necessarily a getty
running on every kernel virtual terminal, that depending from what is configured in /etc/ttys
.
The second error is that one normally accesses the multiple kernel virtual terminals with just plain ⎇ Alt and a function key on FreeBSD. The ⎈ Control is superfluous, and only necessary when an X server is in the foreground. X servers only recognize chords that have both ⎈ Control+⎇ Alt, but the keyboard mappings given to kernel itself, which is what handles this when an X server is not in the foreground, only actually require ⎇ Alt, just as they did on SCO Multiscreen (where this originated):
% sed -n -e '1,4p;/ 068 /p' /usr/share/vt/keymaps/uk.kbd
# $FreeBSD$
# alt
# scan cntrl alt alt cntrl lock
# code base shift cntrl shift alt shift cntrl shift state
068 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O
%
Of course, one can send a ⎈ Control+⎇ Alt chord to the guest operating system, and there are two ways of doing this:
- Turn on sticky keys in the guest. Use sticky keys to stick the ⎈ Control modifier down, and then press ⎇ Alt+F2. Sticky keys support is a GUI thing, note. This will not help if a GUI session is not in the foreground.
- Switch to the QEMU Monitor Console, and use the
sendkey
command. That can send a wide range of chords to the guest operating system. In this particular case it would be sendkey ctrl-alt-f2
. Then switch back from the monitor console, of course.
Ubuntu users, including muru here, have suggested the chvt
command. That's Linux-think. There is no chvt
command in FreeBSD. I wrote one, and provide it in the nosh toolset; but the operating system does not come with one out of the box.
My chvt
is primarily for use with user-space virtual terminals, and defaults to head0
, but it can handle the kernel virtual terminals as well. One would for this purpose invoke it (assuming that one has the privileges to access /dev/ttyv0
) as:
chvt 1@ttyv0
The tool supplied out of the box is vidcontrol
, which for this particular task one would invoke (assuming that one has the privileges to access /dev/ttyv0
) as:
vidcontrol -s 2 < /dev/ttyv0
Further reading
chvt
command could be used. – muru Aug 13 '18 at 08:58agetty
in FreeBSD, by the way BH2017. And the onlychvt
command on FreeBSD to my knowledge is the one that I wrote. – JdeBP Aug 13 '18 at 09:12chvt
and Alt+arrow-keys are also given in it. – muru Aug 13 '18 at 09:28chvt 2
as root (sudo isn't pre-insalled on PCLinuxOS) as it gives me a blank, black screen, no login prompt. Alt-arrow key doesn't work either. – Josh Pinto Aug 13 '18 at 09:55