Fedora 10 & ffmpegthumbnailer

I’ve recently upgraded from F7 to F10 and was surprised to see that ffmpegthumbnailer hasn’t made it into the yum repo’s yet!

As I use ffmpegthumbnailer for PS3 Video thumbnails I needed to find a solution to this.

If I had the time I’d knock up a .spec file & rpm, but for the time being I thought I’d post my bodge…. NUMBER ONE, if you’ve never typed “configure;make;make install” before you need to install the development tools.

sudo yum groupinstall “development tools”

Next pick up a couple of extra dependencies…

sudo yum install libpng libpng-devel ffmpeg ffmpeg-devel

You should now find that, if you download the source, unpack it – gunzip ffmpegthumbnailer-1.5.0.tar.gz;tar -xvf ffmpegthumbnailer-1.5.0.tar and cd ffmpegthumbnailer-1.5.0 hopefully you can complete ./configure without any errors.

If you try make at this point it’ll probably fail with errors, this is how I fixed that….


cd /usr/include/ffmpeg/
ln -s libavcodec/avcodec.h ./
ln -s libavformat/avformat.h ./
ln -s libswscale/swscale.h ./
ln -s libavformat/avio.h ./

Now you can… get back to the build


cd ~/ffmpegthumbnailer-1.5.0
make
sudo make install

If all has gone well you should have a working install :)

Evolution in Gnome 2.26

I’ve just noticed this in the Gnome 2.26 Release Notes

2.3. Evolution Evolves its Migration from Windows

GNOME’s e-mail and groupware suite, Evolution, has gained two important features for helping users who are migrating to GNOME from Microsoft Windows environments.

First is the ability to import Microsoft Outlook Personal Folders (PST files) directly in Evolution. E-mail, contacts, appointments, tasks and journal entries are supported. Previously, the files had to be imported via a third-party utility, such as Thunderbird on Windows.

Second is support for Microsoft Exchange’s MAPI protocol. This is the protocol that Microsoft Outlook uses to communicate with Exchange. Previously, Evolution only supported Exchange’s SOAP protocol, which is not available on all Exchange servers. This support significantly improves Evolution’s integration with Exchange servers.

All I can say is WOW!

Linux users will have known that MAPI support into gnome has been on the cards for a while, but .pst access is just brilliant!!

Monit Alerts via Twitter

In a bid to reduce the size of my inbox, I’ve decided to move monit alerts to twitter.
Sadly monit doesn’t support any kind of alert scripting, but the solution is simple.

  1. Create a new twitter account, something like “mymonitbot” and make the feed private.
  2. Set your “normal” twitter account to follow “mymonitbot”
  3. Now signup for an account with twittermail and give them mymonitbot’s credentials.
  4. Edit /etc/monit.conf, and change set alert to your new twittermail e-mail address
    If necessary edit monit’s message layout
  5. restart monit

After a few seconds you’ll get a tweet from your monit bot saying that monit was re-started :)

Tomboy on Windows

Recently the Tomboy Notes has been released for windows. This is great news, as my current work build is windows and I have a shed load of notes stuck on my linux box at home.

Installing.
I found this didn’t work 1st time, so these are the steps.

You should now be able to run tomboy… it appears in your system tray.

Importing Notes.
If like me you have a linux box with a load of notes you want to read, then follow these steps.

On your linux box:

  • cd into $HOME/.tomboy
  • copy all .note files

Transfer the .note files to your windows box.

On your Windows box:

  • Exit tomboy
  • cd into C:\Users\<USERNAME>\AppData\Roaming\tomboy
  • paste all your .note files

Start Tomboy & Enjoy!

References:

Load balance anything with HAProxy

Recently I wanted to load balance a TCP service i.e. not http, in the past I’ve used ultramonkey but there doesn’t seem to be any maintained Redhat/Centos packages.

After some googling I found that haproxy can balance non-http services but examples of non-http configurations are few and far between, this blog post lead me to my solution, so after the jump I have a haproxy.cfg which will load balance smtp round-robin style across 4 servers, you also get a webstats interface listening on http://IP:8080/haproxy?stats (username = me, password = password).

By changing the port numbers from 25 (SMTP) you can effectively load balance any TCP app :)

Continue reading

CS-Mars V6.0 in VMWARE (Franken Mars)

Emulating software is a very grey area for Cisco, they make their money by selling boxes so I guess officially Cisco don’t approve of things like GNS3 and PEMU. BUT cisco make a lot of their money from techies training in Cisco products who then get their management to buy boxes their certified in, as a result cisco appear to turn a blind eye to emulating their products for personal training purposes :)

So, I’m installing a CS-Mars box in the next couple of weeks and wanted to know what’s new in version 6. How to setup version 4 is already document here in this franken cs-mars guide, the thing is to upgrade from 4 to 6 is a re-image of the box. Upon re-imaging my VMWare appliance I realised that the lilo commands linux rw init=/bin/bash didn’t appear to work anymore. As a result I have a v6 mars box I can’t use due to a licensing problem.

To get this working read through both the old instructions, and what I have written.

The init/boot sequence of a mars box looks very much like a centos/fedora boot, so I thought up a cunning new plan. I downloaded the 1st installation CD of centos 5, after booting this CD instead of hitting “enter” and running the anaconda installer I typed linux rescue, this boots my appliance into a root linux shell. (See Update Below, boot from CentOS straight after MARS installs, don’t let MARS boot!)

What happened next was a little hit and miss, if you’re lucky you can type

mkdir /mnt/opt
mount /dev/md2 /mnt/opt

you can then

cd /mnt/opt/janus/release/bin
mv pnlicense pnlicense.org
echo "/bin/echo d84f7ceaf50f9c45683e2efb77752d4f:License verified:4:0:0:4" > pnlicense
chmod +x pnlicense

as per the old documentation.

If you’re unlucky this “mount” will fail, in this case ls /mnt/sysimage if you can’t see any files issue mount /dev/md1 /mnt/sysimage otherwise the plan is to change the root password so that we can edit the pnlicense file later.

Using vi edit /mnt/sysimage/etc/passwd, and change…

pnadmin:x:500:500::/opt/janus/release/bin:/opt/janus/release/bin/pnsh

for

pnadmin:x:500:500::/opt/janus/release/bin:/bin/bash

Next, setup your editor variable, and edit the suders file…

EDITOR=/mnt/sysimage/bin/vi;export EDITOR
visudo -f /mnt/sysimage/etc/suders

and add..

pnadmin ALL=(ALL)       NOPASSWD: ALL

Reboot by exiting the shell.

After the reboot login as pnadmin, you should now get a standard linux bash shell rather than the “hardened” cisco one. Change the root password…

sudo su
passwd root

And put /etc/password back to how it was. Now from the “pn shell” you can type expert and your root password will work and you’ll have root access to your mars box. With you new root access you can change the pnlicense file as described before and complete the setup process. :cool:

UPDATE: As commented by secopt below, to make this work you need to boot from the CentOS disk straight after the MARS image as installed, if you let the MARS OS boot (and start doing the oracle thing) then for some reason the mount commands don’t work!

UPDATE2: The mount command doesn’t work if you let MARS boot the 1st time as it changes the superblock, rokov has posted the following work around below…

  1. Assemble RAID
    mdadm –assemble /dev/md0 /dev/hda3 /dev/hdc3
  2. Change ext3 superblock magick number
    dd if=/dev/md0 skip=2 count=1 | sed ’s/\x5A\x7B/\x53\xEF/’ | dd of=/dev/md0 seek=2 count=1
  3. Mount partition
    mount /dev/md0 /mnt
  4. Do anything you want with it.
  5. Unmount partition and change magic back
    umount /mnt && d if=/dev/md0 skip=2 count=1 | sed ’s/\x53\xEF/\x5A\x7B/’ | dd of=/dev/md0 seek=2 count=1

Another Dropbox Link

After reading this from Ma.tt, I’ve downloaded dropbox, I’ve had it installed for less than an hour, but I figure they’re worth a post purely for the kudos of releasing a true multi-platform application.

Finding something that can sync between my home linux box and work windohs machine is a real pain so I’m really hoping this will be the answer I’ve been looking for; it’s not that win-linux sync’ing is impossible, it’s just that it’s usually restrictive or so complicated/ un-user-friendly that I never bother.

The only thing the service needs is some WordPress to “public box” integration and the solution is dam’ed near perfect ;)

While I to keep my fingers crossed that dropbox is everything I want it to be, why don’t you try it out?

Bash script to fix file permissions recursively

I love the redhat implementation of cron, simply drop a shell script into /etc/cron.daily/ and your script will be executed every day (by default at 4am).

Recently I’ve been having a small problem with mediatomb, further investigation lead me to a “Inotify thread caught exception” error which can be fixed by recursively resetting your file permissions.

What I have done to fix the issue is save the following code as /etc/cron.daily/fix_mt.sh and ‘jobs a gooden’ :cool:

#!/bin/bash
# Load up your mediatomb directories...
MediaTombDirectories[0]="/home/me/Videos"
MediaTombDirectories[1]="/home/me/Music"
# add more if needbe
# MediaTombDirectories[2]="/home/me/files"

# Setup find correctly.
export IFS=$'\n'

# Loop through our array.
for x in ${MediaTombDirectories[@]}
	do
		# Find all directories & subdirectories
		for i in $(find $x -type d)
			do
				# Fix Permissions
				chmod -c 775 $i
				chown -c me:user $i
			done

		# Find all Files
		for i in $(find $x -type f)
			do
				# Fix Permissions
				chmod -c 664 $i
				chown -c me:user $i
			done
	done


Quick tip:
You (or root) will get e-mailed every time this executes, you can make the script more verbos by changing all “-c” to “-v“, or make it silent by removing the “-c” altogether.

Enjoy!

Is Mac the Anti-Linux or the Answer?

So, I’ve been toying with the idea of buying a mac. Using WindowsXP is a no go for me, we’re just not friends; work haven’t yet rolled out Vista. I love linux, have been using it for years, and have upset many an I.T department by partitioning their loving-crafted standard Windows Build with my favourite flavour of linux but I’m getting the same old Gripes….

Hardware-Compatibility: Now don’t get me wrong, fedora has installed and pretty-much worked out of the box for years, but it’s the little niggles that get you, my hp nc6320 (company issued) has an intel wireless card, and quite frankly the fedora support is unreliable; if it’s not issues where by I can’t connect to hidden ssids, I can’t run leap, and even my broadcasted home wpa network can be a bit flakey (my n800 & ps3 use it fine so it’s definitely a laptop issue)…. top this off with the odd issue with graphics cards, very little support for mobile broadband, fingerpint authentication and it’s enough to drive anyone mad!

Work-Compatibility: Like most UK companies EVERYTHING has a windows focus, even down to the linux web-managed-appliances which have to be ie7 compatible. Open-office is great, but I can’t run the macro’s written by our marketing department (which format things) and even if I do manually make it look right the conversion to MS-Word is a bit “iffy”. Evolutions exchange-connector works most of the time, but archiving my mailbox from outlook screws it, changing my password (due to expiry) cause mail-notification to freak-out, and the built-in html formatting engine doesn’t set a font so if I reply to an HTML e-mail, all my text is in the nasty times roman.. and just another couple of points since I’m in full rant, share-point support in firefox! and what is everyone’s obsession is MSN and office communicator, what’s wrong with skype or google talk both of which have platform independent solutions. (Yes pidgin supports MSN, but it’s not feature complete)

So is a mac the answer? Those I’ve known an met whom own macs (and in the UK, unless you’re in media they’re few and far between) have all said “everything just works”… oh how I’ve longed for that… and the UI is nice, so all the compiz prettyness that I’ve gotten used to is kinda there. I’ve done some research, there’s an offical office for mac, which support exchange, there’s a communicator for LCS which includes msn support, there’s certianly more off the shelf software that supports mac than linux!

But is it out of the frying pan into the fire? Let’s look at why XP doesn’t work for me, 1stly the interface, it makes me feel unconfortable, I’ve tried themeing it, but that just covers up the bad colour scheme, themes ocasionally slow your machine down, some apps don’t accept the theme engine, and after-all you’re just painting a bad egg so even if it is easier on the eye the problems sill exist! All this aside, Vista is supposed to address the usability and eye-candy issues, so maybe I should be using that? So user-interfaces could be considered a shallow reason to choose your OS, and to be honest although how I interact with the PC is important (since it’s what I do for a living) it’s not what attracted me to linux in the 1st place. FREE, yes FREE is what attracts most of us to linux, windows licencing and cost is a nightmare, winzip & winrar are examples of stuff you expect to have as part of the OS, yes XP can open .zips but what about .tgz? … OK lets look at terminal emulation or ssh, finding a good one can be a problem putty is great but it’s a bit dis-jointed, the sftp function isn’t built into explorer tab’s is an extra add-on… what about the stuff you occasionaly use, so I re-size the odd image or convert .jpg to .png should I be paying for a tool I only use once a month, if I should, can I afford it?

The investment in a mac is not a small one, so my question is, can I get the best of both worlds? Can I buy the software I need, and download open-source alternative easily for the rest? Can I mix the “it just works” with the tech-tinkering that I’m used to? After purchasing a macbook, ms office for mac, vmware-fusion (I have vm-ware server on linux to run visio, I know this will be no-different on a mac) and topped that off with a backup-solution (work pay to backup windows, rsync does the job for linux) I’m going to have spent best part of £1,500… oh yeah this includes a special VGA cable so I can plug into a projector… apple are known for tying users in tightly, will that become my new bug-bear? which leads me to….

Is Mac the Anti-Linux?
Apple insist that their OS runs only on their hardware, the ipod only works with their software (itunes) and plays their music format, you need special cables to plug your laptop into a standard monitor/projector, the iphone only works with apples chosen provider… is all this restriction going to make things worse? Linux is about freedom, machine architectures range from pda’s to playstations, the interface that you use can easily be changed, nearly everything is open and if I were a programmer I could fix, change, anything I liked…. would I be jumping from complete democratic freedom to a dictatorship?

So there we have it, a million questions I just don’t know the answer to! I do know I don’t have a grand kicking about, so this won’t be something I tackle lightly, if I do I then have the politics at work to address, no booting into linux isn’t supported by IT, but the laptop is a standard-same-as-everyone-else-thingy if I bring in a shiny new apple it’s going to attract attention…. which will certainly upset someone! The windows of change are bring more macs to the UK, but is it just a fad? More thought is definitely needed, I just hope I can bring myself to a decision soon :)

History Meme – What’s your shell top 10?

Planet gnome have started a trend

$ history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
114 ping
107 sudo
82 ssh
71 top
71 cd
68 iwconfig
56 ls
46 usbkey.sh
43 ps
33 evolution

The output shows what commands you type the most, usbkey.sh is a script to unlock the secret-keys held on my usb key-fob, sudo is high up probably cause I use sudo to bounce services (the intel wireless drive crashes quite alot and both it and Network Manager then need restarting) and evolution needs a shutdown every now and again :( The other commands are fairly self-explanatory.

So what’s your history?

Windows Key on Fedora, Thank you Ruben

I’ve been running compiz fusion on Fedora 8 for a while and found that my windows key short-cuts only work half the time; well I found that if I…

add Option "XkbOptions" "altwin:super_win" to the InputDevice section of my /etc/X11/xorg.conf

It works every time. I’ve logged in and out of my laptop a few times over the last couple of days and had no problems since.

Thank you Ruben :D

Fedora HP Compaq nc6320: Overheating CPU

I’ve been having issues with my laptop overheating recently, in fact ever since loading fedora the cpu has run hot. According to CoreTemp when in windows my CPU idles at 56ºC ( i.e. I’ve logged into windows opened outlook and walked away) considering my AMD Desktop machine runs at 40ºC with two users logged and the CPU peaking at 100%, means that my laptop cooks. In Fedora I’ve found that the CPU actually Idles at around 70ºC which is a joke, it means that the fan is kicking out hot air causing my desk and everything around it to get proper hot – don’t leave any chocolate bars near me!

I need to get some colleagues to run coretemp for a while to see if my laptop is broken or if it’s normal for this model of latop to run hot; in the meantime I thought I’d post some tips on what I’ve done to cool my laptop down. I’ve managed to get Fedora to idle at around 58ºC which is much closer to my windows base-line.

CPUSpeed is a service/daemon which controls what the processor is doing, i.e. if you’re not running a lot it scales down the processor to run slower and use less power, thus runs cooler. I found that my daemon was actually crashing at boot up….

#/etc/init.d/cpuspeed status
cpuspeed dead but subsys locked
#

The config file for cpuspeed is /etc/sysconfig/cpuspeed, I’ve changed the govenor from blank (default: auto detect) to GOVERNOR=ondemand which seems to have solved my crashing issue. The second thing I’ve changed is IGNORE_NICE=1 (default: 0) which is now restricting which processes can scale up the CPU. The only performance impact I’ve seen is that this setting now stops VMWARE from consuming my CPU, and since I’m a patient man this is no bad thing :)

Whilst comparing my windows temp to my linux one it occurred to me that it wasn’t entirely fair, in linux I’ve got compiz graphics enabled, and a load of gnome applets which tell me information about networking, cpu speed, cpu temperature, the weather etc…. since windows has none of these it’s fair to say that my linux desktop should run a little hotter…. so the “other” trick I’ve done to bring the temperature down is to renice the applets to a lower priority…

ps ax | grep "applet" | grep -v grep|cut -c 1-5|xargs sudo renice 1

This seems to have done the trick, anything called “applet” now runs at nice 1 rather than 0, the net effect is these processes are queued up behind the “important” ones rather than continuously scaling up the processor.

I’m happy with the results so far, the desk is a lot cooler!