2008/12/14

Trust in Alsa

The Trust SC-5500p usb sound box isn't picked up by ALSA directly (audacious seems to work?) - the result is bad distorted/garbled sound. ALSA configuration is more complicated than most need.

Adding an asoundrc with channels 6 seems to get sound out at least (no dmix/mixing yet):

pcm.!default complex_convert

pcm_slave.sl3 {
pcm "hw:0,0"
channels 6
}
pcm.complex_convert {
type plug
slave sl3
}

2008/06/08

Get Smart

smartmontools is a good thing -
  • smartctl -a /dev/sda (dump all the SMART info on the disk)
  • smartctl -t short /dev/sda (run a short self test)
  • smartctl -t long /dev/sda (run a long self test)
  • smartctl -l selftest /dev/sda (list the available self test results)
  • smartctl -s on /dev/sda (to turn on SMART if its not on by default)
Running one long test a week is the suggestion here:
0     8      *   *     0     smartctl -t long /dev/sda >>/var/log/smart.log 2>&1
0 9 * * 0 smartctl -l selftest /dev/sda >>/var/log/smart.log 2>&1
Setting:

SMARTD_OPTS="--interval=3600"

in /etc/conf.d/smartd is the only non default setting I made (for a laptop).

Funnies:
  • One disk didn't have SMART enabled (all the rest did...)
  • One (other) disk didn't list self tests in progress
  • RAID confuses SMART on two servers I tried it on (a test started on one side of a mirror showed up on both

2008/03/20

virtual runabout

To move a vm (on vmare 5.5.5) from

kernel 2.6.18-gentoo-r6 (old tools from the iso image)

to

kernel 2.6.24-gentoo-r3 and open-vm-tools (keyworded in portage)

  1. the kernel LSI scsi driver is borked - resulting in the kernel panicing when it can't find the root device. Fix that by hand applying this patch.
  2. the pcnet32 driver loads, but its interrupt is immediately disabled and no interface is created- so switch to the e1000 driver and be happy.
The vmx incantation to get an e1000 is:

ethernet0.virtualDev = "e1000"

And an updated patch:

--- mptbase.c_orig 2008-03-20 21:15:32.000000000 +0000
+++ mptbase.c 2008-03-20 21:17:46.000000000 +0000
@@ -2844,6 +2844,18 @@
pfacts->IOCStatus = le16_to_cpu(pfacts->IOCStatus);
pfacts->IOCLogInfo = le32_to_cpu(pfacts->IOCLogInfo);
pfacts->MaxDevices = le16_to_cpu(pfacts->MaxDevices);
+
+ /*
+ * VMware emulation is broken, its PortFact's MaxDevices reports value
+ * programmed by IOC Init, so if you program IOC Init to 256 (which is 0,
+ * as that field is only 8 bit), it reports back 0 in port facts, instead
+ * of 256... And unfortunately using 256 triggers another bug in the
+ * code (parallel SCSI can have only 16 devices).
+ */
+ if (pfacts->MaxDevices == 0) {
+ pfacts->MaxDevices = 16;
+ }
+
pfacts->PortSCSIID = le16_to_cpu(pfacts->PortSCSIID);
pfacts->ProtocolFlags = le16_to_cpu(pfacts->ProtocolFlags);
pfacts->MaxPostedCmdBuffers = le16_to_cpu(pfacts->MaxPostedCmdBuffers);


Switching to the buslogic driver (especially for new systems) would seem to be a better medium term solution.

The e1000 needs to be blacklisted to allow vmxnet grab the virtual ethernet dev - but a job for another day.

2008/01/31

Following the golden thread

1. create TAGS

$ cd ~/src/TAGS && find . -name "*.[cph]" -print | etags --language=c++ --members -

2. tell xemacs where it is (e.g. .xemacs/init.el): (setq tags-file-name "~/src/TAGS")

3. Hit <meta>. to start finding things

4. read this for more options

2008/01/25

Network Slight of Hand

The mysql proxy cookbook has this recipe:

iptables -t nat -I PREROUTING \
-s ! 127.0.0.1 -p tcp \
--dport 3306 -j \
REDIRECT --to-ports 4040


It redirects remote clients attempting to connect to the default mysqld listen port to the mysql proxy daemon instead.

I had a legacy application with no support for port selection:

iptables -t nat -I PREROUTING \
-p tcp --destination dummyhostname --dport 3306 \
-j REDIRECT --to-ports 4040


This directs any connection to the dummy host port 3306 to instead go to the proxy - neat.

From this HP-UX security summary we see that HP-UX has ipfilter (new enough versions seem to have nat - older ones don't) and puts filter rules in /etc/opt/ipf/ipf.conf :

rdr lan0 20.20.20.5/32 port 80 -> 192.168.0.5 port 8000


redirects traffic from port 80 to port 8000, or how about some load balancing:

rdr lan0 20.20.20.5/32 port 80 -> 192.168.0.5,192.168.0.6 port 8000

A useful trick where the legacy application doesn't know about off host destinations and you would like to punt some of the load to another box.

ipf won't act as a reflector, which appears to mean that something like this doesn't work, even when I think that it should:

/etc/opt/ipf/ipnat.conf:
rdr lo0 127.0.0.1/32 port 7777 -> 192.168.0.42 port 23

# ipnat -CF -f /etc/opt/ipf/ipnat.conf
# ipnat -l
# ipnat -sv


Curious, as the interfaces are different.

Its also not clear if you have to enable ip forwarding on HP-UX with:

# ndd -set /dev/ip ip_forwarding 1
# ndd -get /dev/ip ip_forwarding

2008/01/03

gentoo recovery

gentoo based rescue disk options - the lwn distributions page is a good starting point:
  1. sabayonlinux - appears to be kept up to date & comes in a mini-edition
  2. the official 2007.0 gentoo live CD is getting on a bit now (SATA) [update 2008.0 beta]
  3. the liveusb path is paved with bitrot.
  4. flashlinux from 2005.
  5. gnap - catalyst based...
  6. sysresccd - catalyst based... USB install instructions look good (and is what I used in the end)
  7. linux-live is a possible for pre-686 hardware
other random reading:
  1. lwn has a good/scary article on gentoo for developers
  2. paludis vs portage article
  3. random blog posts sometimes pertaining to gentoo; drobbins blog