Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems

Linux Splunk high CPU utilization starting July 1, 2012

Posted by Admin • Thursday, July 5. 2012 • Category: Linux
This has to be written down for posterity: My single server installation of splunk started using all of the CPU about then. Nagios caught it, but I had no time to debug it. I tried disabling indexes, apps, and inputs - none of that made any difference. I reduced an index size, which again had no effect. I cleaned it out and installed it fresh (empty database), only to see the now familiar steady CPU usage.

In desperation I went to open a question on splunk support forums where it suggested I read a related thread which in fact had the solution: http://splunk-base.splunk.com/answers/52109/universal-forwarder-high-cpu-after-leap-second-correction Apparently the culprit is the leap year second inserted at midnight on June 30. Why that makes splunk go nuts I'm not quite sure, but i did see a warning about it in my dmesg:
[3073222.768708] Clock: inserting leap second 23:59:60 UTC

Apparently this is the same problem that took down Amazon. The solution involves running a perl command to alter the system date ever so slightly in the absence of ntp.

Linux VirtualBox Extension Pack on Ubuntu Precise Pangolin 12.04

Posted by Admin • Thursday, May 31. 2012 • Category: Linux
Not sure why this so unintuitive, but here goes:
  1. You want to use USB 2.0 with Virtual Box on Ubuntu 12.04 (or recent version
  2. You're told to install the extension pack from this page
  3. The download is not the same version as your version of virtual box itself
  4. It doesn't work

Do not despair:
  1. Shorten the extension pack download URL to http://download.virtualbox.org/virtualbox/
  2. Find a directory matching your version ( dpkg -i virtualbox )
  3. Download the extension pack

Yay!

Linux Autodesk Maya 2012 in Virtualbox

Posted by Admin • Wednesday, February 22. 2012 • Category: Linux

Maya does not appear to have a Linux version, so where I have a single machine, I want to run it in VirtualBox - in either Windows XP or Windows 7. I've successfully installed it in both, 32 and 64 bit, and it installs and starts up just fine. The fun comes later. There are two serious problems:

  1. Alt+Mouse doesn't work. Well, this has to do with my window manager more than anything - Alt+Mouse is usually used in Linux. I'm not willing to change that - but fortunately, Alt-Shift+Mouse does something fairly similar in Maya
  2. 3D repainting is completely messed up. In fact, there are two things that don't work immediately - selection on the 3d pane (pointer appears to be below the screen) and the Spacebar popup menu (also below the screen). Fortunately, this can be fixed with a bit of sacrifice: turn off 3d (I turned off 3d and 2d) acceleration in Virtualbox settings.



  3.  
  4. And it works! (not horribly slow either)

Linux Using dual widescreen monitors on old hardware with Ubuntu

Posted by Admin • Tuesday, February 21. 2012 • Category: Linux
My primary development machine is probably 10 years old - it's a Thinkpad T42 in a docking station (Dock II). This is fine - it's fast enough for most purposes, it runs dual monitors, and it uses very little power so I can leave it on at all times.

Not so fine once I got a 24" monitor to go with the standard 20".

First, the DVI hardware in the docking station can't handle high resolutions - it worked fine at 1280x1024, but not so great at 1920x1080. That's OK, I can drive the widescreen with VGA, I can't tell the difference. But now everything on the screen repaints very, very slowly - I mean really slowly - 1/2 a frame per second. This is bad. OK so the video chip in the laptop wasn't intended to drive a combined 3200 x 1080 resolution - but what can I do about it?

Continue reading "Using dual widescreen monitors on old hardware with Ubuntu"

Linux Figuring out the card number of a cheap SAA7130 capture card

Posted by Admin • Sunday, June 19. 2011 • Category: Linux
So you bought yourself a cheap Philips SAA7130 (or SAA713X or SAA7134) capture card to record motion, you plugged it in and you are getting a black or grey screen. Looking in dmesg you see the famous saa7134[0]: Huh, no eeprom present (err=-5)? And
saa7134: Congratulations! Your TV card vendor saved a few saa7134: cents for a eeprom, thus your pci board has no saa7134: subsystem ID and I can't identify it automatically saa7134: I feel better now. Ok, here are the good news: saa7134: You can use the card= insmod option to specify saa7134: which board do you have. The list:
What do you do? How do you try 175 card numbers and figure out which one works? Write a script!

Continue reading "Figuring out the card number of a cheap SAA7130 capture card"

Linux Backing up cPanel without hitting logout

Posted by Admin • Thursday, April 21. 2011 • Category: Linux
cPanel based hosting presents some challenges for automatic backups - there isn't an automatic way of creating local backups or any standard way of triggering their creation remotely. Numerous scripts exist yet none were quite the solution I was looking for - I am primarily interested in the databases and mail forwarders, though files wouldn't hurt either. Moreover - you can do this in a single line!

My Goal therefore is: Create and retrieve backups nightly. I don't want cPanel to push files to my off-site box, I'd rather initiate everything remotely and not have to open up access to some other system. cPanel does permit one to do this using a browser, hence it can be scripted. Really, scripting isn't even necessary - wget is all that is required! That said, I had a very hard time convincing wget not to visit the logout link on each page - once you log out, you're not getting anywhere anymore. So here is how I did it.

Continue reading "Backing up cPanel without hitting logout"

Linux MySQL replication dies with fatal error 1236: Client requested master to start replication from impossible position

Posted by Admin • Friday, February 4. 2011 • Category: Linux
This time, my master-master setup stopped replicating with no explanation at all - running START SLAVE yielded no warnings or errors. Inspecting the log yielded the aforementioned error (on Ubuntu, mysql logs to /var/log/syslog by default):
[ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236) [ERROR] Got fatal error 1236: 'Client requested master to start replication from impossible position' from master when reading data from binary log [4654]: 110204 10:09:20 [Note] Slave I/O thread exiting, read up to log 'mysqld-bin.000742', position 4274

So at first I thought this was a weird bug or a stunnel issue, but looking at 'mysqld-bin.000742' on the master it turns out that it's only 3980 bytes - position 4274 is indeed impossible. But how did it get this way?

Continue reading "MySQL replication dies with fatal error 1236: Client requested master to start replication from impossible position"

Linux Simple flat file site search in PHP/Smarty

Posted by Admin • Wednesday, January 19. 2011 • Category: Linux
Sometimes using a real search implementation (Lucene, Sphinx) is just too much. The particular site I was working on is something like 30 pages, it's maintained as flat files (Smarty templates, but it's basically HTML on disk), and it really, really should not require megabytes of code and cron jobs to be able to search it!

That said, this is a simple search solution - it makes a lot of assumptions:

Continue reading "Simple flat file site search in PHP/Smarty"

Linux Predictable ALSA numbering of USB sound cards

Posted by Admin • Wednesday, January 12. 2011 • Category: Linux
I have 3 rather cute Monoprice usb sound cards for use by mmpd (client I wrote for multiple mpd instances). The great thing about them is that for $9 you can just keep adding zones to your music systems. The bad news is, UDEV will reorder sound cards on boot as it pleases.

Zones changing would be survivable in itself (reboots are rare), but I also have a webcam and an onboard sound card that I don't use - so sometimes the numbers I've configured mpd to use aren't even valid sound cards! On to the continuing search for a working solution

Continue reading "Predictable ALSA numbering of USB sound cards"

Linux Fixing digitemp with LinkUSB on kernels after 2.6.32-24

Posted by Admin • Tuesday, January 11. 2011 • Category: Linux
As many people have discovered, kernels after 2.6.32-24 changed the USB-RS232 serial driver to not set hardware flow control (RTS/DTS) flags. No doubt there was a good reason. Unfortunately, digitemp and owfs don't enable it either, also probably for a good reason - at least when applied to older devices. What this means is that now when you try to use a LinkUSB (and probably other DS9097U type hardware behind USB to Serial converters), digitemp and owfs no longer work.

Let's apply a time-tested hackish approach.

Continue reading "Fixing digitemp with LinkUSB on kernels after 2.6.32-24"

Linux How to take down your pfSense firewall with one checkbox

Posted by Admin • Saturday, January 1. 2011 • Category: Linux
Simple: create a Traffic Shaper queue but forget to choose a queue parent.

Your firewall will not pass any packets across, and you'll have no idea what hit you.

Linux Verizon Wireless tethering Ubuntu Karmic to a Storm 2

Posted by Admin • Friday, April 2. 2010 • Category: Linux
This topic is fairly well described, so this is just a quick how to for me. (This is for USB, I am not attempting bluetooth this time) UPDATE: I now use berry4all instead of the below. It just works, and there is a GUI


Old Way:

  1. sudo apt-get install libbarry0 barry-util barrybackup-gui
    Chances are you already have the first two in a karmic install, and you may not even need barrybackup-gui. I did not need to add any new apt repositories
  2. if the phone requires a password, edit /etc/ppp/peers/barry-verizon and change the pty line to read
    pty "/usr/sbin/pppob -P My_Password"
    Yes there is a password line in that file, but it doesn't seem to do anything, and I don't know how to use variables in a pppd script :-)
  3. sudo pppd call barry-verizon
    You should see the progress and the IP's relevant to the connection. If you're having trouble, add debug:
    sudo pppd debug call barry-verizon
Note1: In my experience, after I kill the pppd connection I can't reconnect until I momentarily unplug the phone. Also, mass storage mode is not necessary.

Note2: These steps should be similar for most providers. Look at /etc/ppp/peers/barry-* to see the predefined provider scripts.

Note3: I believe that the connection will fail miserably if you have any other network connection active on the PC besides the tethered phone.

Note4: I am posting this using my blackberry!

Linux Postfix satelite mail configuration with special needs

Posted by Admin • Monday, February 15. 2010 • Category: Linux
OK so I have special needs. (Either that or I am just oblivious to a working example of this).

My needs are:
  1. Do not receive inbound mail
  2. Do not deliver mail locally at all
  3. Send all outbound mail through an upstream relay (ISP's smtp)
  4. Qualify local addresses with a valid domain name (ISP's smtp will reject invalid domains)
  5. Map some local addresses to convenient aliases (distribution lists in the real mail system - google apps in this case)


Doesn't seem so hard, right? So I started with the postfix "Satelite System" option in ubuntu installer, and then...

Continue reading "Postfix satelite mail configuration with special needs"

Linux Software RAID in Ubuntu Karmic 9.10

Posted by Admin • Monday, February 15. 2010 • Category: Linux
I am writing this down because it was somewhat hard to figure out how much of the HOWTO's out there are out of date. This is not particularly difficult, but it's my first RAID setup and this blog is my notepad. I am setting up a RAID1 on a Dell Precision 490 with two brand new 500GB SATA drives.

First I tried using BIOS RAID. My system doesn't have a true RAID controller card and after some trial,error and googling I decided to forget it and go with an industrty standard (MD) Linux software RAID. I reset my drives to non-raid in the BIOS, popped in Ubuntu server x64 CD and went on ahead.

Continue reading "Software RAID in Ubuntu Karmic 9.10 "

Linux MySQL replication dies with ERROR 1201 (HY000): Could not initialize master info structure

Posted by Admin • Friday, February 12. 2010 • Category: Linux
On a fine happy morning I am greeted with an alert that slave is not running. Running start slave yields this:
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log
Enabling the log yielded nothing. Googling yielded This Page that helped me a lot, but I didn't have to do quite as much work all over again. Here is what I did.

Continue reading "MySQL replication dies with ERROR 1201 (HY000): Could not initialize master info structure"