Is there any way to activate a virtual console at startup?

Hello,
To avoid getting kernel messages, I usually use virtual console 1 (/dev/ttyv1). However, I'd like this console to be active and displayed by default when the PC starts up.

Is there any way of achieving this?
Thanks
 
To avoid getting kernel messages,
What kind of messages are you getting? Syslog messages printed on the console can be turned off by disabling this line in /etc/syslog.conf:
Code:
*.err;kern.warning;auth.notice;mail.crit                /dev/console
This won't stop the kernel from printing debug messages on the console though.
 
If I use the console I get messages like :
Code:
syslogd: last message repeated 1 times
sshd[XXXX]: error: PAM: Authentication error for <user> from <address>
I've disabled the console in /etc/ttys so that I can no longer log in to it and I'm still using a virtual console. This way I can see all the messages displayed by switching to the console with Alt+F1
 
Don't edit /etc/ttys to disable the console. That won't stop the messages from appearing.
I don't want to disable the messages that appear in the console: on the contrary, I want to dedicate the console to displaying all messages and errors. So I've disabled it so that I can't inadvertently log in. What I'd like is to be able to activate a virtual console at startup, so I don't have to type ALT+F1 every startup.

For me (unchanged, so maybe for you, too), sysctl kern.console shows kern.console: ttyv0,/ttyv0,.
I've tried putting
Code:
kern.console="ttyv1"
in /etc/sysctl.conf but it doesn't produce any change.
 
run vidcontrol -s 2
to change to 2nd console
but since there is no rc.conf option for that its a hack for blanktime
so it will run
vidcontrol -t 999999 -s 2 at boot
i don't have a videconsole around and checked it with /etc/rc.d/syscons start and then
vidcontrol -i active and it showed 2 but
 
Isn't it default that at boot some messages are printed to the screen and then you get 'Login:' and 'Password:' ?

Unless some line in /etc/rc.conf starts the graphical environment, there is nothing else than a console.

What do you mean FabArd08 with 'activate a virtual console' ?
 
Isn't it default that at boot some messages are printed to the screen and then you get 'Login:' and 'Password:' ?
Exactly. By default, FreeBSD displays the /dev/ttyv0 console at startup. This is where all syslog and error messages are displayed, as defined according the first line of the /etc/syslog.conf file :
Code:
*.err;kern.warning;auth.notice;mail.crit                /dev/console
It suits me and I don't want to change this.

I don't want to work in this default console /dev/ttyv0 because the various system messages can appear anywhere (when editing a file, for example). I prefer to disable it so that I can't log on it and only switch in it (with ALT-F1) when I want to check all the system messages.

I've therefore got into the habit of switching to console 1 /dev/ttyv1 with Alt-F2 to log in each time the computer start up to work there.

What I'd like is not to have to type Alt-F2 every time I reboot, but to have the /dev/ttyv1 console displayed by default.

Unless some line in /etc/rc.conf starts the graphical environment, there is nothing else than a console.
I don't use a graphical environment but the text console /dev/ttyv1.

So the question I'm asking is: how can I get the /dev/ttyv1 console to be displayed at boot time instead of /dev/ttyv0?
 
this works
Code:
[titus@f13 ~]$ grep ttyv0 /etc/ttys
ttyv0    "/usr/local/libexec/getty Pc"        xterm    onifexists secure

[titus@f13 ~]$ ls -l /usr/local/libexec/getty
-rwxr-xr-x  1 root  wheel  85 Nov 16 10:57 /usr/local/libexec/getty

[titus@f13 ~]$ cat /usr/local/libexec/getty
#!/bin/sh
echo switching to 2
sleep 1
vidcontrol -s2 < /dev/ttyv0
exec /usr/libexec/getty $@
vidcontrol wont change the window from /etc/rc.d/syscons because ttyv2 is not yet available
 
this works
Code:
[titus@f13 ~]$ grep ttyv0 /etc/ttys
ttyv0    "/usr/local/libexec/getty Pc"        xterm    onifexists secure

[titus@f13 ~]$ ls -l /usr/local/libexec/getty
-rwxr-xr-x  1 root  wheel  85 Nov 16 10:57 /usr/local/libexec/getty

[titus@f13 ~]$ cat /usr/local/libexec/getty
#!/bin/sh
echo switching to 2
sleep 1
vidcontrol -s2 < /dev/ttyv0
exec /usr/libexec/getty $@
vidcontrol wont change the window from /etc/rc.d/syscons because ttyv2 is not yet available
Thank you covacat that's exactly what I wanted.

For those who are interested, here is the solution proposed by covacat :

Create a new script /usr/local/libexec/getty
sh:
#!/bin/sh
vidcontrol -s2 < /dev/ttyv0
exec /usr/libexec/getty $@

Make it executable
Code:
chmod 755 /usr/local/libexec/getty

Modify the console configuration file /etc/ttys so that it executes the script
Code:
ttyv0    "/usr/local/libexec/getty Pc"        xterm    onifexists secure

Voila! When the PC boots up, you arrive at the second console /dev/ttyv1 and the first console /dev/ttyv0 is deactivated .
 
Back
Top