Search Results: "tar"

18 February 2009

Kartik Mistry: 3 Years!


* It all started with this sip! At Marriage.. 3 years. Thanks my dear Koki!

Julien Blache: mt-daapd EPIC WIN

I ve been doing some code lately, fixing things here and there, and over the last few days gave mt-daapd some attention. First, I was reported a segfault of mt-daapd when reloading web pages too fast. Surprisingly, it turned out to be a stupid omission in a simple routine and it is hard to hit without disabling the cache in the browser. Now, I just fixed something that s been bugging me for a while: mt-daapd did not handle Avahi daemon restarts, leading to mt-daapd becoming invisible to clients relying on mDNS until you restarted it. And, wow, that went a bit further than expected. As I expected, the simple piece of code needed to handle that wasn t there. But still it did not work, as it turns out the event loop for the Avahi polling wasn t being run. Replace stupid code reinventing the wheel by the Avahi-provided wheel and there, it works. But not when run as a daemon (aka foreground only). Well yes, starting the thread before daemonizing isn t going to work well, so fix that. EPIC WIN \o/ As mt-daapd s upstream is not active anymore I m accumulating fixes for mt-daapd in the Debian package, to the point I m starting to consider setting up a git repository somewhere with those fixes and possibly some more code rework if I feel like it.

Mark Brown: Buffer overflows ahoy

I may be wrong on this but it looks like Microsoft SMTP clients (at least Windows Mail and Outlook) don t like being sent a large volume of SSL certificate information when opening a TLS connection. They appear to assume that the data they are being sent is malformed and assume that STARTTLS failed, continuing with an unencrypted SMTP dialogue. This can be triggered relatively easily on a Debian system by telling Exim to use all the certificates provided by the ca-certificates package (which is the default configuration). The Windows clients will give an unhelpful the remote end dropped the connection style error, caused by the server getting upset by the unexpected fallback to unencrypted SMTP. The server logs will show something like this:
2009-02-17 21:32:55 TLS error on connection from client.example.com (Client) [192.168.192.168] (gnutls_handshake): A TLS packet with unexpected length was received.
2009-02-17 21:33:00 SMTP protocol synchronization error (input sent without waiting for greeting): rejected connection from H=client.example.com [192.168.192.168] input="EHLO Client\r\n"
Configuring the MAIN_VERIFY_TLS_CERTIFICATES option in the Debian Exim configuration (which sets the tls_verifiy_certificates option in the actual Exim configuration) to point to something with less certificates in should avoid the issue. On the bright side, at least they re making an effort to avoid overflows.

John Goerzen: How To Think About Compression, Part 2

Yesterday, I posted part 1 of how to think about compression. If you haven t read it already, take a look now, so this post makes sense. Introduction In the part 1 test, I compressed a 6GB tar file with various tools. This is a good test if you are writing an entire tar file to disk, or if you are writing to tape. For part 2, I will be compressing each individual file contained in that tarball individually. This is a good test if you back up to hard disk and want quick access to your files. Quite a few tools take this approach rdiff-backup, rdup, and backuppc are among them. We can expect performance to be worse both in terms of size and speed for this test. The compressor tool will be executed once per file, instead of once for the entire group of files. This will magnify any startup costs in the tool. It will also reduce compression ratios, because the tools won t have as large a data set to draw on to look for redundancy. To add to that, we have the block size of the filesystem 4K on most Linux systems. Any file s actual disk consumption is always rounded up to the next multiple of 4K. So a 5-byte file takes up the same amount of space as a 3000-byte file. (This behavior is not unique to Linux.) If a compressor can t shrink enough space out of a file to cross at least one 4K barrier, it effectively doesn t save any disk space. On the other hand, in certain situations, saving one byte of data could free 4K of disk space. So, for the results below, I use du to calculate disk usage, which reflects the actual amount of space consumed by files on disk. The Tools Based on comments in part 1, I added tests for lzop and xz to this iteration. I attempted to test pbzip2, but it would have taken 3 days to complete, so it is not included here more on that issue below. The Numbers Let s start with the table, using the same metrics as with part 1:
Tool MB saved Space vs. gzip Time vs. gzip Cost
gzip 3081 100.00% 100.00% 0.41
gzip -1 2908 104.84% 82.34% 0.36
gzip -9 3091 99.72% 141.60% 0.58
bzip2 3173 97.44% 201.87% 0.81
bzip2 -1 3126 98.75% 182.22% 0.74
lzma -1 3280 94.44% 163.31% 0.63
lzma -2 3320 93.33% 217.94% 0.83
xz -1 3270 94.73% 176.52% 0.68
xz -2 3309 93.63% 200.05% 0.76
lzop -1 2508 116.01% 77.49% 0.39
lzop -2 2498 116.30% 76.59% 0.39
As before, in the MB saved column, higher numbers are better; in all other columns, lower numbers are better. I m using clock seconds here on a dual-core machine. The cost column is clock seconds per MB saved. Let s draw some initial conclusions: The Pretty Charts Now, let s look at an illustration of this. As before, the sweet spot is the lower left, and the worst spot is the upper right. First, let s look at the compression tools themselves: compress2-zoomed At the extremely fast, but not as good compression, end is lzop. gzip is still the balanced performer, bzip2 still looks really bad, and lzma -1 is still the best high-compression performer. Now, let s throw cat into the mix: compress2-big Here s something notable, that this graph makes crystal clear: lzop was just as fast as cat. In other words, it is likely that lzop was faster than the disk, and using lzop compression would be essentially free in terms of time consumed. And finally, look at the cost: compress2-efficiency What happened to pbzip2? I tried the parallel bzip2 implementation just like last time, but it ran extremely slow. Interestingly, pbzip2 < notes.txt > notes.txt.bz2 took 1.002 wall seconds, but pbzip2 notes.txt finished almost instantaneously. This 1-second startup time for pbzip2 was a killer, and the test would have taken more than 3 days to complete. I killed it early and omitted it from my results. Hopefully this bug can be fixed. I didn t expect pbzip2 to help much in this test, and perhaps even to see a slight degradation, but not like THAT. Conclusions As before, the difference in time was far more significant than the difference in space. By compressing files individually, we lost about 400MB (about 7%) space compared to making a tar file and then combining that. My test set contained 270,101 files. gzip continues to be a strong all-purpose contender, posting fast compression time and respectable compression ratios. lzop is a very interesting tool, running as fast as cat and yet turning in reasonable compression though 25% worse than gzip on its default settings. gzip -1 was almost as fast, though, and compressed better. If gzip weren t fast enough with -6, I d be likely to try gzip -1 before using lzop, since the gzip format is far more widely supported, and that s important to me for backups. These results still look troubling for bzip2. lzma -1 continued to turn in far better times and compression ratios that bzip2. Even bzip2 -1 couldn t match the speed of lzma -1, and compressed barely better than gzip. I think bzip2 would be hard-pressed to find a comfortable niche anywhere by now. As before, you can download my spreadsheet with all the numbers behind these charts and the table.

Matt Brown: Blacked Out - no Guilt Upon Accusation

If you re reading this post via the website rather than a feed/planet then you will notice that the site has gone completely black in support of the Creative Freedom Foundation s campaign against S92A of the NZ Copyright Amendment Act which is due to come into effect on 28th February 2009. I ve also joined the wave of people blacking out their avatar on Facebook/Jabber/MSN, etc. S92A introduces Guilt Upon Accusation whereby if you are accused of copyright infringement (downloading music and movies, etc) repeatedly (likely 3 or more times) you are at risk of being disconnected from the Internet by your ISP. The law does not require any proof or substantiation of the accusations and the entire process would occur outside of the courts and the established legal system. Not only does it place every user at risk, the wording is very unclear on exactly what type of organisation is considered an ISP and there is significant concern that schools, businesses, libraries and hospitals will be placed in the difficult position of determining whether their users have broken the law and require disconnection. Opposition to the law is not an attack on copyright, or a statement that we should be free to download all the movies and music that we desire. Those sorts of activities are clearly wrong, and I don t have any issue with copyright holders wanting to enforce their rights when their content is illegally copied. However, disconnecting people upon accusation, with no proof or formal legal process to prove guilt is not the right way to go about it. The fact that the law does not require proof of guilt is only the tip of the iceberg in terms of problems with it. For further background on the problems it causes for ISPs by placing them as the middle-man in copyright disputes you should refer to the following posts: Finally, I think it is worth pointing out that S92A was removed from the proposed Amendment at the select committee stage, but was later reintroduced by Judith Tizard during the final reading of the bill. Mark Harris has an excellent post on the history of the amendment which includes facts such as the official report on the amendment also recommended removing S92A as it was unecessary given existing ISP terms and conditions which forbid illegal activity. The fact that the select committee (based on public submissions) recognised the problems with S92A and removed it, only to have it added back in again at the last stage when we no longer had any say on it really hacks me off and I cant help but feel the influence of the big money American media companies pressuring our politicians to pass a law that they don t really understand the full consequences of. So what is to be done? The Blacked Out campaign, being run by the Creative Freedom Foundation is gathering steam and international attention. Peter Dunne of United Future (who originally voted for the amendment) has declared that the amendment is wrong, and doesn t do what they thought they were voting to do, we need to convince National and the rest of the house of the same. Time is running out for this to happen before the amendment comes into effect on Feb 28th, but there is still time to write to your local MP and sign the petition against S92A Guilt Upon Accusation . The Creative Freedom Foundation site has a nice easy list of what you can do to register your protest.

17 February 2009

Gunnar Wolf: Inviting: First VC for the EDUSOL 2009 Seminar - Thursday, Feb 26

It's time to drive some buzz this way ;-) Although this post will only be a pointer towards the Spanish post I made on Planeta EDUSOL, for reasons soon to become obvious. In any case, the information I'm posting here is not exactly the same. Can you read Spanish? Please go on to the invitation for the first videoconference for the EDUSOL Seminar. This year, we the organizers of the On-line Encounter of Education and Free Software (EDUSOL) are aiming higher - we are not "just" having a two-week encounter at the end of the year - We are having an all-year-long Seminar, focusing on the collaborative construction of knowledge. People from quite distinct backgrounds will be part of this project, and we aim to drive it towards the publication of a book. We (mainly, Alejandro Miranda and me) have been quite busy bootstrapping this seminar, getting the proposed authors, thinking over the intended communication channels and ways, and setting up the needed infrastructure) and are ready to start the public-facing activities. We will be having monthly videoconferencing sessions, the last Thursday each month, 16:00-18:00 Mexico Central time (currently GMT-6; GMT-5 after the beginning of April). The VC sessions will be also relayed through Ogg streams, and we will have an IRC channel available to offer full interactivity for those who do not have access to a H.323 VC setup. This first session will be moderated by Victor Manuel Mart nez; the speakers will be Alejandro Miranda and myself - The topics we will present are: If you have access to videoconferencing facilities, please get in touch with Carlos Cruz, the Videoconferences Coordinator at the Economic Research Institute, as soon as possible for all the needed coordination.

Adrian von Bidder: Bowflex machine

After dropping all (pretense at) regular exercise after leaving high/grammar/secondary school (the german word is Gymnasium) and doing more or less nothing for more than 10 years, I've taken up weight training (after a not very successful attempt at volleyball; I like the sport but the team fell apart) two years ago. Since I actually managed to work out regularly (twice a week) in the first year, and since membership in a gym is not cheap, and since I moved and thus had to find a different solution anyway, I decided to buy a Bowflex Sport home gym. I can't compare it to other home equipment, and it apparently it has been discontinued by Nautilus, but nonetheless, a few thoughts: The conclusion first: Would I buy it again? No. Was it a waste of money? No, it's not that bad. In detail: Closing remarks: I'll probably keep it for quite a while. I've thought about spending much less money and just getting a bench and a few weights, but I really like to have a lat tower. Overall I can do what I want to do with the exception of cardio workouts. The other angle is that there is quite a bit of bad press around about the founder of Nautilus, Arhur Jones. I can't comment on how trustworthy these articles are, and I can't comment on Nautilus' business practices today (Mr. Jones seems to be dead), so take this with a large pinch of salt before making a buying decision based on moral/ethical standards.

Wouter Verhelst: RedHat sucks

So a customer of mine needs to use RedHat. It's not their choice, the choice was forced upon them by the people who wrote the tools they need to use. The new version of this particular tool which they wanted to use requires RHEL5, and they're currently running RHEL4. So I had to upgrade their systems from RHEL4 to RHEL5. No sweat, right? Yeah, right. RedHat has this nice 'Red Hat Network', where you can manage your servers, and remotely mark packages for upgrade. You can also, by way of a command line tool, say that you want it to upgrade from one release to another. This can't be done remotely, which sortof makes sense; upgrading from one release to another might cause problems that you really really don't want if you don't have an immediate shell. So you should use 'up2date --upgrade-to-release=5' to upgrade from RHEL4 to RHEL5. Except that that doesn't work. For some reason, RedHat chose not to support in-place upgrades from RedHat 4 to RedHat 5. Instead, you have to download installation media, boot from them (thereby inducing downtime) and select 'upgrade' in the installer. Which part of this distribution is "Enterprise", again? Oh well. So I download the first ISO, and start the upgrade process. Surely that'll work, right? Hah. No, I really need all six images. So I download them, and start again. Some minutes into the installation, the HP iLO session that I'm using times out, and takes my Virtual CD device with it. As such, the installer-in-upgrade-mode obviously can't find the CD-ROM anymore, and produces a read error. This is totally normal. The system provides me with a 'retry' button. That button doesn't work. That is to say, it works, but after two or so files, the installation goes to a grinding halt. I had to reboot, and start over. So after rebooting, changing my iLO session settings so the timeout is at 120 minutes (the maximum) rather than 30 minutes (what appears to be the default), and I restart the upgrade process, making sure to click in the iLO interface every once in a while to keep it active. When it's somewhere at 80% and 3 hours into the upgrade process (god, why does that have to take so long?), it suddenly finds itself out of disk space. Well, shit happens, of course; guess there's nothing to blame RedHat with that one. But the way this situation is handled, is beyond my comprehension: The only 'recover' option is 'reboot'. There's no 'retry'. I don't mind diving to a second console, mucking about a bit on the mounted partition, and doing 'retry', but the installer doesn't even offer me that option. Instead, I have to choose 'reboot'. Never mind that the system is halfway through an installation process and might be totally and utterly broken, and not even bootable. Well, that's what rescue modes on installation media are for, I guess, but still. After cleaning out some old files that aren't needed anymore and going back to the installer, you'd suppose that the system could figure out what it'd already done, and continue from there, right? Well, no, it can't. It starts over from scratch, thereby forcing me to sit and wait for another three hours. Times like these make me remember why I'm a Debian developer, and not a RedHat one. Why I chose not to finish that Linux From Scratch project that I'd started after using RedHat for three years and about six months before becoming a Debian Developer. Why I stopped hitting my computer screen around that time. Stupid piece of shit. disclaimer: this is all IMAO, and you don't have to agree with me. But what's a blog for, if not to rant? ;-)

Joey Hess: new project

So, I've had this plan for ages to follow up with what I did with my nslu2, and hide a Debian box inside a working stereo. Finally I've started work on this little project. I bought a cheap stereo with CD/tape/radio, mostly on the criteria: I got lucky.. after removing the CD drive, ripping out the battery compartment, and making other modifications to the interior of the case, I had just enough space to fit the qnap board, with centimeters to spare in some places, and millimeters in others. It fits perfectly. The board's LEDs and reset button will be accessible via the CD slot. I was able to keep the radio and amp working. Wiring up a USB sound card to that was easy. I could have kept the cassette deck working, but since I don't have any more of that media, I stripped it, and am planning to put a USB hub in there, accessible by pressing Stop/Eject. ;-) It seems I will even have a fair bit of empty space. Pondering adding a small UPS. Or, I might toss in an access point.

Sami Haahtinen: Know you upgrades, apt-listchanges

As an obligatory note, Debian Lenny was released earlier today. Which means that sysadmins all over the world are starting to upgrade their servers. There is an oddly little known tool that each and every sysadmin should install on at least one server they maintain, called apt-listchanges. It lists changes made to packages since the currently installed version. Sure that information will be overwhelming on major upgrades, but what is useful even on major upgrades is the capability to parse News files in the same way. News files contain important information about the package in question. For example a maintainer could list known upgrade problems there, like is done in the lighttpd package. Or list changes in package specific default behaviour, like is done in Vim package. Sure, you will notice these in time, but it's nice to get a heads up before a problem bites you.

John Goerzen: How To Think About Compression

and the case against bzip2 Compression is with us all the time. I want to talk about general-purpose lossless compression here. There is a lot of agonizing over compression ratios: the size of output for various sizes of input. For some situations, this is of course the single most important factor. For instance, if you re Linus Torvalds putting your code out there for millions of people to download, the benefit of saving even a few percent of file size is well worth the cost of perhaps 50% worse compression performance. He compresses a source tarball once a month maybe, and we are all downloading it thousands of times a day. On the other hand, when you re doing backups, the calculation is different. Your storage media costs money, but so does your CPU. If you have a large photo collection or edit digital video, you may create 50GB of new data in a day. If you use a compression algorithm that s too slow, your backup for one day may not complete before your backup for the next day starts. This is even more significant a problem when you consider enterprises backing up terabytes of data each day. So I want to think of compression both in terms of resulting size and performance. Onward Starting Point I started by looking at the practical compression test, which has some very useful charts. He has charted savings vs. runtime for a number of different compressors, and with the range of different settings for each. If you look at his first chart, you ll notice several interesting things: All this was very interesting, but had one limitation: it applied only to the gimp source tree, which is something of a best-case scenario for compression tools. A 6GB Test
I wanted to try something a bit more interesting. I made an uncompressed tar file of /usr on my workstation, which comes to 6GB of data. My /usr contains highly compressible data such as header files and source code, ELF binaries and libraries, already-compressed documentation files, small icons, and the like. It is a large, real-world mix of data. In fact, every compression comparison I saw was using data sets less than 1GB in size hardly representative of backup workloads. Let s start with the numbers:
Tool MB saved Space vs. gzip Time vs. gzip Cost
gzip 3398 100.00% 100.00% 0.15
bzip2 3590 92.91% 333.05% 0.48
pbzip2 3587 92.99% 183.77% 0.26
lzma -1 3641 91.01% 195.58% 0.28
lzma -2 3783 85.76% 273.83% 0.37
In the MB saved column, higher numbers are better; in all other columns, lower numbers are better. I m using clock seconds here on a dual-core machine. The cost column is clock seconds per MB saved. What does this tell us? Some Pretty Charts First, let s see how the time vs. size numbers look: compress-zoomed Like the other charts, the best area is the lower left, and worst is upper right. It s clear we have two outliers: gzip and bzip2. And a cluster of pretty similar performers. This view somewhat magnifies the differences, though. Let s add cat to the mix: compress-big And finally, look at the cost: compress-efficiency Conclusions First off, the difference in time is far larger than the difference in space. We re talking a difference of 15% at the most in terms of space, but orders of magnitude for time. I think this pretty definitively is a death knell for bzip2. lzma -1 can achieve better compression in significantly less time, and lzma -2 can achieve significantly better compression in a little less time. pbzip2 can help even that out in terms of clock time on multicore machines, but 7za already has a parallel LZMA implementation, and it seems only a matter of time before /usr/bin/lzma gets it too. Also, if I were to chart CPU time, the numbers would be even less kind to pbzip2 than to bzip2. bzip2 does have some interesting properties, such as resetting everything every 900K, which could provide marginally better safety than any other compressor here though I don t know if lzma provides similar properties, or could. I think a strong argument remains that gzip is most suitable for backups in the general case. lzma -1 makes a good contender when space is at more of a premium. bzip2 doesn t seem to make a good contender at all now that we have lzma. I have also made my spreadsheet (OpenOffice format) containing the raw numbers and charts available for those interested. Update Part 2 of this story is now available, which considers more compression tools, and looks at performance compressing files individually rather than the large tar file.

16 February 2009

Randall Donald: Lenny

Started updating our Debian Machines at Hosting Nation to Lenny. Smooth so far.

Joey Hess: debhelper dh overrides

This is a followup to the earlier design of dh. After converting many packages to minimal rules files using dh, I find that it works very well for the 3 line rules file case, which works for 80% of packages. But getting from there to a slightly more complex rules file that 20% of packages need can be non-obvious. So, let's make it obvious. Suppose I want to run dh_compress -Xsomefile. But my rules file as it currently stands doesn't offer an easy place to run that command:
#!/usr/bin/make -f
%:
    dh $@
To use dh in this situation you had to go look up rather a lot of boilerplate, and to insert an explicit version of the right target, with the right dependencies, that called dh before and after your command:
#!/usr/bin/make -f
%:
    dh $@
binary: binary-indep
binary-indep:
    dh $@ --before dh_compress
    dh_compress -Xsomefile
    dh $@ --after dh_compress
That took me half an hour to come up with, and I wrote this stuff! Also, if I want to override a second command, I have to do it in the right order. So, the full flexability of debhelper is there, but it's too hard to get at. Here's the new new thing.
#!/usr/bin/make -f
%:
    dh $@
override_dh_compress:
        dh_compress -Xsomefile
What this does should be obvious. These override targets can be written for any debhelper command that you need to change the default behavior of, or even avoid running at all.
override_dh_auto_configure:
    ./configure --with-kitchen-sink
override_dh_auto_test:
    # The test suite for this package is busted on s390.
    if [ $DEB_BUILD_ARCH != s390 ]; then dh_auto_test; fi
The overrides can also be used to run additional stuff before, or after any debhelper command:
override_dh_clean:
    dh_clean
    rm -rf build_dir
So, I think that's beautiful. Simple, clean, no boilerplate, and intuitively obvious if you are familiar with debhelper.
FWIW, the implementation, which will be in the next debhelper release unless someone screams loudly, is not beautiful. Mostly because I sorta shot myself in the foot with the cute implicit "%:" rules. But, I got around it. :-)

Jon Dowland: hard sf

"Hard SF" is a sub-genre of Science Fiction where "Science" is key. It's very hard to draw solid lines around stories that are examples of Hard SF, but it's easier to provide examples of things which are not: "Star Wars", for example, where space ships, travel and light sabres are window-dressing around a fantasy story. If you look at the Wikipedia article on Hard SF, in particular it's edit history, you will see people continually argue back and forth. Editor Jonathan Strahan recently asked for some recommendations of Hard SF authors to be included in a new Hard SF anthology. I stumbled across this via sfsignal. There are some good comments at both sites, and a fair amount of disagreement over whether certain authors should be considered Hard SF authors or not. Alastair Reynolds was cited by people several times. I really enjoy much of Reynold's writing, but I wouldn't consider it Hard SF. I argued this point and Reynolds himself joined the discussion.
This page is a draft.

Joey Hess: mmmmm

I took the package of blackberries from the freezer, where it had sat, neglected since I picked them from my fecund vines in August. They had some frost on top; it didn't seem that the wait could have improved them. But, I figured, let's do this right. No store-bought pie crust, made my own with lots of love, and no little trepidation, since pie crust is not my strong suite. Put it back in the fridge to rest as I melted the frozen berries. Added some honey, then worried I'd sweetened it too much. Seemed too runny, so added some flour. Spent what seemed a long time criss-crossing strips of the pastry on top. Which, now that I look at it, doesn't seem to be quite the way it's typically done, but whatever. 45 minutes later, it came out, and bliss, it's the most perfect pie I've ever made. Crust acceptably flaky, berries just the right mix of tart and sweet. But mostly, it tastes of summer and care, and the wait seems to have been worth it. So that's my Debian release pie.
On the software side of things, I didn't do anything much toward making this release happen. Indeed, I have forgotten most of what I put into the mix earlier. (Something to do with armel, and firmware, and maybe boot menus?) It was a nice change to sit back and watch and not worry (much) about doing anything myself. I think that someone fell asleep in his chair while running the CD builds and had to get a wakeup call early this morning to finish. Dedication. Seems like there should be a better way, but you can't argue with the result. Previously: Easter Etch, Releases and Such, Where was I When ..

15 February 2009

Michael Prokop: Debian GNU/Linux 5.0 codename Lenny - News for sysadmins

Alright, Debian GNU/Linux 5.0 AKA as Lenny has been released. Time for a Debian unstable unfreeze party! 8-) What does the new stable release bring for system administrators? I ll give an overview what news you might expect when upgrading from Debian GNU/Linux 4.0, codename Etch (released on 8th April 2007) to the current version Debian GNU/Linux 5.0, codename Lenny (released on 14th February 2009). I try to avoid duplicated information so make sure to read the release announcement and the official release notes for Lenny beforehand. Noteworthy Changes Virtualisation Virtualisation related new tools: Desktop oriented packages like virtualbox and qemu are available as well of course. Noteworthy Updates This is a (selective) list of some noteworthy updates: New packages Lenny ships over 7000 new packages. Lists of new/removed/replaced packages are available online. I ll name 238 sysadmin related packages that might be worth a look. (Note: I don t list addon stuff like optional server-modules, docs-only and kernel-source related packages. I plan to present some of the following packages in more detail in separate blog entries.) Further Ressources

Mike Hommey: Testing small upgrades with namespaces and unionfs

If you are following this blog, you probably remember per-process namespaces. Today, I m going to tell you how I did use them in the process of preparing this server to be upgraded to Lenny. I must say I was not using the most recent stuff on this server, and this is why I needed such preparation. First, this server is still running with php4. And well, the following line in the apt-get dist-upgrade output got my full attention (emphasis mine):
The following packages will be REMOVED:
cacti libapache2-mod-php4 libarchive-tar-perl libcurl3-openssl-dev
libgssapi2 libpci2 librpm4 libssp0 linux-kernel-headers modutils php4-mysql
While this server is not important enough not to be broken for a couple hours, I do like to test procedures that could help on servers that are. The first thing I needed to do on this server was obviously to upgrade php. But we all know how php applications are not fully compatible with all versions of php, so I also needed to test the upgrade was not breaking anything. On a server you don t care much about, you can just upgrade, test if all is okay, and be done with it. Obviously, if all is not okay, your visitors will see it, and you may also have a bad time downgrading. Another way to perform the upgrade is to have a similarly installed server on the side, test and validate the upgrade there, and replicate the upgrade on the production server if everything is fine. However, that does require additional resources, and possibly to setup them if they don t already exist. A cheaper way to do the above is to do it on the production server, both in-place and on the side (you ll see what I mean), using unionfs and per-process namespaces. Full containers could be used instead of per-process namespaces (such as openvz, vserver or lxc), but they still require much more setup, especially when you don t use them in the first place. Chroots could work just as well as per-process namespaces, but one of the ideas here is to expose the per-process namespaces feature, and allow for improvement of this procedure with pid and network namespaces, which are not available in Etch (where I m starting from), but are in Lenny. Unionfs allows to merge several directories into a single one, accessing some read-only, and others read-write. Installing unionfs is as easy as running the following command:
apt-get install unionfs-modules- uname -r
I won t describe all the kinds of setups that are possible with unionfs, but only one typical use case, which is what we will be using here:
# mkdir /tmp/root-cow
# mount -t unionfs -o dirs=/tmp/root-cow:/=ro none /mnt
The first thing we do here is to create an empty directory. Next, we merge it with the root filesystem (/), that we will keep read-only (meaning unionfs won t allow itself to write there), and mount the merged filesystem under /mnt. none could just be anything, as there is no device to be mounted. The result, in /mnt, is just something that looks like the root filesystem:
# ls /
bin boot dev etc home initrd lib media mnt opt proc root sbin srv sys tmp usr var
# ls /mnt
bin boot dev etc home initrd lib media mnt opt proc root sbin srv sys tmp usr var
But creating or modifying a file will do so in /tmp/root-cow:
# echo a > /mnt/a
# cat /a
cat: /a: No such file or directory
# cat /tmp/root-cow/a
a
# echo foo.com > /mnt/etc/mailname
# cat /etc/mailname
glandium.org
# cat /tmp/root-cow/etc/mailname
foo.com
# find /tmp/root-cow
/tmp/root-cow
/tmp/root-cow/etc
/tmp/root-cow/etc/mailname
/tmp/root-cow/a
Keep in mind that it doesn t include submounts, though:
# ls /var
backups cache lib local lock log mail opt run spool tmp www
# ls /mnt/var
This means we ll have to also mount /var, /proc, /dev, and /sys. That s enough testing for now, and we ll first do some cleanup before going after the real job:
# umount /mnt
# rm -rf /tmp/root-cow
Using the newns utility from my first post on per-process namespaces, let s create a new namespace to keep our testing private, and populate it with the necessary mount points:
# newns
# umount /tmp
# mount -t tmpfs tmpfs /tmp
# mkdir /tmp/root-cow /tmp/var-cow
# mount -t unionfs -o dirs=/tmp/root-cow:/=ro none /mnt
# mount -t unionfs -o dirs=/tmp/var-cow:/var=ro none /mnt/var
# cd /mnt
# pivot_root . mnt
# mount --move /mnt/proc /proc
# mount --move /mnt/sys /sys
# mount --move /mnt/lib/init/rw /lib/init/rw
# mount --move /mnt/tmp /tmp
# mount --move /mnt/dev /dev
The second and third statements are useful to avoid sharing /tmp with the main namespace, which means the directories we create in the fourth statement won t be visible in /tmp outside this namespace. The fifth and sixth statements put the union filesystems in place. As my system only has a separate /var filesystem (no /usr, and I don t care about /home here), I only need to setup these two. Feel free to add more union filesystems as necessary. The pivot_root call allows to switch to the unionfs ed root: everything under /mnt (/mnt and /mnt/var in our case) will be remounted under /, while what was under / is remounter under /mnt under the new root.
This means, in our case, that we have / and /var as union filesystems, while the old / and /var are respectively in /mnt and /mnt/var. It also means /dev, /proc, /sys and other filesystems are remounted as /mnt/dev, /mnt/proc, /mnt/sys, etc., which is why we next mount --move all of them to a better place in our namespace. Once all this setup is done, we are ready to do our php upgrade test. As Etch doesn t have support for neither PID namespaces nor network namespaces, we ll still have some conflicts with the main namespace for TCP port binding and process handling, so we need to be a little careful:
# rm /var/run/apache2.pid
# echo Listen 8080 > /etc/apache2/ports.conf
With these changes, we can now safely start apache2 in this namespace, at the same time the main apache2 runs in the main namespace:
# /etc/init.d/apache2 start
Now, there are actually 2 problems showing up in apache in this setup. The first one is that displaying static files doesn t work. At all. It appears unionfs doesn t support sendfile(). Which is fine. But apache doesn t check for sendfile() s error cases and doesn t fallback to a working solution when sendfile() doesn t work. So we have to manually disable it:
# echo EnableSendfile off > /etc/apache2/conf.d/sendfile.conf
The second one is that access to the mysql socket doesn t work properly under the unionfs. I didn t want to investigate further, so I only worked around the issue by forcing to use the socket outside the unionfs:
# mount --bind /mnt/var/run/mysqld /var/run/mysqld
Finally, we can test and validate our php upgrade:
# apt-get install php5-mysql php5-cli php5-snmp libapache2-mod-php5
# /etc/init.d/apache2 restart
# apt-get remove --purge php4-common
Note that installing libapache2-mod-php5 will remove libapache2-mod-php4, and apache2 gets restarted, taking into account this change. But the php modules (php5-mysql and php5-snmp) install is only going to happen after that, and no apache2 restart is triggered then, which leaves a half working php setup
Also note that the cacti setup in etch supposes php4 is installed, using a IfModule statement against mod_php4.c and none for mod_php5.c, which means a part of its setup doesn t work out of the box (most notably, the DirectoryIndex). Once all is validated, all we need to do is to stop apache2 and exit from the namespace. The union filesystems and temporary filesystems are then automagically cleaned-up and the namespace disappears as well as all modifications we just did, since all processes using the namespace ended. We are now free to upgrade on the production server, as we know all the side effects. I ll now be able to upgrade to Lenny without php getting removed.

Steve Kemp: Imake art, until someone dies

This weekend I have mostly been investigating Common Lisp. If you're new to the environment then you may get started via a simple:
apt-get install clisp
Once you've done that the following resources will help you decide whether you're wasting your time or not: It has been a long time since I've had so much fun - even though the first thing I did was experiment with implementing a spam filter - although in my defense I was only classifying based upon the links contained in the mails. So for example: (NSFW links) ObFilm: Batman

Jan Wagner: Oh happy day

What a happy day on the wedding anniversary of our civil marriage we got a great gift. Our favorite distribution released a new major version.
Like every time it s the best distribution our project released so far. Many thanks to all those people who did make that happen. If you not married today, maybe you have the possibility to dedicate Lenny to your valentine. :)

Paul van Tilburg: Lenny Released

The long-awaited, big and stable Debian GNU/Linux Lenny 5.0 has been released! Great job everyone and congratulations! In this release the Debian/Ruby Extra team has an ever greater presence. We were able to increase the number of mainted libraries and applications to over 95 packages. Also quite a lot of issues were resolved and I am proud that we obtained this quality level. For Squeeze we plan to deal with the transition to Ruby 1.9 and with possible multiple interpreter-support (still Ruby 1.8, JRuby?). We might also deal with the gems, who knows? :) P.S. Indeed, did I just started posting without explaining why I was away for over 7 months?

Next.

Previous.