<?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>Mister Nerd&#039;s Blog</title>
	<atom:link href="http://www.misternerd.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.misternerd.net/blog</link>
	<description>...nerdy by nature!</description>
	<lastBuildDate>Thu, 03 Feb 2011 11:17:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Grep/Regexp</title>
		<link>http://www.misternerd.net/blog/grepregexp/</link>
		<comments>http://www.misternerd.net/blog/grepregexp/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 11:17:50 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=296</guid>
		<description><![CDATA[Just a collection of useful grep or regexp patterns]]></description>
			<content:encoded><![CDATA[<h2>remove all comments and empty lines from a php.ini</h2>
<pre>cat php.ini | grep -v "^;" | grep -v "^$"</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/grepregexp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple external interfaces in Xen routed setup</title>
		<link>http://www.misternerd.net/blog/multiple-external-interfaces-in-xen-routed-setup/</link>
		<comments>http://www.misternerd.net/blog/multiple-external-interfaces-in-xen-routed-setup/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 01:24:14 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=293</guid>
		<description><![CDATA[For connecting multiple IPs to a domU in a routed setup, you only need to create one interface and assign all IPs to it]]></description>
			<content:encoded><![CDATA[<p>For one of my virtual servers running under Xen in a routed setup, I was required to have more than one external interface, meaning the VM should be available on the net on multiple IP addresses.</p>
<p>First, I tried to assign multiple interfaces to the VM, but that didn&#8217;t really work as the kernel was confused on which route it was supposed to send out data. Turns out it&#8217;s even easier. Let&#8217;s say you have the two IPs <em>1.2.3.4</em> and <em>5.6.7.8</em> which you want to assign to your <em>domU</em>. First, you need to put a line like this into your domU config:</p>
<pre>vif=["ip=1.2.3.4/32 5.6.7.8/32,mac=00:1D:92:AA:BB:CC"]</pre>
<p>Within the domU, you would then create an interface (<em>eth0</em>) with a static configuration for the IP <em>1.2.3.4</em>. Afterwards, you would simply create an alias with the second ip:</p>
<pre>ifconfig eth0:1 5.6.7.8 up</pre>
<p>Now you should be able to reach your domU on both interfaces.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/multiple-external-interfaces-in-xen-routed-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chatroulette: Man-in-the-middle</title>
		<link>http://www.misternerd.net/blog/chatroulette-man-in-the-middle/</link>
		<comments>http://www.misternerd.net/blog/chatroulette-man-in-the-middle/#comments</comments>
		<pubDate>Sun, 31 Oct 2010 10:00:38 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=289</guid>
		<description><![CDATA[I've finally gotten prove for myself that it is easily possible to create a man-in-the-middle scenario with Chatroulette]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always wondered whether it&#8217;s possible to put a man-in-the-middle scheme on Chatroulette, connecting two other people and watching them chat. Well, the answer is, of course, YES, but it took me a while to find the right software for the job. Now I finally did and its name is <a title="WebcamStudio homepage" href="http://www.ws4gl.org/" target="_blank">WebcamStudio</a>.</p>
<p>WebcamStudio is a software for modifying existing webcam streams or creating fake webcams, it comes with a kernel module to create virtual webcams. There are several input sources available, the most important one being the one called &#8220;Desktop&#8221;.</p>
<p>I will not give you detailed instructions of how to do it, as it probably violates the Chatroulette terms of use, but with WebcamStudio it is possible to connect two different chat partners, while sitting in the middle and watching them talk. The only obstacles left is sound (probably not an issue if you&#8217;ve got a sound card with a mixer supported by Alsa) and chat content. For the latter one, you&#8217;ll probably need to write a Greasemonkey script and a little server which exchanges messages between browser instances.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/chatroulette-man-in-the-middle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing a wrong Keymap in FreeNX-Sessions</title>
		<link>http://www.misternerd.net/blog/fixing-a-wrong-keymap-in-freenx-sessions/</link>
		<comments>http://www.misternerd.net/blog/fixing-a-wrong-keymap-in-freenx-sessions/#comments</comments>
		<pubDate>Sat, 30 Oct 2010 17:24:43 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=280</guid>
		<description><![CDATA[A wrong xmodmap within a FreeNX session caused the AltGr key being interpreted as "Enter". This annoying behavior can be fixed by exporting the xmodmap from the client and setting it within the NX session]]></description>
			<content:encoded><![CDATA[<p>Using a FreeNX server, I encountered a problem with a wrong keymap being used within the FreeNX session, which results in certain characters not working. Especially annoying: The AltGr key, on my system, was interpreted as &#8220;Enter&#8221;.</p>
<p>In order to fix this problem, one needs to export the xmodmap from the client system (running the NX client) to the server and, afterwards, setting this xmodmap from within the session. Of course, this can also be automated.</p>
<p>First of all, you need to export the xmodmap of the client you&#8217;re connecting from:</p>
<pre>xmodmap -pke &gt; nxclient.xmodmap</pre>
<p>Now you need to transfer it to the system you&#8217;re using as the server. Afterwards, whenever you start a NX session, you need to call the following command from within the session (assuming you put the file obtained above in your home directory):</p>
<pre>xmodmap ~/nxclient.xmodmap</pre>
<p>Of course, you can automate this by calling the command from within the .profile file. The following code only makes sense though, when you connect from clients which all use the same keymap:</p>
<pre>if [ -n "$NXSESSIONID" ]; then
 /usr/bin/xmodmap ~/nxclient.xmodmap
fi</pre>
<p>This snippet works by checking for the environment variable<em> $NXSESSIONID, </em>which indicates that the session is running from within NX.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/fixing-a-wrong-keymap-in-freenx-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse Bug: RenderBadPicture Bug</title>
		<link>http://www.misternerd.net/blog/eclipse-bug-renderbadpicture-bug/</link>
		<comments>http://www.misternerd.net/blog/eclipse-bug-renderbadpicture-bug/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 19:59:00 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=271</guid>
		<description><![CDATA[The Eclipse bug resulting in an error "The program 'Eclipse' received an X Window System error." can be fixed by adding the direct path to XULRunner to your eclipse.ini]]></description>
			<content:encoded><![CDATA[<p>Today, I encountered an annoying bug in Eclipse. All of the sudden (without any updates being carried out that I remember), Eclipse would simply die and print out only the parameters the JVM was initialized with.<br />
Only when starting Eclipse in a shell will you see an error message which looks somewhat like this:</p>
<pre>The program 'Eclipse' received an X Window System error.
This probably reflects a bug in the program.
The error was 'RenderBadPicture (invalid Picture parameter)'.
(Details: serial 43551 error_code 158 request_code 148 minor_code 7)
...</pre>
<p>After a short websearch, I found this <a title="Eclipse Bugtracker" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308731" target="_blank">Eclipse bugreport</a>, which also contains a solution to the problem. It appears that Eclipse tries to load a wrong/nonexistent version of Mozilla&#8217;s XULRunner, which is responsible for rendering HTML parts within the IDE. Obviously, I encountered the problem as the autocompletion tried to display HTML code within a popup.</p>
<p>The solution is simple, you need to point Eclipse to the correct version of XULRunner. On a current openSUSE 11.3 installation, I used the direct path to XULrunner 1.9.2, the default is to rely on the <em>update-alternatives</em> system &#8211; and I&#8217;m not sure whether this might have caused the problem.<br />
So if you encounter the error, you simply need to add the following line to your <em>eclipse.ini</em> file:</p>
<pre>-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner-1.9.2/xulrunner</pre>
<p>On a 64 bit installtion, it needs to look like this, though:</p>
<pre>-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib<strong>64</strong>/xulrunner-1.9.2/xulrunner</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/eclipse-bug-renderbadpicture-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Remote Login for Typo3</title>
		<link>http://www.misternerd.net/blog/create-remote-login-for-typo3/</link>
		<comments>http://www.misternerd.net/blog/create-remote-login-for-typo3/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 21:17:41 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Typo3]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=268</guid>
		<description><![CDATA[Create a direct login to the Typo3 backend from some third party application by adding a fake session in the database and adding some cookies]]></description>
			<content:encoded><![CDATA[<p>Recently, I wanted to add the possibility to log directly into Typo3&#8242;s backend from some other PHP application without entering the password again. The reason for this was mainly convenience since typing in two different logins (or worse: the same login twice) seems annoying.</p>
<p>Of course, a lot of other people have already done the same thing, so I read around in some blogs/forums&#8230;the usual. Most posts pointed out that you need to write a Typo3 backend extension which would do that task for you.</p>
<p>Since I was too lazy to do so, I looked around a bit in the database and the code and came up with a solution which sometimes works and sometimes not&#8230;more on that later.</p>
<p>First of all, there was the issue of obtaining the backend user-ID which is stored in the table <em>be_users</em>. You can query that database with anything you got on a user, I used the e-mail address:</p>
<pre>SELECT
  `uid`
FROM
  `be_users`
WHERE
  `email`=:email
LIMIT 1;</pre>
<p>This is of course done without checking the password. Now the next thing that should be done is to remove all logins, which the following query does:</p>
<pre>DELETE FROM
  `be_sessions`
WHERE
  `ses_userid`=:userId;</pre>
<p>Typo secures its sessions in several ways, the most tricky one of them is by calculating a hash out of the browser&#8217;s user-agent. I believe this one is likely to change in future versions (the original code looks like there could be some additions), but here&#8217;s the code that does the magic for the current 4.4 release:</p>
<pre>$hashLock=hexdec(substr(md5(":".$_SERVER['HTTP_USER_AGENT']),0,7));</pre>
<p>Ok, now with that information (plus a random<em> $sessionId</em> you need to generate), the new session can be created in the database, here&#8217;s the query:</p>
<pre>INSERT INTO `be_sessions` (
  `ses_id`,
  `ses_name`,
  `ses_iplock`,
  `ses_hashlock`,
  `ses_userid`,
  `ses_tstamp`,
  `ses_data`,
  `ses_backuserid`
) VALUES (
  :sessionId,
  'be_typo_user',
  :userIp,
  :hashlock,
  :userId,
  UNIX_TIMESTAMP(),
  NULL,
  0
);</pre>
<p>The last part is to push the cookies to the client, and here lies the most important challenge. By default, Typo locks all cookies to the URL of the backend. However, if no cookies were present yet, one can create &amp; send cookies which are accepted by Typo. First, here&#8217;s the code to create the cookies (assuming the backend is located at /typo3, also the cookies here are locked to a SSL-connection):</p>
<pre>setcookie("be_typo_user",$sessionId,0,"/typo3/",$_SERVER['SERVER_NAME'],true);
setcookie("typo3-login-cookiecheck","true",0,"/",$_SERVER['SERVER_NAME'],false);</pre>
<h2>Conclusion</h2>
<p>Now in my short tests, the above system always worked when there were no Typo3-generated cookies present yet. So if you want this method to REALLY work, you need to place the script within the same directory as the Typo3 backend so you can write the correct cookies, and you might want to make sure no cookies remain by deleting them first.</p>
<p>So all in all, this method was just a quick hack and currently fits my needs, the better approach is certainly to create an auth extension.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/create-remote-login-for-typo3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysqldump and Error &#8220;Unknown command &#8216;\0&#8242;&#8221;</title>
		<link>http://www.misternerd.net/blog/mysqldump-and-error-unknown-command-0/</link>
		<comments>http://www.misternerd.net/blog/mysqldump-and-error-unknown-command-0/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 13:30:47 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=253</guid>
		<description><![CDATA[If you get the error "Unknown command '\0'" on importing a SQL dumpfile exported by mysqldump, you need to set the --hex-blob option]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re using <em>mysqldump</em> to put a complete database into a textfile and try to import that file into another MySQL server, you might come across the error message &#8220;<em>Unknown command &#8216;\0</em>&#8216;&#8221; on importing the database.</p>
<p>The most probable cause to this is a database which contains (large) blobs, as they somehow might not get encoded to the right format.</p>
<p>Easy solution to this problem: Use the <em>&#8211;hex-blob</em> option:</p>
<pre>mysqldump -uusername -p --hex-blob db_name &gt; db_name.sql</pre>
<p>This will force <em>mysqldump</em> to encode all blobs in binary format, which won&#8217;t get messed up in encoding problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/mysqldump-and-error-unknown-command-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synchronize a remote SVN repository using svnsync</title>
		<link>http://www.misternerd.net/blog/synchronize-a-remote-svn-repository-using-svnsync/</link>
		<comments>http://www.misternerd.net/blog/synchronize-a-remote-svn-repository-using-svnsync/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 10:35:17 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=206</guid>
		<description><![CDATA[With svnsync it is possible to mirror a remote repository. This is useful for software like Trac, that depends on local access to the repository. This post provides a step-by-step guide on how to set it up]]></description>
			<content:encoded><![CDATA[<p>If you ever need to mirror a complete SVN repository (for backup, local Trac access etc) you can easily use svnsync, which is part of the SVN packages on most Linux distributions.</p>
<p>Lets say you want to mirror the remote repository <em>http://example.com/svn</em>, which you are allowed to access with the username <em>svnsync</em>, to a local repository located at <em>/srv/svnMirror</em>.</p>
<p>First step: Create the local (empty) repository:</p>
<pre>svnadmin create /srv/svnMirror</pre>
<p>Now you have a choice: Is access to this repository only available to the syncing user or will other users have access to it as well? In the first case, you only need to execute the following commands:</p>
<pre>echo "#!/bin/bash" &gt; /srv/svnMirror/hooks/pre-revprop-change
chmod u+x /srv/svnMirror/hooks/pre-revprop-change</pre>
<p>If other users have access to the mirrored repository as well, I would recommend putting the following lines into <em>/srv/svnMirror/hooks/pre-revprop-change</em> and making it executable afterwards:</p>
<pre>#!/bin/sh
USER="$3"
if [ "$USER" = "svnsync" ]; then exit 0; fi
echo "Only the svnsync user can change revprops" &gt;&amp;2
exit 1</pre>
<p>With the first solution, all users with access to the mirrored repository would have unlimited control over it.</p>
<p>The next step is to perform an initial synchronization:</p>
<pre>svnsync init --username=svnsync /srv/svnMirror</pre>
<p>If this step was successful, you can begin the synchronization by issuing:</p>
<pre>svnsync /srv/svnMirror</pre>
<p>This will successively transfer all revisions available in the original repository, so this might take a while. For continuing synchronization, I&#8217;d recommend putting this command in your crontab.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/synchronize-a-remote-svn-repository-using-svnsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Annoying bug in Typo3</title>
		<link>http://www.misternerd.net/blog/annoying-bug-in-typo3/</link>
		<comments>http://www.misternerd.net/blog/annoying-bug-in-typo3/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 14:17:10 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Typo3]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=191</guid>
		<description><![CDATA[The current version of Typo3 (4.4.0) has a bug which falsely detects PHP running in safe_mode which is not the case]]></description>
			<content:encoded><![CDATA[<p>I just got across a bug in Typo3 (v 4.4.0) which took me a good half hour to analyze, fix &#8211; just to find out it has already been reported -DUH!!</p>
<p>The problem is, that Typo uses something like the following code to check for <em>safe_mode</em>:</p>
<pre>if(ini_get('safe_mode')){
  //safe mode is enabled
}</pre>
<p>This is fine as long as you use <em>1</em> or <em>0</em> to active or deactivate the <em>safe_mode</em>. But since PHP allows to use the words &#8220;<em>on</em>&#8221; and &#8220;<em>off</em>&#8221; as well, setting</p>
<pre>safe_mode=off</pre>
<p>will result in Typo thinking that safe_mode is enabled &#8211; although it is off.</p>
<p>I guess the bug will be fixed pretty soon according to the <a title="Typo3 bug report" href="http://bugs.typo3.org/view.php?id=4272" target="_blank">bug report</a>, in the meantime, just replace <em>off</em> with <em>0</em> as a workaround.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/annoying-bug-in-typo3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing openSUSE (11.3) as Xen guest (domU) under CentOS 5.5 using HVM</title>
		<link>http://www.misternerd.net/blog/installing-opensuse-11-3-as-xen-guest-under-centos-5-5/</link>
		<comments>http://www.misternerd.net/blog/installing-opensuse-11-3-as-xen-guest-under-centos-5-5/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 10:41:22 +0000</pubDate>
		<dc:creator>Mr. Nerd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://www.misternerd.net/blog/?p=159</guid>
		<description><![CDATA[Workaround to install openSUSE as a HVM-enabled Xen guest with a DVD-ISO first and switching back to paravirtualized mode later on. As to why you would want to do this: Read the post :)]]></description>
			<content:encoded><![CDATA[<p>Today, I had the mindnumbing task of installing openSUSE (current version 11.3) as a virtual Xen guest (domU) within a CentOS 5 dom0. There are, of course, multiple solutions to this problem and the most convenient is probably the one found <a title="openSUSE as Xen guest" href="http://et.redhat.com/~kraxel/xen/suse-guest.html" target="_blank">here</a>.</p>
<p>However, my setup is a little bit different as &#8211; thanks to my hoster&#8217;s secure routing &#8211; all my domUs need to route their traffic through the main IP of the dom0, thus preventing me from setting the right network information (netmask 255.255.255.255 and a point-to-point route to the default gw) in YaST installation.</p>
<p>As a solution to the problem, I first installed openSUSE as a HVM domain from a downloaded DVD-ISO. Afterwards, I made some small changes and ran the system in paravirtualized mode. In order to do so, you need twice as much space as the installation takes, since you need to copy the data from the HVM disk to the paravirtualized disk.</p>
<p>So for this example, let&#8217;s say you have a volume group named <em>opensuse</em> with two logical volumes <em>disk1</em> and <em>disk2</em>, where you start the HVM on <em>disk2</em> and <em>disk1</em> will be your root device for the paravirtualized machine. You&#8217;ll also need to download the openSUSE DVD image in ISO format.</p>
<h2>Create a HVM domain</h2>
<p>First of all, we need a HVM enabled config. Be sure to enable PAE, otherwise you&#8217;ll get an error when booting from the DVD. Here&#8217;s the config I used:</p>
<pre>name="opensuse1"
memory=768
vcpus=1
on_poweroff="destroy"
on_reboot="restart"
on_crash="restart"
disk=["phy:/dev/opensuse/disk2,xvda,w", "file:<strong>/path/to/openSUSE-11.3-DVD-x86_64.iso</strong>,xvdb:cdrom,r"]
kernel="/usr/lib/xen/boot/hvmloader"
builder="hvm"
device_model ="/usr/lib64/xen/bin/qemu-dm"
boot="d"
sdl=0
vnc=1
vncconsole=1
usbdevice="tablet"
shadowmemory=8
pae=1
acpi=0</pre>
<p>Of course, you need to adapt the path to your local setting. If you install the domU on a remote host, make sure you&#8217;ve got X11 forwarding enabled, otherwise the VNC window will not pop up. You&#8217;ll be greeted with the standard openSUSE boot promt, so you can just carry out the installation as you normally. Just <strong>be sure to include the package</strong> <em>kernel-xen</em> in the installation. And if you&#8217;re smart, you&#8217;ll only create a single partition (no swap etc) on which the system gets installed, saving you the hassle of copying data from several partitions.</p>
<h2>Copying data from HVM disk to paravirtualized disk</h2>
<p>Once the domU has been set up, shut it down. Now, you need to copy all files from the HVM disk (<em>/dev/opensuse/disk2</em>) to the disk designated for the paravirtualized domain (<em>/dev/opensuse/disk1</em>). If you haven&#8217;t done this yet, put a file system of your choice on that disk, e.g.</p>
<pre>mkfs.ext3 /dev/opensuse/disk1</pre>
<p>Since the HVM domain uses a complete disk structure (including MBR etc) instead of a single partition, you need to mount only a single partition out of the disk structure. You can either specify an offset in the mount command or, if you&#8217;re a little lazy, use kpartx:</p>
<pre>kpartx -av /dev/opensuse/disk2</pre>
<p>This will create mappings for all partitions found in <em>/dev/opensuse/disk2</em>. If you only created one partition as I suggested, you&#8217;ll find the mapping at <em>/dev/mapper/opensuse-disk21</em>.</p>
<p>Now, mount the two disks to seperate mount points and begin copying:</p>
<pre>mkdir /mnt/disk1
mkdir /mnt/disk2
mount /dev/opensuse/disk1 /mnt/disk1
mount /dev/mapper/opensuse-disk21 /mnt/disk2
cp -ax /mnt/disk2/* /mnt/disk1</pre>
<p>After the process has completed, you need to make some small changes.</p>
<p>Change the file <em>/mnt/disk1/boot/grub/menu.lst</em> to boot the Xen enabled kernel. It only needs one entry like this:</p>
<pre>default 0
timeout 0

title Xen
  root (hd0,0)
  kernel /boot/vmlinuz-xen root=/dev/hda1 splash=none showopts vga=0x314 <strong>console=xvc0</strong>
  initrd /boot/vmlinuz-xen</pre>
<p>Make sure the kernel and the initrd exist. The console parameter is also important, otherwise you won&#8217;t see anything on the Xen console. We also need to make sure to enable this console in two more files.</p>
<p>Edit <em>/mnt/disk1/etc/inittab</em> and change the following line</p>
<pre>1:2345:respawn:/sbin/mingetty --noclear tty1</pre>
<p>to look like this:</p>
<pre>1:2345:respawn:/sbin/mingetty --noclear xvc0</pre>
<p>Now edit <em>/mnt/disk1/etc/securetty</em> and append <em>xvc0</em> to the list. The last change isin <em>/mnt/disk1/etc/fstab</em>: Make sure you set the root device to the one from the domU config (e.g. <em>/dev/hda1</em>), as YaST will have put something like <em>/dev/disk-by-id&#8230;</em> in there.</p>
<p>Afterwards, you can umount the two disks:</p>
<pre>umount /mnt/disk1
umount /mnt/disk2</pre>
<h2>Starting in paravirtualized mode</h2>
<p>You still need to adapt the domU&#8217;s config to start in paravirtualized mode. Here&#8217;s what my config reads like:</p>
<pre>name="opensuse1"
memory=768
vcpus=1
on_poweroff="destroy"
on_reboot="restart"
on_crash="restart"
disk=["phy:/dev/opensuse/disk1,hda1,w"]
bootloader="/usr/bin/pygrub"
vif=["ip=192.168.1.1"]</pre>
<p>The network setting looks slightly different, but you need to change this file anyway <img src='http://www.misternerd.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, you can simply start the domU and it will get created as a paravirtualized domain.</p>
<h2>Cleanup &amp; Conclusion</h2>
<p>If you don&#8217;t plan on restarting the dom0 in the next days, you should clear the mapping kpartx created by invoking:</p>
<pre>kpartx -dv /dev/opensuse/disk2</pre>
<p>Also, you are now free to either remove disk2 or add it to the paravirtualized machine for additional space.</p>
<p>I know the solution described in this post is not the most elegant one, but it worked for me right now. Hope it helps someone else, too&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.misternerd.net/blog/installing-opensuse-11-3-as-xen-guest-under-centos-5-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

