<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>therning.org/ magnus &#187; linux</title>
	<atom:link href="http://therning.org/magnus/archives/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://therning.org/magnus</link>
	<description>Incoherent mumblings</description>
	<lastBuildDate>Wed, 17 Mar 2010 00:39:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Moving to Arch Linux</title>
		<link>http://therning.org/magnus/archives/577</link>
		<comments>http://therning.org/magnus/archives/577#comments</comments>
		<pubDate>Tue, 28 Apr 2009 21:56:48 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=577</guid>
		<description><![CDATA[&#60;rant>So my irritation with Debian on the desktop reached a critical moment
over the last few days.  Sid is a good desktop system for most things, but if
you are interested in Haskell then you really should prepare yourself for
being a little behind on things.  If it isn&#8217;t GHC that is out of date then
it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;rant>So my irritation with Debian on the desktop reached a critical moment
over the last few days.  Sid is a good desktop system for most things, but if
you are interested in Haskell then you really should prepare yourself for
being a little behind on things.  If it isn&#8217;t GHC that is out of date then
it&#8217;s some library that hasn&#8217;t been rebuilt for the latest version of GHC.  If
you&#8217;re lucky then new packages are uploaded to the NEW queue and it&#8217;s only a
matter of waiting for the autobuilders to get to them.  Of course that doesn&#8217;t mean you can get those packages, so not that much luck in the end anyway.&lt;/rant></p>

<p>I decided to move to the only other distro I&#8217;ve used seriously since Linux&#8217;
move to 2.x kernels, <a href="http://www.archlinux.org/">Arch</a>.  I remember it as a slightly less polished
than Debian, but more up-to-date than even Sid.  Also, there is a vibrant
group of Haskell hackers working on providing almost all of Hackage in Arch&#8217;s
native packaging system.</p>

<p>Installing Arch turned out to be a bit of a blast from the past, even when
compared to Debian.  Luckily the <a href="http://wiki.archlinux.org/">Arch wiki</a> is there to help with the
things that are different compared to Debian.  I would suggest having a second
computer with a browser pointed to Arch&#8217;s home pages nearby during the entire
install.</p>

<p>For my installation of Debian I had opted to use LVM and I wanted to keep my
<code>/home</code> around so I had to follow the steps required to <a href="http://wiki.archlinux.org/index.php/LVM2">use LVM in Arch</a>.
Installation went smooth and the reboot was successful.  Now starts the hard
work&#8212;configuring the system and updating my home folder.</p>

<p>The very first thing I noticed was that <code>vim</code> wasn&#8217;t installed by default,
only <code>vi</code> was available.  Not a big problem, except that my muscle memory
resulted in a lot of <code>vim: command not found</code> messages.  Clearly I had to install <code>vim</code> just
to keep my sanity.</p>

<p>Next thing to do was to install X.org and the video driver I need:</p>

<pre><code># pacman -S xorg xf86-video-intel
</code></pre>

<p>After adding <code>hal</code> to <code>/etc/rc.conf</code> I started it manually and I ran <code>startx</code>
as non-root.  Wow, it all worked perfect, without creating any configuration
file for X first.  I double checked and it used the driver I wanted, i.e. it
didn&#8217;t pick a safe default, like vesa, as its first option.  Brilliant.</p>

<p>After following the <a href="http://wiki.archlinux.org/index.php/Xorg#Setting_non-us_keyboard_without_xorg.conf">instructions for changing the keyboard layout in X.org
using hal</a> I even had my &#8216;@&#8217; on the right key.  (The most confusing thing
was that in X.org the UK keyboard layout is called <code>gb</code>, while in the console
setup it&#8217;s called <code>uk</code>.)</p>

<p>I&#8217;ll post a bit more about the setup and configuration of my system as I
progress towards my ideal desktop.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/577&amp;title=Moving to Arch Linux' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/577&amp;title=Moving to Arch Linux' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/577#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/577/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>VirtualBox with Linux 2.6.29</title>
		<link>http://therning.org/magnus/archives/549</link>
		<comments>http://therning.org/magnus/archives/549#comments</comments>
		<pubDate>Wed, 01 Apr 2009 05:57:31 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=549</guid>
		<description><![CDATA[After a recent upgrade which brought in kernel 2.6.29 VirtualBox stopped working for me; the kernel module failed to find the symbol g_SUPGlobalInfoPage.  How irritating!

Here&#8217;s a solution I found:


Modify /usr/share/virtualbox/src/vboxdrv/Makefile, uncomment the line

# VBOX_USE_INSERT_PAGE = 1

Recompile the kernel modules:

# /etc/init.d/vboxdrv setup



Now I only have to find a solution for the second problem that upgrade [...]]]></description>
			<content:encoded><![CDATA[<p>After a recent upgrade which brought in kernel 2.6.29 VirtualBox stopped working for me; the kernel module failed to find the symbol <code>g_SUPGlobalInfoPage</code>.  How irritating!</p>

<p>Here&#8217;s a <a href="http://www.virtualbox.org/ticket/3403">solution</a> I found:</p>

<ol>
<li><p>Modify <code>/usr/share/virtualbox/src/vboxdrv/Makefile</code>, uncomment the line</p>

<pre><code># VBOX_USE_INSERT_PAGE = 1
</code></pre></li>
<li><p>Recompile the kernel modules:</p>

<pre><code># /etc/init.d/vboxdrv setup
</code></pre></li>
</ol>

<p>Now I only have to find a solution for the second problem that upgrade brought in, deskbar-applet failing to load in the Gnome panel.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/549&amp;title=VirtualBox with Linux 2.6.29' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/549&amp;title=VirtualBox with Linux 2.6.29' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/549#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/549/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning audio CDs on Linux</title>
		<link>http://therning.org/magnus/archives/363</link>
		<comments>http://therning.org/magnus/archives/363#comments</comments>
		<pubDate>Fri, 08 Aug 2008 21:42:22 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[cd burning]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=363</guid>
		<description><![CDATA[I just had a blast from the past!

Being somewhat spoiled by the current state of Linux-on-the-desktop (Gnome in my case) I have become used to inserting a blank CD, point Nautilus to burn:///, dragging and dropping a few files into it, and finally clicking the &#8220;Burn to CD&#8221; button.  Works beautifully.  Of course [...]]]></description>
			<content:encoded><![CDATA[<p>I just had a blast from the past!</p>

<p>Being somewhat spoiled by the current state of Linux-on-the-desktop (Gnome in my case) I have become used to inserting a blank CD, point Nautilus to <code>burn:///</code>, dragging and dropping a few files into it, and finally clicking the &#8220;Burn to CD&#8221; button.  Works beautifully.  Of course I thought that Nautilus&#8217; CD-burning would know about audio CDs.  So I dragged a few WAV files into Nautilus and clicked the button.  Voilà, a data CD containing a few Wav files!  Not really what I wanted.</p>

<p>So, to avoid this in the future here is the command line to use:</p>

<pre><code>wodim -v dev=0,0,0 speed=40 -audio -pad *.wav
</code></pre>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/363&amp;title=Burning audio CDs on Linux' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/363&amp;title=Burning audio CDs on Linux' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/363#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/363/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dealing with life in Haskell</title>
		<link>http://therning.org/magnus/archives/349</link>
		<comments>http://therning.org/magnus/archives/349#comments</comments>
		<pubDate>Thu, 01 May 2008 21:31:11 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perforce]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=349</guid>
		<description><![CDATA[I bet you have at least one silly little thing at work that, whenever it happens, you let out a sigh, maybe roll your eyes and whish that everyone would use a proper operating system.  A few days I finally decided to do something about one of my things like that.  At work, [...]]]></description>
			<content:encoded><![CDATA[<p>I bet you have at least one silly little thing at work that, whenever it happens, you let out a sigh, maybe roll your eyes and whish that everyone would use a proper operating system.  A few days I finally decided to do something about one of my things like that.  At work, Windows users will at times for some strange reason, manually create directories inside their work area, even though the directories actually are under version control.  Invariably they get the case wrong and due to an onfortunate combination of case insensitive filesystem on the client (Windows) and a version control system the cares about case (Perforce).  This results in files ending up all over the place even though they belong in the same directory.  The Windows users are none the wiser, they simply don&#8217;t see the problem.  Since I use a sane system (Linux) I do notice, and when I see it I sigh and roll my eyes.</p>

<p>Here&#8217;s my take on solving the problem:</p>

<pre><code>module Main where

import Control.Monad
import Data.Char
import System.Directory
import System.Environment
import System.FilePath
import System.IO.HVFS.Utils
import System.Posix.Files

data IFile = IFile
    { iFileIPath :: FilePath
    , iFileIName :: FilePath
    , iFileFull :: FilePath
    } deriving (Show)

toIFile :: FilePath -&gt; IFile
toIFile fp =  IFile path file fp
    where
        path = map toLower $ takeDirectory fp
        file = map toLower $ takeFileName fp

listFilesR :: FilePath -&gt; IO [IFile]
listFilesR path =
    recurseDir SystemFS path &gt;&gt;=
    filterM doesFileExist &gt;&gt;=
    mapM (return . toIFile)

linkFile :: FilePath -&gt; IFile -&gt; IO ()
linkFile dest ifile = do
        createDirectoryIfMissing True newDir
        createLink (iFileFull ifile) newFile
    where
        newDir = normalise $ dest &lt;/&gt; (iFileIPath ifile)
        newFile = newDir &lt;/&gt; (iFileIName ifile)

main :: IO ()
main = do
    args &lt;- getArgs
    listFilesR (args !! 0) &gt;&gt;= mapM_ (linkFile $ args !! 1)
</code></pre>

<p>Yes, this is the <a href="http://therning.org/magnus/archives/348">code</a> I wrote in Literate Haskell, but I think I&#8217;d better not disclose my rant against clueless Windows users publically <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/349&amp;title=Dealing with life in Haskell' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/349&amp;title=Dealing with life in Haskell' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/349#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/349/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LVM rocks!</title>
		<link>http://therning.org/magnus/archives/307</link>
		<comments>http://therning.org/magnus/archives/307#comments</comments>
		<pubDate>Wed, 11 Jul 2007 15:02:13 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/archives/307</guid>
		<description><![CDATA[I knew my persistence with using LVM would pay off one day. Despite the little mishap I had last year  

For a shiny new install of 64-bit Debian I chose to let the installer partition up my entire harddisk and instructed it to use LVM. This morning I noticed that the root partition was [...]]]></description>
			<content:encoded><![CDATA[<p>I knew my persistence with using LVM would pay off one day. Despite the little mishap I had <a href="http://therning.org/magnus/archives/122">last year</a> <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p>For a shiny new install of 64-bit Debian I chose to let the installer partition up my entire harddisk and instructed it to use LVM. This morning I noticed that the root partition was down to only 25% free space and during an upgrade it ran out of space. Not really a good thing. So, shut down the machine and out with the extra harddisk I&#8217;ve been putting off sticking in the machine. Here&#8217;s what I did after booting:</p>

<ol>
<li><p>Create a single large partition and make it of type <code>Linux LVM</code> (<code>8e</code>) using <code>cfdisk</code>.</p></li>
<li><p>Prepare the new partition for use with LVM:</p>

<pre><code># pvcreate /dev/sdb1
</code></pre></li>
<li><p>Add the new &#8216;physical volume&#8217; into the &#8216;virtual group&#8217;:</p>

<pre><code># vgextend mainvg /dev/sdb1
</code></pre></li>
<li><p>Extend the &#8216;logical volume&#8217; where root lives:</p>

<pre><code># lvextend --extents +50%LV /dev/mainvg/root
</code></pre></li>
<li><p>Then it turns out that Ext3 has no problem with extending a mounted filesystem so the last step was easy, but a little nerve wrecking since it was my root partition:</p>

<pre><code># resize2fs /dev/mainvg/root
</code></pre></li>
</ol>

<p>All done!</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/307&amp;title=LVM rocks!' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/307&amp;title=LVM rocks!' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/307#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/307/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One-track thinking (unlocking root)</title>
		<link>http://therning.org/magnus/archives/204</link>
		<comments>http://therning.org/magnus/archives/204#comments</comments>
		<pubDate>Wed, 04 Oct 2006 09:55:58 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mulinux]]></category>
		<category><![CDATA[st00pid]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/archives/204</guid>
		<description><![CDATA[It seems I never quite learn. I like a clean system, so when I get a chance I remove unused packages. This practice has gotten me in trouble before. It got me in trouble again just the other day.

My now second machine used to be my primary. When it was demoted I left GNOME installed [...]]]></description>
			<content:encoded><![CDATA[<p>It seems I never quite learn. I like a clean system, so when I get a chance I remove unused packages. This practice has gotten me in <a href="http://therning.org/magnus/archives/122">trouble before</a>. It got me in trouble again just the other day.</p>

<p>My now second machine used to be my primary. When it was demoted I left GNOME installed on it since you never know when it might come in handy. Over the last few months I&#8217;ve had no use for a GUI on it at all so last Friday I decided to remove GNOME. That got me in trouble because <code>sudo</code> is installed as a dependency of GNOME&#8217;s, and it&#8217;s marked &#8220;automatic&#8221; in <code>aptitude</code>. Couple that with my habit of locking the <code>root</code> account and I ended up with a system that I don&#8217;t have full access to anymore. Not good!</p>

<p>My immediate thought was to boot a live CD, <code>chroot</code> to the root filesystem of the installed system and unlock the <code>root</code> password. Except the damn box refused to boot from CD. I tried all my live and install CDs, Ubuntu (Breezy and Dapper), Knoppix, STD, Debian install (Woody and Sarge). Nothing worked.</p>

<p>A short search later and I found <a href="http://mulinux.dotsrc.org/">muLinux</a>. A one-floppy live system that on paper seemed capable of doing what I needed. Now I had another problem, where do I get a floppy nowadays? The system admins downstairs had one they could spare. Good! Next problem&#8212;where to find a machine with a floppy drive that I can use to create the floppy?</p>

<p>That&#8217;s when it hit me. This plan wasn&#8217;t the best one, it just happened to be the first one that popped into my mind. I had been too focused on my first idea to take the time to stop and think of other ways of getting my <code>root</code> account back.</p>

<p>In the end I didn&#8217;t need to use a live CD/floppy, I could just use the system already present on the box:</p>

<ol>
<li>Boot straight into <code>bash</code> by sticking <code>init=/bin/bash</code> on the boot line in GRUB</li>
<li>Remount the root filesystem, <code>mount -o remount,rw /</code></li>
<li>Unlock the password, <code>passwd -u root</code></li>
</ol>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/204&amp;title=One-track thinking (unlocking root)' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/204&amp;title=One-track thinking (unlocking root)' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/204#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/204/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Banging my head against sparse files</title>
		<link>http://therning.org/magnus/archives/156</link>
		<comments>http://therning.org/magnus/archives/156#comments</comments>
		<pubDate>Tue, 11 Jul 2006 23:22:21 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sparse files]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/archives/156</guid>
		<description><![CDATA[Lately I&#8217;ve had use for sparse files to solve a problem. Simple, yes. Use lseek and write (or read). Even better, at least in this case, use pwrite and pread. Should be simple, right? Yes, should be.

I was banging my head against code equivalent to the following for quite a few hours:

#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve had use for sparse files to solve a problem. Simple, yes. Use <code>lseek</code> and <code>write</code> (or <code>read</code>). Even better, at least in this case, use <code>pwrite</code> and <code>pread</code>. Should be simple, right? Yes, should be.</p>

<p>I was banging my head against code equivalent to the following for quite a few hours:</p>

<pre><code>#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64
#include &lt;errno.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;sys/stat.h&gt;

char buf[1024];

int
main(int argc, char **argv)
{
    int n;
    off_t off;

    for(n = 0; n &lt; 1024; n++) {
        buf[n] = 'a';
    }

    int fd1;

    if(-1 == (fd1 = open("file1", O_WRONLY | O_CREAT, 0666)))
        error(EXIT_FAILURE, errno, "open (test1)");
    off = 0x80000000;
    printf("size: %d\n", sizeof(off));
    if(pwrite(fd1, buf, 1024, off) != 1024)
        error(EXIT_FAILURE, errno, "pwrite (%lli)", off);

    return(0);
}
</code></pre>

<p>Can you spot the problem?</p>

<p>Well, I can tell you it doesn&#8217;t work. <code>off_t</code> becomes 64-bit due to the <code>#define _FILE_OFFSET_BITS 64</code> so the <code>off</code> variable isn&#8217;t negative <em>in my code</em>. Somehow however it becomes negative on the way into <code>pwrite</code>, and without a single compiler or linker error at that!</p>

<p>Have you spot the problem yet?</p>

<p>Here&#8217;s the correctly working code:</p>

<pre><code>#define _XOPEN_SOURCE 500
#define _FILE_OFFSET_BITS 64
#include &lt;errno.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;sys/stat.h&gt;
#include &lt;unistd.h&gt;

char buf[1024];

int
main(int argc, char **argv)
{
    int n;
    off_t off;

    for(n = 0; n &lt; 1024; n++) {
        buf[n] = 'a';
    }

    int fd1;

    if(-1 == (fd1 = open("file1", O_WRONLY | O_CREAT, 0666)))
        error(EXIT_FAILURE, errno, "open (test1)");
    off = 0x80000000;
    printf("size: %d\n", sizeof(off));
    if(pwrite(fd1, buf, 1024, off) != 1024)
        error(EXIT_FAILURE, errno, "pwrite (%lli)", off);

    return(0);
}
</code></pre>

<p>Don&#8217;t see any difference? Look at the list of included files!</p>

<p>Let me just say the C and I aren&#8217;t on speaking terms at the moment!</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/156&amp;title=Banging my head against sparse files' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/156&amp;title=Banging my head against sparse files' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/156#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/156/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Being st00pid with LVM</title>
		<link>http://therning.org/magnus/archives/122</link>
		<comments>http://therning.org/magnus/archives/122#comments</comments>
		<pubDate>Thu, 20 Apr 2006 08:12:28 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[st00pid]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/archives/122</guid>
		<description><![CDATA[Well, this is the first entry in my st00pid category. I make quite a few mistakes when using Linux, mistakes that take time and effort to fix. From now on I&#8217;ll swallow my pride and write down, in a public place like this, about what st00pid things I do. Most importantly I&#8217;ll also write down [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this is the first entry in my st00pid category. I make quite a few mistakes when using Linux, mistakes that take time and effort to fix. From now on I&#8217;ll swallow my pride and write down, in a public place like this, about what st00pid things I do. Most importantly I&#8217;ll also write down what I did to get my Linux system back to the state it was before my brain temporarily popped out for a coffee.</p>

<p>I like keeping my Debian systems minimal. When running Sid there ends up being quite a few upgrades to download and when dependencies change your system ends up having &#8220;orphaned&#8221; packages, i.e. packages that were pulled in to satisfy a dependency but by now the dependent package has since moved on (or been deleted). This is of course a worrying thought, packages are installed that don&#8217;t actually need to be present on the system. My stomach&#8217;s turning. Some people use aptitude to handle this, personally I&#8217;ve never really like <code>aptitude</code> and I use <code>debfoster</code>.</p>

<p>Yesterday, after a sizable upgrade of my system at work I ran <code>debfoster</code> to prune orphaned packages. This was in fact the first time I ran it after setting up the system which resulted in quite a few questions regarding whether to keep specific packages or not. <strong>This is about the time when my brain popped out for a coffee.</strong> When asked if I wanted to keep <code>lvm2</code> or not there was no brain to consult and I answered <em>no</em>. Had the brain been around it would have reminded me that I opted to use logical volumes on that particular machine (for two reasons, 1) I had never done it before and it&#8217;s damn cool, and 2) it makes the system a bit more flexible and future proof).</p>

<p>After a reboot I was sitting there with a system that was fairly useless since the root partition couldn&#8217;t be mounted. A quick calculation of just how long it&#8217;d take me to re-install later, I popped in the only live CD I had available at work&#8211;Ubuntu 5.04, Hoary Hedgehog. Using that I found a page on the Knoppix Wiki on <a href="http://www.knoppix.net/wiki/LVM2">how to use LVM2 with Knoppix</a>. Now armed with something that looked like a workable plan I did the following in a terminal</p>

<pre><code>$ sudo su -
# modprobe dm-mod
# vgscan
# vgchange -a y
# cd /mnt; mkdir debsys
</code></pre>

<p>Then I went ahead and mounted the root partition on <code>/mnt/debsys</code>. I also mounted the other partitions I have on my installed system, <code>/var</code>, etc. Then to get into it and fix it I</p>

<pre><code># chroot /debsys
# apt-get install lvm2 lvm-common
</code></pre>

<p>Except <code>lvm2</code> refused to install, it complained about the kernel being too old. Not surprising since Hoary is getting really old by now. to get around that I downloaded the source for <code>lvm2</code>, modified <code>debian/preinst</code> so that the kernel version check was skipped, re-built the package, and installed it. Worked like a charm.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/122&amp;title=Being st00pid with LVM' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/122&amp;title=Being st00pid with LVM' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/122#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/122/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VMWare server to the rescue</title>
		<link>http://therning.org/magnus/archives/121</link>
		<comments>http://therning.org/magnus/archives/121#comments</comments>
		<pubDate>Tue, 18 Apr 2006 19:07:36 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vmware server]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/archives/121</guid>
		<description><![CDATA[I complained earlier about VMWare Player not allowing me to replace my Windows boxen at work. It seems VMWare took my complaints seriously (yeah right), by releasing VMWare Server they&#8217;ve made my dream possible.

I have to admit that their releasing VMWare Server is surprising, and since it allows creation of new images it makes the [...]]]></description>
			<content:encoded><![CDATA[<p>I complained <a href="http://therning.org/magnus/archives/74/">earlier</a> about VMWare Player not allowing me to replace my Windows boxen at work. It seems VMWare took my complaints seriously (yeah right), by releasing VMWare Server they&#8217;ve made my dream possible.</p>

<p>I have to admit that their releasing VMWare Server is surprising, and since it allows creation of new images it makes the limitation of VMWare Player rather strange. Well, I&#8217;m not complaining. I&#8217;ve finally been able to purge Windows from my desk. From today on all my Windows boxen will be VMWare images accessed from my Linux machine. Brilliant. Thank you VMWare!</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/121&amp;title=VMWare server to the rescue' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/121&amp;title=VMWare server to the rescue' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/121#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/121/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux and explaining the Swedish(-speaking) people</title>
		<link>http://therning.org/magnus/archives/91</link>
		<comments>http://therning.org/magnus/archives/91#comments</comments>
		<pubDate>Wed, 04 Jan 2006 11:45:29 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux journal]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=91</guid>
		<description><![CDATA[I found the following in Linux Journal. It can be found on this page, I&#8217;ve copied it verbatim since I couldn&#8217;t find a link that leads straight to the interesting part!

Might Be Just Right

by Doc Searls

At LinuxWorld in Boston earlier this year, I got together with an old Swedish friend. She&#8217;s a nurse, not a [...]]]></description>
			<content:encoded><![CDATA[<p>I found the following in <a href="http://www.linuxjournal.com/">Linux Journal</a>. It can be found on <a href="http://www.linuxjournal.com/article/8542">this page</a>, I&#8217;ve copied it verbatim since I couldn&#8217;t find a link that leads straight to the interesting part!</p>

<h3>Might Be Just Right</h3>

<p>by Doc Searls</p>

<p>At LinuxWorld in Boston earlier this year, I got together with an old Swedish friend. She&#8217;s a nurse, not a technologist, but she was curious about my work and the conference that brought me to town. Somewhere in the midst of my explanation of Linux and its virtues, she said, &#8220;Ah, Linux is lagom&#8221;. She explained that lagom is a Swedish term that conveys a sense of balance, proportion and appropriateness. &#8220;Not too much, not too little&#8230;just right.&#8221;</p>

<p>When I told her that Linus Torvalds&#8217; first language and surname were both Swedish, she said, &#8220;Well of course. There you go.&#8221; (I&#8217;m half-Swedish myself, though I&#8217;m not sure that matters.)</p>

<p>So I put the question &#8220;Is Linux logom?&#8221; to The Man Himself in an e-mail. He debugged my spelling and declined to commit:</p>

<blockquote>
  <p>Lagom, with an &#8220;a&#8221;.</p>
  
  <p>And yes, it means &#8220;just right&#8221;, in the sense of &#8220;not too much, not too little&#8221;. See <a href="http://en.wikipedia.org/wiki/Lagom">en.wikipedia.org/wiki/Lagom</a></p>
</blockquote>

<p>Then he added, in a following e-mail:</p>

<blockquote>
  <p>They still end up confusing &#8220;lagom&#8221; with finding the &#8220;optimal&#8221; amount. That&#8217;s pretty much missing the point. It&#8217;s not that something is &#8220;lagom&#8221; because it&#8217;s the best possible or &#8220;optimal&#8221;. Quite the reverse. Something being &#8220;lagom&#8221; very much involves not caring too much about what the optimal amount even is. Or possibly questions where &#8220;optimal&#8221; simply doesn&#8217;t make sense.</p>
</blockquote>

<p>So I began checking other sources. The best I found was from &#8220;In Other Words&#8221;, published in AskOxford, published by the Oxford English Dictionary (<a href="http://www.askoxford.com/worldofwords/wordfrom/otherwords">www.askoxford.com/worldofwords/wordfrom/otherwords</a>). It lists lagom among a handful of &#8220;the most insightful, intriguing, and satisfying expressions on the planet-for which there are no English equivalents&#8221;. It says:</p>

<blockquote>
  <p>Swedish commentator Dr Bengt Gustavsson argued that the lagom mentality can be seen as the trait that gives Swedish society its characteristic stability and yet an openness to external influences. The word alludes subconsciously to the avoidance of both conspicuous success and humiliating failure, which is deeply ingrained in the Swedish psyche. It is the inclination among Swedes to shun ostentation, accept modest rewards, be good team players-to fly beneath the radar.</p>
</blockquote>

<p><i>Beneath the Radar</i> was also the title of Bob Young&#8217;s book about starting and guiding Red Hat to success. Coincidence?</p>

<p>Perhaps characteristically, Linus adds these final words to the matter: &#8220;but whether that applies to Linux I have no idea.&#8221;</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/91&amp;title=Linux and explaining the Swedish(-speaking) people' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/91&amp;title=Linux and explaining the Swedish(-speaking) people' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/91#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/91/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thank DOYC for Knoppix</title>
		<link>http://therning.org/magnus/archives/87</link>
		<comments>http://therning.org/magnus/archives/87#comments</comments>
		<pubDate>Wed, 14 Dec 2005 18:02:00 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[knoppix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[phlak]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/archives/87</guid>
		<description><![CDATA[All I needed to do was fill the hard disk with zeros. Simple right? It turned out not to be. My Ubuntu liveCD is broken, it hangs when I get to the keyboard chooser. My Phlak live CD didn&#8217;t cut it either. My minimal System Rescue CD couldn&#8217;t handle the SATA disk&#8230; Off to the [...]]]></description>
			<content:encoded><![CDATA[<p>All I needed to do was fill the hard disk with zeros. Simple right? It turned out not to be. My Ubuntu liveCD is broken, it hangs when I get to the keyboard chooser. My <a href="http://www.phlak.org/">Phlak</a> live CD didn&#8217;t cut it either. My minimal <a href="http://www.sysresccd.org/">System Rescue CD</a> couldn&#8217;t handle the SATA disk&#8230; Off to the <a href="http://www.knoppix.org/">Knoppix home page</a> and one burnt and booted CD later I have a funtioning Linux system. Thank DYOC (Deity of Your Own Choice) for Knoppix!</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/87&amp;title=Thank DOYC for Knoppix' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/87&amp;title=Thank DOYC for Knoppix' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/87#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/87/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experiencing Arch Linux</title>
		<link>http://therning.org/magnus/archives/82</link>
		<comments>http://therning.org/magnus/archives/82#comments</comments>
		<pubDate>Thu, 01 Dec 2005 21:28:25 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[keysafe]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=82</guid>
		<description><![CDATA[I&#8217;ve just &#8220;finished&#8221; installing Arch Linux. (I don&#8217;t think I&#8217;ll ever be finished for real since Linux is such a dynamic place. However, I&#8217;ve installed enough of Arch Linux to be writing this using Epiphany, running on a slick GNOME desktop.)

So far Arch has proven to be a nice, well designed system with a lean [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just &#8220;finished&#8221; installing <a href="http://www.archlinux.org/">Arch Linux</a>. (I don&#8217;t think I&#8217;ll ever be finished for real since Linux is such a dynamic place. However, I&#8217;ve installed enough of Arch Linux to be writing this using <a href="http://www.gnome.org/projects/epiphany/">Epiphany</a>, running on a slick <a href="http://www.gnome.org/">GNOME</a> desktop.)</p>

<p>So far Arch has proven to be a nice, well designed system with a lean feel to it. Being used to <a href="http://www.debian.org/">Debian</a> (lately <a href="http://www.ubuntulinux.org">Ubuntu</a>) and its extreme attention to detail, Arch does give a more rough impression. It&#8217;s a price I think is worth paying, and believe me, it&#8217;s not as bad as it sounds. I&#8217;ve spent about 2 hours getting the base system, <code>postfix</code>, X.org, and GNOME installed and configured properly. A few small details remain, but I would have to attend to those no matter what distro I choose (getting HAL to refrain from mounting one of the partitions on my USB stick isn&#8217;t something that comes pre-configured in any distro I know of <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).</p>

<p>The only thing left doing now is building proper Arch packages for <a href="http://mutt-ng.berlios.de/">muttng</a> and <a href="/magnus/computer/keysafe/">keysafe</a>.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/82&amp;title=Experiencing Arch Linux' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/82&amp;title=Experiencing Arch Linux' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/82#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/82/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux and vfat: mtools</title>
		<link>http://therning.org/magnus/archives/68</link>
		<comments>http://therning.org/magnus/archives/68#comments</comments>
		<pubDate>Thu, 15 Sep 2005 15:21:19 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mtools]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=68</guid>
		<description><![CDATA[When it&#8217;s not enough to just read and write files on a VFAT file system there&#8217;s a good change mtools can help. The only problem is that mtools work with drive letters. To assign a letter to your device you need to edit /etc/mtools.conf. This is the line I use to access the VFAT partition [...]]]></description>
			<content:encoded><![CDATA[<p>When it&#8217;s not enough to just read and write files on a VFAT file system there&#8217;s a good change <code>mtools</code> can help. The only problem is that <code>mtools</code> work with <em>drive letters</em>. To assign a letter to your device you need to edit <code>/etc/mtools.conf</code>. This is the line I use to access the VFAT partition on my USB stick:</p>

<pre><code>drive d: file="/dev/sdb1"
</code></pre>

<p>After this I can use <code>mlabel</code> to set the label of the partition:</p>

<pre><code>mlabel d:MyLabel
</code></pre>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/68&amp;title=Linux and vfat: mtools' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/68&amp;title=Linux and vfat: mtools' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/68#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/68/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Short comment on a rant on Mr. AkaImBatman</title>
		<link>http://therning.org/magnus/archives/56</link>
		<comments>http://therning.org/magnus/archives/56#comments</comments>
		<pubDate>Sat, 09 Jul 2005 10:11:59 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[desktop linux]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=56</guid>
		<description><![CDATA[A few days ago I stumbled on this article by Mr. AkaImBatman. I posted a message on the Ubuntu developer&#8217;s list. A reply mentioned a rather long rant on the article. I couldn&#8217;t help but comment on it (under the name Magnus of course).
   More&#160;&#187;]]></description>
			<content:encoded><![CDATA[<p>A few days ago I stumbled on <a href="http://akaimbatman.blogspot.com/2005/06/linux-desktop-distribution-of-future_15+.html">this article</a> by Mr. AkaImBatman. I posted a <a href="http://lists.ubuntu.com/archives/ubuntu-devel/2005-July/008676.html">message</a> on the Ubuntu developer&#8217;s list. A reply mentioned a rather long <a href="http://emergerandom.blogspot.com/2005/07/we-have-made-linux-ready-now-lets-make.html">rant</a> on the article. I couldn&#8217;t help but comment on it (under the name Magnus of course).</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/56&amp;title=Short comment on a rant on Mr. AkaImBatman' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/56&amp;title=Short comment on a rant on Mr. AkaImBatman' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/56#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/56/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OWASP&#8217;s WebGoat, first impression</title>
		<link>http://therning.org/magnus/archives/53</link>
		<comments>http://therning.org/magnus/archives/53#comments</comments>
		<pubDate>Mon, 04 Jul 2005 14:15:41 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[webgoat]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=53</guid>
		<description><![CDATA[I&#8217;ve finally found the time to check out OWASP&#8217;s WebGoat. I have been putting this off for a while now, but it&#8217;s kept my interest enough to make me keep the zip-files on my desktop for a few weeks already.

My first impression wasn&#8217;t too good. I tried running it on Linux first (preferred platform for [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally found the time to check out <a href="http://www.owasp.org/">OWASP</a>&#8217;s <a href="http://www.owasp.org/software/webgoat.html">WebGoat</a>. I have been putting this off for a while now, but it&#8217;s kept my interest enough to make me keep the zip-files on my desktop for a few weeks already.</p>

<p>My first impression wasn&#8217;t too good. I tried running it on Linux first (preferred platform for work/play/goofing around, yes anything) but installation failed miserably. The zip-file containing JDK1.5 only contains Java for Windows. Luckily I have Sun&#8217;s JDK1.5 on my Ubuntu machine already so I switched to using the <em>StandAlone</em> version. Now began the fun. There are numerous problems with the shell-scripts:</p>

<ul>
<li>they are not executable</li>
<li>they have DOS line-endings</li>
<li>the main setup script has a wacky reference to <code>JAVA_HOME</code></li>
<li>all files are read-only (not only the scripts, but <em>all</em> files)</li>
</ul>

<p>So, after a call to &#8216;chmod&#8217; to make everything writable, a few calls to <code>dos2unix</code> and <code>chmod +x</code> on the script files, a quick edit of <code>webgoat.sh</code> to set <code>JAVA_HOME</code> to something sane I thought I&#8217;d be off. Oh, no! Running <code>webgoat.sh</code> results in nothing. <code>netstat -lpt</code> reveals there is some java app listening on port 8005, but pointing my browser to it results in nothing. The total lack of documentation on how to use it didn&#8217;t help in my frustration.</p>

<p>After browsing the <a href="http://sourceforge.net/mailarchive/forum.php?forum=owasp-webgoat">WebGoat Archives</a> I turned off my Apache2 to free up port 80. Rerun <code>webgost.sh</code>, still nothing!</p>

<p>Some more browsing the archives revelead that I&#8217;m not only one having problems
<a href="http://sourceforge.net/mailarchive/message.php?msg_id=11936208">running WebGoat on Linux</a> , the <a href="http://sourceforge.net/mailarchive/message.php?msg_id=11938691">answer</a> wasn&#8217;t too encouraging. I decided to try my luck on (yuck) Windows. Unzip, run the bat-file, point a browser to <code>http://localhost/</code>. Wow, worked perfectly!</p>

<p>Ok, on to the next problem, where are the lessons? Again, bitten by the lack of documentation it seems. Well, the archive has been saving me before&#8230; Again, I&#8217;m not the only one <a href="http://sourceforge.net/mailarchive/message.php?msg_id=10488457">having problems</a> the answer was <a href="http://sourceforge.net/mailarchive/message.php?msg_id=10492883">there</a> as well:</p>

<pre><code>http://localhost/WebGoat/attack
Username: guest
Password: guest
</code></pre>

<p>Worked again, and now I can start taking the lessons. Not a great start, but after this bumpy ride I got to the destination. I do hope the WebGoat developers improve on the Linux support and documentation though!</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/53&amp;title=OWASP&#8217;s WebGoat, first impression' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/53&amp;title=OWASP&#8217;s WebGoat, first impression' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/53#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/53/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Theo de Raadt and Linux</title>
		<link>http://therning.org/magnus/archives/48</link>
		<comments>http://therning.org/magnus/archives/48#comments</comments>
		<pubDate>Mon, 20 Jun 2005 23:08:26 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openbsd]]></category>

		<guid isPermaLink="false">http://therning.org/magnus/?p=48</guid>
		<description><![CDATA[I&#8217;ve just read the interview with Theo de
Raadt(TdR) and I just need to get my
thoughts into words.

First I need to say that of course he is right. You don&#8217;t get to run the
OpenBSD project without knowing what you talk about most of the time. The only
problem, from my point of view, is that he&#8217;s evaluating [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just read the <a href="http://makeashorterlink.com/?I1ED23B4B">interview with Theo de
Raadt</a>(TdR) and I just need to get my
thoughts into words.</p>

<p>First I need to say that of course he is right. You don&#8217;t get to run the
OpenBSD project without knowing what you talk about most of the time. The only
problem, from my point of view, is that he&#8217;s evaluating OpenBSD from an
administrator&#8217;s point of view.</p>

<p>I&#8217;ll address a few of the points where I think he&#8217;s overly negative about
Linux and I&#8217;ll end with a few of my own points.</p>

<h3>Linux developers are the slaves of corporations</h3>

<p>Well, of course he&#8217;s right, but I think TdR would agree that they are in good
company.  Especially if one considers the bigger picture. The kernel on its
own is useless piece of code without the rest of software that makes up a
useful Linux system. That software is largely shared with *BSD, and several
large pieces in there are supported by corporations,
<a href="http://www.gnome.org/">GNOME</a>, <a href="http://www.trolltech.com/">Qt</a> (the GUI
toolkit used in KDE), <a href="http://gcc.gnu.org/">GCC</a>,
<a href="http://apache.org/">Apache</a>&#8230; The list goes on and on. All of these things
are available on *BSD as well, and they make those OSs usable as well.</p>

<h3>Linux is of lower quality than *BSD</h3>

<p>He&#8217;s probably right. The *BSD maintainers are well-known for being demanding
when it comes to what code makes it into the kernel. The problem with Linux
adopting a similar style is that it&#8217;d reduce the momentum that Linux enjoys at
the moment, without that momentum Linux would become less popular. It&#8217;d
probably lead to several kernel developers moving onto some other OS project
where they have a chance of getting there code in. Linus has a hard job
balancing quality and speed of implementation, so far he&#8217;s been doing a good
job. Sure, a few patches have been merged that should have been left out, but
so far the Linux community has reacted fast enough to avoid disaster.</p>

<p>TdR also forgets to point out a crucial difference between *BSD and Linux. All
of the *BSDs are both a kernel and a distribution. In the case of Linux there
is a separation between kernel and distributions, for good and for bad. What
it does allow is a more relaxed attitude with the kernel. There&#8217;s more
freedom since some of the work is shifted to others. In this case it works in
favour of Linux, even though it works against it in other situations.</p>

<h3>Linux is getting to be as bloated as Windows</h3>

<p>Yes. I can&#8217;t argue with that. It&#8217;s getting big, yes, but Windows&#8217; biggest
problem&#8211;the backwards-compatability requirement&#8211;is not weighing Linux down
at all. Entire subsystems have been replaced with better solutions, and the
old code is being phased out. I don&#8217;t believe Microsoft has ever done that.</p>

<h3>&#8220;Linux people do what they do because they hate Windows.&#8221;</h3>

<p>He continues: &#8220;We do it becuase we love Unix.&#8221;</p>

<p>&#8220;All generalisations are evil!&#8221; <img src='http://therning.org/magnus/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<p>I wonder if TdR hasn&#8217;t been reading too many <em>Linux vs. Windows</em> postings on
<a href="http://www.slashdot.org/">/.</a>. It&#8217;s just such a silly statement!</p>

<h3>My points</h3>

<p>I recently bought a Toshiba laptop. I installed Ubuntu on it, and <em>almost
everything</em> worked on it right away. I needed to tweak a few things, install a
few more packages to get it to the point where Linux was a replacement for
Windows (functionality-wise I mean, I wasn&#8217;t even considering running Windows
as my main OS on it). Could I have done it with *BSD? Maybe! I don&#8217;t know.
Looking at *BSDs laptop pages suggest some success with installing them on
laptops. My particular model is not mentioned anywhere&#8211;there are two pages,
besides my own, on running Linux on it. I am absolutely sure I would have to
spend a considerable amount of time configuring a *BSD system on it if I got
it to install successfully.</p>

<p>That is the kind of experience a modern OS has to offer in order to attract
regular users today. AFACS *BSD doesn&#8217;t offer it! As long as they don&#8217;t they
will be satisfied with being second to Linux in most user&#8217;s eyes.
Administrators, or power users, are a different matter.</p>

<p>It might even be that TdR should be thankful for Linux. User-friendly Linux
distributions are attracting much attention from people today. Chances are
many of them will be bitten by <em>Unix bug</em> and then they might be moving onto
*BSD for their server needs. When I buy a server for home use I know I&#8217;ll be
putting OpenBSD on it.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='linkbuttons'><a href='http://digg.com/submit?phase=2&amp;url=http://therning.org/magnus/archives/48&amp;title=Theo de Raadt and Linux' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://reddit.com/submit?url=http://therning.org/magnus/archives/48&amp;title=Theo de Raadt and Linux' title='Reddit' onclick='target="_blank";' rel='nofollow'><img src='http://therning.org/magnus/wp-content/plugins/bookmarkify/reddit.png' style='width:16px; height:16px;' alt='[Reddit] ' /></a>  <a title='See more bookmark and sharing options...' href='http://therning.org/magnus/archives/48#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div></div>]]></content:encoded>
			<wfw:commentRss>http://therning.org/magnus/archives/48/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
