Configuring an ad hoc network on suse

Since I don’t own a gigabit router but I do have Gbit NICs on my laptop and main computer, I set up a peer to peer network for optimal performance when I have to transfer a large volume. I don’t do that often so I end up losing time every time. So I decided to write a small blog post about it. 🙂 My concrete setup is transfering between a windows and linux machine.

In windows, when the network adapter is configured for DHCP but it can’t find a DHCP server, it automatically falls back to link-local addressing. On IPv4, this is the 169.254.0.0/16 block. (Apparently, Microsoft likes to calls this APIPA.)
However, on my opensuse 11.1 box, it seems not automatically configured for that. When you open Yast -> Network Settings, edit the network interface and enable “zeroconf” under “dynamic address”.
Yast network zeroconfig configuration
All easy peasy and intuitive.

But now comes the catch! After applying these settings, it works… but stops working after a few secs/mins! I checked the messages log and found out the dhcp client tries to restore the old lease if it doesn’t receive an offer. This causes the zeroconf address to be invalidated. So, before enabling Zeroconf, be sure to release the lease first. You can do this as follows:

sudo dhclient -r

Possibly if you keep the DHCP+Zeroconf setting in yast, you can just release the lease when you want to setup a local network and it would fallback to zeroconf. Didn’t verify it though (had to go online to document this ;))

Monitoring resources

Every linux user is familiar with (h)top to monitor processes for cpu usage. Its spin-off tools are a lot less commonly known: iotop for monitoring io,iftop for monitoring network traffic, ftop for file monitoring.. (am I missing any other?).

Another interesting one, particularly if you’re on a mobile device, is powertop for monitoring power consumption. I remember when Intel announced its work on a smaller energy footprint for Intel devices back in 2007 but forgot about it since my kernel didn’t support it yet anyway. 🙂

Although the research was focused on Intel hardware, it is quite useful for other cpu’s like AMD. In that case, powertop is not able to calculate the power usage, but it can still show the number of wake-ups per second per process and how much time is spent in each power state.

Repair grub after windows install

Last week I installed Windows 7 RC (which still works these days, btw) on my brother’s computer so he could practice Autodesk Inventor at home. Since Windows stubbornly still denies the existence of any other OS, it consequently wipes the MBR and installs its own boot loader. Bottom line, we need to reinstall the GRUB boot loader.

There are several ways to do that, but since my brother uses openSUSE, I will use the openSUSE install dvd:

  • Boot from the install dvd
  • Select “Rescue system”. This will give you a console. (I also tried the automatic repair option, but that somehow did not work..)
  • log in with root. no password is asked.

From here on, it is not openSUSE specific anymore:

  • Run “grub”. It starts scanning your disks and after some time you should get a grub> prompt.
  • (Optional) Find the partition where grub is installed:
    grub> find /boot/grub/stage1
  • Set grub’s root partition (example: first harddisk, first partition):
    grub> root (hd0,0)
  • Execute grub installation into MBR:
    grub> setup (hd0)
  • If you would have wanted to install into a specific partition instead of the MBR, simply specify the partition instead:
    grub> setup (hd0,0)

You can find all this info and more in the grub manual.

Flushing the dns cache

As we all know, under windows we can flush the DNS cache with

ipconfig /flushdns

But what is the linux equivalent command? It is so obvious, yet I somehow keep forgetting it. 🙂
Under linux, the standard way to have a daemon reload its configuration, is sending a SIGHUP signal. In case of the name service cache daemon (nscd), this implies flushing its cache!
So you could use the following command to flush the DNS cache if you’re using nscd:

pkill -1 nscd

Extract audio from AV container service menu for KDE4

Nowadays, we live in a KDE4 world for real, so it’s time to update my “dump audio from video file” service menu 😉 It should work both in Konqueror and Dolphin.

Create a file with the following contents and put it in one of your service directories (which you can find out by running “kde4-config –path services” , typically you will have something like $HOME/.kde4/share/kde4/services )


[Desktop Entry]
Type=Service
Encoding=UTF-8
ServiceTypes=KonqPopupMenu/Plugin,video/*
Actions=extractaudio

[Desktop Action extractaudio]
Name=Extract audio
Name[en-GB]=Extract audio
Exec=mplayer -dumpaudio %u -dumpfile %u.dump
Icon=speaker

Time Machine for Linux: Back In Time

Recently, I watched a vid about Apple’s Time Machine and was quite impressed. For the first time in ages, I was considering to try out MacosX, after all, you have to give them credit: they just keep innovating as no other computer company. The plan was quickly abandoned though, when I discovered it wouldn’t run on my newly bought AMD monster-machine (post about that in queue ;)).

Anyhow, I searched some alternatives and somehow nothing as user-friendly showed up.. Until today I stumbled upon the solution by accident while I was checking out LinuxJournal’s tech tips! Quite interesting/entertaining stuff there btw. 🙂 I’m talking about about Back In Time and considering the Ubuntu dev, it even has a KDE4 gui, yay! 🙂

Check out the LJ screencast and the LifeHacker article.

Best. Plugin. Ever.

I was trying to watch a vid on a website which was quicktime only. Since I’ve had some trouble a few days ago to play a wmv file on a windows media only site, I decided to give the firefox mplayer plugin a try. I had heard of it before but never found a compelling reason to install it. Until now. It just plays _everything_! I can’t believe how I could live so long without it. 🙂 Or maybe because 99% of the web’s vids are flash? 😉 (which works, of course)

Here is the supported formats list:
Window Media: wmv, avi, asf, wav and asx
QuickTime: mov and smil
MPEG Video and Audio: mpeg and mp3
Ogg Vorbis: ogg
AutoDesk FLI: fli and flc
Vivo: vivo
Real Player: ram and rm

drop dropbox

For some time now, I’ve been evaluating dropbox. From time to time, I need to be able to store a file and have it available at another location in a synced fashion. First some history.
Before Dropbox, I was (ab)using gmail through the firefox gspace plugin, but, 1) you need firefox 2) you pollute your mail space 3) it’s buggy and bloated 4) but still doesn’t have all features I want. The reason I chose gspace back in the day, was because it was presumably cross platform through use of the firefox platform. That turned out to become limited functionality and eventually useless at all (may be fixed by now). It had also issues with having your gmail open in a tab at the same time. So I looked for an alternative and dropbox seemed promising.

My requirements for a ‘online storage’ solution are:

  • cross platform native clients: to allow sharing between work and home computers.
  • web interface: when you’re in the wild at someone else’s computer where you don’t want to install a client.
  • corporate-proof: can operate from behind different types of proxies.
  • server-side backup: when you accidentally overwrite a file from another location, or when syncing fails to do the right thing.

My nice-to-have’s are:

  • revision history: same as server-side backup but extended to multiple backups.
  • desktop integration: status overlay (aka tortoise stuff), context menu to perform web actions, for example, revert to some revision, make public, …
  • exclusion filters: handy when you don’t want your lock or temp files (due to editing) to be uselessly synced all the time.

Dropbox seemed to fulfill all my wishes except exclusion filters. Until recently. 🙂 At work, when I resume after suspend, the client doesn’t automatically sync back to the server (this can also be a proxy issue here at work, but it doesn’t work anymore and there’s nothing I can do about it, i.e. it’s closed source). But there are other things that bug me: 1) explorer integration is slow but not optional. So you have to live with it. 2) The (windows) client feels sluggish and quite heavy to load. 3) Linux client always lags behind and the desktop integration is only for gnome. Linux users had to wait long for a release, but even now, they are not treated very well. Then of course, there is the whole discussion of dropbox being closed source but the front-end part being open source, confusing people all around. 🙂 They give the impression they care about the linux users and open source, but in reality, they can’t make it true. In fact, I have no problem using a closed client, but it has to work very well then. 😉
Dropbox has free and paid accounts. The free accounts are limited to 2GB storage and only 30 days history. No problem for me.
So up until recently, I was quite happy with dropbox, but since the windows client fails to reconnect after resume and the linux fails to start, I guess I’m counting its last days. 🙂

If anyone knows a decent cross-platform alternative, please let me know.

But it did raise that thought again in my head: why not try to start an open source online storage sharing solution? Is it so hard? Why does it not exist yet? Of course, I’m not targetting a system which can take loads and loads of people uploading their latest torrents to share with the rest of the family *rolling eyes* 😉 But simply, you know, some system that can handle a few accounts (or even just private) which you can install on your own server and offers basic syncing functionality with some better-than-dumb compression/file-diffing mechanism. Personally, I also wouldn’t need fancy public web sharing like photogalleries and the like, so…

Maybe I’m missing something? 🙂