<?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>bsd.m3th.org &#187; Linux</title>
	<atom:link href="http://bsd.m3th.org/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://bsd.m3th.org</link>
	<description>Yet another *nix admin blog</description>
	<lastBuildDate>Fri, 13 Jan 2012 19:03:18 +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>Recovering data from Linux LVM with same volume group name</title>
		<link>http://bsd.m3th.org/2012/01/14/recovering-data-from-linux-lvm-with-same-volume-group-name/</link>
		<comments>http://bsd.m3th.org/2012/01/14/recovering-data-from-linux-lvm-with-same-volume-group-name/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 18:58:19 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.m3th.org/?p=332</guid>
		<description><![CDATA[Although it is not a usual task for replacing/upgrading notebook internal hdd, nevertheless, I have performed one lately due to a failing hdd. smartctl reported hdd read failure and I have decided to make an early replacement. However, I still need to duplicate the hdd for recent data that has not been backup. Cloning the [...]]]></description>
			<content:encoded><![CDATA[<p>Although it is not a usual task for replacing/upgrading notebook internal hdd, nevertheless, I have performed one lately due to a failing hdd. smartctl reported hdd read failure and I have decided to make an early replacement. However, I still need to duplicate the hdd for recent data that has not been backup.</p>
<p>Cloning the hdd seems not a good option as it takes longer time and might fail to completely replicate the data due to hdd read failure. So I reinstalled OpenSUSE on the new hdd and restore relevant data on partition.</p>
<p>Default lvm volume group naming convention from OpenSUSE installer is somehow same as previous volume group. This will create problem when accessing data on failing hdd as I need to mount partition on lvm volume group which is same as running system. You should change the volume group name to something else other than &#8220;system&#8221; during the installation. Guess I didn&#8217;t paid too much attention during the installation and now I have 2 &#8220;system&#8221; volume groups. How should I mount the volume on failing hdd then?</p>
<p>Actually it is just an easy task of renaming volume group name.</p>
<p>1) Discover the UUID of the volume with dd by dumping the disk header.<br />
<code><br />
dd if=/dev/sdb2 bs=512 count=255 skip=1 of=/tmp/sdb2.txt<br />
</code></p>
<p>Checking the output for disk UUID.<br />
<code><br />
cat /tmp/sdb2.txt<br />
</code></p>
<p>You will find some thing like this.<br />
<code></code></p>
<pre>system {
id = "8SX5aX-gQZJ-auYA-UX54-BkBA-nc4V-rNoV6v"
seqno = 6
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192
max_lv = 0
max_pv = 0

physical_volumes {

pv0 {
id = "dAe8PS-ThIN-Piez-pmqE-8hUv-vdGM-dyvtSO"
device = "/dev/sda2"

status = ["ALLOCATABLE"]
flags = []
dev_size = 487845855
pe_start = 384
pe_count = 59551
}
}

logical_volumes {

home {
id = "hQH10J-MouP-sNok-VNJN-53As-BYsw-b5cqS3"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1

segment1 {
start_extent = 0
extent_count = 50847

type = "striped"
stripe_count = 1        # linear

stripes = [
"pv0", 0
]
}
}

root {
id = "nde2YD-6rgk-Ufm7-bLf7-ERTc-bHdO-kg7fwF"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 1

segment1 {
start_extent = 0
extent_count = 7680

type = "striped"
stripe_count = 1        # linear

stripes = [
"pv0", 51359
]
}
}

swap {
id = "KXGiD4-qFSH-smun-P4wS-TH14-xxfY-lWYlq8"
status = ["READ", "WRITE", "VISIBLE"]
flags = []
segment_count = 2

segment1 {
start_extent = 0
extent_count = 512

type = "striped"
stripe_count = 1        # linear

stripes = [
"pv0", 59039
]
}
segment2 {
start_extent = 512
extent_count = 512

type = "striped"
stripe_count = 1        # linear

stripes = [
"pv0", 50847
]
}
}
}
}</pre>
<p>&nbsp;</p>
<p>The UUID of the volume group &#8220;system&#8221; is &#8220;8SX5aX-gQZJ-auYA-UX54-BkBA-nc4V-rNoV6v&#8221;</p>
<p>2) Renaming the volume group<br />
vgrename 8SX5aX-gQZJ-auYA-UX54-BkBA-nc4V-rNoV6v oldsystem</p>
<p>3) Activate the renamed volume group<br />
<code><br />
# vgchange oldsystem -a y<br />
</code></p>
<p>Now you should have your vg ready. Verify it with<br />
<code><br />
# pvscan<br />
</code></p>
<p>Output</p>
<pre>  PV /dev/sdb2   VG oldsystem      lvm2 [232.62 GiB / 0    free]
  PV /dev/sda2   VG system   lvm2 [297.93 GiB / 23.93 GiB free]
  Total: 2 [530.55 GiB] / in use: 2 [530.55 GiB] / in no VG: 0 [0   ]</pre>
<p>Check the volume<br />
<code><br />
# lvscan<br />
</code></p>
<pre>  ACTIVE            '/dev/oldsystem/home' [198.62 GiB] inherit
  ACTIVE            '/dev/oldsystem/root' [30.00 GiB] inherit
  ACTIVE            '/dev/oldsystem/swap' [4.00 GiB] inherit
  ACTIVE            '/dev/system/home' [250.00 GiB] inherit
  ACTIVE            '/dev/system/root' [20.00 GiB] inherit
  ACTIVE            '/dev/system/swap' [4.00 GiB] inherit</pre>
<p>That&#8217;s it. You can now mount and dump/restore the failing hdd.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2012/01/14/recovering-data-from-linux-lvm-with-same-volume-group-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ssh &#8216;connection reset by peer&#8217; issue</title>
		<link>http://bsd.m3th.org/2011/05/06/ssh-connection-reset-by-peer-issue/</link>
		<comments>http://bsd.m3th.org/2011/05/06/ssh-connection-reset-by-peer-issue/#comments</comments>
		<pubDate>Fri, 06 May 2011 02:39:08 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenBSD]]></category>

		<guid isPermaLink="false">http://bsd.m3th.org/?p=316</guid>
		<description><![CDATA[I have been plagued by ssh problem since openssh 5.8p1 on OpenSuSE 11.4. Without any warning, even debug level is set to 3, ssh connection to older router/server is dropped silently. I have issue ssh&#8217;ing to AMD64 FreeBSD 8.2-RELEASE which comes with OpenSSH 5.4p1. chflags@zeus:~> ssh -v 10.0.48.61 -l kevin OpenSSH_5.8p1, OpenSSL 1.0.0c 2 Dec [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ms.shit.la/openssh.gif" alt="OpenSSH" /><br />
I have been plagued by ssh problem since openssh 5.8p1 on OpenSuSE 11.4. Without any warning, even debug level is set to 3, ssh connection to older router/server is dropped silently. I have issue ssh&#8217;ing to AMD64 FreeBSD 8.2-RELEASE which comes with OpenSSH 5.4p1.</p>
<p><code>chflags@zeus:~> ssh -v 10.0.48.61 -l kevin<br />
OpenSSH_5.8p1, OpenSSL 1.0.0c 2 Dec 2010<br />
debug1: Reading configuration data /home/chflags/.ssh/config<br />
debug1: Reading configuration data /etc/ssh/ssh_config<br />
debug1: Connecting to 10.0.48.61 [10.0.48.61] port 22.<br />
debug1: Connection established.<br />
debug1: identity file /home/chflags/.ssh/id_rsa type -1<br />
debug1: identity file /home/chflags/.ssh/id_rsa-cert type -1<br />
debug1: identity file /home/chflags/.ssh/id_dsa type -1<br />
debug1: identity file /home/chflags/.ssh/id_dsa-cert type -1<br />
debug1: identity file /home/chflags/.ssh/id_ecdsa type -1<br />
debug1: identity file /home/chflags/.ssh/id_ecdsa-cert type -1<br />
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.4p1 FreeBSD-20100308<br />
debug1: match: OpenSSH_5.4p1 FreeBSD-20100308 pat OpenSSH*<br />
debug1: Enabling compatibility mode for protocol 2.0<br />
debug1: Local version string SSH-2.0-OpenSSH_5.8<br />
debug1: SSH2_MSG_KEXINIT sent<br />
debug1: SSH2_MSG_KEXINIT received<br />
debug1: kex: server->client aes128-ctr hmac-md5 none<br />
debug1: kex: client->server aes128-ctr hmac-md5 none<br />
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent<br />
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP<br />
Read from socket failed: Connection reset by peer</code></p>
<p>With some internet searching, I'm not the only one who's got bitten by this bug :p<br />
Openssh dev: <a href="http://www.gossamer-threads.com/lists/engine?do=post_view_flat;post=51339;page=1;mh=-1;list=openssh;sb=post_latest_reply;so=ASC">http://www.gossamer-threads.com/lists/engine?do=post_view_flat;post=51339;page=1;mh=-1;list=openssh;sb=post_latest_reply;so=ASC</a><br />
Debian: <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612607">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612607</a><br />
Ubuntu: <a href="https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/708493">https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/708493</a><br />
Arch Linux: <a href="https://bugs.archlinux.org/task/22897?project=1">https://bugs.archlinux.org/task/22897?project=1</a></p>
<p><strong><br />
WORKAROUNDS</strong><br />
1) Downgrade openssh to version 5.5p1 or lower or better still upgrade to version 5.8p2 or wait for future release of 5.9p1</p>
<p>2) Add "-c 'aes128-ctr'" when connecting to router/server with older version of ssh.</p>
<p>3) Add to ~/.ssh/config. <code>HostKeyAlgorithms ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss</code>. <strong>(I personally couldn't get this work. Can't verify this. You can try it though.)</strong></p>
<p>Once you use one of the workarounds, you should be able to connect to old router/servers. For instance, with workaround 2:-</p>
<p><code>chflags@zeus:~> ssh -v 10.0.48.61 -c 'aes128-ctr'<br />
OpenSSH_5.8p1, OpenSSL 1.0.0c 2 Dec 2010<br />
debug1: Reading configuration data /home/chflags/.ssh/config<br />
debug1: Reading configuration data /etc/ssh/ssh_config<br />
debug1: Connecting to 10.0.48.61 [10.0.48.61] port 22.<br />
debug1: Connection established.<br />
debug1: identity file /home/chflags/.ssh/id_rsa type -1<br />
debug1: identity file /home/chflags/.ssh/id_rsa-cert type -1<br />
debug1: identity file /home/chflags/.ssh/id_dsa type -1<br />
debug1: identity file /home/chflags/.ssh/id_dsa-cert type -1<br />
debug1: identity file /home/chflags/.ssh/id_ecdsa type -1<br />
debug1: identity file /home/chflags/.ssh/id_ecdsa-cert type -1<br />
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.4p1 FreeBSD-20100308<br />
debug1: match: OpenSSH_5.4p1 FreeBSD-20100308 pat OpenSSH*<br />
debug1: Enabling compatibility mode for protocol 2.0<br />
debug1: Local version string SSH-2.0-OpenSSH_5.8<br />
debug1: SSH2_MSG_KEXINIT sent<br />
debug1: SSH2_MSG_KEXINIT received<br />
debug1: kex: server->client aes128-ctr hmac-md5 none<br />
debug1: kex: client->server aes128-ctr hmac-md5 none<br />
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent<br />
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP<br />
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent<br />
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY<br />
debug1: Server host key: RSA 63:4c:3e:87:76:5a:d7:62:47:d7:74:60:84:72:10:03<br />
debug1: Host '10.0.48.61' is known and matches the RSA host key.<br />
debug1: Found key in /home/chflags/.ssh/known_hosts:22<br />
debug1: ssh_rsa_verify: signature correct<br />
debug1: SSH2_MSG_NEWKEYS sent<br />
debug1: expecting SSH2_MSG_NEWKEYS<br />
debug1: SSH2_MSG_NEWKEYS received<br />
debug1: Roaming not allowed by server<br />
debug1: SSH2_MSG_SERVICE_REQUEST sent<br />
debug1: SSH2_MSG_SERVICE_ACCEPT received<br />
debug1: Authentications that can continue: publickey,keyboard-interactive<br />
debug1: Next authentication method: publickey<br />
debug1: Trying private key: /home/chflags/.ssh/id_rsa<br />
debug1: Trying private key: /home/chflags/.ssh/id_dsa<br />
debug1: Trying private key: /home/chflags/.ssh/id_ecdsa<br />
debug1: Next authentication method: keyboard-interactive<br />
Password:</code></p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2011/05/06/ssh-connection-reset-by-peer-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeBSD : displaying chinese characters in console</title>
		<link>http://bsd.m3th.org/2011/01/12/freebsd-displaying-chinese-characters-in-console/</link>
		<comments>http://bsd.m3th.org/2011/01/12/freebsd-displaying-chinese-characters-in-console/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 16:38:34 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.m3th.org/?p=308</guid>
		<description><![CDATA[A quick and easy tip to display Chinese characters in console mode. This applies not only to FreeBSD, it does for Linux and some other *nix variants too. This is what you get when dealing with Chinese characters in console mode with csh. Just set up the environment LANG to zh_TW.UTF-8 with this command setenv [...]]]></description>
			<content:encoded><![CDATA[<p>A quick and easy tip to display Chinese characters in console mode. This applies not only to FreeBSD, it does for Linux and some other *nix variants too.</p>
<p>This is what you get when dealing with Chinese characters in console mode with csh.<br />
<img src="http://my.rawpacket.org/non-cjkconsole.png"></p>
<p>Just set up the environment LANG to zh_TW.UTF-8 with this command <code><strong>setenv LANG zh_TW.UTF-8</strong></code>.<br />
<img src="http://my.rawpacket.org/cjkconsole.png"></p>
<p>Simple eh? Indeed. Making it permanently, edit <strong>/etc/csh.cshrc</strong> and put these in:-</p>
<pre>
setenv ENABLE_STARTUP_LOCALE zh_TW.UTF-8
setenv LC_CTYPE en_US.ISO10646-1
setenv LC_ALL zh_TW.UTF-8
setenv LANG zh_TW.UTF-8
</pre>
<p>For bash, you can just edit <strong>/etc/profile</strong> and instead of using <code><strong>setenv</strong></code>, you do it with <code><strong>export</strong></code>. i.e. <code><strong>export LANG=zh_TW.UTF-8</strong></code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2011/01/12/freebsd-displaying-chinese-characters-in-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSuSE 11.3: Network Management disabled</title>
		<link>http://bsd.m3th.org/2010/07/19/opensuse-11-3-network-management-disabled/</link>
		<comments>http://bsd.m3th.org/2010/07/19/opensuse-11-3-network-management-disabled/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 03:36:12 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.m3th.org/?p=269</guid>
		<description><![CDATA[Go hit by buggy network manager on OpenSuSE 11.3 turned disabled after waking up from suspend/hibernate. Simple workarounds to get network manager working again (Use any of these) :- # qdbus --system org.freedesktop.NetworkManager /org/freedesktop/NetworkManager wake # nm-online # rm /var/lib/NetworkManager/NetworkManager.state &#38;&#38; rcnetwork restart This resume bug is marked fixed. However it is not available in [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://my.rawpacket.org/geeko.jpg" alt="" /></p>
<p>Go hit by buggy network manager on OpenSuSE 11.3 turned disabled after waking up from suspend/hibernate.</p>
<p>Simple workarounds to get network manager working again (Use any of these) :-</p>
<p><code><strong><br />
# qdbus --system org.freedesktop.NetworkManager /org/freedesktop/NetworkManager wake<br />
</strong></code></p>
<p><code><strong><br />
# nm-online<br />
</strong></code></p>
<p><code><strong><br />
# rm /var/lib/NetworkManager/NetworkManager.state &amp;&amp; rcnetwork restart</strong><br />
</code></p>
<p>This <a href="https://bugzilla.novell.com/show_bug.cgi?id=597572">resume bug</a> is marked fixed. However it is not available in update repo yet. <img src='http://bsd.m3th.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2010/07/19/opensuse-11-3-network-management-disabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Battery info button on HP elitebook 6930p</title>
		<link>http://bsd.m3th.org/2009/09/16/battery-info-button-on-hp-elitebook-6930p/</link>
		<comments>http://bsd.m3th.org/2009/09/16/battery-info-button-on-hp-elitebook-6930p/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 04:43:50 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.m3th.org/?p=236</guid>
		<description><![CDATA[Keymap for laptop keyboard is fun especially there are lots of default actions attached to it. One particular key, FnF8, which has tiny battery icon is not mapped to any action. It has a keycode of 137 on HP elitebook 6930p. I decided to bind the keycode to call up kpowersave information dialog since I [...]]]></description>
			<content:encoded><![CDATA[<p>Keymap for laptop keyboard is fun especially there are lots of default actions attached to it. One particular key, FnF8, which has tiny battery icon is not mapped to any action. It has a keycode of 137 on HP elitebook 6930p. I decided to bind the keycode to call up <a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a> information dialog since I am using KDE4 as desktop manager. But how to call up only <a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a> information dialog? Running command &#8220;<a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a>&#8221; will only trigger another instance of <a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a>.</p>
<p>I tried to use qdbus but could not find suitable <a href="http://www.freedesktop.org/wiki/Software/dbus" target="_blank">dbus</a> object to display <a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a> information dialog. Nevertheless qdbus is quit handy when come to change power profile of <a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a>.</p>
<p>qdbus is a no go for this purpose. I had to look for something else. Luckily, it did not take much of my time searching. &#8220;<a href="http://www.ibm.com/developerworks/linux/library/l-dcop/" target="_blank">dcop</a>&#8221; is it! <code>dcop kpowersave KPowersaveIface showDetailedDialog</code> will display <a href="http://powersave.sourceforge.net/" target="_blank">kpowersave</a> information dialog. Awesome!</p>
<p>I edited <a href="http://keytouch.sourceforge.net/">keytouch</a> keyboard with these lines.<br />
<code><br />
&lt;key&gt;<br />
&lt;name&gt;battery&lt;/name&gt;<br />
&lt;scancode&gt;137&lt;/scancode&gt;<br />
&lt;keycode&gt;PROG2&lt;/keycode&gt;<br />
&lt;default-action&gt;dcop kpowersave KPowersaveIface showDetailedDialog&lt;/default-action&gt;<br />
&lt;/key&gt;</code></p>
<p>Reactivated <a href="http://keytouch.sourceforge.net/">keytouch</a>, the nifty application to map your multimedia keyboard. This is the result of pressing FnF8.</p>
<p><img src="http://ms.shit.la/batt-info.png" alt="" /></p>
<p>Nice eh?</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2009/09/16/battery-info-button-on-hp-elitebook-6930p/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick note on Xen P2V migration</title>
		<link>http://bsd.m3th.org/2009/07/24/quick-note-on-xen-p2v-migration/</link>
		<comments>http://bsd.m3th.org/2009/07/24/quick-note-on-xen-p2v-migration/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 09:23:47 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[OpenSUSE]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://bsd.m3th.org/?p=220</guid>
		<description><![CDATA[I had migrated some of the old machines at work to Xen hypervisor VM. The procedure is rather straight forward and with many options. In this post, I used simple dd command to migrate physical machine to a flat file image on Xen server. DD IN ACTION debian-HP370:~/ # dd if=/dev/cciss/c0d0 &#124; ssh me@xenserver dd [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://ms.shit.la/xen_logo.gif" alt="" /><br />
I had migrated some of the old machines at work to <a href="http://www.xen.org/">Xen hypervisor</a> VM. The procedure is rather straight forward and with many options. In this post, I used simple dd command to migrate physical machine to a flat file image on Xen server.</p>
<p><strong>DD IN ACTION</strong></p>
<blockquote><p><strong><em>debian-HP370:~/ # dd if=/dev/cciss/c0d0 | ssh me@xenserver dd of=/home/xen/img/debian-HP370.img</em></strong></p></blockquote>
<p>This will take a long time depending on your disk size/network speed. So leave it there and go on with other stuff. After a couple of hours, you have the image transferred to Xen server.</p>
<p><strong>TAILORING TO VM ENVIRONMENT</strong></p>
<p>As the physical machine has smart array raid and VM has choices of disk options: IDE, SATA, physical partition under the VM guest, I mounted the image and edit /etc/fstab to reflect disk on VM. Mounting an image file with many partitions is simple. Firstly, offset value of the partition is required. This can be obtained via fdisk command.</p>
<blockquote><p><strong><em>xenserver:/home/xen/img # fdisk -lu debian-HP370.img</em></strong><br />
You must set cylinders.<br />
You can do this from the extra functions menu.</p>
<p>Disk debian-HP370.img: 0 MB, 0 bytes<br />
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors<br />
Units = sectors of 1 * 512 = 512 bytes<br />
Disk identifier: 0x111f5759</p>
<p>Device Boot      Start         End      Blocks   Id  System<br />
debian-HP370.imgp1   *          63   102269789    51134863+  83  Linux<br />
debian-HP370.imgp2       102269790   106655534     2192872+   5  Extended<br />
debian-HP370.imgp5       102269853   106655534     2192841   82  Linux swap / Solaris</p></blockquote>
<p>The offset value in this example is 63 * 512 = 32256</p>
<p>Note : 63 is the Start sector of the partition that I wanted to mount.</p>
<blockquote><p><strong><em>xenserver:/home/xen/img # mount -o loop,offset=32256 debian-HP370.img /mnt/stuff</em></strong></p></blockquote>
<p>Next, you can just <strong><em>vi /mnt/stuff/etc/fstab</em></strong>, to suit your Xen VM configurations. We are almost done.</p>
<p><strong>CREATING NEW VM</strong></p>
<p>Creating a new VM is rather easy. You need a configuration file for VM guest. Please refer to example and wiki for complete parameters. Just run <strong><em>xm new &lt;configure file&gt; i.e. xm new debian-vmconfig</em></strong> or else use <strong><em>vm-install</em></strong> and be prompted with bunch of questions for configuration parameters. Sample HVM configuration file for my VM:-</p>
<blockquote><p>name=&#8221;Linux-debian-HP370&#8243;<br />
memory=1024<br />
maxmem=2048<br />
vcpus=2<br />
on_poweroff=&#8221;destroy&#8221;<br />
on_reboot=&#8221;restart&#8221;<br />
on_crash=&#8221;destroy&#8221;<br />
localtime=0<br />
keymap=&#8221;en-us&#8221;</p>
<p>builder=&#8221;hvm&#8221;<br />
extid=0<br />
device_model=&#8221;/usr/lib/xen/bin/qemu-dm&#8221;<br />
kernel=&#8221;/usr/lib/xen/boot/hvmloader&#8221;<br />
boot=&#8221;c&#8221;<br />
disk=[ 'file:/home/xen/img/debian-HP370.img,sda,w', ]<br />
vif=[ 'mac=00:16:3e:51:16:ee,bridge=br0,model=e1000', ]</p>
<p>stdvga=0<br />
vnc=1<br />
vncunused=1<br />
apic=1<br />
acpi=1<br />
pae=1</p>
<p>serial=&#8221;pty&#8221;</p></blockquote>
<p><strong>START THE MACHINE, LITERALLY</strong></p>
<p>At this point of time, you should turn off the physical machine to avoid IP address clash. There is one last step to go which is the editing grub on VM. You could just fire up the new guest VM with <strong><em>xm start Linux-debian-HP370 &amp;&amp; xm console </em></strong><strong><em>Linux-debian-HP370</em></strong> and hit &#8220;e&#8221; at GRUB menu to edit kernel parameter for root disk. Lastly, modify /boot/grub/menu.lst to reflect your root partition. Remember to run <em><strong>update-grub</strong></em> after finished editing.</p>
<p><strong>OPTIONAL</strong></p>
<p>Since my xen is a headless box, I have to go extra mile to get into the console by ssh tunnel.</p>
<blockquote><p><strong><em>ssh me@xenserver -L 5900:127.0.0.1:5900</em></strong></p></blockquote>
<p>Connect vnc to localhost will give you the new shinny VM console.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2009/07/24/quick-note-on-xen-p2v-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian : ssl-cert 1.0.15 chroot issue (ugly workaround)</title>
		<link>http://bsd.m3th.org/2008/02/20/debian-ssl-cert-1015-chroot-ugly-workaround/</link>
		<comments>http://bsd.m3th.org/2008/02/20/debian-ssl-cert-1015-chroot-ugly-workaround/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 05:13:22 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.b3ta.org/2008/02/20/debian-ssl-cert-1015-chroot-ugly-workaround/</guid>
		<description><![CDATA[On my previous post, I encountered problem with ssl-cert in chrooted environment. By installing ssl-cert via apt-get, these processes were triggered. root 27799 0.0 0.4 4676 2256 pts/2 Ss+ 04:33 0:00 /usr/bin/dpkg --status-fd 13 --configure ssl-cert root 27800 0.4 1.3 10016 7132 pts/2 S+ 04:33 0:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/ssl-cert.postinst configure root 27806 0.0 0.2 [...]]]></description>
			<content:encoded><![CDATA[<p>On my previous <a href="http://bsd.b3ta.org/2008/02/18/debian-ssl-cert-1015-chroot-issue/">post</a>, I encountered problem with ssl-cert in chrooted environment. By installing ssl-cert via apt-get, these processes were triggered.<br />
<code><br />
root     27799  0.0  0.4   4676  2256 pts/2    Ss+  04:33   0:00 /usr/bin/dpkg --status-fd 13 --configure ssl-cert<br />
root     27800  0.4  1.3  10016  7132 pts/2    S+   04:33   0:00 /usr/bin/perl -w /usr/share/debconf/frontend /var/lib/dpkg/info/ssl-cert.postinst configure<br />
root     27806  0.0  0.2   3804  1192 pts/2    S+   04:33   0:00 /bin/sh -e /var/lib/dpkg/info/ssl-cert.postinst configure<br />
root     27808  0.0  0.2   3820  1280 pts/2    S+   04:33   0:00 /bin/bash -e /usr/sbin/make-ssl-cert generate-default-snakeoil<br />
root     27812  0.0  0.2   3780  1448 pts/2    S+   04:33   0:00 openssl req -config /tmp/tmp.OXerK27810 -new -x509 -days 3650 -nodes -out /etc/ssl/certs/ssl-cert-snakeoil.pem -keyout /etc/ssl/private/ssl-cert-snakeoil.key<br />
</code></p>
<p>Further investigation showed that process 27812 stuck. Running the openssl command manually brings up:<br />
<code><br />
27830:error:0E065068:configuration file routines:STR_COPY:variable has no value:conf_def.c:629:line 5<br />
</code></p>
<p>The error message is exactly same as what <a href="http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/5578d8377af1111d">Michael Prokop</a> has found out.</p>
<p>The content of /tmp/tmp.OXerK27810 is:<br />
<code><br />
#<br />
# SSLeay example configuration file.<br />
#</p>
<p>RANDFILE                = $ENV::RANDFILE</p>
<p>[ req ]<br />
default_bits            = 1024<br />
default_keyfile         = privkey.pem<br />
distinguished_name      = req_distinguished_name<br />
prompt                  = no<br />
policy                  = policy_anything</p>
<p>[ req_distinguished_name ]<br />
commonName                      = myshinnybox<br />
</code></p>
<p><strong>DIRTY SOLUTION</strong><br />
As I&#8217;m only interested to get packages such as Postfix, Postgresql Apache mod SSL to install, killed the &#8220;<strong><code>apt-get install ssl-cert</code></strong>&#8221; process and fired up vi and removed the line <strong><code>RANDFILE                = $ENV::RANDFILE</code></strong> from <code>/tmp/tmp.OXerK27810</code>.</p>
<p><code><br />
# openssl req -config /tmp/tmp.OXerK27810 -new -x509 -days 3650 -nodes -out /etc/ssl/certs/ssl-cert-snakeoil.pem -keyout /etc/ssl/private/ssl-cert-snakeoil.key<br />
Generating a 1024 bit RSA private key<br />
................................................++++++<br />
.......++++++<br />
writing new private key to '/etc/ssl/private/ssl-cert-snakeoil.key'<br />
-----<br />
# apt-get install ssl-cert<br />
Reading package lists... Done<br />
Building dependency tree<br />
Reading state information... Done<br />
ssl-cert is already the newest version.<br />
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.<br />
1 not fully installed or removed.<br />
After this operation, 0B of additional disk space will be used.<br />
Setting up ssl-cert (1.0.15) ...<br />
#<br />
</code></p>
<p>I don&#8217;t understand why the package ssl-cert exist in the first place when user can just use &#8220;openssl&#8221; command to generate ssl certificate. Yet making the situation worst, ssl-cert was added as dependency to many packages. Duh! In additional, chroot seems to be buggy under Linux.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2008/02/20/debian-ssl-cert-1015-chroot-ugly-workaround/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian : ssl-cert 1.0.15 chroot issue</title>
		<link>http://bsd.m3th.org/2008/02/18/debian-ssl-cert-1015-chroot-issue/</link>
		<comments>http://bsd.m3th.org/2008/02/18/debian-ssl-cert-1015-chroot-issue/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 12:16:04 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.b3ta.org/2008/02/18/debian-ssl-cert-1015-chroot-issue/</guid>
		<description><![CDATA[Ran into some issues with ssl-cert 1.0.15 installation on Debian chroot environment. But looks like I&#8217;m not alone. The issue was reported by Michael Prokop. molecule:/# apt-get install ssl-cert Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: ssl-cert 0 upgraded, 1 newly installed, 0 to [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into some issues with ssl-cert 1.0.15 installation on Debian chroot environment. But looks like I&#8217;m not alone. The <a href="http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/5578d8377af1111d">issue</a> was reported by Michael Prokop.</p>
<p><code><br />
molecule:/# apt-get install ssl-cert<br />
Reading package lists... Done<br />
Building dependency tree<br />
Reading state information... Done<br />
The following NEW packages will be installed:<br />
ssl-cert<br />
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.<br />
Need to get 0B/7938B of archives.<br />
After this operation, 90.1kB of additional disk space will be used.<br />
Preconfiguring packages ...<br />
Selecting previously deselected package ssl-cert.<br />
(Reading database ... 27065 files and directories currently installed.)<br />
Unpacking ssl-cert (from .../ssl-cert_1.0.15_all.deb) ...<br />
Setting up ssl-cert (1.0.15) ...</code></p>
<p>&#8230;&#8230;took forever&#8230;&#8230;</p>
<p><code>make-ssl-cert generate-default-snakeoil</code> took forever. So it looks like no fun with ssl-cert in chroot&#8217;ed environment. Any solution out there? Buzz me. Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2008/02/18/debian-ssl-cert-1015-chroot-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux : vmsplice local root exploit (Goodbye uptime)</title>
		<link>http://bsd.m3th.org/2008/02/14/linux-vmsplice-local-root-exploit-goodbye-uptime/</link>
		<comments>http://bsd.m3th.org/2008/02/14/linux-vmsplice-local-root-exploit-goodbye-uptime/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 17:41:05 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.b3ta.org/2008/02/14/linux-vmsplice-local-root-exploit-goodbye-uptime/</guid>
		<description><![CDATA[As Linux kernel vmsplice local root exploit in the wild and the Debian boxes in my office is vulnerable to the exploit, I have decided to upgrade their kernels. It&#8217;s sad to see rock-solid Linux boxes went down for the 1st time after running stable nearly 8 months. 17:01:25 up 230 days, 9:59, 3 users, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://bsd.ipv6.la/linux.jpg" /><br />
As Linux kernel vmsplice local root exploit in the wild and the Debian boxes in my office is vulnerable to the exploit, I have decided to upgrade their kernels. It&#8217;s sad to see rock-solid Linux boxes went down for the 1st time after running stable nearly 8 months.<br />
<strong><br />
17:01:25 up 230 days, 9:59, 3 users, load average: 0.00, 0.00, 0.02<br />
</strong><br />
<strong><br />
17:02:31 up 231 days,  7:02,  1 user,  load average: 0.18, 0.38, 0.18<br />
</strong><br />
<strong>After upgrade</strong><br />
<code><br />
chflags@mzimyklosb03:~$ ./c<br />
-----------------------------------<br />
Linux vmsplice Local Root Exploit<br />
By qaaz<br />
-----------------------------------<br />
[+] mmap: 0x0 .. 0x1000<br />
[+] page: 0x0<br />
[+] page: 0x20<br />
[+] mmap: 0x4000 .. 0x5000<br />
[+] page: 0x4000<br />
[+] page: 0x4020<br />
[+] mmap: 0x1000 .. 0x2000<br />
[+] page: 0x1000<br />
[+] mmap: 0xb7e64000 .. 0xb7e96000<br />
[-] vmsplice: Bad address<br />
chflags@mzimyklosb03:~$ uname -smr<br />
Linux 2.6.24.2 i686</code></p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2008/02/14/linux-vmsplice-local-root-exploit-goodbye-uptime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS : Switching default MTA to Postfix</title>
		<link>http://bsd.m3th.org/2008/02/04/centos-switching-default-mta-to-postfix/</link>
		<comments>http://bsd.m3th.org/2008/02/04/centos-switching-default-mta-to-postfix/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 17:59:11 +0000</pubDate>
		<dc:creator>Kevin Foo (chfl4gs_)</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://bsd.b3ta.org/2008/02/04/centos-switching-default-mta-to-postfix/</guid>
		<description><![CDATA[This a just a short note for my own reference. 1) Install postfix # yum install postfix 2) Set default MTA to Postix via this command # alternatives &#8211;set mta /usr/sbin/sendmail.postfix 3) Autostart Postfix (Optional but you really want to do it) # chkconfig &#8211;levels 235 sendmail off # chkconfig &#8211;levels 235 postfix on # [...]]]></description>
			<content:encoded><![CDATA[<p>This a just a short note for my own reference. <img src='http://bsd.m3th.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>1) Install postfix<br />
# yum install postfix</p>
<p>2) Set default MTA to Postix via this command<br />
# alternatives &#8211;set mta /usr/sbin/sendmail.postfix</p>
<p>3) Autostart Postfix (Optional but you really want to do it)<br />
# chkconfig &#8211;levels 235 sendmail off<br />
# chkconfig &#8211;levels 235 postfix on<br />
# /etc/init.d/sendmail stop<br />
# /etc/init.d/postfix start</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.m3th.org/2008/02/04/centos-switching-default-mta-to-postfix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

