X11 Mouse Cursor Themes
Starting after installimg the binary nvidia drivers on both my laptop
(Quadro K1100M) and my workstation (GeForce GT 630) Blackbox was
defaulting to a mouse cursor that was suboptimal, a black, notched
triangle.
The settings in the Xresources for the mouse cursor theme are honored by
XDM at the graphical log in, but when Blackbox or Fluxbox start, the
cursor would change to the black notched triangle. TWM honors the
settings in Xresources, but TWM is just a little too minimalist, even for
me.
But there's a simple fix!
Create a file in your home directory (if it doesn't already exist)
.icons/default/index.theme. In this file, add the following lines:
[Icon Theme]
Inherits = polarblue
where polarblue is the name of the X11 mouse cursor theme you wish to
use. FreeBSD installs many of the X11 cursor sets into
/usr/local/lib/X11/icons/, your Unix flavor may be different. In theory,
you can also install new themes of your choosing into ~/.icons/ and use
those without the need for any elevated privileges.
Additionally, there's the option of creating a .Xdefaults file in the
home directory and adding the line
Xcursor.theme: polarblue
Again, where polarblue is the name of theme you want to use.
[/unix]
[permanent link]
FreeBSD Unix on Dell Precision M4800
I installed FreeBSD 10.3 on the laptop I recently acquired and
almost eveything worked out of the box. The gigabit ethernet and
wi-fi coards worked fine and by setting the BIOS to discrete graphics
only, the nVidia Quadro was recognized.
I installed the binary driver from nVidia, because they support FreeBSD
because they're awesome like that. The nvidia-xconfig(1) program was
useful to streamline the process of getting X.org to use the Quadro.
There were a few things that did need some tewaking though. First
there's the sound card. Because the quadro supports HDMI (in addition to
VGA and DisplayPort), it includes an HDA-compliant sound card. This card
is recognized before the primary HDA-compliant sound card in the
machine, the one that's actually connected to the speakers.
I did some research and there were some suggestions about using
sysctl(8) to control soundcard GPIO pins to connect the nVidia sound
device to the speackers but what ultimately worked was using sysctl(8)
to change the default primary sound device to the dedicated card. There
were a few ways to make this happen but the one I found that actually
worked was to place sysctl(8) command lines in /etc/rc.local.
First I found the device I wanted as the default:
mforde@gaz:~> cat /dev/sndstat
Installed devices:
pcm0: (play) default
pcm1: (play)
pcm2: (play)
pcm3: (play)
Device pcm2 was the one I wanted so I added the following lines to
/etc/rc.local
sysctl hw.snd.default_unit=2
sysctl hw.snd.default_auto=2
Now when boot completes pcm2 is set to my default and sound "just
works" and sndstat shows pcm2 as the default.
I found ACPI support has some weirdness as ACPI support often does. What
I found was that Suspend works from console, but resume doesn't...
HOWEVER After I start X ACPI suspend and resume work just
fine. Normally I prefer to boot into a console and only start X if I
really need it, but because I want suspend and resume to work "by
default" I've enabled X to start at boot by allowing the xdm console in
/etc/ttys.
But this had one last issue. See, when manually starting X, I added the
-dpi 143 option to get graphics and text to be appropriately sized for
my screen. XDM needed to know about this.
This probably wasn't the best place to do it, but I edited
/usr/local/lib/X11/xdm/XServers and modified the call to X(7) to add the
-dpi 143 option. Now when Xdm loads at start up, the DPI is set
correctly.
The function keys for adjusting the screen brightness don't work;
however, xbacklight(1) works just fine. Similarly the volume keys don't
work but I can adjust the volume quite easily with aumix(1).
I've submitted my dmesg output to NYCBUG's
dmesgd repository.
I suppose I've posted this for two reasons. The first is so I have a
record of how I eventually got these little things working in case I
have to do it again. The second is in case anyone has similar issues
with their hardware; if they happen to stumble upon this, it might give
them some hints.
[/unix]
[permanent link]
Remapping Keys in Vim
While I love the keyboard on my relatively new Dell M4800, I'm not
particularly fond of the placement of the Page Up and Page Down keys to
the left and right of the Up arrow, and above the Left and Right arrow
keys. I find myself accidently hitting those keys too frequently while
editing code and jumping all over the file.
So I remapped them. It was quite simple, because Vim is awesome. I added
the following lines to my .vimrc file:
map <PageUp> <Up>
map <PageDown> <Down>
This turns Page Up into a second Up arrow, and Page Down into a second
Down arrow. For now, I'll leave it like that. I may remap them to the
Left and Right arrows in the future. Or not.
[/unix]
[permanent link]
How to Make VMWare suck less Tip #273
Find the .vmx file for your VM and add a line
bios.bootDelay = "15000"
That gives you 15 seconds before the virtual machine launches the boot
loader, giving you plenty of time to do things like change the boot
order so you start from a recovery CD.
[/unix]
[permanent link]
Things I love about vim
- Tabbed interface in the 7.x line
- Macro recording
- Built-in sed
- :make
- Not needing to remember a thousand key combinations that require
seventeen fingers to properly execute
[/unix]
[permanent link]
Resetting Vim
On occasion while I'm coding, I'll mistype something and vim's code
autoindenting will stop honoring my settings. Likely, I've done
something stupid that has disabled or modifying the settings from the
defaults I set in my .vimrc file.
If (when) this happens, Vim can be reset without exiting the procces by
going into command mode and typing
:source $MYVIMRC
This reloads the settings of the .vimrc file without forcing you to
restart the process, thus losing your place in your code.
[/unix]
[permanent link]
... On man pages, a mini-rant
I really despise the linux man pages. They're useless at best and wrong
at worst.
From the man page for setsockopt: "The include file <sys/socket.h>
contains definitions for socket level options, described below."
1) The options are not "described below."
2) No, that file actually doesn't contain those definitions.
On the other hand... The FreeBSD man page for setsockopt does actually
describe the options and under FreeBSD the <sys/socket.h> file does
indeed contain the definitions.
[/unix]
[permanent link]
[mini-rant]
I hate bash. I hate it. I hate how it bastardized bourne by adding
half-assed implementations of features from ksh and tcsh.
[/unix]
[permanent link]
Problems with loader.conf
First the background. The story of how I got into this mess:
I'm trying to get ACPI working on my laptop under FreeBSD. Specifically,
I'm trying to get Resume to work properly. Suspend works, and resume
seems to partially work. The fans spin up, the keyboard's backlight
comes back on, but no screen. And without video, it's a little hard to
figure out what's going on.
ACPI works great on my server. It's running the same FreeBSD 9.1 x86-64
build that the laptop is, but the biggest difference is that it's an
intel motherboard. The laptop is an Alienware, for our purposes, I might
as well just call it a Dell.
I started comparing the ASL output from both machines and noticed some
things. First, the Alienware's ACPI implementation looks for the OS to
be various forms of Windows or "Linux." The intel ACPI implementation
also looks for these Windows variants and "Linux" but it has an
additional OS string. It has an entry for "FreeBSD."
I figured the easiest next step was to use iasl co compile the intel ASL
source and load that DSDT onto the laptop.
I calculated the odds it would work vs the odds I was doing something
incredibly stupid... and I went ahead and did it anyway...
I compiled the asl and I set /boot/loader.conf to override the DSDT with
the intel one I had just compiled and I rebooted. At first everything
was good. The machine went down, I got the boot loader, and the FreeBSD
kernel started to load. Seconds into the kernel load, it rebooted
itself. After the second time, I powered off and tried a cold boot. Same
problem just as I had feared.
Now i was in a situation where I couldn't successfully boot because of
an error in loader.conf I needed to find a way to edit it.
And here's the solution:
The FreeBSD bootloader, like many others, works in stages. At a certain
point, it can be interrupted at which point it provides a set of simple
yet powerful commands to control various aspects of the loading process.
If you still have that default menu at load, I beleive the option to
chose is 6. I disable that menu so during a brief countdown I hit escape
before the boot loader turns control over to the kernel.
Once in the boot loader prompt, I entered the following commands:
unload
load kernel
boot
Pretty simple right? The unload command does what it says, it unloads
the kernel and any modules loader.conf had pulled into memory. The load
kernel command grabs the kernel and loads it into memory... but only
the kernel thus ignoring the broken DSDT in loader.conf. And of course
boot tells the boot loader to continue booting the system.
Once booted, I removed the bad DSDT from loader.conf.
[/unix]
[permanent link]
Excluding directories while using pax(1)
My primary disk is failing. There are large segments that are generating
low level IO errors during read or write operations. Most of the files
written to the bad area were under /usr/ports/ where the FreeBSD Ports
collection is installed. A few files were under the web server's root.
Figuring I'd take care of things prior to the disk actually failing to
the point of it being irrecoverable, I purchased a new disk early. I
installed it, partitioned it, and formatted it.
To copy the data over, ignoring the areas that were causing the IO
errors, I used mv to "move" the files from the web root under /usr/ports
and used the following command as root:
pax -rwvpe -s':/usr/ports/.*::gp' -X / /mnt/newdisk/
The -X prevents pax from traversing into mount points that have a
different device ID than the one on which it was started. This prevents
an infinitely recursive loop from happening when the new disk's mount
point would have been hit. It also prevents data on the non-failing
disks from being copied as well.
the -s option allows for sed search and replace scripts to be run. In
this example, the : is used as the delimiter and any path matching
/usr/ports/* is replaced by a null string. With this replacement all
directories under /usr/ports are excluded from the copy.
[/unix]
[permanent link]
freebsd-update
I'm attempting to update my laptop from FreeBSD 9.1-Beta1 to 9.1-RC1. The
freebsd-update(8) utilitly was reporting an error finding the public key. A
quick search found this thread. As per tangram's
suggestion, I used
env UNAME_r=9.0-RELEASE freebsd-update upgrade -r 9.1-RC1
and then the update began working.
[/unix]
[permanent link]
Fun little alias
I use a console based RSS reader written in Ruby. It crashes often and
will delete my list of feeds in the process. It also has a tendency to
not fully exit, leaving a ruby process sitting in the background soaking
up close to 100% CPU time. For such occasions, I've added the following
alias to my .cshrc file.
alias killraggle kill -9 '`ps ax|grep raggle|grep -v grep|awk '\''{print $1;}'\''`'
[/unix]
[permanent link]
FreeBSD 6.4 EoL
As of yesterday, FreeBSD 6.4, and with it the entire 6.x branch, has
reached its End-of-Life. It's time to upgrade (or maybe upgrayedd, for a
double dose of something-or-other).
So herein lies the problems. Months (years?) ago, I attempted to upgrade
tak to FreeBSD 7.2. I plugged in a SATA disk into my workstation,
installed the OS, reconfigured all the daemons, services, and
functionalities tak has running, copied over a snapshot of all the data,
and then edited the fstab to match the device names as they'd exist on
tak.
I removed the IDE root disk and installed the new SATA disk and tak and
watched the kernel fail to find the root disk. Or the other SATA disk in
tak.
Based on the bug reports in the FreeBSD Gnats system, and various
conversations in the mailing list, it seems Asus, who made the
motherboard in tak, used a slightly non-standard SATA implementation on
this particular board. Between the 6.x and 7.x line, some work had been
done on the SATA drivers in FreeBSD and mad them more
standards-compliant (a good thing). This, however, broke SATA on this
Asus board.
Tak is about 6 years old now, and other than some over heating issues,
serves its purpose well. So do upgrade to FreeBSD 8.x on an IDE disk and
replace the other SATA disk with another ATA disk, or do I build a new,
lower-power, higher-performance system?
If anyone actually reads this, feel free to use the new comments feature
to give me feedback. I think it's working.
[/unix]
[permanent link]
Gmail and mutt
I like mutt. Of all the mail clients I've used over the years, it
sucks the least. It works well with my mail server.
Despite having my own domain and mail server, I still use gmail for
certain things; things I don't mind being retained for 3 years after I
delete them, or more specifically, things I want retained for 3 years
after I delete them.
I don't like the gmail web interface. I find checking my gmail to be
annoying because of this. I remembered gmail offering POP and IMAP.
I figured I could use that to get my gmail. Shouldn't be too hard right?
A quick search of Mr. Yahoo and Mr. Google gave me two good starting
points: Lifehacker.com
and MattCutts.com.
I read the sites and the getmail man page and figured out what I needed
to do. First I enabled IMAP for my gmail account. Next, I created the
.getmail directory in my home directory then created a getmailrc file
there. I want all gmail mail to be delivered to a specific mbox file
without going through my normal mail delivery channels. The contents of
the getmailrc file are quite simple:
[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = username@gmail.com
password = usernamespasswordgoeshere
mailboxes = ("inbox",)
[destination]
type = Mboxrd
path = /usr/home/mforde/Mail/GMAIL
The retriever section defines how getmail will retrieve the mail. In
this case it uses IMAP over SSL to connect to imap.gmail.com. The
mailboxes setting can be used to specify only certain gmail labels to
retrieve, but I want anything in the inbox.
The destination section tells getmail what to do with the mail once it
has grabbed it from gmail. This configuration dumps it into an mbox file
I've named GMAIL.
I chose IMAP over POP because of the slightly-less-than-documented
"feature" of gmail only allowing 99 messages at a time over POP.
So to get the initial batch of 7000+ emails, I ran
> getmail -vvv -l
to get verbose output and to leave messages on the gmail server. When
that was done I pointed mutt at the GMAIL mbox and like magic, there was
my gmail, organized nicely in my terminal.
Now, I want to check to get the latest mail fairly often, and I don't
want to download messages already copied over. To accomplish this, I
added a crontab to run every 10 minutes and invoke
getmail -l -n -q
This tells getmail to leave copies on the server, only get new messages
it hasn't already retrieved, and be quiet about it.
This has worked out well for me. If you're interested in setting up
something like this, I highly recommend reading the article at matcutts.com.
That article also links to several sample getmailrc files.
[/unix]
[permanent link]
BSD v. GPL
Jason Dixon gave a talk at this year's NYCBSDCon entitled "BSD v. GPL
(a.k.a. not the sequel to "BSD is Dying")." It's a humorous look at the
differences between the licenses and their supporters. Despite the
humor, he made some good points.
You can find a copy of the presentation at The Dixon Group
website.
[/unix]
[permanent link]
Mailman
The other night I installed mailman on my server. I integrated it into the
apache configuration and restarted that. The mailman web interface became
available as expected.
I used the web interface to subscribe to the one list I had set up and I
received an email asking me to confirm my subscription. I went to the
included link, and all seemed to be good.
Another person joined the list successfully, then sent an email to the list.
This email never arrived in her inbox. She told me about it, and I checked
only to find I did not have a copy either. I sent a mail to the list and
promptly received a message saying that [listname] was not a valid recipient
at the domain.
That's when I realized I had forgotten to tell the mail server (postfix) about
mailman. I had told apache about mailman, and mailman about postfix, but not
postfix about mailman.
I used mailman to create an alias database for its single list, then updated
postfix's configuration to use that as one of its alias maps. All seems to be
working now.
In conclusion, I learned two things. One is always test your configuration
before telling people it's ready. The other is, "I'm an idiot."
[/unix]
[permanent link]
FreeBSD 7 SATA Weirdness
Over the weekend I installed the x86-64 build of FreeBSD 7 on my
workstation, dib. I haven't had time yet to configure everything to my
liking yet, but almost everything works.
The one really annoying issue centers around a SATA DVD burner. When
this device is attached to the primary SATA controller (ICH7), the
system refuses to boot from the hard drive. It reports that no system
disk has been found. I've tried all of the SATA settings options in the
BIOS and none work.
If I connect the SATA burner to the secondary Marvell "RAID" controller
the system boots from the hard drive without issue. In Windows, this
requires another driver (which for some reason installed a copy of
apache along with it). Under FreeBSD 7; however, this second controller
seems to be currently unsupported, leaving me with only the IDE burner
available.
I may spend the $20 and get another IDE burner and just forget about the
SATA issue, but I really would like to know what the problem is. If any
one has any idea why the system would fail to boot from a SATA hard
drive when a SATA optical drive is attached, please email me and give me
some insight into this issue.
Maybe the Unix category wasn't the best for this. I spent more time
discussing the hardware/BIOS weirdness than the installation or
configuration of FreeBSD7. In fact, FreeBSD 7 isn't a very good title
for this either. I'm going to change that.
[/unix]
[permanent link]
chdir(2)
So today at work another developer many years my senior, with many more years
experience than I, came to me with a Unixy problem.
"When I have a program, how can I have it so the current working directory
for all processes it starts isn't the one that it started in?"
"chdir."
"No, I want so that if this process starts something like ls, when ls stats
'dot' I want 'dot' to be the directory that process wants it to be, not the
directory that process was started from."
After about 15 minutes of me suggesting chdir while he said that's not what
he wanted but then describing chdir, I finally wrote something along the lines
of the following
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main (int argc, char *argv[])
{
system("/bin/pwd");
system("/bin/ls");
chdir("/tmp");
system("/bin/pwd");
system("/bin/ls");
chdir("/etc");
system("/bin/pwd");
system("/bin/ls");
chdir("/");
system("/bin/pwd");
system("/bin/ls");
return 0;
}
I compiled that, ran it, showed him the output. He said, "Yeah, that's
what I want to do."
I showed him the code.
"chdir does that?"
[/unix]
[permanent link]
Alpha
Due to the power failure, there was the loss of several hours of work.
Last night I installed FreeBSD 6.2-RELEASE on an old DEC AlphaStation
200 I have. I had started building a new, smaller kernel for it around
23:30 last night. It had not completed by the time of the power outage.
I have restarted that build.
Any one reading this would reasonably ask, "Why are you not as
confused/angry/annoyed with a compile that was not finished in 7 hours
as you were about one that took 3 hours?"
The answer is simple. This AlphaStation is powered by a 100MHz DEC Alpha
EV4 CPU and has 64MB of RAM. To the best of my knowledge, DEC made this
machine around 1994 or 1995. I expected the build to take a long time;
the machine is around a dozen years old.
[/unix]
[permanent link]
How long does it take to build a linux kernel?
It has been a number of years since I built a linux kernel. Slackware
9.1 was the last GNU/Linux distro I used before switching back to BSD.
Tonight I put together a machine from some old parts (1.2GHz celeron
with 256KB cache, 256MB RAM, 20GB hard drive) and installed Slackware
12.
I customized a kernel configuration and attempted to build it. I don't
remember the 2.4 kernel taking as long to build as this 2.6 kernel. It
took nearly two hours. Granted, this machine is fairly old, but 2 hours?
After I complete the tasks for which I needed this setup, I'm going to
install an older Slackware with the 2.4 kernel and build that. I may
also install FreeBSD and NetBSD and build their kernels. I'd like to get
an idea how long it takes to compile other kernels on this rig.
[/unix]
[permanent link]
|