When working with SSH sessions, terminal scrollback functionality primarily depends on two components:
- The terminal emulator's buffer (client-side)
- The server-side pager or terminal multiplexer configuration
In minimal Ubuntu installations (especially on Xen VPS like Slicehost), these packages are often missing:
less
most
screen (properly configured)
tmux
First check if core utilities are installed:
# Check for essential packages
dpkg -l | grep -E 'less|most|screen|tmux'
# If missing, install with:
sudo apt-get update
sudo apt-get install less most screen tmux
Your .screenrc needs proper scrollback settings. Try this configuration:
# ~/.screenrc
defscrollback 5000
termcapinfo xterm* ti@:te@
altscreen on
Ensure your TERM variable is set correctly:
# Check current TERM
echo $TERM
# For modern terminals
export TERM=xterm-256color
# For basic terminals
export TERM=xterm
If scrollback still fails, consider these workarounds:
- Pipe output to less:
long_command | less - Use tmux instead:
sudo apt-get install tmux - Redirect to file:
long_command > output.log
Some SSH clients limit scrollback. For PuTTY:
- Go to Window → Behaviour
- Increase "Scrollback lines" (try 20000)
- Check "System menu appears on ALT alone"
Xen virtual consoles sometimes have scrollback limitations. Try:
# Check kernel buffer size
sysctl kernel.printk_ringbuffer_size
# Temporary increase (requires root)
echo 1048576 > /proc/sys/kernel/printk_ringbuffer_size
When connecting via SSH to my Ubuntu Xen DomU instance (Slicehost legacy environment), terminal scrollback using Shift-PageUp fails completely. This persists even with GNU Screen's defscrollback 1024 setting configured in .screenrc. The terminal buffer appears truncated despite attempts to increase history limits.
Terminal scrollback functionality depends on several layers:
1. Terminal emulator (client-side: iTerm2, GNOME Terminal, etc.) 2. SSH client configuration 3. Server-side terminfo database 4. Readline/libedit implementations 5. Xen console driver (particularly for DomU)
First verify basic terminal capabilities:
# Check terminfo entry
$ infocmp $TERM
# Verify scrollback buffer size
$ stty size
$ tput lines
For Xen-specific checks:
# Examine Xen console settings
$ xm list
$ xm console
# Check kernel ring buffer
$ dmesg | grep -i console
Try these server-side adjustments:
# Force a better terminal type in .bashrc
export TERM=xterm-256color
# Increase tty buffer in /etc/sysctl.conf
kernel.printk_ratelimit = 0
kernel.printk_ratelimit_burst = 0
Client-side SSH configuration (~/.ssh/config):
Host myslice
HostName slicehost.example.com
RequestTTY force
RemoteCommand screen -Rd
SendEnv TERM
ServerAliveInterval 60
When native scrollback fails, consider:
# Pipe output to less immediately
$ long_command | less -R
# Use tmux instead of screen
$ tmux new -s session_name
(set -g history-limit 10000 in .tmux.conf)
For persistent logging:
# Continuous logging to file
$ script -f /var/log/term_session.log
Xen paravirtualized consoles often have constrained buffers. To check:
# Xen store parameters
$ xenstore-read /console/ring-ref
$ xenstore-read /console/port
Kernel parameters that may help:
# Add to GRUB config
xencons=hvc console=hvc0 console=tty0 loglevel=all