<?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>Shadows of epiphany &#187; Linux</title>
	<atom:link href="http://blog.bodhizazen.net/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bodhizazen.net</link>
	<description>A LAMP in the Samsara</description>
	<lastBuildDate>Wed, 11 Aug 2010 22:42:18 +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>How to improve resolution in KVM</title>
		<link>http://blog.bodhizazen.net/linux/how-to-improve-resolution-in-kvm/</link>
		<comments>http://blog.bodhizazen.net/linux/how-to-improve-resolution-in-kvm/#comments</comments>
		<pubDate>Tue, 18 May 2010 06:33:59 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1422</guid>
		<description><![CDATA[Once again I found myself trying to &#8220;fix&#8221; something that has been bothering me for some time &#8211; the Resolution in KVM guests is sometimes poor, as low as 800&#215;600.
As it turns out, one can increase the resolution of the guests much higher by using a custom xorg.conf and the std vga driver.
Save the following in /etc/X11/xorg.conf in the Guest OS.
Direct download &#8211; bodhi.zazen&#8217;s kvm xorg.conf
As root run:
wget http://bodhizazen.net/adblock/kvm.xorg.conf -O /etc/X11/xorg.conf
xorg.conf
Section &#34;ServerLayout&#34;
	Identifier     &#34;BodhiZazen&#8217;s KVM xorg.conf&#34;
	Screen      0  &#34;Screen0&#34; 0 0
	InputDevice    &#34;Mouse0&#34; &#34;CorePointer&#34;
	InputDevice    &#34;Keyboard0&#34; &#34;CoreKeyboard&#34;
EndSection
Section &#34;Module&#34;
	Load  &#34;record&#34;
	Load  &#34;dri&#34;
	Load  &#34;extmod&#34;
	Load  &#34;glx&#34;
	Load  &#34;dbe&#34;
	Load  &#34;dri2&#34;
EndSection
Section &#34;InputDevice&#34;
	Identifier  &#34;Keyboard0&#34;
	Driver      &#34;kbd&#34;
EndSection
Section &#34;InputDevice&#34;
	Identifier  &#34;Mouse0&#34;
	Driver      &#34;vmmouse&#34;
	Option	    &#34;Protocol&#34; &#34;SysMouse&#34;
	Option	    &#34;Device&#34; &#34;/dev/sysmouse&#34;
	Option	    &#34;ZAxisMapping&#34; &#34;4 5 6 7&#34;
EndSection
Section &#34;Monitor&#34;
	Identifier  [...]]]></description>
			<content:encoded><![CDATA[<p>Once again I found myself trying to &#8220;fix&#8221; something that has been bothering me for some time &#8211; the Resolution in KVM guests is sometimes poor, as low as 800&#215;600.</p>
<p>As it turns out, one can increase the resolution of the guests much higher by using a custom xorg.conf and the std vga driver.</p>
<p>Save the following in <strong>/etc/X11/xorg.conf</strong> in the Guest OS.</p>
<p>Direct download &#8211; <a href="http://bodhizazen.net/adblock/kvm.xorg.conf">bodhi.zazen&#8217;s kvm xorg.conf</a></p>
<p>As root run:</p>
<p class="code">wget http://bodhizazen.net/adblock/kvm.xorg.conf -O /etc/X11/xorg.conf</p>
<p>xorg.conf</p>
<p class="code">Section &#34;ServerLayout&#34;<br />
	Identifier     &#34;BodhiZazen&#8217;s KVM xorg.conf&#34;<br />
	Screen      0  &#34;Screen0&#34; 0 0<br />
	InputDevice    &#34;Mouse0&#34; &#34;CorePointer&#34;<br />
	InputDevice    &#34;Keyboard0&#34; &#34;CoreKeyboard&#34;<br />
EndSection<br />
<br />Section &#34;Module&#34;<br />
	Load  &#34;record&#34;<br />
	Load  &#34;dri&#34;<br />
	Load  &#34;extmod&#34;<br />
	Load  &#34;glx&#34;<br />
	Load  &#34;dbe&#34;<br />
	Load  &#34;dri2&#34;<br />
EndSection<br />
<br />Section &#34;InputDevice&#34;<br />
	Identifier  &#34;Keyboard0&#34;<br />
	Driver      &#34;kbd&#34;<br />
EndSection<br />
<br />Section &#34;InputDevice&#34;<br />
	Identifier  &#34;Mouse0&#34;<br />
	Driver      &#34;vmmouse&#34;<br />
	Option	    &#34;Protocol&#34; &#34;SysMouse&#34;<br />
	Option	    &#34;Device&#34; &#34;/dev/sysmouse&#34;<br />
	Option	    &#34;ZAxisMapping&#34; &#34;4 5 6 7&#34;<br />
EndSection<br />
<br />Section &#34;Monitor&#34;<br />
	Identifier   &#34;Monitor0&#34;<br />
	VendorName   &#34;Monitor Vendor&#34;<br />
	ModelName    &#34;Monitor Model&#34;<br />
	HorizSync       20.0 &#8211; 50.0<br />
	VertRefresh     40.0 &#8211; 80.0<br />
	Option          &#34;DPMS&#34;<br />
EndSection<br />
<br />Section &#34;Device&#34;<br />
	Identifier  &#34;Card0&#34;<br />
	Driver      &#34;vesa&#34;<br />
	VendorName  &#34;Cirrus Logic&#34;<br />
	BoardName   &#34;GD 5446&#34;<br />
	BusID       &#34;PCI:0:2:0&#34;<br />
EndSection<br />
<br />Section &#34;Screen&#34;<br />
	Identifier &#34;Screen0&#34;<br />
	Device     &#34;Card0&#34;<br />
	Monitor    &#34;Monitor0&#34;<br />
	SubSection &#34;Display&#34;<br />
		Viewport   0 0<br />
		Modes &#34;1600&#215;1200&#34;<br />
	EndSubSection<br />
EndSection</p>
<p><strong>Note</strong>: The vmware mouse driver is installed on most distros by default. If you need to install it use:</p>
<p class="code"># Fedora<br />
yum install xorg-x11-drv-vmmouse<br />
<br />#Debian / Ubuntu<br />
apt-get install xorg-input-vmmouse</p>
<p><strong>If you need a higher/lower resolution, change &#8220;1600&#215;1200&#8243; to your desired resolution.</strong></p>
<p>Finally, when we restart KVM use the &#8220;std&#8221; video driver. The default video driver is cirrus.</p>
<p class="code">kvm -m 512 <strong>-vga std</strong> -disk file=/path/to/linux.qcow,cache=writeback,media=disk</p>
<p>You may specify vga from Virtmanager or in your guest xml file (if you are using libvirt).</p>
<p class="code">&lt;model type=&#39;vga&#39; vram=&#39;9216&#39; heads=&#39;1&#39;/&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/how-to-improve-resolution-in-kvm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to use UFW in OpenVZ templates</title>
		<link>http://blog.bodhizazen.net/linux/how-to-use-ufw-in-openvz-templates/</link>
		<comments>http://blog.bodhizazen.net/linux/how-to-use-ufw-in-openvz-templates/#comments</comments>
		<pubDate>Tue, 11 May 2010 20:24:47 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1331</guid>
		<description><![CDATA[I was looking at iptables / UFW in openvz templates and was able to work through some of the problems with UFW.
In this blog I will outline how to get ufw working.
The issues with UFW and OpenVZ guests are:
1. Openvz has limited options for iptables, and UFW scripts fail when these options are called.
See this link for a discussion (and some hints).
2. The other problem with ufw is that it attempts to load kernel modules via modprobe and change sysctl settings. Since you can not load kernel modules in an openvz guest ufw fails. Because sysctl does not work, we get error messages.
3. Issues with logging. By default Ubuntu (and many distros) use rsyslog, which does not work well in OpenVZ guests.
4. Fix the ufw init script (otherwise we receive errors).
5. ipv6 is not fully functional in openvz guests.
6. Some things are still broken &#8230; The ufw scripts for Applications [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking at iptables / UFW in openvz templates and was able to work through some of the problems with UFW.</p>
<p>In this blog I will outline how to get ufw working.</p>
<p>The issues with UFW and OpenVZ guests are:</p>
<p>1. Openvz has limited options for iptables, and UFW scripts fail when these options are called.</p>
<p>See <a href="http://forum.openvz.org/index.php?t=msg&#038;goto=37450&#038;">this link</a> for a discussion (and some hints).</p>
<p>2. The other problem with ufw is that it attempts to load kernel modules via modprobe and change sysctl settings. Since you can not load kernel modules in an openvz guest ufw fails. Because sysctl does not work, we get error messages.</p>
<p>3. Issues with logging. By default Ubuntu (and many distros) use rsyslog, which does not work well in OpenVZ guests.</p>
<p>4. Fix the ufw init script (otherwise we receive errors).</p>
<p>5. ipv6 is not fully functional in openvz guests.</p>
<p>6. Some things are still broken &#8230; The ufw scripts for Applications remain broken, specify by port instead (see below).</p>
<h2>&#8220;Fix&#8221; iptables</h2>
<p>UFW throws cryptic error messages:</p>
<p><code><br />
# ufw enable<br />
ERROR: problem running ufw-init<br />
<br /># /lib/ufw/ufw-init restart<br />
iptables-restore: line 66 failed<br />
iptables-restore: line 30 failed<br />
<br />Problem running '/etc/ufw/before.rules'<br />
Problem running '/etc/ufw/after.rules'<br />
</code></p>
<p>These cryptic error messages are telling us which lines in which config files are failing.</p>
<p>Edit the ufw config files and comment out iptables modules incompatible with ufw.</p>
<p>Edit /etc/ufw/after.rules</p>
<p class="code"># don&#8217;t log noisy broadcast<br />
#-A ufw-after-input -m addrtype &#45;&#45;dst-type BROADCAST -j ufw-skip-to-policy-input</p>
<p>Edit /etc/ufw/ufw/before.rules</p>
<p class="code"># if LOCAL, RETURN<br />
#-A ufw-not-local -m addrtype &#45;&#45;dst-type LOCAL -j RETURN<br />
<br/># if MULTICAST, RETURN<br />
#-A ufw-not-local -m addrtype &#45;&#45;dst-type MULTICAST -j RETURN<br />
<br /># if BROADCAST, RETURN<br />
#-A ufw-not-local -m addrtype &#45;&#45;dst-type BROADCAST -j RETURN</p>
<h2>&#8220;Fix&#8221; modprobe</h2>
<p>Not really a fix, a work around &#8230; we can not really &#8220;fix&#8221; modprobe, so we will return a success code when modprobe is called by ufw.</p>
<p class="code">rm -f /sbin/modprobe<br />
ln -s /bin/true /sbin/modprobe</p>
<h2>&#8220;Fix&#8221; sysctl</h2>
<p>Similar to modprobe, sysctl does not work inside openvz templates (you would set these parameters on the host, but they do not apply per container).</p>
<p><code><br />
# echo 0 > /proc/sys/net/ipv6/conf/all/accept_redirects<br />
-bash: /proc/sys/net/ipv6/conf/all/accept_redirects: Permission denied<br />
# sysctl -w net.ipv6.conf.all.accept_redirects="1"<br />
error: permission denied on key 'net.ipv6.conf.all.accept_redirects'<br />
</code></p>
<p>Same fix as modprobe:</p>
<p class="code">rm -f /sbin/sysctl<br />
ln -s /bin/true /sbin/sysctl</p>
<h2>Fix logging</h2>
<p>This fix actually works &#8230;</p>
<p class="code">apt-get -y purge rsyslog<br />
apt-get install -y syslog-ng</p>
<p>UFW will now log to /var/log/messages and /var/log/kern.log (but not /var/log/ufw.log )</p>
<h2>Edit ufw init</h2>
<p>Edit /etc/init/ufw.conf and add the following lines at the end of the file:</p>
<p class="code">start on startup<br />
#console output</p>
<h2>ipv6</h2>
<p>ipv6 is not fully functional in openvz guests and can cause problems with ufw.</p>
<p>If you are having problem with ufw and ipv6 the only solution I am aware of is to disable ipv6.</p>
<p>This is the cryptic error message I receive when I enable ipv6 in ufw.<br />
<code><br />
w# ufw enable<br />
ERROR: Could not load logging rules</code></p>
<p>To disable ipv6, edit <strong>/etc/default/ufw</strong> and change IPV6 to &#8220;no&#8221; (without quotes)</p>
<p class="code"># Set to yes to apply rules to support IPv6 (no means only IPv6 on loopback<br />
# accepted). You will need to &#8216;disable&#8217; and then &#8216;enable&#8217; the firewall for<br />
# the changes to take affect.<br />
IPV6=no</p>
<h2>Still broken</h2>
<p>The ufw application  scripts add iptables rules that are incompatible with iptables in an openZV guest and thus remain broken.</p>
<p>You will need to work around this by specifying ports rather then applications.</p>
<p>Thus use :</p>
<p class="code">ufw allow 80/tcp<br />
ufw allow 443/tcp</p>
<p>But not:<br />
<code><br />
#This does NOT work<br />
ufw allow Apache<br />
<br />#This does NOT work either<br />
ufw allow &#34;Apache Full&#34;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/how-to-use-ufw-in-openvz-templates/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Upgrade Ubuntu 9.10 OpenVZ Templates</title>
		<link>http://blog.bodhizazen.net/linux/upgrade-ubuntu-9-10-openvz-templates/</link>
		<comments>http://blog.bodhizazen.net/linux/upgrade-ubuntu-9-10-openvz-templates/#comments</comments>
		<pubDate>Tue, 11 May 2010 18:43:17 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1315</guid>
		<description><![CDATA[This post is for those wanting to upgrade existing Ubuntu 9.10 openvz templates to Ubuntu 10.04 (Lucid Lynx) which is a LTS release (supported server side for 5 years).
Caution: Back up your data before you upgrade. This upgrade works on a minimal server and you may need to edit (upstart) init scripts (mysql in particular) and I make no guarantees this upgrade procedure will work for you (use at your own risk).
Assuming your template is 101 &#8230;
sudo vzctrl enter 101
Update 9.10
Start by updating 9.10:
apt-get update
apt-get dist-upgrade
Upgrade to 10.04
Upgrade &#8211; Instructions from This link
apt-get install -y update-manager-core
Edit /etc/update-manager/release-upgrades , make sure Prompt=normal
Prompt=normal
It was normal already on my VPS &#8230;
Upgrade to 10.04
do-release-upgrade
Follow the on screen directions, accept the new configuration files.
Continue installing without GURB &#8211; answer &#8220;yes&#8221;
At the end of the upgrade, do not restart (yet)
Post -upgrade
We need some post-upgrade configuration:
Start by removing unnecessary packages
apt-get purge eject kbd laptop-detect linux-generic linux-image-2.6.32-21-generic os-prober [...]]]></description>
			<content:encoded><![CDATA[<p>This post is for those wanting to upgrade existing Ubuntu 9.10 openvz templates to Ubuntu 10.04 (Lucid Lynx) which is a LTS release (supported server side for 5 years).</p>
<p><strong>Caution</strong>: Back up your data before you upgrade. This upgrade works on a minimal server and you may need to edit (upstart) init scripts (mysql in particular) and I make no guarantees this upgrade procedure will work for you (use at your own risk).</p>
<p>Assuming your template is 101 &#8230;</p>
<p class="code">sudo vzctrl enter 101</p>
<h2>Update 9.10</h2>
<p>Start by updating 9.10:</p>
<p class="code">apt-get update<br />
apt-get dist-upgrade</p>
<h2>Upgrade to 10.04</h2>
<p>Upgrade &#8211; Instructions from <a href="http://www.ubuntu.com/getubuntu/upgrading">This link</a></p>
<p class="code">apt-get install -y update-manager-core</p>
<p>Edit /etc/update-manager/release-upgrades , make sure Prompt=normal</p>
<p class="code">Prompt=normal</p>
<p>It was normal already on my VPS &#8230;</p>
<p>Upgrade to 10.04</p>
<p class="code">do-release-upgrade</p>
<p>Follow the on screen directions, accept the new configuration files.</p>
<p>Continue installing without GURB &#8211; answer &#8220;yes&#8221;</p>
<p>At the end of the upgrade, <strong>do not restart</strong> (yet)</p>
<h2>Post -upgrade</h2>
<p>We need some post-upgrade configuration:</p>
<p>Start by removing unnecessary packages</p>
<p class="code">apt-get purge eject kbd laptop-detect linux-generic linux-image-2.6.32-21-generic os-prober ubuntu-keyring update-manager-core<br />
apt-get autoremove</p>
<p>Put mountall and upstart on hold</p>
<p class="code">echo &#34;mountall hold&#34;|dpkg &#45;&#45;set-selections<br />
echo &#34;upstart hold&#34;|dpkg &#45;&#45;set-selections</p>
<p>Remove / Fix the init scripts.</p>
<p class="code">cd /etc/init<br />
rm -f console*  dmesg.conf failsafe* mount* network-interface* openvz.conf plymouth*</p>
<p>The only init scripts I have are:</p>
<p class="code">hostname.conf<br />
networking.conf<br />
rc-sysinit.conf<br />
rc-S.conf<br />
rc.conf</p>
<p>Edit /etc/init/rc.conf and comment out the following lines:</p>
<p class="code">#console output<br />
#env INIT_VERBOSE</p>
<p>Make an openvz.conf (run (copy-paste) the &#8220;cat&#8221; command):</p>
<p class="code">cat &lt;&lt;EOF &gt; /etc/init/openvz.conf<br />
# OpenVZ &#45; Fix init sequence to have OpenVZ working with upstart<br />
<br />description &#34;Fix OpenVZ&#34;<br />
<br />start on startup<br />
<br />
task<br />
pre-start script<br />
mount -t devpts devpts /dev/pts<br />
mount -t tmpfs varrun /var/run<br />
mount -t tmpfs varlock /var/lock<br />
mkdir -p /var/run/network<br />
if [ ! -e /etc/mtab ]; then<br />
cat /proc/mounts &gt; /etc/mtab<br />
fi<br />
touch /var/run/utmp<br />
chmod 664 /var/run/utmp<br />
chown root.utmp /var/run/utmp<br />
if [ &#34;$(find /etc/network/ -name upstart -type f)&#34; ]; then<br />
chmod -x /etc/network/*/upstart || true<br />
fi<br />
end script<br />
<br />script<br />
start networking<br />
initctl emit filesystem &#45;&#45;no-wait<br />
initctl emit local-filesystems &#45;&#45;no-wait<br />
initctl emit virtual-filesystems &#45;&#45;no-wait<br />
init 2<br />
end script<br />
EOF</p>
<p>Fix ssh</p>
<p class="code">sed -i -e &#39;s_oom never_#oom never_g&#39; /etc/init/ssh.conf</p>
<p>Fix mysql </p>
<p>Edit /etc/init/mysql.conf , change the start line to</p>
<p class="code">start on start on runlevel [2345]</p>
<p>I advise you replace rsyslog with syslog-ng (rsyslog is default in Ubuntu, but IMO does not work well in Openvz VPS).</p>
<p class="code">apt-get purge rsyslog<br />
apt-get -y install syslog-ng</p>
<p>That&#8217;s it, exit and restart your VPS.</p>
<p>If all went well you should have a fully functional Ubuntu 10.04 VPS. If you broke it, you get to keep both pieces.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/upgrade-ubuntu-9-10-openvz-templates/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>&#8220;Fix&#8221; wordpress rendering of &#8220;code&#8221;</title>
		<link>http://blog.bodhizazen.net/linux/fix-wordpress-rendering-of-code/</link>
		<comments>http://blog.bodhizazen.net/linux/fix-wordpress-rendering-of-code/#comments</comments>
		<pubDate>Mon, 03 May 2010 22:22:48 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1228</guid>
		<description><![CDATA[When posting code , wordpress often changes text into gibbersih making code boxes hard to read and copy-paste of code difficult or impossible.
Examples two &#8211; show up as &#8212; (one).
To fix this, use html code.
Single quote  &#8216;  = &#38;#39; yields &#39;
Double quote &#8221; = &#38;#34; yields &#34;
Single dash &#8211; = &#38;#45; Yields &#45;
Double dash &#8212; = &#38;#45;&#38;#45; yields &#45;&#45;
&#62; = &#38;gt; yields &#62;
&#60; = &#38;lt; yields &#60;
The result is &#8220;code&#8221; that people who follow your blog can copy-paste into their terminals.
Alternately you may use a wordpress plugin. Here is a nice option with links to to other plugins.
]]></description>
			<content:encoded><![CDATA[<p>When posting code , wordpress often changes text into gibbersih making code boxes hard to read and copy-paste of code difficult or impossible.</p>
<p>Examples two &#8211; show up as &#8212; (one).</p>
<p>To fix this, use html code.</p>
<p>Single quote  &#8216;  = &amp;#39; yields &#39;</p>
<p>Double quote &#8221; = &amp;#34; yields &#34;</p>
<p>Single dash &#8211; = &amp;#45; Yields &#45;</p>
<p>Double dash &#8212; = &amp;#45;&amp;#45; yields &#45;&#45;</p>
<p>&gt; = &amp;gt; yields &gt;</p>
<p>&lt; = &amp;lt; yields &lt;</p>
<p>The result is &#8220;code&#8221; that people who follow your blog can copy-paste into their terminals.</p>
<p>Alternately you may use a wordpress plugin. Here is <a href="http://www.thunderguy.com/semicolon/wordpress/code-markup-wordpress-plugin/">a nice option</a> with links to to other plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/fix-wordpress-rendering-of-code/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>apt-get how to fix very broken packages</title>
		<link>http://blog.bodhizazen.net/linux/apt-get-how-to-fix-very-broken-packages/</link>
		<comments>http://blog.bodhizazen.net/linux/apt-get-how-to-fix-very-broken-packages/#comments</comments>
		<pubDate>Sun, 02 May 2010 19:44:55 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1222</guid>
		<description><![CDATA[I recently upgraded from Ubuntu 8.04.3 to Ubuntu 10.04 and things went well, except a few broken packages.
Apt-get / synaptic was very broken due to the flashplugin-nonfree.
sudo apt&#45;get &#45;f
[clip]
dpkg: error processing flashplugin&#45;nonfree (&#45;&#45;remove):
 Package is in a very bad inconsistent state &#8211; you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 flashplugin&#45;nonfree
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo dpkg &#45;&#45;configure &#45;a
dpkg: dependency problems prevent configuration of realplayer:
 realplayer depends on libstdc++5 (&#62;= 1:3.3.4&#45;1); however:
  Package libstdc++5 is not installed.
dpkg: error processing realplayer (&#45;&#45;configure):
 dependency problems &#45; leaving unconfigured
Errors were encountered while processing:
 realplayer
Not looking very good &#8230; and forcing things did not help (same results with &#45;&#45;remove &#45;&#45;force&#45;remove&#45;reinstreq.

dpkg &#45;&#45;remove &#45;&#45;force&#45;all flashplugin&#45;nonfree
dpkg: warning: overriding problem because &#45;&#45;force enabled:
 Package is in a very bad inconsistent state &#45; you should
 reinstall it before attempting a removal.
(Reading database ... 239938 files and directories currently installed.)
Removing flashplugin&#45;nonfree ...
update&#45;alternatives: error: [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded from Ubuntu 8.04.3 to Ubuntu 10.04 and things went well, except a few broken packages.</p>
<p>Apt-get / synaptic was very broken due to the flashplugin-nonfree.</p>
<p class="code">sudo apt&#45;get &#45;f<br />
[clip]<br />
dpkg: error processing flashplugin&#45;nonfree (&#45;&#45;remove):<br />
 Package is in a very bad inconsistent state &#8211; you should<br />
 reinstall it before attempting a removal.<br />
Errors were encountered while processing:<br />
 flashplugin&#45;nonfree<br />
E: Sub-process /usr/bin/dpkg returned an error code (1)<br />
<br />sudo dpkg &#45;&#45;configure &#45;a<br />
dpkg: dependency problems prevent configuration of realplayer:<br />
 realplayer depends on libstdc++5 (&gt;= 1:3.3.4&#45;1); however:<br />
  Package libstdc++5 is not installed.<br />
dpkg: error processing realplayer (&#45;&#45;configure):<br />
 dependency problems &#45; leaving unconfigured<br />
Errors were encountered while processing:<br />
 realplayer</p>
<p>Not looking very good &#8230; and forcing things did not help (same results with &#45;&#45;remove &#45;&#45;force&#45;remove&#45;reinstreq.</p>
<p><code><br />
dpkg &#45;&#45;remove &#45;&#45;force&#45;all flashplugin&#45;nonfree<br />
dpkg: warning: overriding problem because &#45;&#45;force enabled:<br />
 Package is in a very bad inconsistent state &#45; you should<br />
 reinstall it before attempting a removal.<br />
(Reading database ... 239938 files and directories currently installed.)<br />
Removing flashplugin&#45;nonfree ...<br />
update&#45;alternatives: error: no alternatives for iceape&#45;flashplugin.<br />
update&#45;alternatives: error: no alternatives for iceape&#45;flashplugin.<br />
dpkg: error processing flashplugin&#45;nonfree (&#45;&#45;remove):<br />
 subprocess installed pre&#45;removal script returned error exit status 2<br />
postinst called with argument `abort&#45;remove'<br />
dpkg: error while cleaning up:<br />
 subprocess installed post&#45;installation script returned error exit status 1<br />
Errors were encountered while processing:<br />
 flashplugin&#45;nonfree</code></p>
<p>To fix the problem I needed to manually remove the package.</p>
<p class="code">cd /var/lib/dpkg/info<br />
sudo rm flashplugin&#45;nonfree.*</p>
<p>Now remove the offending packages:</p>
<p class="code">sudo dpkg &#45;&#45;remove &#45;&#45;force&#45;remove&#45;reinstreq flashplugin&#45;nonfree<br />
sudo dpkg &#45;&#45;remove &#45;&#45;force&#45;remove&#45;reinstreq realplayer</p>
<p>Voilà &#8211; apt&#45;get is now fixed =)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/apt-get-how-to-fix-very-broken-packages/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Download Ubuntu 10.04 OpenVZ Templates</title>
		<link>http://blog.bodhizazen.net/linux/download-ubuntu-10-04-openvz-templates/</link>
		<comments>http://blog.bodhizazen.net/linux/download-ubuntu-10-04-openvz-templates/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 15:08:52 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenVZ]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1218</guid>
		<description><![CDATA[This is in follow up to my previous post on Ubuntu OpenVZ templates .
I have made a set of Ubuntu 10.04 openvz templates available for download HERE .
The templates *should* be compatible with the Proxmox Web Interface (thus the seemingly odd names) as well as any other OpenVZ host (Centos / Debian).
There are both 32 and 64 bit templates.
Minimal templates
The &#8220;minimal&#8221; templates are approximately 85 Mb and are, as the name implies, minimal.
lamp
As the name implies, these templates include Apache and MySQL and PHP5.
Both Apache and MySQL have been optimized for use with openvz and use signifigantly less ram then the defaults.
Here is what the 32 bit LAMP template looks like:

root@ubuntu-minimal:/# free -m
                      total     used    free    shared   [...]]]></description>
			<content:encoded><![CDATA[<p>This is in follow up to my <a href="http://blog.bodhizazen.net/linux/ubuntu-10-04-openvz-templates/">previous post on Ubuntu OpenVZ templates</a> .</p>
<p>I have made a set of Ubuntu 10.04 openvz templates available for download <a href="http://bodhizazen.fivebean.net/openvz/">HERE</a> .</p>
<p>The templates *should* be compatible with the Proxmox Web Interface (thus the seemingly odd names) as well as any other OpenVZ host (Centos / Debian).</p>
<p>There are both 32 and 64 bit templates.</p>
<h2>Minimal templates</h2>
<p>The &#8220;minimal&#8221; templates are approximately 85 Mb and are, as the name implies, minimal.</p>
<h2>lamp</h2>
<p>As the name implies, these templates include Apache and MySQL and PHP5.</p>
<p>Both Apache and MySQL have been optimized for use with openvz and use signifigantly less ram then the defaults.</p>
<p>Here is what the 32 bit LAMP template looks like:</p>
<p><code>
<pre>root@ubuntu-minimal:/# free -m
                      total     used    free    shared    buffers    cached
Mem:                   256       69     186       0         0          0
-/+ buffers/cache:     69        186
Swap:                  0         0      0
root@ubuntu-minimal:/# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.1  0.6  23432  1644 ?        Ss   06:50   0:00 init
root        21  0.0  0.0    100    16 ?        S    06:50   0:00 [init-logger]
root        86  0.0  0.3  49256  1044 ?        Ss   06:50   0:00 /usr/sbin/sshd
mysql       90  0.1  4.3  83420 11280 ?        Ssl  06:50   0:00 /usr/sbin/mysqld
root       120  0.0  2.7 119440  7280 ?        Ss   06:50   0:00 /usr/sbin/apache2 -k start
www-data   124  0.0  1.7 119440  4636 ?        S    06:50   0:00 /usr/sbin/apache2 -k start
www-data   126  0.0  1.7 119440  4636 ?        S    06:50   0:00 /usr/sbin/apache2 -k start
www-data   127  0.0  1.7 119440  4636 ?        S    06:50   0:00 /usr/sbin/apache2 -k start
www-data   128  0.0  1.7 119440  4636 ?        S    06:50   0:00 /usr/sbin/apache2 -k start
www-data   129  0.0  1.7 119440  4636 ?        S    06:50   0:00 /usr/sbin/apache2 -k start
root       182  0.0  0.1  18552   520 ?        Ss   06:51   0:00 vzctl: pts/0
root       183  0.0  0.7  17860  1904 pts/0    Rs   06:51   0:00 -bash</pre>
<p></code></p>
<p><strong>Note</strong>: mysql has no set root password, I would advise you set one ;)</p>
<p class="code">mysql &#45;u root<br />
<br />SET PASSWORD FOR &#39;root&#39;@&#39;localhost&#39; = PASSWORD(&#39;your_new_root_password_here&#39;); FLUSH PRIVILEGES; exit;<br />
<br />service mysql restart</p>
<h2>Feedback welcome</h2>
<p>If you have suggestions or experience any difficulties with these templates, please let me know and I will try my best to fix/update them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/download-ubuntu-10-04-openvz-templates/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 OpenVZ Templates</title>
		<link>http://blog.bodhizazen.net/linux/ubuntu-10-04-openvz-templates/</link>
		<comments>http://blog.bodhizazen.net/linux/ubuntu-10-04-openvz-templates/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 23:56:10 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenVZ]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1184</guid>
		<description><![CDATA[
OpenVZ is used for Virtualization and is both light weight (minimal software on the host, guests have small footprints on the hard drive, and minimal use of RAM) and fast (native speed).
I know there are some fans of Openvz out there who wish to use Ubuntu templates (you know who you are).
Cautionary note: The init scripts in Ubuntu 10.04 are problematic and you may have problems starting servers. For example , mysql will not start on boot unless you edit /etc/init/mysql.conf . Updates (to upstart and or the boot scripts [ mountall ] ) may break any fixes you add.
Because of these issues, I would hold off on using Ubuntu 10.04 on a &#8220;Production&#8221; server.
In this post I will walk you through how I create Ubuntu Lucid (10.04) Templates. There have been a few glitches along the way, and I would like to especially thank Stéphane Graber for the Openvz [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://vpslink.com/images/content/openvz-vps/logo-color-openvz.jpg" alt="OpenVZ Logo" /></p>
<p><a href="http://wiki.openvz.org/Main_Page">OpenVZ</a> is used for Virtualization and is both light weight (minimal software on the host, guests have small footprints on the hard drive, and minimal use of RAM) and fast (native speed).</p>
<p>I know there are some fans of Openvz out there who wish to use Ubuntu templates (you know who you are).</p>
<p><strong>Cautionary note</strong>: The init scripts in Ubuntu 10.04 are problematic and you may have problems starting servers. For example , mysql will not start on boot unless you edit /etc/init/mysql.conf . Updates (to upstart and or the boot scripts [ mountall ] ) may break any fixes you add.</p>
<p>Because of these issues, I would hold off on using Ubuntu 10.04 on a &#8220;Production&#8221; server.</p>
<p>In this post I will walk you through how I create Ubuntu Lucid (10.04) Templates. There have been a few glitches along the way, and I would like to especially thank <a href="https://launchpad.net/~stgraber">Stéphane Graber</a> for the Openvz init scripts.</p>
<p>This walk through is loosely based on <a href="http://wiki.openvz.org/Debian_template_creation">OpenVZ Debian Template</a> and assumes you have OpenVZ set up and that you know the basics of chroot, debootstrap, and openvz commands.</p>
<p>To make a template, use <a href="https://help.ubuntu.com/community/DebootstrapChroot">Debootstrap</a>. for this how-to the chroot (location to build the template) is <strong>/vz/private/777</strong>.</p>
<p><strong>Note</strong>: On Debian / Ubuntu hosts I mount /var/lib/vz at /vz by adding this line in /etc/fstab :</p>
<p class="code">/var/lib/vz /vz bind bind 0 0</p>
<p>To create a template, follow the <a href="https://help.ubuntu.com/community/DebootstrapChroot">Ubuntu wiki Debootstrap page</a>.</p>
<h2>Debootstrap</h2>
<p>I assume you were able to create what will be a chroot at /vz/private/777 via deboostrtap.</p>
<p class="code">sudo mkdir &#45;p /vz/private/777<br />
 sudo debootstrap &#45;&#45;variant=minbase &#45;&#45;arch i386 lucid /vz/private/777 http://archive.ubuntu.com/ubuntu/</p>
<p>Change &#45;&#45;arch i386 to &#45;&#45;arch amd64 for a 64 bit template.</p>
<h2>Template Configuration</h2>
<p>Fix openvz &#8211; we need an init script for openvz to start</p>
<p class="code">sudo nano /vz/private/777/etc/init/openvz.conf</p>
<p>Add these lines:</p>
<p class="code"># OpenVZ &#45; Fix init sequence to have OpenVZ working with upstart<br />
<br />description &#34;Fix OpenVZ&#34;<br />
<br />start on startup<br />
<br/>task<br />
pre&#45;start script<br />
    mount &#45;t devpts devpts /dev/pts<br />
    mount &#45;t tmpfs varrun /var/run<br />
    mount &#45;t tmpfs varlock /var/lock<br />
    mkdir &#45;p /var/run/network<br />
    if [ ! &#45;e /etc/mtab ]; then<br />
    cat /proc/mounts &gt; /etc/mtab<br />
    fi<br />
    touch /var/run/utmp<br />
    chmod 664 /var/run/utmp<br />
    chown root.utmp /var/run/utmp<br />
    if [ &#34;$(find /etc/network/ &#45;name upstart &#45;type f)&#34; ]; then<br />
        chmod &#45;x /etc/network/*/upstart || true<br />
    fi<br />
end script<br />
<br />script<br />
    start networking<br />
    initctl emit filesystem &#45;&#45;no&#45;wait<br />
    initctl emit local-filesystems &#45;&#45;no&#45;wait<br />
    initctl emit virtual-filesystems &#45;&#45;no&#45;wait<br />
    init 2<br />
end script</p>
<p><a href="https://bugs.launchpad.net/ubuntu/+source/mountall/+bug/436130/comments/34">Init script from Stéphane Graber</a>  modified by bodhi.zazen to work with <a href="http://pve.proxmox.com/wiki/Main_Page">Proxmox</a></p>
<p>Fix /etc/init/rc.conf . This fix was submitted by Jean-Michel Dault and Tomoiaga (see the comments below).</p>
<p>Open etc/init/rc.conf and comment out the line &#8220;console output&#8221;</p>
<p class="code">#console output<br />
#env INIT_VERBOSE</p>
<p>Now remove init scripts we do not need (these scripts are not relevant to openvz guests).</p>
<p class="code">cd /vz/private/777/etc/init/<br />
sudo rm &#45;f console* control* hwclock* module* mount* network-interface* plymouth* procps* tty* udev* upstart* </p>
<p><strong>Note</strong>: The final init scripts I have (on a template with ssh-server, mysql, and apache) are :</p>
<p class="code">cron.conf<br />
hostname.conf<br />
mysql.conf<br />
networking.conf<br />
openvz.conf<br />
rc-sysinit.conf<br />
rcS.conf<br />
rc.conf<br />
ssh.conf</p>
<p>You can likely remove rcS.conf and rc-sysinit.conf if you wish. cron.conf will fill your logs, so if you do not run cron scripts / jobs you can remove this script as well.</p>
<p>Configure the template (openvz configuration)</p>
<p class="code">sudo vzctl set 777 &#45;&#45;applyconfig vps.basic &#45;&#45;save<br />
sudo sh &#45;c &#39;echo &#34;OSTEMPLATE=ubuntu-10.04-i386-minimal&#34; &gt;&gt; /etc/vz/conf/777.conf&#39;<br />
<br/># Set an ipaddress on the guest (adjust for your network)<br />
sudo vzctl set 777 &#45;&#45;ipadd 192.168.0.77 &#45;&#45;nameserver 192.168.0.1 &#45;&#45;save</p>
<h2>Start the template and perform additional configuration</h2>
<p>Start the template</p>
<p class="code">sudo vzctl start 777</p>
<p><strong>The next series of steps will configure your template. DO NOT RUN THESE COMMANDS ON THE HOST !!!</strong></p>
<p>Enter into the template</p>
<p class="code">sudo vzctl enter 777</p>
<p>Install some additional packages (you need quota, vim/nano are optional).</p>
<p class="code">apt-get install &#45;&#45;force-yes -y gpgv<br />
apt-get update<br />
<br />apt-get install &#45;y adduser apt&#45;utils console&#45;setup iproute netbase nano openssh&#45;blacklist openssh&#45;blacklist&#45;extra openssh&#45;server quota ping sudo vim</p>
<p>Put upstart and mountall on hold (these packages will not be upgraded with apt-get upgrade).</p>
<p class="code">echo &#34;mountall hold&#34;|dpkg &#45;&#45;set&#45;selections<br />
echo &#34;upstart hold&#34;|dpkg &#45;&#45;set&#45;selections
</p>
<p>Replace rsyslog with syslog-ng.</p>
<p>rsyslog is the default in Ubuntu, but, IMO, rsyslog does not work well in an OpenVZ VPS, so I suggest you replace it with syslog-ng.</p>
<p class="code">apt-get purge rsyslog<br />
apt-get -y install syslog-ng</p>
<p>&#8220;Fix&#8221; Modprobe -</p>
<p>modprobe does not work inside openvz templates, and any script/binary which call modprobe will fail. As a potential fix you can remove modprobe and link to /bin/true</p>
<p class="code">rm /sbin/modprobe<br />
ln -s /bin/true /sbin/modprobe</p>
<p>Depending on the script this may or may not help. For example it helps with ufw, but does not fix all the problems with ufw :</p>
<p>See <a href="http://forum.openvz.org/index.php?t=tree&#038;goto=37013">this discussion</a> on the openVZ forums .</p>
<p>Lock down the root account. If you lock the root account, and wish to access the guest via ssh, you will need to create additional user accounts and configure sudo (in the template). I do this after bringing up a guest and so it is not part of template configuration.</p>
<p class="code">chmod 700 /root<br />
usermod -p &#39;!&#39; root</p>
<p>Fix ssh</p>
<p class="code">sed &#45;i &#45;e &#39;s_oom never_#oom never_g&#39; /etc/init/ssh.conf</p>
<p>Edit /etc/apt/sources.list, add these repositories (if you so desire).</p>
<p class="code">deb http://us.archive.ubuntu.com/ubuntu/ lucid main universe multiverse<br />
deb http://us.archive.ubuntu.com/ubuntu/ lucid-security main universe multiverse</p>
<p>Set a few aliases. This is optional, but I set these in /root/.bashrc .</p>
<p class="code">alias ll=&#34;ls &#45;l&#34;<br />
alias la=&#34;ls &#45;A&#34;<br />
alias nano=&#34;nano &#45;w&#34;<br />
alias cp=&#34;cp &#45;i&#34;<br />
alias mv=&#34;mv &#45;i&#34;<br />
alias rm=&#34;rm &#45;i&#34;</p>
<p>Set locale (adjust your language accordingly).</p>
<p class="code">apt-get update<br />
apt-get -y install language-pack-en<br />
locale-gen en_US.UTF-8<br />
/usr/sbin/update&#45;locale LANG=&#34;en_US.UTF&#45;8&#34; LANGUAGE=&#34;en_US.UTF&#45;8&#34; LC_ALL=&#34;en_US.UTF&#45;8&#34; LC_CTYPE=&#34;C&#34;</p>
<p>Next edit /etc/environment and define your environmental variables:</p>
<p class="code">LANG=&#34;en_US.UTF&#45;8&#34;<br />
LANGUAGE=&#34;en_US.UTF&#45;8&#34;<br />
LC_ALL=&#34;en_US.UTF&#45;8&#34;<br />
LC_CTYPE=&#34;C&#34;</p>
<h2>Package the template</h2>
<p><strong>I strongly suggest you use the &#8220;S15ssh_gen_host_keys&#8221; script to automatically generate a unique set of ssh host keys for each openvz template.</strong></p>
<p>Run these commands in the TEMPLATE , not the host.</p>
<p class="code"># clean your packages<br />
apt&#45;get clean<br />
apt&#45;get autoremove<br />
<br />#Generate a unique set of ssh (host) keys.<br />
rm &#45;f /etc/ssh/ssh_host_*<br />
<br />cat &lt;&lt; EOF &gt; /etc/rc2.d/S15ssh_gen_host_keys<br />
#!/bin/sh<br />
ssh&#45;keygen &#45;f /etc/ssh/ssh_host_rsa_key &#45;t rsa &#45;N &#39;&#39;<br />
ssh&#45;keygen &#45;f /etc/ssh/ssh_host_dsa_key &#45;t dsa &#45;N &#39;&#39;<br />
rm &#45;f \$0<br />
EOF<br />
<br />chmod a+x /etc/rc2.d/S15ssh_gen_host_keys<br />
<br /># disable some unnecessary boot scripts<br />
update-rc.d &#45;f ondemand remove<br />
<br /># Clear log files<br />
&gt; /etc/resolv.conf \<br />
echo localhost &gt; /etc/hostname \<br />
&gt; /var/log/messages; &gt; /var/log/auth.log; &gt; /var/log/kern.log; &gt; /var/log/bootstrap.log; \<br />
&gt; /var/log/dpkg.log; &gt; /var/log/syslog; &gt; /var/log/daemon.log; &gt; /var/log/apt/term.log; rm -f /var/log/*.0 /var/log/*.1</p>
<p><strong>Exit the template</strong>.</p>
<p class="code">exit</p>
<p>On the HOST stop the template and package.</p>
<p class="code">vzctl set 777 &#45;&#45;ipdel all &#45;&#45;nameserver &#39; &#39; &#45;&#45;save<br />
vzctl stop 777</p>
<p>Package with tar</p>
<p class="code">cd /vz/private/777<br />
tar &#45;&#45;numeric&#45;owner &#45;vzcf /vz/template/cache/ubuntu&#45;10.04&#45;i386&#45;minimal.tar.gz .</p>
<p>Test the template</p>
<p class="code">sudo vzctl create 888 &#45;&#45;ostemplate ubuntu&#45;10.04&#45;i386&#45;minimal<br />
sudo vzctl set 888 &#45;&#45;ipadd 192.168.0.88 &#45;&#45;nameserver 192.168.0.1 &#45;&#45;hostname ubuntu&#45;minimal &#45;&#45;save<br />
sudo vzctl start 888</p>
<p>If all went well you should have a working Ubuntu template.</p>
<p>I am always looking for comments or feedback on my templates.</p>
<p>I will post Ubuntu 10.04 templates for others to download in the near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/ubuntu-10-04-openvz-templates/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Ubuntu how to faillog</title>
		<link>http://blog.bodhizazen.net/linux/ubuntu-how-to-faillog/</link>
		<comments>http://blog.bodhizazen.net/linux/ubuntu-how-to-faillog/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 05:52:28 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[he top of the file]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1175</guid>
		<description><![CDATA[I cam across an interesting command &#8211; faillog
With faillog you can lock a user&#8217;s account after x number of failed log in attempts.
HOWEVER &#8211; it is not so straight forward &#8211; see man pam_tally
In order to enable this option you need to edit a few of the pam configuration files located in /etc/pam.d
What makes this confusing, as with sudo, THE ORDER OF RULES IS CRITICAL.
So, we can not just add a few lines at the bottom of the file, we need to add them in order
In particular, using any editor, open /etc/pam.d/common-auth and add the line AT THE TOP OF THE FILE:
auth  required pam_tally.so per_user magic_root onerr=fail
Use the silent option if you do not want pam_tally to give error messages.
auth  required pam_tally.so per_user magic_root onerr=fail silent
You may set the number of failed log in attempts and lock out time by either adding additional options to the above line [...]]]></description>
			<content:encoded><![CDATA[<p>I cam across an interesting command &#8211; <a href="http://manpages.ubuntu.com/manpages/lucid/en/man8/faillog.8.html">faillog</a></p>
<p>With faillog you can lock a user&#8217;s account after x number of failed log in attempts.</p>
<p>HOWEVER &#8211; it is not so straight forward &#8211; see <a href="http://manpages.ubuntu.com/manpages/lucid/en/man8/pam_tally.8.html">man pam_tally</a></p>
<p>In order to enable this option you need to edit a few of the pam configuration files located in /etc/pam.d</p>
<p>What makes this confusing, as with sudo, THE ORDER OF RULES IS CRITICAL.</p>
<p>So, we can not just add a few lines at the bottom of the file, we need to add them in order</p>
<p>In particular, using any editor, open /etc/pam.d/common-auth and add the line AT THE TOP OF THE FILE:</p>
<p class="code">auth  required pam_tally.so per_user magic_root onerr=fail</p>
<p><strong>Use the silent option if you do not want pam_tally to give error messages</strong>.</p>
<p class="code">auth  required pam_tally.so per_user magic_root onerr=fail silent</p>
<p>You may set the number of failed log in attempts and lock out time by either adding additional options to the above line or using faillog</p>
<p class="code">sudo faillog -m 3</p>
<p>To unlock an account use </p>
<p class="code">faillog -u login_name -r</p>
<p>Or set a time with the fail log command, the -l option sets the lock time.</p>
<p class="code">faillog -m 3 -l 3600</p>
<h2>Using faillog with ssh</h2>
<p>Now to use this with ssh we need to also edit both /etc/pam.d/sshd and /etc/ssh/sshd_config</p>
<p>First, using any editor, open /etc/pam.d/sshd </p>
<p>Look for the line &#8220;@include common-auth&#8221; , we need to add auth required tam_tally.so per_user onerr=fail</p>
<p class="code">auth required tam_tally.so per_user onerr=fail<br />
@include common-auth</p>
<p>By adding this line before include common-auth we over ride the &#8220;magic_root&#8221; setting in common-auth.</p>
<p>Once a user is logged in, we need the magic_root option so that failed sudo attempts do not lock us out of root access. But because sshd runs as root, we need to over ride this option in /etc/pam.d/sshd &#8211; clear as mud ?</p>
<p>If it does not make sense, read the man pages, open a shell, and log in as root (so you do not loose root access), and test these options, see what happens when as your admin user you try sudo -i and ssh localhost.</p>
<p>Next, using any editor, open /etc/ssh/sshd_config</p>
<p>Change the &#8220;ChallengeResponseAuthentication no&#8221; to yes (in Ubuntu UsePAM yes was default).</p>
<p class="code">ChallengeResponseAuthentication yes<br />
UsePAM yes</p>
<p><strong>If the pam_tally module locks your account, you will still be able to log in with ssh keys</strong>.</p>
<p>So it may be a good idea to make sure you have a working set of ssh keys before you enable this option ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/ubuntu-how-to-faillog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>NIDS &#8211; psad and fwsnort</title>
		<link>http://blog.bodhizazen.net/linux/nids-psad-and-fwsnort/</link>
		<comments>http://blog.bodhizazen.net/linux/nids-psad-and-fwsnort/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 01:02:13 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1165</guid>
		<description><![CDATA[I have been playing with psad and fwsnort as a NIDS tool. They are light weight and very capable tools and I highly recommend both of them.
I was going to post a blog about these tools, but it kept growing longer and longer and involved init scripts, selinux policies, and apparmor profiles.
Rather then spamming the Ubuntu planet with all the details, I made a web page.
Nids &#8211; psad &#038; fwsnort
Sorry this blog is brief, but the above link will get you started using psad / fwsnort on Debian (squeeze) , Fedora 13 , or Ubuntu 10.04.
Feel free to post any feedback or comments here.
]]></description>
			<content:encoded><![CDATA[<p>I have been playing with <a href="http://cipherdyne.org/psad/">psad</a> and <a href="http://cipherdyne.org/fwsnort/">fwsnort</a> as a NIDS tool. They are light weight and very capable tools and I highly recommend both of them.</p>
<p>I was going to post a blog about these tools, but it kept growing longer and longer and involved init scripts, selinux policies, and apparmor profiles.</p>
<p>Rather then spamming the Ubuntu planet with all the details, I made a web page.</p>
<p><a href="http://bodhizazen.net/Tutorials/psad/">Nids &#8211; psad &#038; fwsnort</a></p>
<p>Sorry this blog is brief, but the above link will get you started using psad / fwsnort on Debian (squeeze) , Fedora 13 , or Ubuntu 10.04.</p>
<p>Feel free to post any feedback or comments here.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/nids-psad-and-fwsnort/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Improve KVM performance</title>
		<link>http://blog.bodhizazen.net/linux/improve-kvm-performance/</link>
		<comments>http://blog.bodhizazen.net/linux/improve-kvm-performance/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 19:55:35 +0000</pubDate>
		<dc:creator>bodhi.zazen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://blog.bodhizazen.net/?p=1146</guid>
		<description><![CDATA[In this post I would like to share two tips I have found that greatly improve the performance of KVM guests. Both tips work with Linux guests, although only the second tip will work with windows or BSD guests.
With these tips you should notice an immediate improvement in performance including boot times, general performance, and responsiveness to inputs (mouse / keyboard).
Kernel option noop
With this tip we will use the kernel (boot) option elevator=noop to optimize your virtual hard drive I/O.
For a technical discussion of this option, see this link . If you want a more detailed discussion see this second link.
Grub 2
Using any editor, open /etc/default/grub
sudo -e /etc/default/grub
Look for the line :
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Add elevator=noop at the end of the line
GRUB_CMDLINE_LINUX_DEFAULT=&#8221;quiet splash elevator=noop&#8221;
Save your changes and exit your editor.
update grub
sudo update-grub
Reboot &#8211; One of the few times you will need to reboot.
Grub 1
With most distros you edit /boot/grub/menu.lst
Using any editor, open [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I would like to share two tips I have found that greatly improve the performance of KVM guests. Both tips work with Linux guests, although only the second tip will work with windows or BSD guests.</p>
<p>With these tips you should notice an immediate improvement in performance including boot times, general performance, and responsiveness to inputs (mouse / keyboard).</p>
<h2>Kernel option noop</h2>
<p>With this tip we will use the kernel (boot) option elevator=noop to optimize your virtual hard drive I/O.</p>
<p>For a technical discussion of this option, see <a href="http://lonesysadmin.net/2008/02/21/elevatornoop/">this link</a> . If you want a more detailed discussion see <a href="http://www.redhat.com/magazine/008jun05/features/schedulers/">this second link</a>.</p>
<h3>Grub 2</h3>
<p>Using any editor, open /etc/default/grub</p>
<p class="code">sudo -e /etc/default/grub</p>
<p>Look for the line :</p>
<p><code>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"</code></p>
<p>Add elevator=noop at the end of the line</p>
<p class="code">GRUB_CMDLINE_LINUX_DEFAULT=&#8221;quiet splash elevator=noop&#8221;</p>
<p>Save your changes and exit your editor.</p>
<p>update grub</p>
<p class="code">sudo update-grub</p>
<p>Reboot &#8211; One of the few times you will need to reboot.</p>
<h3>Grub 1</h3>
<p>With most distros you edit /boot/grub/menu.lst</p>
<p>Using any editor, open Using any editor, open /boot/grub/menu.lst</p>
<p>Look for the kopts line:</p>
<p><code># kopt=root=/dev/sda1 ro</code></p>
<p>Just add this option to the end of the line.</p>
<p class="code"># kopt=root=/dev/sda1 ro elevator=noop</p>
<p><strong>Note</strong>: DO NOT remove the # in the front of the line !!!</p>
<p>Then update grub</p>
<p class="code">sudo update-grub</p>
<p>Reboot &#8211; One of the few times you will need to reboot.</p>
<h2>Fedora is an exception</h2>
<p>Fedora is a bit odd about this. Fedora uses /boot/grub/grub.conf , and /boot/grub/menu.lst is a symbolic link to grub.conf .</p>
<h3>Specify the noop kernel option at installation</h3>
<p>You may specify grub options at installation : <a href="http://docs.fedoraproject.org/fedora-install-guide-en/fc4/sn-bootloader-advanced.html">Fedora Wiki Installation Options</a></p>
<h3>Adding the noop kernel option post installation</h3>
<p>As far as I can see, this is a manual edit. You will need to manually edit the file /etc/grub/grub.conf and add elevator=noop to the end of the kernel line.</p>
<p><a href="https://fedoraproject.org/wiki/KernelCommonProblems#How_to_set_kernel_boot_options">Fedora wiki boot options</a></p>
<p>Save your changes and reboot &#8211; One of the few times you will need to reboot.</p>
<hr />
<h2>Cache writeback option</h2>
<p><a href="http://ubuntuforums.org/member.php?u=490875">Ibuclaw</a> pointed this option out to me on IRC, and discusses in <a href="http://iainbuclaw.wordpress.com/2010/04/15/debian-kfreebsd-in-qemu-kvm/">ibuclaw&#8217;s blog</a>.</p>
<p>From <a href="http://manpages.ubuntu.com/manpages/jaunty/man1/qemu.1.html">man qemu</a> :</p>
<blockquote><p>By default, writethrough caching is used for all block device.<br />
           This means that the host page cache will be used to read and write<br />
           data but write notification will be sent to the guest only when the<br />
           data has been reported as written by the storage subsystem.</p>
<p>           Writeback caching will report data writes as completed as soon as<br />
           the data is present in the host page cache.  This is safe as long<br />
           as you trust your host.  If your host crashes or loses power, then<br />
           the guest may experience data corruption.  When using the -snapshot<br />
           option, writeback caching is used by default.</p>
<p>           The host page can be avoided entirely with cache=none.  This will<br />
           attempt to do disk IO directly to the guests memory.  QEMU may<br />
           still perform an internal copy of the data.</p>
<p>           Some block drivers perform badly with cache=writethrough, most<br />
           notably, qcow2.  If performance is more important than correctness,<br />
           cache=writeback should be used with qcow2.  By default, if no<br />
           explicit caching is specified for a qcow2 disk image,<br />
           cache=writeback will be used.  For all other disk types,<br />
           cache=writethrough is the default.
</p></blockquote>
<p>So either using writethrough or disabling the cache will improve performance.</p>
<p>To use this option, rather then specifying a drive with -hda image.qcow we need to use the -drive option</p>
<p class="code">kvm -m 512 -drive file=image.qcow,cache=writeback,media=disk</p>
<p>This option can be used with .iso as well ( note the media=cdrom )</p>
<p class="code">kvm -m 512 -drive file=fedora.iso,cache=writeback,media=cdrom</p>
<p><strong>Warning</strong>: Please note that in the event the host node crashes, data loss can result from this option.</p>
<hr />
<h2>KSM</h2>
<p>This tip was added by morgan cox (see comments). KSM == Kernel SamePage Merging and was enabled by default on Fedora 12.</p>
<p>See <a href="http://wiki.archlinux.org/index.php/KVM#Enabling_KSM">This KVM page from the Arch Wiki</a>.</p>
<p>For a more detailed description of KSM see <a href="http://www.ibm.com/developerworks/linux/library/l-kernel-shared-memory/index.html">IBM &#8211; Anatomy of Linux Kernel Shared Memory</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bodhizazen.net/linux/improve-kvm-performance/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.211 seconds -->
