When running FreeBSD in a virtual machine (especially on laptops with compact keyboards), the absence of a Scroll Lock key creates a significant usability challenge. The traditional console scrolling mechanism becomes inaccessible, forcing administrators to find alternative solutions.
The FreeBSD console maintains a scrollback buffer (typically 1000 lines) that preserves terminal output. Normally, you'd access this with:
Scroll Lock + Page Up/Down
Without physical access to Scroll Lock, we need alternative approaches to access this buffer.
1. Keyboard Remapping
Remap another key to function as Scroll Lock:
# Add to /etc/rc.conf keymap="us.iso" # Create custom keymap file cat << EOF > /usr/share/syscons/keymaps/custom.map keycode 71 = Scroll_Lock EOF # Load the keymap kbdcontrol -l /usr/share/syscons/keymaps/custom.map
2. Using Screen or TMUX
Terminal multiplexers provide their own scrollback mechanisms:
# Install screen pkg install screen # Basic scrolling in screen: Ctrl+a then [ # Enter copy mode Up/Down arrows # Scroll q # Exit
3. Virtual Console Switching
Switch to another virtual terminal (vt) and back to reset the buffer:
Alt+F2 # Switch to vt2 Alt+F1 # Switch back to vt1
4. SSH Alternative
Connect via SSH from another terminal with proper scroll capabilities:
ssh user@freebsd-vm
For virtual machines, consider these host-specific solutions:
- VMware: Use host key + Page Up/Down
- VirtualBox: Right-click + select "Scrolling"
- QEMU: Ctrl+Alt+2 to enter monitor, then 'sendkey scroll_lock'
For persistent changes, modify your /etc/sysctl.conf
:
# Increase scrollback buffer kern.vt.kbd_scroll_lines=2000 kern.vt.scroll_mode=1
When working with FreeBSD in a virtualized environment on modern laptops, one common frustration is the absence of a physical Scroll Lock key - which is the default key binding for scrolling console output in FreeBSD's text mode. This becomes particularly problematic when:
- Examining long command output (e.g., dmesg or compilation logs)
- Debugging system startup messages
- Reviewing lengthy man pages
FreeBSD's console actually supports multiple key combinations for scrolling:
Shift + Page Up - Scroll up
Shift + Page Down - Scroll down
Fn + Up Arrow - Alternative on many laptops
Fn + S - Some Lenovo/ThinkPad models
For a more permanent solution, modify the keyboard mapping in /etc/rc.conf
:
# Add this line to /etc/rc.conf
allscreens_flags="-f vga -m non-scroll=Shift+Up,scroll=Shift+Down"
After saving the file, either reboot or apply changes immediately with:
vidcontrol -f vga -m non-scroll=Shift+Up,scroll=Shift+Down
Different VM solutions offer workarounds:
For VMware/VirtualBox:
# Send special keycodes through the VM interface
VBoxManage controlvm "VM Name" keyboardputscancode 46 # Simulates Scroll Lock
For QEMU:
Add this to your startup command:
-k en-us -global i8042.kbd-throttle=off
Terminal multiplexers provide their own scroll mechanisms:
# Install screen or tmux
pkg install tmux
# In tmux, use:
Ctrl-b [ - Enter scroll mode
Up/Down - Navigate
q - Exit scroll mode
To verify your current console key mappings:
vidcontrol -i
This will output all active key bindings and their functions.