Friday, April 29, 2011

Saeco Via Venezia and espresso pods

We have one of these machines at work, and it some experimenting on how to use it with pods.  The instructions left much to be desired.  So, put the rubber adapter in first, then the single shot basket, then the pod.  Here's a picture:

Wednesday, April 27, 2011

Connecting a VirtualBox guest network to its host

I love VirtualBox (http://www.virtualbox.org/) and use it all the time.  I have a Ubuntu guest running on an OSX host.  I wanted to move files between the two, but my OSX home directory is encrypted (as they all should be).  In general, the network connection made from the guest to outside the box isn't directly available, so I added a second network adapter via the VirtualBox control panel, and made it a "Host-only Adapter" (see screen shot below).  An 'ifconfig' on the guest gave the address of 192.168.56.101, so a simple 'sftp beaty@192.168.56.101' from the host OS connected me to the SSHD server.
One does have to first create the network via Virtualbox's preferences:
 

Thursday, April 14, 2011

udev and USB serial devices

We have a number of secure serial device servers (from http://www.vscom.de/) where I work.  One the Linux server where they are connected, they show up at different /dev/ttyUSB locations after each boot.  No particular surprise as I've seen the same things with disks.  What I wanted to do was create symlinks that remained constant.  So, one starts by profiling the devices via
udevinfo -a -p /class/tty/ttyUSBXX
A lot of info spews out.  For these particular devices, there are two ttyUSBXX entries, one number apart.  They differ in only one regard
29c29
<     SYSFS{bInterfaceNumber}=="00"
---
>     SYSFS{bInterfaceNumber}=="01"
So, one has to create udev rules to differentiate the two.  I created a file '/etc/udev/rules.d/97-pdu.rules' the looks like
kernel=="ttyUSB*", SYSFS{bInterfaceNumber}=="00", SYSFS{../serial}=="FT123456", 
SYSFS{../product}=="USB FAST SERIAL ADAPTER", SYSFS{../manufacturer}=="FTDI", SY
MLINK+="PDU44"

kernel=="ttyUSB*", SYSFS{bInterfaceNumber}=="01", SYSFS{../serial}=="FT123456", 
SYSFS{../product}=="USB FAST SERIAL ADAPTER", SYSFS{../manufacturer}=="FTDI", SY
MLINK+="PDU45"
Did a 'udevtest /class/tty/ttyUSBXX' to make sure the correct symlinks would be created, and then did a '/sbin/udevtrigger' to make it happen the first time.  All was good after that.

Direct network connection to APC PDU's

Some of this information is scattered around the web, but I thought I'd put in all in one place.

In order to schedule an event on the PDU's, one has to use the web interface -- this functionality is not replicated in the serial interface.  First, I set the PDU's to request addresses on via DHCP via the serial interface, though I didn't test if that was necessary.

To connect (in my case, a MacBook) directly to the ethernet port on a PDU, one has to run a DHCP server on the laptop.  You'll need to set the ethernet port to a static IP address, in this case something along the lines of 'ifconfig en0 192.168.1.1/24'.

First, download the DHCP server source from ISC: http://www.isc.org/software/dhcp  Do the usual './configure'.  There is a compile error at this time requiring editing 'dhcpctl/Makefile' to remove the -Werror from the CFLAGS macro.  Then one can 'make'.  Do not 'make install' as it will overwrite your DHCP client config.  Instead, cd to each of server, dhcpctl, and opamip, and do 'sudo make install' in each.  The APC PDU's require a very specific portion of the reply; use the following /etc/dhcpd.conf
option vendor-encapsulated-options 01:04:31:41:50:43;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.150 192.168.1.200;
    default-lease-time 300000;
    max-lease-time 350000;
}

Run 'sudo /usr/local/sbin/dhcpd -d en0' and watch for the DHCP requests and responses.  You will see a lease given out; point your browser to that IP address.

Monday, April 4, 2011

Linux external USB hard drive

It appears a well-known problem that when an external USB hard drive sleeps to save power, Linux becomes very confused.  I tried modifying the drive's settings to no avail.  My cheesy answer is to not let the drive sleep using a cron job.  Do "sudo crontab -e" and put a line like:
0,10,20,30,40,50 * * * * echo "junk" > /mnt/steve/keepawake
in the crontab, with the correct path to the file on your machine of course.  You don't have to be root of course, if you have permissions to write to a partition on the drive.