Author Archives: Oren

RIP sysvinit, welcome upstart

After Ubuntu and Fedora, Debian also migrates to upstart.

To summarize the article in the previous link, the main reason for the change is that the kernel is now no more blocking on some hardware scans, and this might make some init scripts (e.g. fsck, network) start before the device is initialized. We now need an event-based init system, so the kernel could "tell" it when the device is ready. This is something that upstart is capable of.

Now I wonder if RHEL6 would inherit upstart from Fedora, this will mean a complete victory for upstart.

Avahi and other (relatively) new desktop technologies

Every time when I try to sit and study, I find something better to do. This time it was playing with Avahi and some avahi clients such as pidgin, amarok, pulseaudio.

What is Avahi?

A free zeroconf implementation which is very common on Linux distros, just as Bonjour is Apple's zeroconf implementation. AKA multicast DNS (mDNS), and is probably similar to the Microsoft-backed UPnP.
Long story short: it allows discovering and resolving the available services on the LAN (if they're zeroconf-aware, of course)

How do I use Avahi?

  • Discovering: If the avahi daemon is installed and running, the magical command avahi-browse -a (might require the avahi-utils package) would query and display all the available services.
  • Resolving: the following weird hosts line in /etc/nsswitch.conf enables resolving through avahi (usually with the .local suffix, i.e. ping mymachine.local):

    hosts:          files dns mdns4_minimal [NOTFOUND=return]

Software using Avahi out of the box:

  • Pidgin: simply add a new Bonjour account, and you'll be able to instantly talk to your LAN-neighbors.
  • CUPS or other printer config frontends: find zeroconf-supporting printers on the LAN.
  • Amarok v2: automagically finds all DAAP-shares on the LAN (iTunes, for example). The bad news is: iTunes v7 and newer weren't yet reverse-engineered, so amarok cannot login to the most popular DAAP servers. Apple, why won't you give us a hand?
  • Pulseaudio: using the paprefs program, you can choose to share your sound devices and become zeroconf-discoverable. This means that people running the padevchooser program can find your sound card and redirect audio to/from yours.
    • It seems to require a wide bandwidth (couldn't find an option to lower the sound quality)
    • I've experienced some bugs which required restarting pulseaudio and other voodoo, in order to make things work.

Accessing a LVM volumes from a foreign OS

A lesson learned: in order to mount an LVM device on another machine or simply another OS (e.g., from within a live cd os, mount the local machine's volumes), the LVM volume group must be exported and then imported. This is done using the vgexport / vgimport commands.

Another requirement, is to have lvm2 package installed (so lvs command actually sees the volumes), and device mapper module should be loaded (dm-mod) or builtin the kernel.

Thanks for Amir who found that out.

By the way, I've recently found the dmsetup command very useful.

bash evilness

I've been trying to read a file in bash, and keep all the lines in a single variable, printing it at once after the loop:


all="EVIL_BASH"
cat /tmp/myfile | while read line; do
all="$all $line"
done
echo $all

However the output was only: EVIL_BASH, instead of having the lines of the /tmp/myfile appended.

WHAT THE HELL?

Because of the PIPE, the whole 'while' loop runs in another subshell. This means that $all outside the loop  is not the same $all from within the loop!

Sounds simply like scoping (as in perl), but a really awkward one. Beware.

Choosing a CMS: any reason NOT to choose Drupal?

While researching the current free CMS software options, I realized that Drupal wins in almost any category: it's intensively developed, has a wide community, lots of plugins, amazing taxonomy extension, etc.

I recommended an organization I volunteer at to swtich to Drupal (they need a major upgrade anyway). After I've said all the good things to convice them, they asked me: "what are the disadvantages of Drupal". Smart question. I wasn't sure what to say. In many Drupal vs. Joomla comparisons, the only Joomla advantage (more or less) was Joomla considered easier to use. From my little experience, it's not true (maybe it was, in earlier versions). A user can easily create content when using FCKEditor and IMCE plugins, and administration is also pretty straightforward.

The ease-of-use issue matters in my particular case, for it's possible that the next admin will be less technology oriented.

What do you think, is Drupal really more difficult to administer? Other reasons to choose something else?

* WordPress is really cool for personal blogs, I believe it's less cool for a more complex organization website.

Windows firewall adventures

At work, I needed to block outgoing IP connections in order to inspect the behavior of our product.

I thought: why not use the native, Windows Firewall for that? Oh. Controlling outgoing connections is not supported by windows firewall (w2k3, at least). lame.

So I went on and searched the net for free windows firewalls. And.. I couldn't find anything good which is really free. So I've started looking for less-free firewalls, and found the Kerio firewall which is a trial version which expires if you don't pay them $$s.

It was pretty good actually, and satisfied my needs.

[30 days later]

Why is this VM so slow?? Remote desktop doesn't work.. After chasing the wrong error message problem, I've tried logging in through the vmware console. Then I've noticed this little balloon on the systray saying something like "Kerio firewall trial has expired; limiting bandwidth to 4kb/sec". OHHH that's just a great attitude!

Local issues

This is not a post of original content, I'm simply linking to interesting things I've read recently.

  1. Israel: Linux-IL mailing list is inspecting some weird phenomenon. Looks like 012 ISP is blocking SSH packets which are  sent abroad.
  2. Hebrew: this feature is too hidden.. Diego explains that how to enable left/right alignment switching by ctrl+shift. (Useful for RTL languages).  The "trick" works for QT, KDE (3+4) apps.

Weird CSS tricks

I was quite surprised to find out these two interesting css "tricks":

  • Data urls: putting the data inside the CSS (inline).
  • CSS sprites: instead of loading many small images (one per item), it's possible to load one big image that contains them all.. then play with the offsets to get the right image.