Archive for category Linux

WWDC Parties/Events – WWDC 2009

June 4 Update: Added Loopt Mixer and Developer/Artist Meetup. Thanks LooptChris and Steve Weller!

There are a number of events going on around WWDC this year. Brandon Kwaselow has the most comprehensive list I’ve seen so far, it even includes Three Wolf Tuesday!

WWDC Parties/events – WWDC 2009 – Brandon “Quazie” Kwaselow’s Blog.

Google Calendar with the events:

Virtual Serial Ports Under VMware

VMware has an option to create virtual serial ports. The “Named Pipe” used under Linux is actually a UNIX domain socket, which is not easily accessed by most tools. My goal was to be able to connect to the virtual serial port using minicom the same way I would connect to a physical device with a real serial port.

The solution is to use socat along with Unix98 pseudo-terminals (/dev/pts/*).

I set up the Virtual Machine to “Use named pipe”, “This end is the client”, “The other end is an application”, and “Yield CPU on poll”. I put the pipe in /export/vmware/DUT.serial0.

At host startup I run the following socat command using start-stop-daemon:

# start-stop-daemon --start --pidfile /var/run/socat.DUT.pid \
    --background --make-pidfile \
    --exec /usr/bin/socat -- \
    -ly -d -lpsocat:DUT \
    PTY,b115200,raw,link=/dev/ttyDUTSerial0,group=uucp,mode=660 \
    UNIX-LISTEN:/export/vmware/DUT.serial0,fork,owner=frank,group=frank,mode=755

DUT is a placeholder for the virtual machine’s name.

I can then make a minicom config using /dev/ttyDUTSerial0 for the serial port and work as usual.

The above is actually wrapped up in some Gentoo init scripts.
Read the rest of this entry »

Finding Average File Size with Perl

I was creating a new filesystem on a NetBSD box today, and wondered about the appropriate value for the “average file size” parameter. The first question I had was “what is the average filesize in my data set”, which I figured I could answer, since I had some representative data handy. I put together a quick one-liner to answer this question:

find /export -type f -print | perl -ne 'chomp; $count++; $total += (stat())[7]; END { print "$count files $total bytes total ", $total/$count, " byte average\n"; }

After running this, I was surprised at just how large the “average” size was, which led me to wonder just which average they were looking for here: mean or median? While I was at it, I decided to calculate the mode as well.

Read the rest of this entry »

VMWare network devices and udev

I’ve been struggling for a while trying to get udev to maintain device names for vmxnet devices when running in a virtual machine. Well, I finally figured it out. The 75-persistent-net-generator.rules script in Gentoo was making rules that looked like:

SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:0c:29:0b:02:d2", NAME="eth0"

These seemed to be silently ignored.

After an emerge --sync; emerge -u world last night, the vmware devices started getting IDs following the highest-numbered eth device. These rules would be added to 70-persistent-net.rules, and on the next boot the devices would move up even higher, causing all network device config settings to be ignored.

I noticed that the new rules added to 70-persistent-net.rules were of the form:

SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:0c:29:0b:02:d2", NAME="eth0"

(ATTRS was replaced with ATTR), which just means the match is done on the specific node rather than checking all of the parents.

After a lot of painful attempts to fix this, I finally found the problem. Apparently the DRIVERS key is unset at this point for the vmxnet driver. I removed that test, so that I have:

SUBSYSTEM=="net", ATTR{address}=="00:0c:29:0b:02:d2", NAME="eth0"

which now works.

Phew!