new kernel release detection snippet

Just a small and old snippet that might be helpful or an example: Some years ago I’s in need of getting to know early about new released Linux kernel versions. Therefore I wrote a (not sophisticated but working) crontabbed script checking the kernel page for a new stable Linux kernel and alerting me via mail if a new version is found with link to the changelog:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
CURRENTVERSION=`w3m -dump \
 http://www.kernel.org/kdist/finger_banner \
 | head -n 1 | awk '{print $10}'`
SAVEDVERSION=`cat ~/bin/kernelversion.log \
 | tail -n 1 | awk '{print $2}'`
SAVEDDATE=`cat ~/bin/kernelversion.log \
 | tail -n 1 | awk '{print $1}'`
MAILADDRESS=mail@address.tld
 
if [[ "$CURRENTVERSION" != "$SAVEDVERSION" ]]
  then
  CURRENTDATE=`date +'%Y-%m-%d'`
  echo "$CURRENTDATE $CURRENTVERSION" \
  >> ~/bin/kernelversion.log
  echo -e "Detected new kernel version \
   ${CURRENTVERSION} on ${CURRENTDATE} \
   (replacing version ${SAVEDVERSION} from\
   ${SAVEDDATE}). Please check \
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-\
   ${CURRENTVERSION} forr details." \
 | mail -s "new kernel ${CURRENTVERSION}" \
 ${MAILADDRESS}
fi

The only real bug in this script is that it does not detect network issues and therefore alerts you when it is not able to get a http response. But this could be fixed with one or two lines of code. And yes most lines could be more elegant :) Probably today there are better channels like rss or even an old mailing list with announcements that I never looked for, but this snippet does it’s job very well.

update:

Fixed the broken wrapping of the script. Sorry about this. (Thank you Jeremy.)

Jonne stated that of course using a feed like http://kernel.org/kdist/rss.xml is the better choice today. He is surely right about this  though sometimes receiving a mail is a need.

Call for Papers: Ubuntu Hardy Heron Release Party (Berlin)

As already mentioned the „Ubuntu Berlin“ user group already planned it’s Ubuntu Hardy Heron release party for 26th of April. This time we want to go one step further and extend our lecture track. Therefore we started a call for papers. The call itself is in German due to our local focus. If you live around Berlin and are willing and able to speak about a Ubuntu- oder Linux-related topic – let us know! The most recent version of the call and a pdf version are to be found on: http://www.ubuntu-berlin.de/hardy-cfp/

For the lazy ones around, take the following:

Call for Papers

Ubuntu Hardy Heron Releaseparty (Berlin)

Die Anwendergruppe „Ubuntu Berlin“ sucht Referenten für die am 26.4.2008 in den Räumen des c-base e.V. stattfindende Ubuntu Hardy Heron Releaseparty.

Die Teilnehmer der Party setzen sich aus Ubuntu-Neulingen, Anwendern und fortgeschrittenen Entwicklern zusammen. Es ist mit einer Teilnehmerzahl ab 100 Personen zu rechnen. Thematisch sind Vorträge zu Ubuntu-bezogenen Themen (Neuerungen in Hardy Heron, Ubuntu, Kubuntu, Xubuntu, Edubuntu, Gobuntu, usw.), Installation, speziellen Anwendungsfällen und Applikationen, aber auch Community- und Linux-nahen Aktivitäten willkommen. Die Vortragszeit beträgt 20 Minuten, um ein Vortragsinterval von 30 Minuten einzuhalten. Beamer, Internetzugang, Rechner, Mikrofon können gestellt werden. Bei rechtzeitiger Anfrage ist eventuell die Bereitstellung eines Workshop-Raums für kleinere Sitzungen möglich (ca. 8 Plätze).

Vorschläge sind einzureichen bis zum 29.2.2008. Über eine Annahme der Vorträge wird bis 16.3.2008 entschieden.

Beim Einreichen sind folgende Vorgaben zu beachten:

  • Nennung von Vortragstitel, Name des Vortragenden, Qualifikation (z.B. Anwender, Vereinsmitglied, Entwickler)
  • Beschreibung des Vortragsthemas in einem Absatz
  • Kontakt-Möglichkeit des Vortrages (E-Mail, nach Möglichkeit Telefon)
  • Nennung notwendiger Ressourcen (Beamer, Netzwerk, Rechner)
  • Besteht die Möglichkeit, den Vortrag ca. eine Woche vorher voraufzuführen

Ubuntu Berlin kann keine Kostenerstattung für Anreise, Unterkunft und Verpflegung übernehmen. Ein eventuell notwendiger Transport von Hardware kann im Raum Berlin organisiert werden.

Vortrags-Konzepte und Fragen sind per E-Mail zu richten an
[email protected]

Richard Stallman on 18.2. in Berlin

Just wanted to let you that Richard Stallman helds a lecture in Berlin/Germany on 18th of February.

Here is the German announcement:

Richard Stallman, der Begründer und Vordenker der Freien Software Bewegung hält einen Vortrag über die Philosophie und Geschichte der Freien Software.

Der in New York lebende Richard Stallman ist der Begründer der Freien Software-Bewegung und Verfasser wegweisender Texte dieser Bewegung. Der Begriff der “Freien Software” stammt von ihm und steht für die Idee, dass Software von ihren Benutzern zu jedem Zweck ausgeführt, verändert und weiterentwickelt werden kann und darf. Dieses Recht – das die meisten Software-Firmen ihren Nutzern verweigern – begründet Stallman mit der Forderung, dass Wissen jedem Menschen frei zugänglich sein sollte. Stallman vergleicht das von ihm geforderte Recht auf Freie Software (free software) mit dem Recht der “Freien Rede” (free speach), die im Gegensatz zum “Freibier” (free beer), zu den Grundrechten einer freien Gesellschaft gehört.

Richard Stallman hat mit dem Betriebssystem GNU/Linux auch die Entwicklung des heute am weitesten verbreiten Betriebssystem vorangetrieben, das unter einer freien Lizenz steht. Mit der der GNU General Public Licence hat er darüber hinaus die rechtliche Grundlage für die Nutzung und Verbreitung Freier Software geschaffen. Um die Idee der Freien Software zu kommunizieren und zu verbreiten gründete Richard Stallman 1985 die Free Software Foundation (FSF), die mittlerweile auch Schwesterorganisationen in Europa (FSFE), Indien (FSFI) und Lateinamerika (FSFLA) hat.

Die Veranstaltung beginnt um 19:00 Uhr und findet im Atrium des media centre, Johannisstraße 20, 10117 Berlin statt.

Der Eintritt kostet 5 Euro.

More information can be found on the newthinking website and on the netzpolitik.org blog. See you there?

Bashup – a first example for a simple tree backup over ssh

Some days (weeks?) ago I told you about the release of „Bashup“ a bourne shell compatible backup script on sourceforge. As the script is still in heave Alpha I’d like to give you a first insight into it’s development.

Bashup is written in heavy Bash syntax and has few dependencies to external programs. You should image it as a scripting library for backups as it allows to call different backup methods and is more a framework than a fully integrated solution. The power of this is the ability to be free in the creation of a backup process while still using easy methods.

The following is a fairly easy setup of bashup for backing up some directories over ssh. You see that we only source the bashup library here, setup some variables and call the bashup method then which executes the backup.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# source bashup lob
. bashup_lib.sh
 
# set setup source - we want to backup a tree
SOURCE=tree
# set source dirs
TREE_DIRECTORIES="$HOME/PDF $HOME/ogg"
# setup filter for compression
FILTER=bzip2
 
# set destination - we want to ssh
DESTINATION=ssh_file
# set ssh host, you could be clever
# and setup access in .ssh/config
SSH_HOST=host.name.tld
# set remote file name
FILE=file.name.bz2
 
# we want two types of logging
USE_REPORTERS="console log"
 
# set the log file names
COMBINED_LOG=combined.log
ERROR_LOG=error.log
 
# call bashup
bashup

I admit this example won’t win a Noble award but if you are busy with setting up backups on very different servers you might like the idea of a scripting environment which only needs bash. Imagine your power when digging deeper into the bashup lib and calling the special methods directly while piping output and more. This is possible of course.

In the next weeks I’ll show you how to use backup rotation (yes, also over ssh, ftp and other methods), mysql/postresql/oracle/subversion backup, nagios feedback integration and more.

If you like to test and tell me what you think or even want to provide patches, feel free to checkout bashup:

svn co https://bashup.svn.sourceforge.net/svnroot/bashup bashup

more battery, please

After I found out that the enhanced Gnome power manager applet has some trouble dealing with two batteries (it currently assumes you have only one and therefore it’s ability to guess the correct lifetime based on recent discharging times shows you definitely wrong spans when swapping the battery). But to be honest, this bug isn’t that grave to drop more words about this – I am quite sure it will be fixed soon.

More interesting instead is the possibility to save power. At least with gutsy you have the possibility to install Intel’s „powertop“ utility – a command line tool for measuring power consumption and detecting possible power leaks. I heard a lot of bad words about powertop, I for myself am quite satisfied about it and it’s documentation and hints on the website.

After dealing with it for some time, I wrote the following quite stupid but effective script, that extends my battery life time for some percent:

#!/bin/dash
# stop not essentially needed daemons
/etc/init.d/cupsys stop
/etc/init.d/tor stop
/etc/init.d/privoxy stop
/etc/init.d/bluetooth stop
/etc/init.d/racoon stop
/etc/init.d/postfix stop
/etc/init.d/cron stop
/etc/init.d/sysklogd stop
/etc/init.d/klogd stop
# decrease wlan power consumption (if wlan is not needed: switch it off!)
iwpriv eth1 set_power 5
# increase writeback time
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
# enable ac97 sound power save mode
echo 1 > /sys/module/snd_ac97_codec/parameters/power_save
# enable usb power save (actually not needed as it gets killed afterwards)
echo 1 > /sys/module/usbcore/parameters/autosuspend
# switch off usb
modprobe -r ehci_hcd
modprobe -r uhci_hcd
# switch off bluetooth
modprobe -r rfcomm
modprobe -r l2cap
modprobe -r bluetooth
# put harddisk to power save mode (spin down)
hdparm -B 1 -S 12 /dev/sda
# activate quiet hard disk mode - probably not needed when using the power save mode
hdparm -M 128 /dev/sda
# remount active partitions with noatime
mount -o remount,noatime /
mount -o remount,noatime /mnt/cryptdevice
# active laptop mode
echo 5 > /proc/sys/vm/laptop_mode

So you might guess I am not the hardware guru and you are right about it. But maybe this snippet is a good starting point for you to save some power. And yes, you can also save power on your desktop pc. It will not extend a battery lifetime but maybe the one of your purse.

Feel free to drop some of your hints or rants in the comment field.

Packaging Jam session on 6th of February at Newthinking store Berlin/Germany

Time to get a ticket to Berlin! As Daniel Holbach already mentioned on this blog, the „Ubuntu Berlin“ team is proud to present the first „Packaging Jam“ session in Germany (if not even in Europe).

On 6th of February between 19:00 and 21:00 you’ll have the possibility to attend a workshop with Ubuntu developer and Canonical employee Daniel Holbach who explains the essential steps towards Ubuntu packaging and answers development related questions. The workshop takes place at the Linux friendly „Newthinking store“ (thank you, guys!), Tuchholskystraße 48, 10115 Berlin, and will be, of course, free of charge.

Feel free to bring your notebook along in order to be able to check if Daniel is right about what he tells you 😉 If you don’t feel like carrying it around – you don’t have to. Just join us for a fine evening!

More information:

Bashup – a sophisticated Bash backup script

Mnemonikk (who still lacks a blog because he cannot decide which name to choose) finally made the step to create a sourceforge project for Bashup. Bashup is a more or less modular and Bourne shell compatible backup script with few dependencies. It targets backup for servers and provides features like mysql, oracle, postgresql, subversion repository and file system backup, backup over ftp, ssh, rsync, heavy rotation (yes – even over ftp) and reporting. The script is already used on a couple of different live servers. It matches the need for a script that is neither binary, nor python, ruby or perl but just plain shell and some external calls.

The script is released under GPL. Right now you can only get it by checking out the svn repository (see sourceforge project page for details) but will be branched with an official version number soon. I know there are a lot of backup solutions out there and this is just one more, but you might also know how difficult it can be to backup a system when having very limited possibilities to install software and servers distributed on very different data centers…

Feel free to contact me for gaining access as developer. Patches and new modules welcome!

/usr/bin/test not /usr/bin/[ anymore?

I am really puzzled: While proudly presenting some linux knowledge I could not explain why /usr/bin/test and /usr/bin/[ are on Debian and Ubuntu (and maybe other distributions) not binary and symlink but different binaries. On Ubuntu Gutsy it looks like this:

[ccm:0:~]$ ls -l /usr/bin/test
-rwxr-xr-x 1 root root 23036 2007-09-29 14:51 /usr/bin/test
[ccm:0:~]$ ls -l /usr/bin/\[
-rwxr-xr-x 1 root root 25024 2007-09-29 14:51 /usr/bin/[
[ccm:0:~]$ md5sum /usr/bin/test
d83583f233cb4a014c2e9faef6bb9b32  /usr/bin/test
[ccm:0:~]$ md5sum /usr/bin/\[
b1e9282a48978a17fb7479faf7b8c8b7  /usr/bin/[

When playing around with them, they even behave different:

[ccm:0:~]$ /usr/bin/test --version
[ccm:0:~]$ /usr/bin/\[ --version
[ (GNU coreutils) 5.97

On Debian, Fedora, RedHat it looks the same. It puzzles me as just some weeks ago I read one of them is actually a symlink and think I the first test I made showed me machine where it behaved that way.

So maybe someone can update me why these binaries are different now. Guess there cannot be good reason as „man test“ and „man [“ show the same document:

ls -l /usr/share/man/man1/\[.1.gz
lrwxrwxrwx 1 root root 9 2007-12-04 19:20 /usr/share/man/man1/[.1.gz -> test.1.gz

And when answering this: „/usr/bin/test“ is part of coreutils, but /usr/bin/[ ?

Powered by ScribeFire.

Ubuntu LAN party

While dealing with preparations for our already announced Hardy Heron release party we are currently planning an Ubuntu LAN party. What does that mean? The Ubuntu Berlin team came to the conclusion that network gaming is one of the major reasons for sticking to Windows based operating systems. There is of course an unmanageable amount of games of Windows machines out there – no doubt about it. But it seems to be a prejudice that you cannot have network based gaming fun on Linux. And I don’t mean running Wine, VmWare or similar here.

Therefore we set up a small and incomplete list with games that you can play under Linux. Some of them are actually Windows games that can run under Wine – but only some (and they are a kind of compromise for some of our members). Quite enthusiastic discussions occurred in conjunction with games like „Battle for Wesnoth„, „Armagetron„, „OpenArena“ and „Nexuiz„. All of them are available through Ubuntu package repositories and – even better – not all of them are shooters.

So we are happily looking towards our first lan party within the next weeks which will be located at c-base or newthinking store if one them lets us in. I hope that we also have time to do some bug reporting afterwards if necessary – it should be a great possibility to do some network game stress tests.

Powered by ScribeFire.

The dilemma of ssh authorized_keys key files and its comments

Imagine the following situation: You care for live servers and work in a team of let’s say five, six or even more people. Access to the servers is granted through ssh. The people login either as root (yes, you should not do that, but that is not the point here) or as user with sudo rights or they just share an unprivileged account. Authentication is done via ssh keys.

Now somebody leaves your team. Either as he has a new job or he just got fired. Of course you start deleting his key from all those ~./ssh/authorized_keys files. You have been smart before as you forced your buddies to use their real name or mail address as comment in the key. Easy identification.

But then you start thinking: How do I know I am deleting the right keys? Let’s say the target user is a smart bad guy. He just might have done the following: He looks for somebody who seldomly logs in. Maybe a manager has a key just for security purposes or something like that. Now he exchanges the order of the keys and its comments if they are in a shared authorized_keys or he even exchanges the authorized_keys files when they belong to different users, so you just think you are deleting the right keys but disable another person – in the worst case even yourself.

Of course you can start working around this with trip wire, shell scripts and so on, but be honest: Being able to change the comment in an ssh key without disturbing a checksum or even a signature that rings bells and whistles is a pain for every security minded administrator.

Feel free to hint me an easy solution for this that you might already have implemented.