Rough Book

random musings of just another computer nerd

Tag: windows xp

An update to running aterm (or any other X app) rootless, without a DOS console on Cygwin

A while ago, I wrote up a quick guide about running X/Windows applications (specifically, aterm) without root windows on Windows, using Cygwin. Recently I tried to set it up again and I realized that some of the information is slightly out of date. I’m also endeavoring to write a better guide. I’m assuming that you have, at the very least, a decent understanding of building things from source. The process under Cygwin is pretty much the same as under any other *nix, but there are a few quirks. On the whole, it’s a whole lot easier than it used to be. This guide is primarily geared towards running aterm with a transparent background on a windows machine so that you can have a decent client for the Cygwin commandline, instead of the crappy Windows one.

I’m assuming that you already have Cygwin installed. If you don’t, you can get it from here. In addition to whatever other packages you have selected to customize your install, you also need development packages (gcc and friends), Xorg packages (headers, includes, and libraries), and a few graphics libraries (for aterm):

  • Devel
    • gcc-core
    • gcc-g++
    • libXaw3d-devel (for xv)
    • libjpeg-devel (for aterm)
    • libpng12-devel (for aterm)
  • Libs
    • jpeg (for aterm)
    • libXaw3d-devel
    • libXaw3d-7
    • libfreetype6
    • libjpeg-devel
    • libjpeg62 (for aterm)
    • libjpeg6b (for aterm)
    • libpng12 (for aterm)
    • libpng12-devel (for aterm)
    • libtiff5 (for aterm, xv)
    • zlib-devel (for aterm)
    • zlib0 (for aterm)
  • Utils
    • bzip2 (to handle .bz2 files)
  • X11
    • libX11-devel
    • xinit
    • xsetroot (if xv doesn’t work for you)

After Cygwin finishes installing those packages, grab the sources for libAfterImage, aterm, and xv. Unpack the sources perform the requisite steps to build and install from source (./configure, make, and make install should work if all goes well).

libAfterImage:

If you get “parse error before XErrorEvent” errors while building libAfterImage, make sure that you didn’t forget to select the X11 development package.

aterm:

gcc on Cygwin expects –rdynamic and not -rdynamic. If you’re seeing these errors, edit the Makefiles under src and src/graphics within the aterm source directory. Change the “-rdynamic” to “–rdynamic”. The changes should be on line 54 for both files.

xv:

Under the tiff directory within the xv sources, there is a file called RANLIB.csh. Edit this file and make sure that you ONLY have the following line in there:

ranlib $1 >& /dev/null

Otherwise the build process will fail. Additionally, you need to edit xv.h. This file lives right at the root of your xv source directory. If you do not perform the following change, you’ll get errors from gcc complaining that “sys_errlist has previously been defined”. Change line 119 of xv.h to:

/*extern char *sys_errlist[]; */    /* this too... */

What you’re doing is commenting out the definition for sys_errlist so that it doesn’t conflict with what has already been defined in the Cygwin header files. These changes should be the only ones you need to get xv compiling and running.

Now you need to set up two batch files. One to start up X rootlessly, and another to start up aterm. Before you do that, make sure you add C:\cygwin\usr\bin and C:\cygwin\X11R6\usr\bin to your PATH variable. You can do this by going to My Computer > Properties > Advanced > Environment Variables. If you don’t do this, you’ll get “cygwin1.dll not found” errors while trying to run these batch files. The X windows binaries used to live in C:\cygwin\usr\X11R6\bin, but have since been moved to C:\cygwin\usr\bin. Therefore, the start-up batch-file now looks like this:

xwin.bat:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\bin\xwin.exe -multiwindow -clipboard -silent-dup-error
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\local\bin\xv.exe -display :0 -root -quit -be -max /cygdrive/c/Documents\ and\ Settings/vivin/My\ Documents/My\ Pictures/Wallpapers/01707_spectrumofthesky_1920x1200.jpg

The first line starts up the X windowing system. The second line sets the wallpaper using aterm. You now need another batch file to run aterm, and that looks like this:

aterm.bat

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "aterm -sh 80 -tr -trsb -fade 20 -tint gray -sb -st -sr -sl 1000 -tn xterm"

This file starts aterm with the background image at 50% brightness, transparent background, transparent scrollbar, 20% fading on losing focus, gray tint, scrollbar, trough-less scrollbar, scrollbar on the right, 1000 scrollback lines, and with xterm terminal emulation. Like I mentioned in my original guide. xv will sometimes fail to start with xwin. If that is the case, you can modify aterm.bat to look like this:

aterm.bat:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "xv -display :0 -root -quit -be -max /cygdrive/c/Documents\ and\ Settings/vivin/My\ Documents/My\ Pictures/Wallpapers/01707_spectrumofthesky_1920x1200.jpg && aterm -sh 80 -tr -trsb -fade 20 -tint gray -sb -st -sr -sl 1000 -tn xterm"

Slightly inefficient, but it works. Now if you have a dual-monitor display, you’ll notice that the background image is stretched across both screens when you run aterm. This is probably not what you want. To fix this problem you need to change a few invocation options for xv. For this to work properly (meaning, not look crappy) both screens should be running at the same resolution:

xv -display :0 -root -quit -be -maxpect -rmode 1 /cygdrive/c/Documents\ and\ Settings/vivin/My\ Documents/My\ Pictures/Wallpapers/01707_spectrumofthesky_1920x1200.jpg

Notice the -maxpect and -rmode 1 options. -maxpect expands the image to fill the screen while maintaining the aspect ratio, while -rmode 1 sets the display mode on xv to tiled. So you should now have your wallpaper displaying on both screens now (under X) without being distorted.

Here’s what it looks like on my machine:

aterm running on XP under X with a dual-monitor setup

This is on a dual-monitor setup with both screens running at 1920×1200 resolution. I’ve set X’s background to be the same as my windows Wallpaper so that it looks cooler. Notice how the background image (inside aterm) is not stretched, but tiled across the two screens. That’s all there is to it. Seems like a bit of work, but I think it’s worth it. My main reason for going through all this trouble was to get a decent terminal running in windows. I guess I could have just used xterm, but aterm looks so much nicer, doesn’t it?

There is no Windows 7

Here is a first look at the Windows 7 beta. All I could really get from the review was that “it’s done”, and that it “feels snappier” and that it is “more responsive”. In the screenshots it still looks like Vista. The taskbar reminds me of KDE. A bunch of torrent sites have the beta up for download. Microsoft is expected to announce the build’s public availability in January. So you can get a copy of it and try it out, but to do so might be “breaking the law”. But that hasn’t deterred a bunch of people who’re out downloading it. Right now, piratebay‘s torrent for the beta is showing 2,503 seeds and 8,137 peers.

On another note though. People seem to think that this is a new operating system from Microsoft. It isn’t. It’s just Vista Service Pack 3, in my opinion. I mean, how long did it take Microsoft to come up with Vista after XP? I seriously doubt they got a brand new operating system out in about a year and a half. The name is just a PR campaign to bury the name “Vista”. There is so much bad press and publicity surrounding the name that Microsoft has to get away from it, if they want the Vista codebase to be successful.

I had Vista on my laptop. It was alright; I didn’t use it long enough to run into too many issues. The UAC prompts were pretty annoying though. Also, compiling anything on it took forever. I’m running Ubuntu on it now, and it’s way faster. My sister and my dad both run Vista, but I haven’t heard of them having any problems. If Windows 7 really is good, then I might actually consider running it. I currently have only one Windows machine and that’s running XP. Everything else is either running FreeBSD or Linux.

Running aterm (or any other X app) rootless, without a DOS console on Cygwin

This guide is outdated. Please check out the updated version of this guide here.

On any system that I plan to use for an extended period of time, I will always install Cygwin. This is mainly because I like have UNIX tools on Windows, and also so that I can use the console to do things that DOS is not able to do. I started using Cygwin in 2000, and I’ve continued using it since. One of the cool things you can do with Cygwin is run X, which means that you can have X applications running on the Windows desktop. When I was interning at Motorola, I used to run eXceed, with fvwm. This was where I first ran into aterm. What I liked most about aterm is the eye-candy. You can have transparent windows with shading effects and all sorts of other cool stuff. I tried to get aterm running on my machine at home by compiling it from source under Cygwin. I was eventually able to do this (install libjpeg, libpng, libAfterImage, zlib, and the X includes and libraries first), but what I didn’t like was the fact that you had to start up a Cygwin console to open up X, and then aterm. I wanted aterm to start up and run directly without that ugly DOS/Cygwin console window. Of course, you can’t simply run the aterm executable because it needs X and Cygwin to be running. I eventually figured it out (actually a few months before leaving on my “extended vacation”) by starting out with X running with a rootless window. Oh, and run.exe proved to be very helpful. Anyway, here is how you do it:

First you need to add C:\cygwin\bin to your PATH Environment Variable. You can do this from My Computer > Properties > Advanced > Environment Variables. You might also have to add C:\cygwin\usr\X11R6\bin to PATH.

Then you need to create two batch files. The first one is to start X, and the second one is to start aterm (or whatever X app you want to start). The example I’m going to show includes starting up X with a wallpaper (using xv), and then running aterm. I run aterm with a transparent background, using the X wallpaper. However, you can also load aterm with a background image of your choice.

The batch file to start X, which I call xwin.bat looks like this:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\X11R6\bin\xwin.exe -multiwindow -clipboard -silent-dup-error
C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\usr\local\bin\xv.exe -display :0 -root -quit -be -maxpect /cygdrive/c/Wallpapers/upper_limit_wp_dark_1600.jpg

This will start up X in a rootless window with upper_limit_wp_dark_1600.jpg as your X wallpaper. Next, you write a batch file (aterm.bat) that will load aterm:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "aterm -sh 50 -tr -trsb -fade 20 -tint gray -bl -sb -st -sr -sl 1000 -tn xterm"

This batch file will load aterm with the background image at 50% brightness, transparent background, transparent scrollbar, 20% fading on losing focus, gray tint, borderless window (sometimes works), scrollbar, trough-less scrollbar, scrollbar on the right, 1000 scrollback lines, and with xterm terminal emulation. One issue I have had with this, is that aterm may load up with the default (checkered) X background. This is because the xv did not properly execute in xwin.bat. I have no idea why this happens, sometimes it works, and sometimes it doesn’t. If it doesn’t, you can modify aterm.bat:

C:\cygwin\usr\X11R6\bin\run.exe C:\cygwin\bin\bash.exe --login -i -c "xv -display :0 -root -quit -be -max /cygdrive/c/Wallpapers/upper_limit_wp_dark_1600.jpg && aterm -sh 50 -tr -trsb -fade 20 -tint gray -bl -sb -st -sr -sl 1000 -tn xterm"

This batch file will load xv every time you start aterm, so there is a slight performance hit on startup. However, it’s not that big of a deal because the xv instance quits right after it sets up the wallpaper, and so you’re not loading a new instance of xv into the memory every time.

Well, there you have it. I hope it was helpful!

X with XP
Screenshot of my XP desktop, with aterm, xcalc, xclock, xeyes, and xterm running

w00t

You know what’s so sweet? I am using Winamp to make an http connection to my FreeBSD machine to access music that’s on my XP machine through an SMB share. So my music goes from my XP machine through the SMB share to my FreeBSD machine and from there over the internet through a symlinked directory in my pub folder to arrive at my laptop. So Schweeet! I can access my entire music collection!

Upgraded System

I just upgraded my WinXP machine. She’s a 2.4Ghz HyperThread Enabled Pentium IV with 1 Gb RAM. I have about 230 Gb that spans across two disks (one 160 Gb and one 75 Gb). I had to get a RAID controller. All of the other hardware is the same. It took me about three freaking days to get it all working. It was a bitch. The last day was the worst. It wouldn’t POST and there was no video. I must have taken apart everything and put it back together about 10 or 15 times. Finally I took it all out – including the motherboard. There was a dust bunny beneath it. Maybe it was shorting the board. I dunno… the no video problem was pretty intermittent. Anyway… it’s all working now. I just have to back up my old stuff… it’s kinda late now though… I’ll do it tomorrow… I need some SLEEP now.

So many toys!

Woohoo! I love the Friday after Thanksgiving. I got my self two 256Mb RAMBUSes and also a 160Gb HD. All for a schweet, schweet price! Now my machine is running with 768Mb of RAM. I am so tempted to go up to 1Gb! I am going to put the 160Gb in my WinXP machine. And keep the 75Gb in there too. I still have a 512Mb SIMM lying around and also two 64Mb RAMBUSes. Maybe I should put the RAMBUSes in the FreeBSD machine and the 512Mb into the new server that I want. SCHWEETNESS!

Ugh. Back to school. I wish I was still in Cali. I built 3 computers in two days. Can’t wait for the semester to be done!

smbfs

Sharity-Lite stopped working… No, wait… Actually it might have been my Windows machine. Ever since I installed that piece-of-crap Xilix ISE and ModelSim software my computer has been acting weird. It wouldn’t authenticate requests from Sharity-Light. The only way I could mount drives was if I enable simple file sharing. I couldn’t have that… I wanted it to be exclusive… It used to work before, but for some reason, now it doesn’t. That’s when I discovered SMBFS. It’s pretty neat. Mounts Windows shares really well! That and CUPS works really nicely with my HP Deskjet 812C, which is now connected to my FreeBSD machine. God I’m such a nerd!

Samba

Got samba working on my FreeBSD machine. Now I can access NFS shares from my XP box.

Fixed Sharity Light Problem

Fixed the problem. I had (wrongly) set the hostname for my XP box as 10.0.0.1. D’OH! It should have been 10.0.0.2. Works perfectly now!

Horrible

How hard can installing a new OS get? Pretty damn hard. It took three hard disks and two other OS’es to get it right. Huh what? Yeah you heard me… I wanted switch from Windows XP Home to Windows XP Professional. So I pull out a pre-activated copy (muhaha) that my buddy gave me a year ago and start installing it. I selected the “Update” option. Call it intuition. But after using computers for more than 12 years, I have an idea when things are about to go wrong. Sure enough, it did. I can probably illustrate this better in a more logical format:

Problem

XP installation starts, runs for a while and then crashes with a blue screen. I rebooted and tried to install again. Same problem. Did this three times. No difference.

Solution

Forget about installing XP professional. See if you can use the Alienware recovery CD and get XP Home back.

New Problem

CD won’t boot for some bizarre reason. Later I found out that the machine had a problem recognizing signals from the USB Keyboard. The strange thing was that it would recognize the F2 keystroke for the BIOS setup, but wouldn’t recognize anything after that. It would say “Press any key to boot from CD…”, I’d press any key and nothing would happen. XP Installer would boot up (and crash).

Solution

Remove hard drives from the boot sequence. I’ll see if I can force it to boot from the CD.

Bigger Problems

Boot failure. Also, after restoring the boot sequence, it says the OS is corrupted. I still can’t boot from the Alienware Master CD.

Solution

Try to boot up with FreeBSD CD. It worked! I installed FreeBSD on the 20Gb hard drive. Tried to boot up, but kept locating the 75Gb hard drive. Switched boot sequences. It worked! Mounted the 75 Gb as an nfs mount using mount_ntfs. Tried to move everything to /. Said it ran out of space. That didn’t make sense! I knew there was a whole lot of space left on the 20 Gb. Then I realized that / was on a different partition and that I should install it on /usr. Did that. Pulled out hard drive, put it into my FreeBSD machine (I could have left it in there and just transfered it using another mount_ntfs after I wiped out the 75 Gb and installed XP Professional… but it was 3 am and this didn’t occur to me). XP Installs fine. So now I set up the network and set up a shared dir on the XP box. I try to mount it from the FreeBSD box using sharity light. It dies. Then I figured out I had changed the machine name. Tried it again with the new machine name – it worked! Then I mount the 20 Gb. I go to /usr on the 20 Gb to get my files…

Really Big Problem

I can’t find my files!! ls on /usr gives absolutely nothing!

Solution

Then suddenly I had an epiphany… I was mounting /dev/ad1s1. This means drive 1, slice 1 as FreeBSD organizes the drive into partitions, and different dirs are mapped to different partitions. I try to mount /dev/ad1 directly and it gives me a superblock error. So then I try /dev/ad1s2 – same problem. So I goto /dev and list all ad1 devices. I see a bunch of /dev/ad1s1a, /dev/ad1s1b and so on… So I tried mounting those and eventually found all the rescued files. Then I transferred everything over the home network to my XP shared dir. Problem solved! I have XP Professional and everything works fine… well almost. The BIOS and XP can see my 20 Gb hard drive, but it doesn’t assign it a drive letter… I formatted it (using FreeBSD so that might be a problem… except I don’t think so, because I just zapped all the partitions), but it still doesn’t see it… I’ll have to figure out how to fix it. Also, Qwest is sending me a Cisco 678. Then I can buy some static IP’s and set up my webserver… finally! Ahhh… This was a very trying experience, but I learnt a lot…

All original content on these pages is fingerprinted and certified by Digiprove
%d bloggers like this: