Ctrl alt f12 linux

What does «Ctrl + Alt + F12» do?

I accidentally pressed Ctrl + Alt + F12 and my display turned to black. I then had to make a reboot.. What did it do to my system? Also what does Alt + F8 to F10 do?

FYI — I accidentally hit Ctrl-Alt-F12 on Ubuntu 20.04 and got black screen(s) — dual monitors both displayed a large blinking cursor.

7 Answers 7

Pressing Ctrl + Alt + Fn (or just Alt + Fn when not in X11, the GUI) switches to the nth virtual console ( ttyn ).

Often we talk about a virtual console as a usable text console. So we often say there are six virtual consoles, accessible with Alt + F1 through Alt + F6 (holding down Ctrl too if you’re in the GUI when you want to switch). And we often say that then, separately, is the GUI, which can be switched (back) to with Alt + F7 .

But in fact, tty7 , where the GUI typically runs, is a virtual console too. It’s just not usable as a text console, because it doesn’t have getty running for it. getty runs for tty1 through tty6 (by default). getty sets a virtual console up to be used like a terminal and runs login to prompt for a username and password.

You can see the getty commands that are running by filtering the output of ps :

ek@Kip:~$ ps ax | grep -v grep | grep getty 1127 tty4 Ss+ 0:00 /sbin/getty -8 38400 tty4 1150 tty5 Ss+ 0:00 /sbin/getty -8 38400 tty5 1171 tty2 Ss+ 0:00 /sbin/getty -8 38400 tty2 1172 tty3 Ss+ 0:00 /sbin/getty -8 38400 tty3 1175 tty6 Ss+ 0:00 /sbin/getty -8 38400 tty6 11231 tty1 Ss+ 0:00 /sbin/getty -8 38400 tty1 

Since tty7 is the first virtual console that is not set up to behave like a terminal (i.e., no getty is running for it), that’s the one X11 (which provides the GUI) uses.

Virtual consoles higher than tty7 exist also. It’s just that, ordinarily, they neither have getty running for them, nor do they have X11 using them. The first 12 virtual consoles are accessible with the key combinations described above using function keys (because a keyboard typically has only 12 numbered function keys). They are accessible even if nothing is happening on them.

Thus, when you press Ctrl + Alt + F12 , you get a blank screen because you are now on tty12 , which has nothing at all running on it.

As an interesting exercise, you might try running:

sudo /sbin/getty -8 38400 tty12 

Then press Alt + F12 (or Ctrl + Alt + F12 if you’re in the GUI rather than one of the first 6 virtual consoles).

This will bring you to tty12 , which now has a login screen and is usable as a terminal.

(If you wanted to permanently create usable text-based consoles on higher-numbered virtual consoles, then you should configure init to run getty for them automatically. When getty is run manually as above, or even if you were to add that line to a startup script, you won’t get the ability to login again after logging out on the virtual console, because getty won’t automatically run again. Furthermore, there are some other problems running getty in that way for production use—for example, bash job control might not be available in your login shell, after you log in. If you want to make more virtual consoles usable as text-based terminal emulators, I recommend asking a separate question about that.)

Читайте также:  Linux i686 32 bit

It would be interesting to know, how (non-getty) virtual consoles like 9-12 are removed, so Ctrl+Alt+F9-12 can be used as keyboard shortcuts

Here is a brief explanation:

The following Keys are for going to the Terminal (The black background, white letters way):

Ctrl + Alt + F1 — Will send user to tty1 or 1st Terminal

Ctrl + Alt + F2 — Will send user to tty2 or 2nd Terminal

Ctrl + Alt + F3 — Will send user to tty3 or 3rd Terminal

Ctrl + Alt + F4 — Will send user to tty4 or 4th Terminal

Ctrl + Alt + F5 — Will send user to tty5 or 5th Terminal

Ctrl + Alt + F6 — Will send user to tty6 or 6th Terminal

For GUI Terminals (Where X is typically running, or better said, where you land when Unity appears and everything looks good. The default one where you start the GUI would be F7 ):

Ctrl + Alt + F7 — Will send user to the 1st GUI Terminal

Ctrl + Alt + F8 — Will send user to the 2nd GUI Terminal

Ctrl + Alt + F9 — Will send user to the 3rd GUI Terminal

Ctrl + Alt + F10 — Will send user to the 4th GUI Terminal

Ctrl + Alt + F11 — Will send user to the 5th GUI Terminal

Ctrl + Alt + F12 — Will send user to the 6th GUI Terminal

The thing to note here is that you can go from one terminal to the other by pressing the corresponding keys. You should also note that, since you are running one instance of the X server (one Unity running) you will only have F7 working for the GUI Terminals. If you open another X Server session, it will start in F8 and you can switch between both by pressing the correct keys. You can keep doing this for a total (default) of 6 times which would be F7 up to F12 .

@hexafraction I can imagine the user typing in the terminal something like «sudo xinit — :4 vt14» where 4 would be the session number and the 14 would be the virtual terminal.

I know it’s possible to issue a command, just not sure if it will render if switched into by software,

Ok I tried and it works but the problem I think will be how to switch to it using the keyboard ;). I mean CTRL+ALT+F21??

No, my question is whether X.Org cuts off VTs at 12 or has keyboard-inaccessible ones past there available for software access.

Читайте также:  Bluetooth deauth kali linux

You can come back to any of normal GUI in Ubuntu from any of the TTY screens by hitting:
Ctrl + Alt + F7

Could you please add an answer to the question? Your answer is giving a solution which will work, but the user has asked what does alt-f8, alt-f.

While these other answers are correct, in my case I was unable to switch back or do a typical SSH connection to my machine when this occurred. I couldn’t figure out what Ctrl + Alt + F12 was, but whatever it was, it made my screens go black and my input die completely (even from changing back to tty1-tty7). I’m not sure if my case is a one-off situation or if this is a common issue.

I was able to SSH with the -T flag to disable «pseudo terminal emulation» and it was pretty painful to work with (I forgot a world without bash .. or any sh), however I did get this from the /var/log/kern.log before at least gracefully rebooting it:

Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369331] BUG: unable to handle kernel NULL pointer dereference at 0000000000000a62 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369334] IP: [] _raw_spin_lock_irqsave+0x1e/0x39 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369335] PGD 0 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369335] Oops: 0002 [#1] SMP Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369353] Modules linked in: ctr ccm rfcomm ip6table_filter ip6_tables iptable_filter ip_tables x_tables tun efi_pstore pci_stub vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) bnep hp_wmi sparse_keymap intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm binfmt_misc irqbypass crct10dif_pclmul crc32_pclmul nls_iso8859_1 ghash_clmulni_intel aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd intel_cstate uvcvideo videobuf2_vmalloc intel_rapl_perf arc4 videobuf2_memops videobuf2_v4l2 videobuf2_core videodev efivars joydev media iwlmvm mac80211 serio_raw btusb sg btrtl btbcm btintel bluetooth iwlwifi cfg80211 snd_seq_midi snd_seq_midi_event snd_hda_codec_hdmi snd_rawmidi rtsx_pci_ms snd_hda_codec_realtek snd_hda_codec_generic snd_seq rfkill memstick snd_hda_intel snd_hda_codec snd_seq_device snd_hda_core snd_hwdep lpc_ich snd_pcm shpchp snd_timer snd battery ac soundcore hp_accel mei_me hp_wireless lis3lv02d input_polldev mei tpm_infineon evdev parport_pc ppdev lp parport efivarfs autofs4 ext4 crc16 jbd2 fscrypto mbcache hid_microsoft hid_generic usbhid hid rtsx_pci_sdmmc mmc_core crc32c_intel psmouse wmi i915 video i2c_algo_bit thermal button drm_kms_helper fjes syscopyarea sysfillrect sysimgblt fb_sys_fops e1000e rtsx_pci ptp pps_core ahci libahci drm Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369368] CPU: 1 PID: 1110 Comm: Xorg Tainted: G OE 4.8.2-040802-generic #201610161339 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369369] Hardware name: Hewlett-Packard HP EliteBook 840 G2/2216, BIOS M71 Ver. 01.16 08/26/2016 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369369] task: ffff9e0535b25500 task.stack: ffff9e05349f0000 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369371] RIP: 0010:[] [] _raw_spin_lock_irqsave+0x1e/0x39 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369372] RSP: 0018:ffff9e05349f3a70 EFLAGS: 00010046 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369372] RAX: 0000000000000000 RBX: 0000000000000246 RCX: 0000000000000008 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369373] RDX: 0000000000000001 RSI: 0000000000000003 RDI: 0000000000000a62 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369373] RBP: 0000000000000000 R08: 0000000000000438 R09: 0000000000000898 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369374] R10: 0000000000000780 R11: 0000000000000898 R12: 0000000000000a62 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369374] R13: 0000000000000000 R14: ffff9e053986a800 R15: 0000000000000003 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369375] FS: 00007f76b8175a00(0000) GS:ffff9e054f440000(0000) knlGS:0000000000000000 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369376] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369376] CR2: 0000000000000a62 CR3: 0000000435136000 CR4: 00000000003406e0 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369377] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369377] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369377] Stack: Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369379] 000000000000000e ffffffff9c4a9dfd 0000004800000000 0000078000024414 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369380] 00000000faa01f96 ffff9e0534d02a58 ffffea000b023400 ffff9e0534d02a60 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369382] ffff9e0534d02a5c ffff9e053986a800 ffff9e0534879000 ffffffff9cb3d9de Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369382] Call Trace: Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369385] [] ? try_to_wake_up+0x3d/0x350 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369387] [] ? __ww_mutex_lock+0x7e/0xa0 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369401] [] ? drm_modeset_lock+0x47/0xd0 [drm] Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369411] [] ? drm_atomic_get_connector_state+0x2d/0x170 [drm] Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369417] [] ? __drm_atomic_helper_set_config+0x271/0x340 [drm_kms_helper] Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369422] [] ? drm_fb_helper_pan_display+0x17a/0x280 [drm_kms_helper] Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369424] [] ? __internal_add_timer+0x1a/0x50 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369444] [] ? intel_fbdev_pan_display+0x16/0x60 [i915] Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369446] [] ? fb_pan_display+0xc9/0x150 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369447] [] ? bit_update_start+0x1a/0x40 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369448] [] ? fbcon_switch+0x49d/0x610 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369450] [] ? redraw_screen+0x165/0x240 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369451] [] ? vc_allocate+0x2a/0x1c0 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369453] [] ? complete_change_console+0x3a/0xd0 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369454] [] ? vt_ioctl+0x6d5/0x1260 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369462] [] ? drm_ioctl+0x1db/0x460 [drm] Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369473] [] ? tty_ioctl+0x340/0xc30 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369474] [] ? brightness_store+0x5b/0x70 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369475] [] ? handle_mm_fault+0x898/0x1350 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369477] [] ? do_vfs_ioctl+0x9f/0x600 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369478] [] ? SyS_ioctl+0x74/0x80 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369479] [] ? entry_SYSCALL_64_fastpath+0x1e/0xa8 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369492] Code: 98 ff 48 89 d8 5b c3 66 0f 1f 44 00 00 0f 1f 44 00 00 53 9c 58 0f 1f 44 00 00 48 89 c3 fa 66 0f 1f 44 00 00 31 c0 ba 01 00 00 00 0f b1 17 85 c0 75 05 48 89 d8 5b c3 89 c6 e8 7e 94 98 ff 66 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369493] RIP [] _raw_spin_lock_irqsave+0x1e/0x39 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369494] RSP Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.369494] CR2: 0000000000000a62 Oct 23 09:02:52 BC-LINPC-02 kernel: [11410.375145] ---[ end trace 27ab810be96982ee ]--- 

I see some intel’y stuff in there, and some virtual-box’y stuff in there (it’s not a VM but hosts a couple on occasion). Not sure what the problem is exactly. 4.8.2 kernel, KDE neon, intel graphics i915.

Читайте также:  Linux documentation admin guide init rst

My guess is this was an isolated case with my configuration — but thought it was worth mentioning in case this does occur more widely.

ssh -T [user]@[host] sudo -S reboot 

The -S is necessary, but it won’t mask your password as you type it.

Источник

Оцените статью
Adblock
detector