Headless desktop

From Nekochan
Revision as of 16:12, 9 April 2010 by Vp (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

As SGI hardware ages you are less and less likely to want to run your systems with the original graphics hardware especially if that hardware is only 8-bit or perhaps the hardware is a server (without graphics). This page will demonstrate how to get the most out of your SGI by running a full X session from another, better equipped, workstation. I'm using a SGI Indy as my example but most of this will apply to any class of older SGI computer with only minor variations in the setup.

Step 1: Setting up the Indy

The first step is to make sure your SGI computer is ready to be run headless without any startup issues. Generally this means making sure the PROM is configured so that it will boot without a keyboard and without a graphics console. The two variables you want to check are console and nogfxkbd. First get a serial cable [mini-din to 9/25 pin], this is a must if you want to be able to get at the PROM without having to reattach a monitor. A stock Indy will probably stop at the PROM if you try to boot without a keyboard attached. So even if you do not have the right monitor you can get everything set up with just a serial cable. Use your favorite terminal emulator [I use minicom from both Linux and Mac OS X, on Windows I have SecureCRT] to open the PROM when the Indy is booting generally pressing "ESC" is all that is required, or if you do not have a keyboard plugged in you will probably find the console already waiting at the PROM manager. Press 5 to [Select Command Monitor], type "printenv" to print out all the current settings. Use "setenv -p console d" to set the default console to the first serial port, use "setenv -p nogfxkbd 1" to tell the PROM not to worry about not having a keyboard. Type "init" to reset the PROM and let the Indy boot normally.

Next you want to make a small change to how Xsessions are handled so you can get the best experience from your headless computer. You want to edit the file /var/X11/xdm/xdm-config and make 2 changes.

 #DisplayManager*startup:                /var/X11/xdm/Xstartup-remote
 DisplayManager*startup:                 /var/X11/xdm/Xstartup
 #DisplayManager*session:                /var/X11/xdm/Xsession-remote
 DisplayManager*session:                 /var/X11/xdm/Xsession

Comment out, like I did here, the original startup and session lines and add the edited version. All you are doing is telling Xdm not to handle remote logins differently than local logins. I also added one extra line to my xdm-config which was:

 DisplayManager.randomFile:              /dev/random

Only because by default it uses /dev/mem and I got errors in /var/adm/SYSLOG that it was unable to read from /dev/mem. HOWEVER make sure you have /dev/random if you do this! My Irix 6.5.22m does have this so this works for me.

You need to restart XDM by doing "/etc/init.d/xdm stop; /etc/init.d/xdm start" also be sure that xdm is setup to start on boot which it really should be but it is easy to check, just type "chkconfig | grep xdm" and make sure it says on.

Step 2: Connecting from your Desktop

This requires that you are running some sort of X Window server. Any Unix will have this, although with Mac OS X you have to install Xcode. Windows will require additional software like Cygwin, Exceed, Xming, etc.

Linux

You have 2 choices: if you want to run the desktop as a window inside your existing desktop then you want to use Xnest, if you want an entire stand alone desktop then you want to use the power of virtual consoles.

Xnest

First you must already have a GUI running locally. Type "xhost +<IP of Indy>" to bless X traffic from the Indy, then type "Xnest :1 -query <IP of Indy>". Assuming everything is set up correctly you will get a GUI window with the Login prompt, and once you login you will get your Irix desktop. The :1 <- of this solution tells Linux which console to attach to, you can have up to 7 of these I believe.

Full Desktop

Do the "xhost +<IP of Indy>" to bless X traffic, then type "X :1 -query <IP of Indy>". Your screen will flicker to black as it changes consoles and attaches to Indy. Login and you have your IRIX desktop. By default F7 is console :0 your Linux desktop and :1 should be F8. You can switch between them by pressing Ctrl-Alt-F8 or Ctrl-Alt-F7, it is possible that the console attached to F9 so check that if seem to have lost your session. As with Xnest the :1 is the a console to attach to and you can have more than one.

MIT-MAGIC-COOKIE-1 issues

If you get an error like the following:

 AUDIT: Mon Dec  8 20:49:31 2008: 21019 Xnest: client 1 rejected from IP 10.54.85.9
 Auth name: MIT-MAGIC-COOKIE-1 ID: -1

you need to add your linux X's MIT-MAGIC-COOKIE-1 to IRIX's xauth list. To get the linux X's MIT-MAGIC-COOKIE, type:

 xauth list

You should get a list like:

 10.54.85.1:0  MIT-MAGIC-COOKIE-1  22a1c246079866c48436b0d751125004
 [fe80::250:56ff:fec0:8]:0  MIT-MAGIC-COOKIE-1  22a1c246079866c48436b0d751125004
 rei/unix:0  MIT-MAGIC-COOKIE-1  485acdec385fbd53b5abde9dbf3f5513
 rei/unix:1  MIT-MAGIC-COOKIE-1  22a1c246079866c48436b0d751125004

Where 10.54.85.1 is my linux box's IP address. For me the rei/unix:0 line was the most important. As root on my Octane, I ran:

 xauth add 10.54.85.1:0 MIT-MAGIC-COOKIE-1 485acdec385fbd53b5abde9dbf3f5513

This probably could be done as a user without any problems. This show allow you to do

 Xnest :1 -query <ip of octane>

For the fullscreen solution of running another X server, I found I needed

 xauth add 10.54.85.1:1 . 485acdec385fbd53b5abde9dbf3f5513

So give me on the octane:

 octane:1  MIT-MAGIC-COOKIE-1  1348e621e0e00908dd22c5a6b2298275
 octane/unix:1  MIT-MAGIC-COOKIE-1  1348e621e0e00908dd22c5a6b2298275
 10.54.85.1:0  MIT-MAGIC-COOKIE-1  485acdec385fbd53b5abde9dbf3f5513
 10.54.85.1:1  MIT-MAGIC-COOKIE-1  485acdec385fbd53b5abde9dbf3f5513

For the record, the linux machine is Ubuntu intrepid.

Mac OS X

Assuming you have Xcode installed you have the same 2 choices as Linux except that Mac OS X does not have "virtual consoles", instead you get an application window called Xquartz for each X session you run. You can still have more then one and you invoke them exactly the same way you do under Linux. But instead of the CTRL-Alt-F# you just click on the Xquartz session you want to use or click on the Finder to get back to normal.

Quick overview. Start X11, the Installer puts X11.app into /Applications/Utilities, find it and double click on it. Once it is running you should have an Xterm in which to type, from there just type "Xnest :1 -query <IP of Indy>" or "X :1 -query <IP of Indy>" either will startup a Irix desktop session for you. Again you can have more then one simple use the next console via :2 or :3. You may want to start an Xterm for each session so you can kill them with Ctrl-C. Or place them in the background and grep the PID so you can send "kill -TERM <PID>" to shut them down.

Windows

Windows does not ship with the tools you need to do this so you have to decide which 3rd party software you want to use. Cygwin/X is the the most obvious free choice. It gives you a very complete Unix like environment which you can use much like the examples above. This is the software we will use as an example in this section. Other options include X-Deep/32, Exceed and Xming.

You begin by installing the Cygwin package from http://www.cygwin.com, it will prompt you to download packages from the internet. The only packages you will need belong to the xorg tree. Select xorg base and xorg nest, all of the dependencies for both of those pacakges will be automatically downloaded. Finish the install and proceed.

Fire up Cygwin and type "xwin -query <IP of Indy>"

At this point, if you followed all of the instructions correctly, you should be prompted with a login screen for your IRIX box.

If you are presented with a black box instead of your desktop, you may have to edit your /etc/hosts on the SGI system. This is because XDMCP does a reverse DNS lookup on the box attempting to establish the remote connection. Adding the client IP and hostname to the /etc/hosts file on your SGI X host should fix this problem. If this issue persists, you may also need to fix any incorrect entries in your reverse lookup zones on your DNS server.


End Notes

Using these methods I get a full 1280x1024/24-bit desktop from my old Indy with no visible delays in redrawing or moving. This is way more than the 8-bit video card could ever give me. It allows me to enjoy most of the benefits of IRIX without having yet another keyboard/mouse/monitor setup. I use the same solutions with my Sparc 20 and Ultra 5 hardware and anyone who has every had to run older Sun video cards can understand how having some modern hardware handling the video is a huge blessing.


Addendum - Font problems

One drawback though was that the fonts didn't display correctly over the remote X connection. For example the Toolchest font was not italic as it should have been. Most software run OK with the exception of IRIX "Software Manager" that gave me a couple of error messages of missing fonts. And sure enough, the list of software did not display correctly.

To fix this problem I enabled the font server on the IRIX box:

   chkconfig fontserver on

After I enabled the fontserver I had to tell Xnest, X or Xephyr to use it. E.g to start Xnest and remote control my octane2 that had a running fontserver I would type the following on my Linux box:

    Xnest :1 -fp tcp,octane2:7100 -query octane2

The "tcp,octane2:7100 " tell Xnest to get the fonts over the network from the computer with host name octane2 port 7100 This did something for sure, but it was actually worse! The fonts in sub menus of Toolchest was all garbled. And so was some other menus in other software. It was unusable and much worse than running without the fontserver.

The alternative to using a remote fontserver on the IRIX box is to copy them to the Linux box so they are available locally. It took me few hours of "how-to" reading before I eventually was able to get it working. I though I share it here should someone else want to try the same.


1 Copy the fonts Copy the IRIX fonts from your IRIX box to your Linux box. You will find them at /usr/lib/X11/fonts on your IRIX 6.5 box. I copied the 100dpi, 75dpi, CID, Speedo and misc sub folders.

I choose /usr/share/fonts/X11 as the destination folder on my Debian Linux.

2 Register the fonts on the Linux box. To get them registered with the Linux X server I used the command:

   xset fp+ /path/to/fonts

for every IRIX folder added. E.g.

 xset fp+ /usr/lib/X11/fonts/100dpi
 xset fp+ /usr/lib/X11/fonts/75dpi

etc.

3 Tell the Linux X server to start using the newly added fonts. I issued the command

  xset fp rehash

to tell the Linux X server to use the new fonts.

And now when I connect to IRIX computers with either X, Xnest or Xephyr the fonts displays correctly!

See also the post by Debug

Links