You are currently browsing the category archive for the ‘Linux’ category.

Today UPC broke my internet connection.. entirely. For 4 hrs. Four long, painful hours… up to this point I was having a nightmare trying to debug why a KVM based asterisk cluster was not talking to each another. Following the fairly straight-forward and very short walk through at https://wiki.asterisk.org/wiki/display/AST/Distributed+Device+State+with+AIS which is essentially the same (or 99% close!) on every Google-able page on the internet, I was getting nowhere. After compiling OpenAIS & Corosync and then recompiling Asterisk, the cluster worked.. until starting the cluster resource in Asterisk’s console which gave

ERROR[19134]: ais/clm.c:140 ast_ais_clm_load_module: Could not initialize cluster membership service: Unknown

And in the Corosync log:

Jul 11 13:16:17 corosync [IPC   ] Invalid IPC credentials.

It wasn’t till IRC & Google were wrestled from my hands that I really started to dig in the src directory and the accompanying documents. Tut tut I know. It was simple. There is a new (well how new I don’t know, but certainly I’ve found it nowhere else! Including Asterisk: The Definitive Guide) auth mechanism where you specify what users can send/receive messages via Corosync. Create a new file in

/etc/corosync/uidgid.d/

I called mine asterisk, and in it I added the user and group (both asterisk in my case) you want to allow. You can add as many as you want. So in mine I had:

uidgid {
        uid: asterisk
        gid: asterisk
}

And that was it. Quick restart of everything and it was fixed. Thank you UPC/unknown_individual_with_a_JCB you saved my sanity!

Advertisements

I finally got around to updating the code with all the changes that have been running on the main project this was initially written for. So just a quick update to say added in some actually monitoring code rather than just examples. Can now monitor and restart (using event handler functionality in Nagios):

* AFP
* DHCP
* Directory Services
* DNS
* FTP
* Jabber
* Mail
* MySQL
* NAT
* Netboot
* NFS
* Print
* Quicktime Streaming Server
* SMB/CIFS
* Software Update
* Web

Services on an Apple Server… it has to be the actual Server edition though. Send comments, suggestions, general grief and mayhem.. HERE 🙂

libsrvrmgrd-osx

Special prize for me the other morning. Now and again (think every couple of months) Phonon (the KDE device manager) would, upon login, pop up a small box telling me that Analogue Output Something Something Whatchamathing is no longer need, do you want me to just remove it? As you can tell the specifics escape me now, I blame a rather sleep deprived night leaving me in an unfit state to operate anything more complex than a spoon. Normally I say no, look at it suspiciously and swear to “do something about that later”. I had a 50/50 chance of purely by chance choosing the correct option… I didn’t.

ALSA was clearly working, I could hear audio on the command line with mplayer, but KDE specific apps were just not having it. So after a very long search, several chicken sacrifices and blind luck I stumbled upon a fix allowing you to reset your Phonon config. Apparently the device is still there, you’ve just removed it from your normal users login.

So…. As YOUR user (ie. not root) run the following commands:

rm $(kde4-config --localprefix)/cache-$(hostname)/libphonon/hardwaredatabase
kbuildsycoca4 --noincremental
rm -r ~/.config/kde.org
rm ~/.kde/share/config/phonondevicesrc
rm -r ~/.xine

Logout of KDE and back in and you should have working audio again. Alas I can’t remember where I got the fix so I hear-by claim this to not be my own work but perhaps useful to other dexterity challenged individuals.

If you are looking for hosting and you live in France make sure you have a .fr email address if you go with OVH. Apparently they’ve had a lot of non French residents signing up for space on the French part of their site, when they are supposed to be in France. Sorry what now? Not for the first time in France someone has thought maybe I should get a .fr. Perhaps we’ve been unlucky and got some particularly idiotic people. It’s not like when signing up for a yahoo.fr email address, for instance, I need to report to the local police station and present my passport, 5 letters showing my French address. It’s not a postal address for goodness sake.

OVH needed a French postal address (fine), a French mobile number to send a verification SMS (fine, and verified last night), and a French bank card. All good. But because we used a .co.uk email address they stopped the order. See you later OVH, clearly business is not something you need. There’s more than one RPS/VPS hosting service out there and the requirement the helpdesk person said where I send a photocopy/fax of passport and bank card with details blacked-out for security and a possible wait of 3 weeks(!!!!) forget about it.

Next year at Edinburgh’s Fringe Festival “OVH Provides Decent Service” 😉

It appears I missed my 10 year anniversary of using a non Microsoft OS (not counting a TI99/4A and a BBC Masters Compact). Apparently the March 1999 edition of PCPlus magazine (a hard magazine to find in Ireland back then) had a LiveCD for BeOS. I was doing CS in Uni at the time but it was up till then concentrated on Windows. I wasn’t entirely sure if it was going to break my install, the idea of something running off of CD was strange and I had only just started using the Internet so alternate OSes were not something I’d really been in contact with (actually at this point even in Uni you had to join Netsoc to get Internet as it was not provided and I was using it for about 6 months for the princely sum of £5 Irish pounds, £3 for just email… which hilariously I had gotten the year before and not known anyone with an email account). The whole FOSS thing kinda happened some time after this… I think. Or I had perhaps tried a Mandrake disk on a spare HDD, but I’m really not sure.

So last week not being particularly busy I decided I’d give Haiku a shot. It’s in very early Alpha stage right now and only provides VMWare images. I don’t use VMWare, so I figured must be a way to get it running on VirtualBox. There is and it’s nice and easy. Download the latest raw disk image and unzip. Then use VBoxManage application that comes with VirtualBox (I’m still on v2)

VBoxManage convertdd haiku-alpha-gcc4.image ~/.VirtualBox/VDI/haiku-alpha-gcc4.vdi

And you are good to go, you can now select it as a disk image in the manager. The Computer Action Show guys bizarrley enough covered it in their last episode so best to listen/watch them if you want an in depth review! I got bored rapidly when there wasn’t really anything I could think to do with it! 🙂

About 12-13 years ago I made the rather annoying decision to encode my music in OGG Vorbis format. I say annoying as it has ended up being an awkward choice. I made the choice before I was even using Linux, I’m not sure what prompted it, but it might have been a PC Plus article, better Audio for smaller size.

All my music sat on my PC. Which was fine until about 2003 (possibly.. it’s all rather vague) when flash players first came on the scene. I’d always been reluctant to buy anything with moving parts (Creative Zen was about £400 back then) which was going to exist in my jacket pocket. I had a CD walkman.. it drove me nuts skipping like a drunk boxer.

So I started looking for a OGG player. And that’s where the realisation I may have taken “the road less travelled” dawned on me. Eventually I found one though. An iRiver iFP500, 256MB, Built in FM Radio. It cost me around £100 or there abouts. It was great, with a crazy 40Hrs battery life on two AAA’s and 256MBcapacity. But I outgrew it (2005), especially when LugRadio came along with it’s whopping 20-40MB files ! So I searched again. And after another long and annoying search found a 2GB Samsung YP-U1. It was perfect, again somehow costing me about the same.

All went well till I was out walking the dog a few months back. He saw a dog he took an instant dislike too. I had the player in my hand while changing track. It got caught up in the leash, I was too busy trying to play referee that I didn’t notice the impending doom. Player ripped from hand, falls to ground, my foot went through the player. Fail. (I feel like adding “it only had one day to retirement” Lethal Weapon style, but in reality I’d have kept using it till the flash couldn’t handle any more writes!).

So step forth the Cowan iAudio 7, thanks to Mr. Sweet’s recommendation in an episode of LugRadio I went about short cutting my previous anguish and finding a replacement. Again I somehow managed to find it around the 100 mark, €99 this time. Fantastic.

  • Small
  • 8GB storage
  • USB Mass Storage mode (Also can switch to MTP via in-built menu)
  • Works on Linux perfectly (ie. can firmware upgrade it without needing software)
  • Plays Flac, Vorbis and Wav aswell as all the usual freedom hating formats (MP3, WMA, ASF, JPG, MPG Video)
  • It’s got a diagonal touchpad for fast scrolling and while a *bit* sensitive, it’s really not bad and makes fast forwarding through long audio less of a chore
  • Has ridiculously long battery life (50-60Hrs)
  • And some other things like Lyrics, Colour Screen, Fancy EQ settings..

It also rather importantly sounds great. Well done Cowan! So if you don’t “hate the freedom” I strongly suggest one 🙂

This Guide Is Depreciated!!!
Please visit my company website where there is an in-depth install.

OrangeHRM is a Human Resource tool for all sorts of HR things, which I’m sure is great… I have no idea how good it is, but an install was required, I had to install it, and the docs to install it are aweful. They mainly assume you are using AMP, on Windows and are very unclear as to what’s actually required. On Ubuntu you need:
sudo aptitude install apache2 mysql-server-5.0 php5 php5-mysql

If it’s a fresh install make sure you use a root password for mysql, go grab the tar.gz file from their website and extract it somehwhere temporarily. It’ll extract a file and a directory

  • orangehrm-2.4.2
  • orangehrm-quick-start-guide.html

Move it to /var/www removing the digits at the end.

Then all you need to do is go to http://you_server/orangehrm and follow the on screen Wizard. If you are getting blank screens like I was (Thanks for that PHP) it means you likely forgot php-mysql like I did. Oops. It should have been obvious, but Apache logs gave no errors and PHP gave me blank pages… 😦

PS: It looks very flash. Perhaps worth demoing to Finance/HR people if your company has a 90s application that still live on ! Its even got commercial support and a bug tracker built in which can submit bugs back to OrangeHRM.

If you followed my wmic post a while back you’ll have seen that wmic outputs a LARGE amount of data seperated by the | character, sort of like a CSV. This quickly becomes unusable as the first line is the column titles of the data and each following line is a result. So I wrote a small, very much ugly and not exactly rock solid, bit of python to dump wmic output into a Dictionary of Lists. What I mean is every column will be a key in the Dictionary and each value is a list of 1 or more values. So for instance a WMI query of HDDs will likely return 2+ (Your C Drive and a CD Drive), but say one for memory will only return one. Anyway this is pretty basic and doesn’t do much more than print the actual dictionary but it might help someone write a Cacti plugin or a Nagios plugin that can pull free disk space for example.

Here it is: pythonwmic (Yes Sorry it’s called .doc but wordpress doesn’t seem to like .py)

To use it just call the script (first modifying the win32User/Password variables) with one argument which is the IP address of the server you want to query. Bear in mind it’s fairly rough but hopefully enough to get you going. It doesn’t work for all WML queries but the Win32_PerfFormattedData_ ones seem to work nicely (Win32_OperatingSystem I’m looking at you inparticular with your extra | characters in the Name column !).

As an example of output I ran against one of my machines querying the Logical Disks:

{‘DiskBytesPersec’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Frequency_Sys100NS’: [‘0’, ‘0’, ‘0’, ‘0’], ‘PercentDiskReadTime’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Timestamp_Object’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDiskBytesPerTransfer’: [‘0’, ‘0’, ‘0’, ‘0’], ‘PercentIdleTime’: [‘100’, ‘100’, ‘100’, ‘100’], ‘AvgDiskBytesPerWrite’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Description’: [‘(null)’, ‘(null)’, ‘(null)’, ‘(null)’], ‘DiskWriteBytesPersec’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Timestamp_Sys100NS’: [‘0’, ‘0’, ‘0’, ‘0’], ‘DiskWritesPersec’: [‘0’, ‘0’, ‘0’, ‘0’], ‘PercentDiskTime’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDiskQueueLength’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDiskBytesPerRead’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDisksecPerRead’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Timestamp_PerfTime’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Name’: [‘C:’, ‘E:’, ‘F:’, ‘_Total’], ‘CurrentDiskQueueLength’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDisksecPerWrite’: [‘0’, ‘0’, ‘0’, ‘0’], ‘DiskReadBytesPersec’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Caption’: [‘(null)’, ‘(null)’, ‘(null)’, ‘(null)’], ‘PercentDiskWriteTime’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Frequency_Object’: [‘0’, ‘0’, ‘0’, ‘0’], ‘Frequency_PerfTime’: [‘0’, ‘0’, ‘0’, ‘0’], ‘SplitIOPerSec’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDiskReadQueueLength’: [‘0’, ‘0’, ‘0’, ‘0’], ‘FreeMegabytes’: [‘54155’, ‘127668’, ‘69809’, ‘251632’], ‘DiskReadsPersec’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDiskWriteQueueLength’: [‘0’, ‘0’, ‘0’, ‘0’], ‘AvgDisksecPerTransfer’: [‘0’, ‘0’, ‘0’, ‘0’], ‘PercentFreeSpace’: [’77’, ’91’, ’99’, ’90’], ‘DiskTransfersPersec’: [‘0’, ‘0’, ‘0’, ‘0’]}

Have fun, and please post comments, corrections or improvements ! I’m sure there’s better/more_pythonistic ways to build the Dictionary and I will at some stage build a better way to output key bits of data rather than just dump the dictionary as is possibly with a Cacti/Nagios plugin to utilise it.

Before I found out about adtool I was managing users using Windows own command line AD tools via the very cool winexe (Thanks to TMM for pointing me to it in the first place). Winexe is a very nice way to either avoid using pstools from another Windows machine or having to install cygwin SSH server, which to be honest is a bit of a pain unless you package it into your system imaging solution and have it on every machine by default. Winexe allows you full access to a terminal on a Windows or allows you to run commands remotely. It’s fairly easy to install (although it’s be nice if someone with better packaging skills than me got it into Ubuntu), the usual configure make dance. I had a bit of trouble with the tarball so I downloaded the latest SVN snapshot which worked perfectly.

Next on my todo list is a small project that I had already built in my last job where we were *stuck* on NT4. And as Samba 4 isn’t out yet it’s relevant to Samba 3 networks to, whereby certain machines can have different registry files applied against them to do things like switch of USB mass storage and all sorts of things you can do with GPOs if you have AD (and make sure OCS Inventory is on there too !). I already built fairly stable system whereby all these things were applied via domain logon scripts, but the horribleness that is scripting on Windows has spurred me on to write something properly in Python that can be run from a Samba PDC/Linux box on an NT4 network to apply all this stuff….

A simple example is:

winexe -U HOME/Administrator%Pass123 //192.168.0.10 “ipconfig /all”

There’s more on the site but you can just as simply log into the server entirly with:

winexe -U HOME/Administrator%Pass123 //192.168.0.10 “cmd”

With Samba 4 coming out *soon* it’s almost redundant but what are weekends for ! So hopefully I’ll get this written in a few hours and it’ll spur me on to get into Django and put an interface on it. It’s certinly getting very easy to manage Windows from Linux, fair play to the Samba team and the EU for badgering MS till they got the documents they needed. What OS you use is becoming less and less relevant.

Last week I found a truly excellent tool for adding, modifying and managing user in Active Directory from Linux. It’s in Ubuntu

sudo aptitude install adtool

For a better guide in setting it up Vide has a great one over at his site.

One thing that got me though, you have to make sure your /etc/ldap/ldap.conf file is set up correctly, which should have been obvious but it stumped me for a while (necessary to allow setting passwords etc.)

Make sure you have the following in your config:

BASE    dc=ad-servername,dc=example,dc=com
URI     ldaps://ad-servername.example.com
TLS_REQCERT allow

This allows you to correctly receive the SSL certificate from the server, otherwise you’ll get an error like this:

bind: : Can’t contact LDAP server (-1)

And hey presto you can avoid using MMC to manage users. 🙂 And if you combine it with wmic ….. happy days !