Changing the VT is hardcoded in the lightdm binary by the looks of it, although i would have to look through the code more to see exactly what it's doing.
Originally Posted by terminator14
matthew-S206:/home/matthew % sed -n '/vt_set_active/,/^}/ p' /home/matthew/storage/linux_source/lightdm/lightdm-1.4.0/src/vt.c
vt_set_active (gint number)
g_debug ("Activating VT %d", number);
/* Pretend always active */
if (getuid () != 0)
console_fd = open_console ();
if (console_fd >= 0)
int n = number;
if (ioctl (console_fd, VT_ACTIVATE, n) < 0)
g_warning ("Error using VT_ACTIVATE %d on /dev/console: %s", n, strerror (errno));
/* Wait for the VT to become active to avoid a suspected
* race condition somewhere between LightDM, X, ConsoleKit and the kernel.
* See https://bugs.launchpad.net/bugs/851612 */
if (ioctl (console_fd, VT_WAITACTIVE) < 0)
g_warning ("Error using VT_WAITACTIVE %d on /dev/console: %s", n, strerror (errno));
Yep ! That is what i mean. I'll give you a contrived example that i knocked up to show you and a real world example of how to use it.
Automatic responses would definately be a good solution in most cases, but unfortunately, I do not know of every possible question that the nvidia driver installer may ask the user. I know every question it asks me, but it might ask someone with a differently configured system, or a different video card something else which an automated script would not pick up on. Even if I knew every question that could be asked by the driver, I would rather have people choose the options they want while installing the video driver rather than me choose for them - I can't say that I'm so experienced that I know exactly what options will work best for everyone.
The idea of automating responses like that is interesting though. By "heredoc", do you mean this:
If you do, then I was not aware that it could be used to automate responses to scripts. Interesting...
Very contrived but you get the point. The heredoc is created at the command line but can also be created in a script.
matthew-S206:/home/matthew/useful_commands_dir % cat tmp
# This line wants input
read -p "hello" read1
echo "hello 1: $read1"
# and so does this one.
read -p "hello 2" read2
echo "hello2: $read2"
matthew-S206:/home/matthew/useful_commands_dir % ./tmp << EOF
heredoc> This is line input 1
heredoc> And here is line input 2
hello 1: This is line input 1
hello2: And here is line input 2
This is a real world example from the slackware script usbimg2disk.sh.
# create a FAT32 partition (type 'b')
/sbin/fdisk $TOWIPE <<EOF