Currently showing posts tagged: Linux

cello lessons from a dead genius

By , January 28, 2013 8:05 pm

Well, it seemed like a good idea at the time …

In the summer of 2011, I quit my job to resume full-time music studies. During the summer semester at the Berkeley Jazzschool in California, I started learning John Coltrane’s solo on the title track of his famous album Blue Train. It was really tough going, but addictive – I was getting my arse handed to me on a plate on a daily basis by a dead person, but I felt like I was way off the well-trodden path and that was really satisfying!

After 3 months studying in various places in the USA, I got back home and resumed work on this transcription in earnest. It became part of my daily routine, and I craved the day that I could play the whole thing note perfect at the same speed as the original. There were so many notes to fit in that I had to come up with totally new ways to use my left thumb, on which the normal cellist’s callus grew to epic proportions. Trane became the best cello teacher I never had. Unfortunately, just around the time I was getting close to being able to nail it, real life intervened, and I had to refocus on earning money. Inspired by Benoît Sauvé’s incredible rendition of the same solo on recorder (recorder?! what a mofo – check out his other videos), I did a couple of very rough recordings with my compact camera for posterity, and moved on.

Sometime later, I discovered a John McLaughlin video on YouTube (sadly no longer available) which had an awesome animated transcription at the bottom – a really cool glimpse inside the craft of a master musician. Then it occurred to me that I could do the same kind of thing with my video, and publish it in case there are any other jazz cellists out there who would be interested in it. I put a lot of effort into notating and fingering it, so it seemed a waste to just let it rot and never see the light of day. After all, I already had the source files and a video, so it was just a simple matter of combining the two, right? How hard could it be?

Very very hard, it turns out. I had to write two new pieces of software, completely overhaul a third, and fix some obscure bugs hidden deep inside a fourth. But I didn’t discover that until I’d reached the point of no return …

I’ll probably blog more at some point about the software engineering hoops I had to jump through in order to make this all work. Email me if you’re interested.

In the mean time, hope you enjoy the video! (You can also view it on YouTube.)

Share

Upgrading to openSUSE 12.2

By , September 25, 2012 12:15 pm

Yesterday I did an online upgrade of my laptop from openSUSE 12.1 to 12.2, using this procedure. It was almost a painless process; however unfortunately something crashed the whole X session part-way through the upgrade so I had to manually re-run zypper dup from a virtual console to complete it. The procedure should probably warn about that scenario in some way, although there is no obvious clean solution, e.g. switching to runlevel 3 before starting the upgrade would probably kill the network when NetworkManager is in use. I also had some weirdness related to my encrypted /home partition (despite the advice in the release notes).

The final issue was Google Chrome failing to start with the following error:

/usr/bin/google-chrome: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory

It seems that this is at least in part due to a disagreement between Google engineers and Linux distros on what symlinks ldconfig should generate. If you look in the %post section of the google-chrome-stable rpm, you’ll see

# Most RPM distros do not provide libbz2.so.1.0, i.e.
# https://bugzilla.redhat.com/show_bug.cgi?id=461863
# so we create a symlink and point it to libbz2.so.1.
# This is technically wrong, but it'll work since we do
# not anticipate a new version of bzip2 with a different
# minor version number anytime soon.

I don’t have time to decipher openSUSE’s shared library packaging policy, but I assume it’s deliberate that /usr/lib64/libbz2.so.1.0 does not exist as a symlink even though /usr/lib64/libbz2.so and /usr/lib64/libbz2.so.1 do.
It has been suggested to me that this omission could be related to http://en.opensuse.org/openSUSE:Usr_merge. Regardless, google’s hack should have compensated for this, but for some reason (presumably related to the upgrade), there was a dangling symlink in /opt/google/chrome:

lrwxrwxrwx 1 root root 18 Sep 24 10:17 libbz2.so.1.0 -> /lib64/libbz2.so.1

This symlink is not owned by any rpm, which suggests that google’s hack might be in violation of the FHS for modifying a static and potentially read-only filesystem – although that’s moot since the modification would only happen at install-time at which point opt has to be mounted read-write anyway. Regardless, removing that dangling symlink and pointing it to /usr/lib64/libbz2.so.1 fixed the issue.

Share

Tool-building hacks #1: audible pings

By , February 11, 2012 8:07 pm

I think I’m genetically a tool-builder. My dad and uncle both take great pleasure in carefully selecting and buying or building tools for their workshops, my mum’s an expert woodcarver with a fair array of sharp pointy things, and these are not the only examples in the family. For me, the habit has manifested in electronic form, and I really enjoy programming new scripts etc. to help me work more efficiently. In fact I’ve collected such a vast array of them over the years that I had to start tracking them under version control back in 1999. (CVS did me proud for many years, but it did not age well, and I finally migrated them to git a few months ago.)

I can’t claim to be remotely unusual in this respect though – there’s a whole subculture of programmers (“hackers”) who can relate to this mindset. Sometimes when I build a new tool, I get the impulse to share it with the world in case it turns out to be of use to anyone else. In the past, these hacks have ended up on my software web page, but I think this blog might be a better medium.

So, without further ado, here’s a cute hack I just built: bping, a wrapper around ping(8) which makes it do a lot of beeping ;-) – one beep per packet received, with pitch going up an octave for every doubling of the response latency. (See below for installation instructions.) Why did I want this?

I use ethernet over power to connect the machines in my bedroom to the equipment in the lounge. In a high-rise apartment block with about 100 wireless networks fighting over the same spectrum band, this is (normally) a much more reliable option. However yesterday the connections in my home network started behaving very weirdly. I tried pinging various machines on the network from each other to narrow down the problem, but it was annoying to have to keep going between rooms to visually monitor the output from the various pings when it would have been quicker to be able to hear the quality of the connections being tested. So I wrote bping, which also turns a laptop into a sort of Geiger counter for wifi.

Currently bping uses bip (here’s a suggested approach to installation) which in turns uses sox to make the beeps. This works fine on Fedora 15 but unfortunately for some reason takes longer than one second to run on Ubuntu 11.10 and openSUSE 12.1, regardless of how short the beep is. I think it’s something to do with pulseaudio, but I haven’t bothered to figure it out yet. Answers on a e-postcard please …

By the way, many of my hacks are already publically available on my github account, but most aren’t documented yet. The current exceptions are:

I’ll try to document some of the others soon. Watch this space!

Share

port redirection from kvm host to guest

By , January 23, 2012 2:58 am

I’ve just started using kvm in earnest, and immediately ran into the challenge of how to access my guest via ssh. My first instinct was to configure the guest in bridged mode, but this doesn’t work well (or at all) with wireless interfaces.

So plan B was to set up port redirection from the host to the guest, e.g. so that ssh’ing to localhost port 2222 would redirect to the guest’s port 22.

After a quick google, some fiddling with iptables, and a glance at the libvirt Networking wiki page, I was still having no luck. Then it hit me – my guest was using user-mode networking, and rather than getting its DHCP-allocated IP from the libvirtd-launched dnsmasq instance on the host, was receiving a hardcoded allocation of 10.0.2.15 from the host which is on 10.0.2.2. This can be extremely puzzling at first, because no network commands run on the host (such as ifconfig, iptables, brctl, route) will reveal this magic address, yet the host is still accessible from the guest via it.

After a lot more googling, I stumbled across a technique for configuring host to guest port redirection on a running VM. This sounded very promising, but virt-manager refused to accept the magic Control-Alt-2 key combination to switch to QEMU monitor mode. It turns out that this is no accident. However, since libvirt 0.8.8, the QEMU monitor can be accessed via virsh.
Note that the --hmp option is required, otherwise the monitor expects the command in JSON format, so omitting it leads to errors like error: internal error cannot parse json ... lexical error: invalid char in json text.

The final hurdle was figuring out the correct monitor command. The host_net_redir command as mentioned in the above article is no longer recognized. Luckily the QEMU monitor interface helped me out here – I spotted an encouraging sounding command hostfwd_add:

# virsh qemu-monitor-command --hmp sles11 'help hostfwd_add'
hostfwd_add [vlan_id name] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport -- redirect TCP or UDP connections from host to guest (requires -net user)

and google confirmed that the latter had superceded the former.

So finally we have the complete solution:

# virsh qemu-monitor-command --hmp sles11 'hostfwd_add ::2222-:22'
# ssh -p 2222 localhost
Password:
Last login: Mon Jan 23 00:37:44 2012
linux-mnsh:~ #

Hooray!

UPDATE: just found another very simple solution – add a new NIC to the VM which doesn’t use user-mode networking. Then it will get a IP (on 192.168.100.0/24 by default) which is still NAT’d but also routable via virbr0 on the host, meaning no redirection is necessary; just ssh directly to the guest’s IP from the host. A minor disadvantage of this is that the guest won’t be directly reachable from outside the host, but that’s unlikely to be an issue in most scenarios.

Share

Linux desktop community “outraged” by latest Torvalds comments

By , November 29, 2011 4:40 pm

Once again, users and developers all around the Linux desktop community have been provoked by controversial comments from Linus Torvalds, creator and long-time maintainer of the Linux kernel. Back in October, Linus dubbed GNOME 3 an “unholy mess”, referring to one of the changes as “crazy crap” and demanding “I want my sane interfaces back”. Since then he has gone even further, contending that “for some people, a stable, flexible functional desktop environment is far more important than the latest eye candy or trendy minimalist UI design.”

Reaction from the desktop development community has been swift and mostly unapologetic. Mark Shuttleworth, the founder of Canonical, responded “Once again, Linus is underestimating the importance of aesthetics in computing. You only have to look at Apple to see that people place more importance on visual beauty than the kind of efficient work processes that a flexible and reliable desktop environment enable. This is why we’re pushing our new Unity launcher as a mandatory part of Ubuntu. We’re confident that people will quickly overcome the initial shock of everything taking longer to find and access because they’ll be too busy admiring how beautiful it looks.” He then cited the latest 11.10 release as an example of this. “If you look in the release notes for [Oneiric Ocelot], you’ll see a new Alt+Tab switcher at the top of the list of highlights, and below it other radical changes such as renaming ‘Places’ to ‘Lenses’. Frankly, most people lap up this whizzbang shit, and as long as it looks cooler than their friend’s Windows 7 netbook they’ll be willing to tolerate some minor annoyances which are unavoidable when making immature software a critical component of the desktop. Sure, we could prioritise boring bug-fixing over innovation, but that just doesn’t excite the teenagers on the web forums, and we have to think about the next generation of users. Besides, if you want a dumbed down system that mostly works, there’s always Mac OS X.”

Havoc Pennington, a GNOME developer well-known for initiating the war on Linux desktop flexibility by drastically reducing the number of preferences and replacing GNOME’s default window manager, the high-performance scriptable Sawfish, with Metacity, commented: “It’s about achieving the right work/play balance. If your desktop allowed you to get stuff done too quickly, it would just increase your stress levels. Some ‘power’ users think they want to be able to stream-line their workflows, but we know better, so we are doing them a favour by making this customizability harder. After all, everyone needs basically the same things. Rather than trying to be different, these people should instead learn to enjoy the cute visuals and focus more on having fun. Life’s more than just work, work, work, you know.”

The KDE camp has been slightly less vociferous, perhaps because it’s old hat for them – back in 2008 they pioneered the concept of intrusive redesigns and ended up the wrong end of one of Linus’ rants as a result. “With KDE 4.0, we did our best to prevent people achieving real work, and I think we largely succeeded”, one of the KDE team leaders recalls. “I mean, there was a significant period of time where neither the KDE3 version of knetworkmanager nor its KDE4 rewrite worked properly, so for many wireless networks, the only way you could connect was to disable NetworkManager and write a shell-script to interface directly with wpa-supplicant and ifup. And that’s just one small example.”

Despite Torvalds’ comments, the move towards form over function has been witnessed elsewhere outside the desktop software space. For example, Apple have introduced the MacWheel, a move so bold that it makes innovations such as Unity and the GNOME Shell look positively conservative. However there is no clear industry-wide consensus; in fact companies such as Ebay and Sony are beginning to experiment with rejecting both form and function, turning conventional wisdom on its head.

Share

Panorama Theme by Themocracy