Ubuntu – SSH terminal automatic resizing

gnome-terminalresizessh

Ubuntu installations (12.04 and 14.04) from the mini.iso (and not on Server or Desktop versions) result in the host providing terminal session that do not automatically resize themselves to the same size of the client when one SSHs into them. This can be seen below:

enter image description here

This is noticeable on Rackspace cloud Ubuntu servers as well as KVM instances that I have deployed myself.

One can workaround the issue by installing xterm and running the command resize manually every time you resize your terminal.

Does anybody know what packages I need to install/configure to have the host act like the Server and Desktop installations whereby there is automatic adjustment?


Update

I discovered that for my local KVM setup, I only got this effect when connecting with sudo virsh console $VM_ID and not when I SSH into the virtual machine. However this problem still persists with Rackspace VMs. I just tried again today (25th May 2014) and easily noticeable when you open VIM.

Best Answer

See SSH doesn't resize terminal. The user reported that the problem was fixed when he upgraded to gnome-terminal-3.12.1.

To install the new version in 14.04:

wget http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu/pool/main/v/vte3/libvte-2.90-common_0.36.2-1ubuntu1~trusty1_all.deb
wget http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu/pool/main/v/vte3/libvte-2.90-9_0.36.2-1ubuntu1~trusty1_amd64.deb
wget http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu/pool/main/g/gnome-terminal/gnome-terminal-data_3.12.1-0ubuntu1~trusty1_all.deb
wget http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu/pool/main/g/gnome-terminal/gnome-terminal_3.12.1-0ubuntu1~trusty1_amd64.deb
dpkg -i libvte-2.90-common_0.36.2-1ubuntu1~trusty1_all.deb
dpkg -i libvte-2.90-9_0.36.2-1ubuntu1~trusty1_amd64.deb
dpkg -i gnome-terminal-data_3.12.1-0ubuntu1~trusty1_all.deb
dpkg -i gnome-terminal_3.12.1-0ubuntu1~trusty1_amd64.deb

And to uninstall (change the versions to match the latest found in the archive.ubuntu.com repository):

# apt-cache madison gnome-terminal gnome-terminal-data libvte-2.90 libvte-2.90-common
gnome-terminal | 3.6.2-0ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
gnome-terminal | 3.6.2-0ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main Sources
gnome-terminal-data | 3.6.2-0ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
gnome-terminal | 3.6.2-0ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main Sources
libvte-2.90-dev | 1:0.34.9-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libvte-2.90-9 | 1:0.34.9-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libvte-2.90-doc | 1:0.34.9-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libvte-2.90-common | 1:0.34.9-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
libvte-2.90-common | 1:0.34.9-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
      vte3 | 1:0.34.9-1ubuntu1 | http://archive.ubuntu.com/ubuntu/ trusty/main Sources
# apt-get install gnome-terminal=3.6.2-0ubuntu1 gnome-terminal-data=3.6.2-0ubuntu1 libvte-2.90-9=1:0.34.9-1ubuntu1 libvte-2.90-common=1:0.34.9-1ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be DOWNGRADED:
  gnome-terminal gnome-terminal-data libvte-2.90-9 libvte-2.90-common