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 :)

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!

Fedora 7 to 8

As it’s quiet at work (due to the usual x-mas madness) I decided on Friday to upgrade from Fedora 7 to 8, now this was a bit of a risk for me since I have F7 running perfectly. The fedora release notes advise a clean install over an upgrade, so it’s important when you do this to backup /etc so that you can restore anything you need later.

As with all fedora installs it’s always two steps forward and one step back, my reasons for upgrading were:

Unfortunately so far I’ve had a couple of issues (my steps back),

It’s a shame that beagle still doesn’t index my evolution exchange account other than that all looks good, the wallpaper that changes on the time of day is a neat feature; I recommend the following resources to anyone looking to upgrade or use fedora.

Fedora 7: Theming the Gnome Screensaver Lock Dialogue

Fedora 7 Flying High Locked Theme

I stumbled across this the other day, I’ve no idea why the fedora team would go to the effort of making a really nice theme for the lock dialogue for gnome screen saver then leave it “disabled by default”. After a quick google I found the ubuntu guys have been up to something similar, so here a quick how to enable the fedora art work on the gnome-screensaver lock screen.

To enable paste this into a terminal (NOT root, as your normal user).

gconftool-2 -s --type=string /apps/gnome-screensaver/lock_dialog_theme system

To switch it back:

gconftool-2 -s --type=string /apps/gnome-screensaver/lock_dialog_theme default

The only “downer” is that your avatar isn’t shown, but for my work laptop I prefer this theme, much cooler fedora advocate when I’m not at my desk ;)

Security updates only for Fedora 7 / RHEL & Centos 5

I found this on redhat.com the other day….

It is now possible to limit yum to install security updates only. To do so, simply install the yum-security plugin and run the following command:

yum update –security

Hopefully this will allow fedora users to have the option of running a “stable” install :)

Extra Packages for Enterprise Linux… CentOS !

Why has it taken me so long to spot this ? Looks like this draft was written on the 13th May, if I hadn’t have been just about to download FC7 then I’d have missed it !

EPEL – Fedora Project Wiki
EPEL is a volunteer-based community effort from the Fedora project to create a repository of high-quality add-on packages that complement the Fedora-based Red Hat Enterprise Linux (RHEL) and its compatible spinoffs like CentOS or Scientific Linux.

About time, and thank you redhat/fedora, want fedora extra packages in centos, then install this epel-release .rpm frickin’ sweet ! :cool:

Service Recovery Scripts & Error Page Tips.

A couple of weeks ago, I was proper ill with flu; the problem with looking after your own server is that only you can fix it – it’s well and good having monitoring systems (nagios) telling you about faults, but if you can’t read or see the alerts the fault won’t get resolved.

During this time I was ill, for an unknown reason the mySQL process on my server died, as such my website (and others I look after) were down for 8 hours. The fix was simple, one command, restart the service and normal service was resumed (excuse the pun).

This led to me to the conclusion that there must be a way to get the server to fix it’s self. after all, why do a job when you can get a computer to do it for you ! Fortunately I had a light bulb moment and realised that I could use the init scripts that are provided by redhat, the below code will restart apache (httpd) and mySQL on a redhat based system in the event that the service was not stopped cleanly. (In-fact this config has only be tested on CentOS, your mileage may vary on anything else)

#!/bin/bash

# taken from redhast default scripts - /etc/rc.d/init.d/functions

# Set up a default search path.
PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
export PATH

status() {
        local base=${1##*/}
        local pid

        # Test syntax.
        if [ "$#" = 0 ] ; then
                echo $"Usage: status {program}"
                return 1
        fi

        # First try "pidof"
        pid=`pidof -o $$ -o $PPID -o %PPID -x $1 ||
             pidof -o $$ -o $PPID -o %PPID -x ${base}`
        if [ -n "$pid" ]; then
# Uncomment this if you want OK messages
#               echo $"${base} (pid $pid) is running..."
                return 0
        fi

        # Next try "/var/run/*.pid" files
        if [ -f /var/run/${base}.pid ] ; then
                read pid < /var/run/${base}.pid
                if [ -n "$pid" ]; then
                        echo $"${base} dead but pid file exists"
                        /etc/init.d/${base} restart
                        return 1
                fi
        fi
        # See if /var/lock/subsys/${base} exists
        if [ -f /var/lock/subsys/${base} ]; then
                echo $"${base} dead but subsys locked"
                /etc/init.d/${base} restart
                return 2
        fi
        echo $"${base} is stopped"
        return 3
}

# found in /etc/init.d/httpd
httpd=${HTTPD-/usr/sbin/httpd}

status mysqld
status $httpd

If you save this, as /etc/cron.hourly/auto_recovery.sh , then do chmod +x /etc/cron.hourly/auto_recovery.sh , assuming you’ve not changed the default cron setup, every hour mySQL & httpd will be checked, if they have died the’ll be restarted and root will get an e-mail about what happened.

Cool eh !

A final finishing touch: I wanted to change the default “Database Down” error messages on my two most popular applications.

  • Melvin Rivera has written a tutorial on how to customize the wordpress error page, note that it involves editing a file outside of wp-content, that means you’ll have to re-do this “hack” every time you upgrade wordpress.
  • PHPBB: Setting a custom error page on that is really easy, first create a php page displaying your message. Then at the bottom of /path/to/phpbb-install/includes/db.php you’ll see
    // Make the database connection.
    $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
    if(!$db->db_connect_id)
    {
    message_die(CRITICAL_ERROR, "Could not connect to the database");
    }

    change it to

     // Make the database connection.
    $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
    if(!$db->db_connect_id)
    {
     include("/path/to/my-custom-error-page.php");
            die();
    }

Now if you database dies, for the time it’s down (before cron fixes it) wordpress & phpbb sites would get a much prettier error message. Obviously there’s no solution for apache as there’s nothing to serve the pages, but hopefully this kind of thing doesn’t happen to often :D

SNMP v3 on Redhat Linux

I think it’s safe to say, if you can’t get something to work then the manual is rubbish or the user is stupid, with setting up snmp v3 on linux, the user is me, so the fault is probably lies there.

SNMPv3 moves away from the community string idea from older version, and into a username & password combo. The correct tool for creating users is snmpusm, but no matter how many times I read the man page I can’t work it out. I get that you copy a user from the initial user, but how do you create the initial user ? If I try on my box I just get an “snmp timeout” error.

I found a work around for my stupidity, on redhat based boxes (RHEL, CENTOS, WHEL, FEDORA) there is a development package to do the job, so to to get the snmp v3 encrypted goodness going run,

yum install net-snmp-utils net-snmp-devel 

Yum will pick up the dependencies you need. Now as root, run (make sure snmpd is stopped first)

/usr/bin/net-snmp-config --create-snmpv3-user -a PASSWORD MYUSERNAME

You’ll get the following output…

adding the following line to /var/net-snmp/snmpd.conf:
   createUser MYUSERNAME MD5 "PASSWORD" DES
adding the following line to /usr/share/snmp/snmpd.conf:
   rwuser MYUSERNAME

Before testing make sure that UDP 161 is permitted through iptables, and restart snmpd

/etc/init.d/snmpd start

now from another box, you can test, snmpwalk is the command, if it works your screen will fill up with loads of interesting snmp stuff, if it fails you’ll get an error. Timeout usually means UDP 161 is blocked or they can’t ping each other, and you’ll get authentication failure messages if there is a problem with your snmp accounts.

snmpwalk -v 3 -a md5 -A PASSWORD -x des -X PASSWORD -u MYUSERNAME IP.ADD.RE.SS

good luck !

FC 6 Is out !

…and their server is down…..

Fedora Project
We are working hard to bring fedora.redhat.com back up to its fully operational state.

DOH !

Oh well I haven’t got time to install it now anyway, I’ll wait for the “Zod” frenzy to finish I think ;)