Thursday, September 7, 2006

Wild Wiki Waxings

As mentioned in the comments section of an earlier posting, there is a FreeBSD wiki out there called FreeBSD Wiki (no kidding!). I love wikis. They make a great way to share knowledge. We should all get on there and add one piece of information. FreeBSDWiki has been pretty quiet lately, so it is due for an influx of new talent.



When I first started playing Oblivion, I was helping out quite a bit on OblivioWiki. It was fun while my Oblivion obsession lasted. But as is often the case with computer games, my interest faded, and so did my efforts with that wiki.



I check in regularly with the EmacsWiki. It is an incredible treasure trove of information for that beast that is Emacs. I'm constantly learning new ways to do things with Emacs, even though it has been my main editor for ten years or more. You can see my EmacsWiki page here.



And a cool add-on for Firefox is the Googlepedia. I often forget to check Wikipedia when I'm looking for information (I know I know, how could I?). With this add on, it splits your Google search window in two, with a usually appropriate Wikipedia page in it. Pretty nice, although sometimes the matches aren't correct, and it does tend to slow the response of Firefox down a little for a Google search.



I recommend the site pb wiki for setting up a quick 'n' easy wiki. There's a very functional free version available and it's pretty easy to use. Of course, many readers of this blog would prefer to set up their own, but I haven't yet done that myself. I should though.



And I'd be entirely remiss if I didn't mention the amazing Javascript feat that is TiddlyWiki, a one page wiki for users. I'm not sure I entirely agree with the concept of keeping your entire wiki in a single file, downloaded all the time, but it still is some incredible Javascript going on it there.



Tuesday, September 5, 2006

Wallpapers to the rescue

For some reason, my posting with a couple of links to some BSD wallpaper sites here is one of the most popular pages on my blog. It's a mystery why it (and the other one here) get looked at so much! But hey, if it is popular, I'll just go with the flow and post Yet Another BSD Wallpaper Site (YABWS). This one even has five pages of them!



Bsdportal.Ru :: Wallpapers :: Part 1





Chucktips keeps a noob informed

A self-proclaimed "newbie-friendly" site for FreeBSD users. Forums, Q&A, tips and tricks irregularly posted. Looks like a simpler Slashdot kind of site.



Chucktips - Newbie Friendly






Monday, September 4, 2006

xorg.conf battles

So I'm a little further along. Not too much, but a little. I spent over two days, probably at least 8 - 10 hours, playing with my X config file, trying to get my ATI X850 dual monitor card to work. Each monitor was showing the same image, a clone of each other. Not quite what I wanted. On Windows, I have my cheapo 14" LCD monitor set up to the left of my 19" CRT, and it is very easy to use the Display Properties dialog to move things around. The CRT is in 1280x1024 mode, while the LCD is in 1024x768, which works just fine in Windows.



But under X it is a whole new ballgame. It was *very* difficult to get the appropriate information on the web. What I could find was one or more of a] out of date, b] for Linux, c] for nVidia and/or d] for a different ATI card. I would have been happy to find a reasonable man page even for the magical xorg.conf file, and especially the ATI driver. But most pages talked about the various ATI proprietary drivers for Linux, which didn't help me at all for my PC-BSD installation. And those that did talk about BSD were using a different card to do dual monitors.



See, ATI has two ways of doing dual monitors. One is a card with one VGA plug on the back, and a splitter cable that has two VGA plugs to plug two monitors into. A similar setup is for a laptop showing on both the internal and external display. But mine actually has two plugs on the board, one for VGA and one for DVI (which came with a DVI->VGA adapter, as my LCD isn't DVI - told you it was cheap).



So this meant all talk about the flgrx couldn't be used, as that has never been ported to BSD. I'd love to see a petition for ATI to make BSD drivers! And there was a lot of talk about Screen 0 and Screen 1, but that never seemed to work for me.



Anyway, after a gazillion hours of experimentation, I was sure I had to ignore all the advice saying to use Screen 0 and Screen 1 in the "Driver" section. For instance, the xorg.conf file found here has:


Section "Device"
Identifier "aticonfig-Device[0]"
Driver "fglrx"
BusID "PCI:1:0:0"
EndSection

Section "Device"
Identifier "aticonfig-Device[1]"
Driver "fglrx"
BusID "PCI:1:0:0"
Screen 1
EndSection


(note especially the BusID - we'll come back to that later) This is a typically recommended configuration for dual monitor with ATI cards. In this case, it is for a laptop to use both the internal and an attached external monitor. Or another found on the web:




Section "Device"
Identifier "Card0"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "Radeon X300"
BusID "PCI:1:0:0"
Screen 0
EndSection

Section "Device"
Identifier "Card1"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "Radeon X300"
BusID "PCI:1:0:0"
Screen 1
EndSection


Again, note the matching BusID and the different Screen numbers. Basically, this tells X that there are two screens, and, in a "Screen" section, you'll tell it which monitor is on which screen, thusly:




Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultColorDepth 16
SubSection "Display"
Depth 1
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
DefaultColorDepth 16
SubSection "Display"
Depth 1
Modes "1024x768" "800x600" "640x480"
EndSubSection
EndSection


So I tried a million variations on this, and would either get the driver complaining about devices not being found ("no matching Device section for instance (BusID PCI:1:0:1)", mismatched devices or it would just go "poof", with no report, no display and a reset button press in my future. Round and round I went, often starting over using "X -configure" to generate me a new xorg.conf and trying to change one piece at a time to see exactly what was happening. Change a piece, type in "X -config xorg.conf.test", read /var/log/Xorg.0.log and try to decipher its nearly 1000 lines of technical jargon for some kind of help.



To work on this, I would boot into X, then type, from a root Konsole window, "shutdown now". This would drop me into single user text mode. From there I could edit the test config file, run X to see what it would do (of course, it was running a bare metal X, so nothing was really working), Ctrl-Alt-Backspace to kill the X server and try again. There was the added frustration that Ctrl-G (to cancel a command in emacs) would kill emacs and drop me back to the command shell. A command shell that was in some weird mode that didn't echo back any characters. I thought at first it was hung, but it was actually getting the characters, but Enter wasn't being recognized. I had to hit Ctrl-J to enter the (invisible) line. Oh, what fun I had! And to add to my frustration, PC-BSD intermittently hangs. sigh.



(BTW, a better method of doing this would be to use the alternate terminals in X. Ctrl-Alt-F7 puts you into tty6, in text mode. Edit the xorg.conf file, switch back to the X "terminal" with Ctrl-Alt-F9, and the reset the X driver with Ctrl-Alt-Backspace. This would give me a real KDE display, rather than the basic X of black and white crosshatch.)



After many hours of this, I felt like I was no closer, but by now I was determined to get to the bottom of it. I was certain, given the kinds of errors I was getting, that the Screen 0 and Screen 1 stuff wasn't for me. I eventually came to the conclusion it is for the dual head that uses the single VGA connector with the split, which makes sense, The BusID says which bus to talk to on the video card, and the screen number says which cable to talk to. But that wasn't my set up, and I was certain I needed to heed the warnings about "No matching Device section" and so I created two device sections, one for BusID "PCI:1:0:0" and one for "PCI:1:0:1". This would bring up X on both windows, but still they were clones of each and not two different displays.



So I reached deep into my Google-fu and I finally found this page: MergedFB on Freedesktop.org. I liked the idea of the Virtual command, but I wasn't exactly sure how he meant it to be used. But the Radeon man page linked from there was also a huge help, in explaining the options, explaining the arguments and telling me what they actually did. And it explained an incredibly important option - change the default setting of the "CRT2Position" option from "Clone" (sound familiar?) to be "RightOf". Now who in their sickest dreams would decide that the default setup for a two monitor computer should be where the two monitors are clones? How many people would actually want that? I wouldn't be surprised to learn but for want of that one option I could have been saved hours and hours of tweaking!



The other important option, as mentioned, is the Virtual one. This tells X how to layout your two screen desktops. It will only work with rectangular regions, unlike Windows which just abuts the two different rectangular screens, even if they are of different sizes. So I defined a Virtual area of (1280+1024)=2304 by 1028, so it abuts the LCD monitor to the left of the CRT (the LCD is always the CRT1 for the X850 card), with a desktop that scrolls from top to bottom (as the desktop is 1024 pixels vertically but the display is only 768). There's a small bit of "tear" from the mouse cursor when the desktop scrolls up and down, but it goes away immediately and thus isn't too bad.



I also had to play some games with the monitor refresh, as X insisted on setting the horizontal to slightly less than the LCD would handle, but luckily the monitor actually gave me a nice error message, saying the mode wasn't supported and showing me the mode that was being tried. I'm not sure why X thought that 59.9 was enough for a monitor that wanted 60!



I also played with the Xinerama mode, which is slightly different than the MergedFB mode. But it won't do the irregular layout of my two displays, and instead finds the highest common denominator, in this case 1024x768. It is, however, nice that the task bar goes across both monitors and it really acts like a big 2048x786 screen. MergedFB is more like Windows, in that there are two displays and many things when asked to be put in the center, will go in the center of Screen 0. In Xinerama, it will really just go in the middle of both screens! Oh, and another option I set was "MergedXineramaCRT2IsScreen0", as CRT2 is my CRT, which is right in front of me (and Display 1 for Windows), while without this option, centered dialogs (like the login dialog for X) show up on my little LCD monitor.



So that's my X window story. I would really hate to think of just how long I banged my head on the keyboard working at this. Most of Friday night, on and off through most of Saturday, until late Saturday night I finally got it working correctly. I really think that had the "CRT2Position" option defaulted to the more expected "RightOf" or "LeftOf"(you can even do "Above" or "Below"!), I may have figured it out a few hours before. Because when you don't know what you are doing, you change lots of things, but without that option, it never looked right. And nearly everything on the web (including the few bits of help I found on the PC-BSD forums) talked about setting Screen 0 and Screen 1, which just isn't right for my card.



So, here's my complete xorg.conf file. I'm not sure what other tweaks I made. Some options can be put in the "Device" section or the "Screen" section, but I could never figure out which. I mean, what exactly does this mean (from the xorg.conf(5) man page):



Note that most of the Options listed here (but not the other entries) may be specified in the Screen section instead of here in the Device section.


Speaking some other language than English, I think! So I made sure AGP was turned on and tweaked a few other performance options. Rereading the Radeon man page just now, I noticed the "MergedNonRectangular" option, which would exactly match my Windows setup. I'll have to think about whether I want to use it or not, although I am not a big fan of scrolling desktops.




Section "ServerLayout"
Identifier "ATI Dual Monitor"
Screen "Screen0" 0 0
Screen "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
# Option "Xinerama" "True"
EndSection

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "Module"
Load "extmod"
Load "glx"
Load "dri"
Load "dbe"
Load "record"
Load "xtrap"
Load "type1"
Load "freetype"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
#DisplaySize 280 210 # mm
Identifier "LCD-Mon"
VendorName "PTS"
ModelName "PZ456"
### Comment all HorizSync and VertSync values to use DDC:
# HorizSync 30.0 - 60.0
VertRefresh 61.0 - 75.0
Option "DPMS"
EndSection

Section "Monitor"
#DisplaySize 350 260 # mm
Identifier "CRT-Mon"
VendorName "SAM"
ModelName "SyncMaster"
### Comment all HorizSync and VertSync values to use DDC:
HorizSync 30.0 - 96.0
VertRefresh 50.0 - 160.0
Option "DPMS"
EndSection

Section "Device"
Identifier "ATI Port 1"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "R480 [Radeon X850Pro]"
BusID "PCI:1:0:0"

# MergedFB options
Option "MergedFB" "True"
Option "EnablePageFlip" "True"
Option "AGPMode" "4"
Option "AGPFastWrite" "True"
Option "MergedXineramaCRT2IsScreen0" "True"
Option "CRT2Position" "RightOf"
EndSection

Section "Device"
Identifier "ATI Port 2"
Driver "ati"
VendorName "ATI Technologies Inc"
BoardName "R480 [Radeon X850Pro]"
BusID "PCI:1:0:1"
EndSection

Section "Screen"
Identifier "Screen0"
Device "ATI Port 1"
Monitor "LCD-Mon"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x768" "800x600"
Virtual 2304 1024
EndSubSection
EndSection

Section "Screen"
Identifier "Screen1"
Device "ATI Port 2"
Monitor "CRT-Mon"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection





hier page

Cool man page showing the layout of the FreeBSD file system. Ever wonder what that directory is for? Well, here's your answer:



man hier






Saturday, September 2, 2006

Making the move

Well, I'm getting there. Unfortunately, I'm still posting this from my WinXP boot, but progress is being made. Here's what I've done so far:




  1. Cleaned up one of the 120gb hard drives, in order to turn it over entirely to PC-BSD.

  2. Made a PC-BSD CDROM. Well, to be honest, I've made about about ten PC-BSD CDROMs, as I'm having problems getting one to boot without any errors. Using two different burners and two different pieces of software (BurnCDCC and Easy Media Creator), burning at a variety of speeds (from "Optimal", through 16x, 8x and down to 4x) to burn the ISO, and booting it on 4 different computers and 5 different CD drives (I found out my main machine will boot from either CD drive), I still get random CD errors while booting, which has me scared. One suggestion was to try setting the 'hw.ata.atapi_dma' to zero, but that didn't help (by selecting option 6 at boot time, and typing in:



    # set hw.ata.atapi_dma=0

    # boot

    But that didn't help either. The one I burned at 16x seemed to work the best - both fast enough (slower speeds were real drags) and with the same number of (minimal) "READ_BIG MEDIUM ERROR" reports as slower speeds. It seemed to install okay, finding my 160GB hard drive on my Promise controller card just fine.


  3. I installed BootIT NG and it found both the old WinXP and the new PC-BSD boot partitions, and I can boot into either.




The boot in PCBSD worked fine, but now I have to play the usual, tiring, X Window games. I have an ATI 8500 card with dual monitors, and now I have to figure out how to get that setup to work, as both monitors show the same screen. It looks like it can be made to work, but I'm not sure how just yet. Then I have to tweak the X display to be bigger and better.



I was pleased to see that PC-BSD easily found all my WinXP partitions, which is nice. Not sure if I can write to them, as most of them are NTFS partitions. But at least reading them is nice.



Friday, September 1, 2006

Movin' on up

So I think I'm going to take the plunge and move my main home system over to FreeBSD, specifically, PC-BSD 1.2. I've been having a good time with it on my oldest machine (an 833mhz overclocked(!) Celeron), and I've moved most of my professional development over to my work machine (a real beaut - dual 3.0ghz dual core, hyper-threaded CPUs with 2gb of RAM), so I think I can finally break free from the shackles of Windows on my everyday personal machine. I will be dual-booting it for my game playing, though, so the break won't be complete.



So that means I should be updating this blog a lot more too. I've released 3 new PBIs to PBIDir.com:




  • Enscript : a pretty amazingly flexible "filter" from the GNU folks that translates text into Postscript, HTML and RTF. It's especially cool for creating HTML files from your source code. The example line in the man pages is:



    $ enscript -E --color -whtml --toc -pfoo.html *.h *.c


    But oddly enough, that complains about a bad -w parameter, although 'enscript --help' lists -w as well. Just change it to the more GNU-like "--lang=html" and you have an html file that contains all of your .c and .h files nicely colorized. Very cool. I created PBIs for both the a4 and letter versions, which I guess just pick the default paper size.



  • gnuls : It's kind of a pain that Linux and Cygwin use GNU file utilities like mv, cp and ls, while BSD uses, well, BSD ones, with their incompatible arguments. I especially the colorization, although upon further reflection, the BSD ls has the -G option for colorization. But it sure makes sharing .bashrc files difficult between my Cygwin, Redhat Linux, and BSD machines a pain. So I created the gnuls PBI, which makes on program that matches anyway. There's probably a GNU utiities package too, somewhere, that would make the transition easier too.



I will try to put up some notes on the process of creating the PBI. I'm getting to be pretty good at it.



First step is to consolidate my hard drives. I have three on my machine - 2 120GB drives and a 160GB - wow, who would have imagined such numbers just a few short years ago! I just recently put in the 120gb, so it is pretty empty and I will dedicate that to be my PC-BSD drive. I'll also re-install Windows XP for gaming, to get rid of 3 years of cruft. And I'll keep my current WinXP boot as well, just in case I forget something.



For a boot manager, I'll go with BootITNg. I always used to be a System Commander guy, but I started to have problems and have settled on BootIT. Very nice program, albeit a little rougher our the edges than System Commander, and it doesn't have the wonderful Partition Commander either.



Other specs on this machine include an 256mb ATI Radeon X850, 1GB of RAM, using a 2.5ghz Intel Pentium 4, a SoundBlaster Live! sound card, a no-name 50x CD and a LiteOn DVD+RW drive, an LS120 floppy drive (remember the 120mb floppy drives?), an SiS onboard network card, and two monitors, a Samsung SyncMaster 997df (very nice 19" monitor) and a no-name 14" LCD monitor. Wonder how tough it will be to get X to work with them both?



It'll be interesting to see how it works out. I've had some problems in the past getting PC-BSD to recognize hard drives beyond the first one. It should be something to do on a rainy Labor Day weekend. We'll see how it works this time - wish me luck!