Tuesday, February 17, 2009

New Workstation

I'm blogging from my shiny new FreeBSD 7.1 workstation. This is probably not of general interest: I'm using my blog to document how I built this workstation, as there were some hiccups along the road, and maybe some other poor soul will find it useful to know how I worked around them.

So this workstation is a Dell Optiplex 760. It's running a 3GHz Intel Core 2 Duo with 4 GB RAM and two 215 GB hard drives.

So I installed FreeBSD 7.1 from the DVD image via BitTorrent. I followed the instructions on ish and got it booting into a root filesystem on ZFS. Note that the instructions suggest first installing into a 1GB UFS partition, but I found 500MB more than enough room.

So now my filesystem looks like:

> df -h
Filesystem Size Used Avail Capacity Mounted on
tank/root 213G 165M 213G 0% /
devfs 1.0K 1.0K 0B 100% /dev
tank/tmp 213G 128K 213G 0% /tmp
tank/usr 214G 456M 213G 0% /usr
tank/usr/home 218G 4.3G 213G 2% /usr/home
tank/usr/local 216G 2.6G 213G 1% /usr/local
tank/usr/ports 216G 2.4G 213G 1% /usr/ports
tank/usr/ports/packages 215G 1.2G 213G 1% /usr/ports/packages
tank/var 213G 38M 213G 0% /var
> cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/ad8s1b none swap sw 0 0
/dev/ad10s1b none swap sw 0 0
/dev/ad8s1a / ufs rw 1 1
/dev/acd0 /cdrom cd9660 ro,noauto 0 0


The zpool labelled "tank" is actually mirrored across both hard drives:

> sudo zpool status
Password:
pool: tank
state: ONLINE
scrub: none requested
config:

NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror ONLINE 0 0 0
ad8s1d ONLINE 0 0 0
ad10s1d ONLINE 0 0 0

errors: No known data errors


I haven't yet mirrored the boot partitions between the drives, but I do have both swap partitions enabled, which I suspect is actually too much swap.

The real difficulty was in getting my dual monitor configuration to work. Without a configuration file, Xorg started the monitors in mirrored mode. After I ran
Xorg -configure
the monitors came up with much better resolution, but were still mirrored. Thus began a rather tedious "let's configure X" session that involved a great deal of Google searches and too many false leads.

The final breakthrough came when I found a post on a message board (which I can't find now) and read through the manpage for the Radeon driver a few times. Here's what I did:

  1. I started xfce4 with the automatically-created Xorg configuration.

  2. I used xrandr to discover what monitors the driver saw:

    > xrandr
    Screen 0: minimum 320 x 200, current 3200 x 1200, maximum 3200 x 1200
    TV_7PIN_DIN disconnected
    DVI-I_1/digital connected 1600x1200+0+0 367mm x 275mm
    1600x1200 60.0*+ 59.9
    1280x1024 75.0 59.9
    1152x864 74.9
    1024x768 75.1 60.0
    800x600 75.0 60.3
    640x480 75.0 60.0
    720x400 70.1
    DVI-I_1/analog disconnected
    DVI-I_2/digital connected 1600x1200+1600+0 367mm x 275mm
    1600x1200 60.0*+ 59.9
    1280x1024 75.0 59.9
    1152x864 74.9
    1024x768 75.1 60.0
    800x600 75.0 60.3
    640x480 75.0 60.0
    720x400 70.1
    DVI-I_2/analog disconnected



  3. I used xrandr to turn the monitors off and on, and to arrange them side-by-side to my liking, paying attention to the warnings it gave me.

  4. I wrote the new configuration to the Xorg configuration file:

    > cat /etc/X11/xorg.conf
    Section "Files"
    RgbPath "/usr/local/share/X11/rgb"
    ModulePath "/usr/local/lib/xorg/modules"
    FontPath "/usr/local/lib/X11/fonts/misc/"
    FontPath "/usr/local/lib/X11/fonts/TTF/"
    FontPath "/usr/local/lib/X11/fonts/OTF"
    FontPath "/usr/local/lib/X11/fonts/Type1/"
    FontPath "/usr/local/lib/X11/fonts/100dpi/"
    FontPath "/usr/local/lib/X11/fonts/75dpi/"
    EndSection

    Section "Module"
    Load "GLcore"
    Load "extmod"
    Load "record"
    Load "glx"
    Load "xtrap"
    Load "dri"
    Load "dbe"
    Load "freetype"
    Load "type1"
    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"
    Identifier "leftMonitor"
    VendorName "Dell"
    ModelName "Dell 2007FP"
    Option "DPMS" "on"
    EndSection

    Section "Monitor"
    Identifier "rightMonitor"
    VendorName "Dell"
    ModelName "Dell 2007FP"
    Option "DPMS" "on"
    Option "RightOf" "leftMonitor"
    EndSection

    Section "Device"
    Identifier "Card0"
    Driver "radeonhd"
    VendorName "ATI Technologies Inc"
    BoardName "Unknown Board"
    BusID "PCI:1:0:0"
    Option "Monitor-DVI-I_1/digital" "leftMonitor"
    Option "Monitor-DVI-I_2/digital" "rightMonitor"
    EndSection

    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    Monitor "leftMonitor"
    Monitor "rightMonitor"
    DefaultDepth 24
    SubSection "Display"
    Viewport 0 0
    Depth 24
    Virtual 3200 1200
    EndSubSection
    EndSection




Notice I don't have two video cards listed: I simply have both monitors listed as options on the one card. Notice also the names are "Monitor-DVI-I_1/digital" and "Monitor-DVI-I_2/digital" on the card. Apparently the driver probes them as "DVI-I_1/digital" and "DVI-I_2/digital", and Xorg prepends those strings with "Monitor-".

My new setup is working perfectly now.

The one problem I haven't totally resolved is the USB mouse and keyboard. The mouse wasn't working at all (a Logitech MX Laser wireless) until I plugged it into a USB port on the back of the box. Then there was contention with the keyboard, where one or the other would spontaneously stop working. I finally got them to work together, almost consistently, by plugging them both in the back, the keyboard to the right of the mouse. I'm not 100% sure this is fixed, but it's working fairly reliably now.

I did have to twiddle some things in /etc/rc.conf, and got some help from sysinstall on that too:

> sed -n -e '/^[^#]/p' /etc/rc.conf
zfs_enable="YES"
hostname="********************"
ifconfig_em0="DHCP"
usbd_enable="YES"
sshd_enable="YES"
fusefs_enable="YES"
moused_port="/dev/ums0"
moused_type="auto"
moused_enable="YES"
ntpdate_flags="-b***************"
ntpdate_enable="YES"
nfs_client_enable="YES"


FreeBSD has come a long way since I started using it in the 4.0-RELEASE days. It's been a couiple years since I've messed with it, and it's not been disappointing to return. I'm looking forward to a long and productive relationship with this great operating system.

I'm not done yet: I have some Perl modules and some ASDF packages to install, as well as migrating PGP and ssh keys from my MacBook. But we're well on the way here.

And I'm having a blast.

3 comments:

Ames said...

I'm glad you are having a blast.

Ben said...

Hi there,

I've been trying to get the same dual monitor/spanned desktop setup working on my Dell Optiplex 760 with the onboard VGA and a breakout DVI card under RHEL5.3. I wonder if we can talk via email about my xorg.conf and you can give me some pointers on what I might be able to do to get things working.

I'm nearly there... it's just the last step that's frustrating me. I won't explain here as its a little long-winded! (-:

With hopeful thanks,

Ben

clumsy ox said...

Ben,

My email address is at the bottom of the page, shoot me a note and we'll try and figure it out.

-co