Sunday, November 18, 2012

Setting the Size of the Terminal / Console Window in a Linux Server VM

We did a lot of Linux virtual machine installs when I worked with VMWare's SpringSource group. It let us run multi-node clusters off our MacBooks for customer demos.  We usually used desktop installes because they have you multi-terminal access to the machines.  I decided I wanted get some of my Linux/Java/OpenSource mojo back after 8 months on a Microsoft only project.  I downloaded Ubuntu 12.10 and installed server version so I could spin up more VMs on my Dell.

The server install is thin and the Linux console defaults to 640x48 as displayed in the VMWare Player/Workstation.  It wasn't exactly obvious how to make that terminal window larger.  The desktop version of Ubuntu is sync'd with the VMWare window size through the VMWare tools.  That isn't true of the server version.  You have to do the following steps. These assume you have created and installed a new machine and are logged into the console window on the Virtual Machine. I did this with Ubuntu 12.10 Server.

  1. First determine the resolution you wish to have the console run at. Most cards support the standard VESA resolutions and their associated mode numbers.  Pick the resolution you want and remember it's mode number.  I wanted 1024x768x16 so my mode number is 791. Additional information on how this works in ubuntu is available at the Ubuntu help site.
  2. Type sudo su at the terminal prompt and enter your password. This leaves you with a root capable shell.  You're more secure if you just run the su command for each command prompt because you won't do anything dangerous by accident but I'm kind of lazy and elevate my privileges.
  3. Edit /etc/default/grub with something like
        vi /etc/default/grub
  4. Find the line with GRUB_CMDLINE_LINUX_DEFAULT and add vga=xxx where xxx is the mode number.  It should look something like:
        GRUB_CMDLINE_LINUX_DEFAUT="quiet vga=791"
    1. You will see other documentation that talks about modeset or nomodeset. I think those are more applicable when you are not running on a virtual machine and where there are custom settings for a particular video card.
    2. Other document says you change the resolution using the line that includes GRUB_GFXMODE by removing the '#' at the beginning and setting the resolution to the same as the VESA mode. That didn't work for me and was unnecessary when I made the change just discussed.
  5. Save the changes and exit the editor
  6. Update grub with the new settings.  The settings will not take affect with out this.
        update-grub
  7. Restart your machine with the
        reboot command if you are still elevated or
        su reboot
    if not.
Ubuntu server takes up 1.2GB on the disk with additional services or tools installed.  It makes a nice lightweight virtualization platform.

Changing the Login Prompt in Linux

I try and standardize my user ids and passwords on my development virtual machines but sometimes a piece of software has tighter restrictions.  In that case I change the Linux login message to tell me the default user ids and passwords.  The contents of /etc/issue are displayed before the login prompt. Edit /etc/issue and add your user id and password information.  DO NOT do this for any system that is accessible to the Internet or that contains real or sensitive data.

No comments:

Post a Comment