Mounting filesystems with fstab

If you’re just switching from Windows and you don’t like to enter passwords every time you want to access your disks, fstab is what you need. Of course it also applies to e.g. ext4 partitions that you didn’t assign a mount point during the installation of your OS, but when you’ve come that far along you probably already know this.

By far the best explanation of fstab I’ve found was on ArchWiki, so I won’t waste my time reiterating what is stated there. I’ll merely try to further clarify a few things that were less immediately obvious to myself and needed a little experimentation.

In many ways fstab is what I always wanted in Windows. For a long, long time I’ve maintained a C partition (dedicated Windows, so I could wipe it without really affecting anything), a D partition (my primary data container), and later, as I added more HDDs, I think I got up to G. There are some hacks available, like NTFS junction points, but they don’t really protect against the fundamental flaw of drive letter assignment compared to the much more sensible mechanism of mount points.

When you mount a partition manually through your GUI, by clicking on it and entering your password, it creates a temporary entry in /etc/mtab; this entry can be used to as a starting point for fstab entries. However, for more reliable partition mounting you need to use UUIDs. You can obtain this using blkid /mnt/sda1, where /mnt/sda1 should be replaced with whatever partition you want to print a UUID for. This command needs to be run as root, i.e. with su or sudo.

# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).

If you prefer to use a GUI, there are some options, but I haven’t tried any of them.

Disk Manager
http://flomertens.free.fr/disk-manager/
PySDM
http://pysdm.sourceforge.net/
fwfstab
http://www.diffingo.com/oss/fwfstab

Comments

Why Opera’s XHTML Error Handling Is Superior

I found this old, unfinished post in my drafts. I’m not quite sure when I originally wrote it, but it was over a year ago. Rather than updating the content I decided to publish it as is, as I’m not sure why I didn’t, with a small addendum at the end.


I made a little compilation of the various error messages displayed by browsers upon encountering an XML syntax error. Firefox (Gecko) has the unfriendly looking error on top, Chromium (Webkit) renders the page up to the error, but shows a large error message (albeit not at all useful like in Opera & Fx), and for Opera I included 10.10 and the latest 10.50 pre-alpha build. Note that it’s just the styles behind the error message that changed a bit: the content and helpfulness of the error message is still the same. I’ll run it down a bit more:

  • Firefox displays an error message that’s only useful if you already know sufficiently much about X(HT)ML, whereas Opera’s error message not only highlights more clearly where parsing failed — although ultimately this difference might just be one of preference. More important, its error message might just helpfully link you precisely where you need to go to learn how to avoid it. When I first started messing about with XHTML back in ’03 or so, I probably would’ve appreciated it if Opera had done that. At the time Opera behaved the same as Fx does now.
  • Chromium displays an error message that doesn’t even manage to clearly indicate what’s the problem. This compares negatively to Fx and Opera highlighting the &.
  • Chromium renders the page up to the problem, which may result in a get out of jail free card. The error message doesn’t seem very annoying, but if the error is in the middle of the page it’ll still be in the way. In my sample page it’s at the end, however. (My example page is basically a standard installation of phpGraphy on which I decided to switch to application/xml+xhtml because it claims to be more or less XHTML compliant now — I had to fix all the unclosed meta and link tags first.)
  • Despite rendering the page, you won’t be able to see the page fully in Chromium. You will with Opera’s reparse as HTML function.

I hope that clarifies why I think Opera’s handling is best, both as a user and as an author.


This blog post is now outdated. You can return to the behavior I hailed by disabling the opera:config#UserPrefs|AutomaticallyreparseXHTMLwithparsingerrorsasHTML option.

Comments

Multiple Nationalities

I seem to have missed Donner’s latest brilliant idea for a new law. It seems that the Dutch government is looking to limit the number of people with multiple nationalities to a minimum. In today’s NRC Handelsblad Ulli d’Oliveira wrote a great opinion piece about the matter on page 14. Some highlights:

De rabiate weerzin in delen van het politieke spectrum tegen het verschijnsel van de meervoudige nationaliteit heeft een gevolg dat pas laat aan het licht kwam – dezelfde beperkingen aan het behouden van de oorspronkelijke nationaliteit die aan buitenlandse aspirant-Nederlanders worden opgelegd, gelden voor Nederlanders die een buitenlandse nationaliteit willen aannemen. Een petitie met meer dan vijftienduizend handtekeningen van mensen in het buitenland keert zich tegen deze collateral damage.

In het nationaliteitsrecht is het nuttig om politics of identity te onderscheiden van politics of interests. De laatste jaren wordt het Nederlandse nationaliteitsrecht gedomineerd door de vurige wens om aan buitenlanders die Nederlander willen worden eerst de eis te stellen dat ze ideaaltypische Nederlanders zijn geworden. Ze zijn ingeburgerd, spreken de taal, participeren in de samenleving, verdienen behoorlijk, hebben hun startkwalificatie op zak, hebben geen strafblad en zo meer – alsof Nederlandse losers niet bestaan. Deze Nederlandse identiteit mag niet worden bezoedeld door vreemde smetten, zoals een buitenlandse nationaliteit. De identiteit van de would-be-Nederlander moet exclusief Nederlands zijn.

Het wetsontwerp houdt geen rekening met burgers. De argumenten van expats zijn verstandig en invoelbaar. Mensen willen settelen in den vreemde zonder hun Nederlanderschap te verloochenen. Om praktische, zakelijke overwegingen nemen ze een vreemde nationaliteit aan, zonder dat ze erover piekeren hun Nederlandse identiteit weg te snijden. Het zijn dezelfde overwegingen die buitenlanders ertoe brengen om Nederlander te willen worden.

Quick, messy, summarizing translation: the dislike in some parts of the political spectrum against multiple nationalities has an unexpected result: the same limitations that apply to aspiring Dutch apply to Dutch people who wish to assume another nationality.

In recent years Dutch politics has been dominated by demanding that foreigners become idealized Dutch people, part of which is being exclusively Dutch.

The law design doesn’t take citizens into account. The arguments made by expatriates are reasonable and can be empathized with. People want to settle in a foreign country without renouncing their Dutch nationality. For practical reasons they assume a foreign nationality without considering cutting off their Dutch identify. These are the same considerations that make foreigners want to assume the Dutch nationality.


I have little to add to that. The whole shebang about multiple nationalities is ludicrous. Perhaps the Dutch municipalities should stop automatically submitting babies born of Moroccan-Dutch parents for Moroccan nationality if it’s truly a problem of such massive scale — although they might’ve stopped it by now, since I think a some Moroccan-Dutch parents sued Amsterdam over this gross misconduct. Nobody will apply for multiple nationalities just for the heck of it.

Comments

Mental Conversations

She remembered the day a furniture van from Portland had shown up with a two-thousand-dollar sectional sofa. Scott had been in his study, writing with the music cranked to its usual deafening levels — she could faintly hear Steve Earle singing “Guitar Town” in the house even with the soundproofing — and interrupting him was apt to do another two thousand dollars’ worth of damage to her ears, in Lisey’s opinion. The furniture guys said “the mister” told them she’d let them know where to put the new piece of furniture. Lisey had briskly directed them to carry the current sofa — the perfectly good current sofa — out to the barn, and place the new sectional where it had been. The color was at least a fair match for the room, and that was a relief. She knew she and Scott had never discussed a new sofa, sectional or otherwise, just as she knew Scott would declare — oh yes, most vehemently — that they had. She was sure he’d discussed it with her in his head; he just sometimes forgot to vocalize those discussions. Forgetting was a skill he had honed (emphasis mine).

From Lisey’s Story by Stephen King (p.148 of the 2006 Scribner hardcover).

My wife alleges I do just that.

Comments

Skype Call Recorder

Skype Call Recorder delivers on the promise of its name. It records calls, with the participants split into two separate channels if you want — which you do if you want the option of raising or lowering the volume of one participant.

Comments

On Critical Thinking

Written in response to someone talking about thinking critically “against the powers that be.”

Given your phrasing, it’s highly improbable that you’re actually talking about critical thinking. One does not think critically against anything. You think critically, period, about everything. Perhaps most important, this includes yourself and your own notions. If you only think critically about (let alone against) others, you’re not thinking critically at all. If you think critically against someone or something, rather than about, you’re just out to find flaws so you can justify your own preconceived notions.

Comments

Some Practical, (Extremely) Simple Algebra

Early in secondary school, many of my classmates used to be exasperated by the perceived lack of practical application of the mathematics we had to learn at the time. I never really understood why, because it had clear practical applications, though I admit I also simply thought it was fun. Later on, things like statistics were really boring, but I figured I’d share how the simplest of elementary algebra can help you make financial choices.

Having just moved, we had to decide whether or not to buy a washing machine. Washing machines start at about €400 — they can be obtained used for much less, but last time I picked up a used washing machine for €40 it broke within about a year and it’s just so much trouble trying to fix it or getting yet another used replacement — while laundromats cost about €3-4 per load (+20 cents for detergent). Admittedly the load sizes are slightly larger at the laundromat, but I don’t see that as a good thing: it just makes it harder to carry and dry the laundry.

Washing costs per load for various temperatures in € according to Nibud
temperature/ type of costs 90°C 60°C 40°C
electricity 0.48 0.25 0.15
water 0.10 0.08 0.08
washing powder 0.19 0.19 0.19
depreciation / maintenance 0.48 0.48 0.48
total 1.25 1.00 0.90
total without depreciation 0.77 0.52 0.42

We usually wash on 30 degrees and have an otherwise energy and water efficient washing machine, but I’ll just run with the price for a single wash without depreciation value. I’m not interested in depreciation of the value of the washing machine, since the point is how many times you have to wash to break even compared to the laundromat. Of course a depreciation value could be used for this so that ax = bx should yield a useful conclusion, but that’d be a bit of a roundabout way.

I devised the following simple formula: ax = bx + c, where a is the cost of one load at the laundromat, b is the cost of one load in a self-owned washing machine, and c is the price of a washing machine. x is the break even point of the number of washes required to make it worth your while to buy a washing machine as opposed to utilizing a laundromat.

3.20x = .42x+480 (-.42x)
2.78x = 480
x=480/2.78=173

I haven’t counted the number of times we’ve washed, but if we haven’t surpassed it yet, I bet we’re quite close. We’ve had it for nearly two years and we wash slightly more than once a week on average.

Comments

Liberty

Lost now to family, buddies, girlfriend, rabbit hound, society, and himself, this poor young sailor had fallen—not very many miles from Jerusalem—understanding virtually nothing of the situation in the Middle East. He probably believed it involved a struggle between right and wrong, good and evil, freedom and oppression. That was his second mistake. His third mistake was in trusting that even if he didn’t understand the situation, his leaders did. His first—and worst—mistake was blindly doing what he was told to do. Without questioning their methods or their motives, he allowed politicians to make the decisions that led to his early demise.

What is politics, after all, but the compulsion to preside over property and make other people’s decisions for them? Liberty, the very opposite of ownership and control, cannot, then, result from political action, either at the polls or the barricades, but rather evolves out of attitude. If it results from anything, it may be levity.

From Skinny Legs And All by Tom Robbins (p.118 of the May 2003 Bantam trade paperback reissue).

Comments

Switching µTorrent from Windows to Linux

A while ago, I wrote about using Wine in order to switch completely to Linux a lot quicker than would be possible if you had to figure out replacements for various pieces of peripheral software. In the case of µTorrent this meant that I could keep on seeding all the torrents I’ve downloaded over the years and not having to set up my RSS feeds and other preferences once more, but it’s not all sunshine. Aside from minor bugs in Wine, it simply uses a lot more memory and sometimes CPU. As an unscientific guestimate, it seems about 5 times as memory hungry as on Windows.

In the not too distant past, fixing this would’ve required a switch to e.g. qBittorrent, but an alpha version of µTorrent Server is now available for Linux. It can do everything normal µTorrent can, but not everything is necessarily available through its default WebUI. Luckily an alternative WebUI is available and I’d highly recommend it over what comes with the µTorrent Server by default. It enables RSS feeds and filters, among other things. I think it’s probably no more than a newer version, so perhaps you can ignore this part of this post if you’re reading this in a few months time.

One thing that doesn’t seem to be mentioned in the documentation anywhere is that you can access the WebUI through http://localhost:8080/gui/.

Now for switching over the data and configuration files. Luckily µTorrent for Linux uses the same data files, so you can easily copy over rss.dat (feeds configuration) and resume.dat (locations of torrents). Of course that won’t fix the problem that directory structures are slightly different on the respective platforms, and I don’t think you can make symbolic links to drive letters except in Wine. That’s where BEncode Editor comes in, as described in an article about moving your µTorrent files. I couldn’t find a similar utility for Linux, but no matter, it works quite well in — drum roll — Wine. I downloaded version 0.7.1.0, the latest at the time of writing.

You should read through the guide I linked, but of course some slight adjustments will have to be made. In my case I did some reorganizing of my HDDs after I hadn’t booted into Windows for a month, but the differences for my torrents weren’t that big. I replaced D:\downloads\torrents\ globally with /media/downloads/torrents/ as outlined in the text. I repeated similar commands for my E:\ and I:\, but of course the specifics will be different for everyone. To finish it off you can replace all instances of \ with /.

Something similar can be done for rss.dat, but I had already adjusted all my filters manually in the µTorrent WebUI.

Assuming you run this command in the directory where you put the µTorrent Server executable, you can run cp /somewhere/uTorrent-for-Windows-folder/*.torrent to copy over all the relevant *.torrent files.

There are some slight inconveniences. For example, you can’t open in folder directly, but you have to navigate there manually or copy the location from the WebUI. However, if you were using Wine you’d already given up on proper integration regardless. I think it’s easier to copy the proper Linux path from the WebUI than to mentally line up Wine drives and directories with real ones.

As one final caveat this method didn’t seem to remember proper times when downloads finished and instead “downloaded” all my torrents at that point in time. I’m sure that could be avoided somehow (perhaps by copying over settings.dat?) but for my purposes it didn’t matter.

Comments

More Fun with Screen and SSH with Byobu: Automatic Reattaching

A while ago I wrote about screen, which makes your SSH experience more satisfying. There are some enhancements you can make to screen with .screenrc, but Byobu does more by default than I ever could be bothered to figure out. It seems to come pre-installed on Ubuntu, while aptitude install byubo suffices for Debian.

I thought it’d be even better if screen automatically attached itself when logging in through SSH, and clearly I wasn’t alone in that thought. I made a slight adjustment to the code I found so that Byobu is utilized when available and otherwise regular screen will load. Screen is often installed by default, unlike Byobu, so that way I won’t have to install or compile Byobu to reap the benefits of my custom .bashrc.

# From http://tlug.dnho.net/node/239
# "The following code when added to your .bashrc file will, after logging in via ssh, look for any unattached screen sessions and automatically attach to the first one found. If only attached sessions are found then a list of these will be outputted to std out. Finally, If there are no screen sessions running at all then a new screen session will be created."
if [ $SSH_TTY ] && [ ! $WINDOW ]; then
	SCREENLIST=`screen -ls | grep 'Attached'`
	if [ $? -eq "0" ]; then
		echo -e "Screen is already running and attached:\n ${SCREENLIST}"
	else
		type -P byobu &>/dev/null && byobu -U -R || screen -U -R
	fi
fi
# Optionally adding the following will alter your prompt to let you easily know which window within a screen session you are currently in.
if [ $TERM = "screen" ]; then
	PS1='window ${WINDOW} '$PS1
fi

Comments

Older Entries »