<?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>systemBash &#187; Ubuntu</title>
	<atom:link href="http://systembash.com/tags/software/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://systembash.com</link>
	<description>Technology and System Administration</description>
	<lastBuildDate>Sat, 12 May 2012 13:13:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Experimenting with Pascal on Ubuntu</title>
		<link>http://systembash.com/content/experimenting-with-pascal-on-ubuntu/</link>
		<comments>http://systembash.com/content/experimenting-with-pascal-on-ubuntu/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 02:35:44 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Other Code]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[pascal]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=884</guid>
		<description><![CDATA[I&#8217;ve been busy lately on a number of projects, one of which is a programming class I am currently taking. The class itself is interesting, we are learning about the different types of programming languages. For our latest project, we were tasked with writing a simple program in Pascal. Pascal isn&#8217;t used too much any [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been busy lately on a number of projects, one of which is a programming class I am currently taking. The class itself is interesting, we are learning about the different types of programming languages. For our latest project, we were tasked with writing a simple program in <a href="http://en.wikipedia.org/wiki/Pascal_%28programming_language%29">Pascal</a>. Pascal isn&#8217;t used too much any more since it lacks some of the features that most modern languages have, but it is good to know at least a little bit about it in case you ever run across some old Pascal programs in the wild.</p>
<p>The syntax for pascal is a bit verbose, that is the main complaint about it. There are a number of others, but that is beyond the scope of this howto.</p>
<h2>Installing The Pascal Compiler on Ubuntu</h2>
<p>Installing Pascal in modern Ubuntu is a cinch. The <a href="http://www.freepascal.org/">Free Pascal Compiler</a>, or <a href="http://manpages.ubuntu.com/manpages/intrepid/man1/fpc.1.html">fpc</a>, is all that you need to get started. It works great on 32-bit or 64-bit systems. Install with:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-get install fpc</div></td></tr></tbody></table></div>
<p>Any prerequisites will automatically download and install along with fpc. </p>
<h2>Getting Started in Pascal</h2>
<p>To test the compiler let&#8217;s start with a simple Hello World program. Open up hello.pas and enter:</p>
<div class="codecolorer-container pascal mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="pascal codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">program</span> Hello;<br />
<br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
<br />
<span style="color: #000066;">Writeln</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Hello World'</span><span style="color: #009900;">&#41;</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">end</span>.</div></td></tr></tbody></table></div>
<p>Compile with <code class="codecolorer text mac-classic"><span class="text">fpc hello.pas</span></code> and run:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dave@cerberus:~/Pascal$ ./hello <br />
Hello World</div></td></tr></tbody></table></div>
<h2>Selection Sort in Pascal</h2>
<p>Now that we&#8217;ve verified it is running, I&#8217;m going to show you the code that I wrote for my program. Basically we were asked to Selection Sort two arrays of varying length. Apparently one of the (bad) features of Pascal originally was that you needed to declare the length of the array which made it a pain to work with them. </p>
<p>In this situation it is just two arrays so it isn&#8217;t too bad. Enter your array by creating two text files arrayA.txt and arrayB.txt. One number per line. The source code for sort.pas is:</p>
<div class="codecolorer-container pascal mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br /></div></td><td><div class="pascal codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">program</span> Sort;<br />
<br />
<span style="color: #000000; font-weight: bold;">var</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; A<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">array</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span>..<span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span> <span style="color: #000000; font-weight: bold;">of</span> <span style="color: #000066; font-weight: bold;">Integer</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; B<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">array</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span>..<span style="color: #cc66cc;">20</span><span style="color: #009900;">&#93;</span> <span style="color: #000000; font-weight: bold;">of</span> <span style="color: #000066; font-weight: bold;">Integer</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; F<span style="color: #339933;">:</span> Text;<br />
&nbsp; &nbsp; &nbsp; &nbsp; i<span style="color: #339933;">,</span>j<span style="color: #339933;">,</span>k<span style="color: #339933;">,</span>l<span style="color: #339933;">,</span>m<span style="color: #339933;">,</span>temp<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">Integer</span>;<br />
<br />
<span style="color: #000000; font-weight: bold;">begin</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">{Read in array A}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Assign<span style="color: #009900;">&#40;</span>F<span style="color: #339933;">,</span> <span style="color: #ff0000;">'arrayA.txt'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Reset<span style="color: #009900;">&#40;</span>F<span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; i<span style="color: #339933;">:=</span> <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #000000; font-weight: bold;">not</span> <span style="color: #000066;">EOF</span><span style="color: #009900;">&#40;</span>F<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #000000; font-weight: bold;">begin</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Inc<span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Read</span><span style="color: #009900;">&#40;</span>F<span style="color: #339933;">,</span> A<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">end</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">{Read in array B}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Assign<span style="color: #009900;">&#40;</span>F<span style="color: #339933;">,</span> <span style="color: #ff0000;">'arrayB.txt'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; Reset<span style="color: #009900;">&#40;</span>F<span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; j<span style="color: #339933;">:=</span> <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #000000; font-weight: bold;">not</span> <span style="color: #000066;">EOF</span><span style="color: #009900;">&#40;</span>F<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #000000; font-weight: bold;">begin</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Inc<span style="color: #009900;">&#40;</span>j<span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Read</span><span style="color: #009900;">&#40;</span>F<span style="color: #339933;">,</span> B<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">end</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; i<span style="color: #339933;">:=</span><span style="color: #cc66cc;">10</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; j<span style="color: #339933;">:=</span><span style="color: #cc66cc;">20</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">{Print out the unsorted arrays}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Unsorted Arrays:'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Array A:'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> k<span style="color: #339933;">:=</span><span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> i <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Write</span><span style="color: #009900;">&#40;</span>A<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">' '</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Array B:'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> k<span style="color: #339933;">:=</span><span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> j <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Write</span><span style="color: #009900;">&#40;</span>B<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">' '</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'========================='</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Sorting Arrays...'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'========================='</span><span style="color: #009900;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">{Selection Sort Array A}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> l <span style="color: #339933;">:=</span> <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> i <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> m <span style="color: #339933;">:=</span> l <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> i <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> A<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span> &gt; A<span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span> <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">begin</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp <span style="color: #339933;">:=</span> A<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:=</span> A<span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A<span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:=</span> temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">end</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">{Selection Sort Array B}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> l <span style="color: #339933;">:=</span> <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> j <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> m <span style="color: #339933;">:=</span> l <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> j <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> B<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span> &gt; B<span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span> <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">begin</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp <span style="color: #339933;">:=</span> B<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B<span style="color: #009900;">&#91;</span>l<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:=</span> B<span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; B<span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:=</span> temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">end</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">{Print out the sorted arrays}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Selection Sorted Arrays:'</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Array A: '</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> k<span style="color: #339933;">:=</span><span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> i <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Write</span><span style="color: #009900;">&#40;</span>A<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">' '</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Array B: '</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> k<span style="color: #339933;">:=</span><span style="color: #cc66cc;">1</span> <span style="color: #000000; font-weight: bold;">to</span> j <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">Write</span><span style="color: #009900;">&#40;</span>B<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">' '</span><span style="color: #009900;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">WriteLn</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">end</span>.</div></td></tr></tbody></table></div>
<p>Compile and run (ok to ignore the compile-time errors)</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dave@cerberus:~/Pascal$ fpc sort.pas <br />
Free Pascal Compiler version 2.4.0-2 [2010/03/06] for x86_64<br />
Copyright (c) 1993-2009 by Florian Klaempfl<br />
Target OS: Linux for x86-64<br />
Compiling sort.pas<br />
Linking sort<br />
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?<br />
73 lines compiled, 0.1 sec <br />
dave@cerberus:~/Pascal$ ./sort <br />
Unsorted Arrays:<br />
Array A:<br />
28 24 85 55 43 6 23 13 59 71 <br />
Array B:<br />
13 37 36 53 24 83 27 42 62 71 9 92 1 41 6 3 88 77 65 67 <br />
=========================<br />
Sorting Arrays...<br />
=========================<br />
Selection Sorted Arrays:<br />
Array A: <br />
6 13 23 24 28 43 55 59 71 85 <br />
Array B: <br />
1 3 6 9 13 24 27 36 37 41 42 53 62 65 67 71 77 83 88 92 <br />
dave@cerberus:~/Pascal$</div></td></tr></tbody></table></div>
<p>And there you have it. Compiling Pascal program on Ubuntu is an easy way to get your feet wet in programming. Pascal is a great beginner&#8217;s programming language, but if you want to learn more there are a number of great resources available for <a href="http://www.learn-programming.za.net/learn_pascal_programming.html">learning Pascal</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/experimenting-with-pascal-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UbunTOS &#8211; Ubuntu 9.10 + TinyOS 2.x VirtualBox Image</title>
		<link>http://systembash.com/content/ubuntos-ubuntu-9-10-tinyos-2-x-virtualbox-image/</link>
		<comments>http://systembash.com/content/ubuntos-ubuntu-9-10-tinyos-2-x-virtualbox-image/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 01:05:56 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Programs]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[tinyos]]></category>
		<category><![CDATA[ubuntos]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=601</guid>
		<description><![CDATA[This is my admittedly minor but I hope useful contribution to the TinyOS development community. TinyOS is an Operating System and development framework for Wireless Sensor Networks and other platforms which has a small footprint and is very energy conscious. The TinyOS source code is available for free online for many operating systems, however it takes [...]]]></description>
			<content:encoded><![CDATA[<p>This is my admittedly minor but I hope useful contribution to the TinyOS development community. <a href="http://tinyos.net/">TinyOS</a> is an Operating System and development framework for Wireless Sensor Networks and other platforms which has a small footprint and is very energy conscious.</p>
<p>The TinyOS source code is available for free online for many operating systems, however it takes a long time to get the environment set up and it is not portable at all. I came across <a href="http://toilers.mines.edu/Public/XubunTOS">XubunTOS</a> but it did not seem to be in active development anymore, so I endeavored to install TinyOS 2.1 and 2.x from source into a regular Ubuntu image. The most help came from <a href="http://www.keally.org/2008/11/11/installing-tinyos-2x-on-ubuntu-with-iris-support/">Matt Keally&#8217;s Blog</a>. While doing this, I thought it might be useful to many others who wish to develop in the TinyOS framework but might not have the skills necessary to install it. Therefore, I developed this <a href="http://www.virtualbox.org/">VirtualBox</a> image so that you can install it on any system for which VirtualBox is available and supports USB passthrough for the programming of the motes. I&#8217;ve tested on Windows 7, Windows XP and it should work on any other host OS, but I would love to hear your feedback. All <a href="http://www.arsgeek.com/2007/05/10/exclusive-canonical-ltd-and-ubuntu-founder-mark-shuttleworth-announce-ubuntos/">funny business</a> aside, I present to the world UbunTOS:<span id="more-601"></span></p>
<p><a href="http://systembash.com/wp-content/uploads/2010/02/vboxubuntos.png"><img class="aligncenter size-full wp-image-605" title="vboxubuntos" src="http://systembash.com/wp-content/uploads/2010/02/vboxubuntos.png" alt="" width="453" height="230" /></a></p>
<h3>Features</h3>
<ul>
<li>Ubuntu 9.10 OS (patched through 2/5/2010)</li>
<li>Complete TinyOS development environment</li>
<li>TinyOS 2.1 Installed</li>
<li>TinyOS 2.x CVS Installed (default environment)</li>
<li>Portable for development in a variety of host environments</li>
<li>Patched motelist for MIB520 programming board</li>
</ul>
<h3>Directions</h3>
<ol>
<li>Unzip the file and import into VirtualBox. I recommend at least 768M RAM</li>
<li>Boot system</li>
<li>Enable USB passthrough for the programming board. Check off the USB device in the menu as shown:<br />
<img class="aligncenter size-full wp-image-606" title="vboxusb" src="http://systembash.com/wp-content/uploads/2010/02/vboxusb.png" alt="VirtualBox USB Passthrough" width="381" height="132" /></li>
<li>Check &#8216;motelist&#8217; to see which port it has been assigned to (motelist has been patched to see MIB520 programming board)</li>
<li>Program away! TinyOS resides in /opt/</li>
</ol>
<h3><span style="text-decoration: underline;">Download</span></h3>
<p>MD5 sum:    <strong>9a27ba7902337139c2eae0121ec6ca4e</strong></p>
<p>Download UbuntuTOS_Ubuntu-9.10_TinyOS-2.x.zip [2/8/2010]:    [ <a href="/devel/UbuntuTOS_Ubuntu-9.10_TinyOS-2.x.zip.torrent"><strong>torrent</strong></a> | <a href="http://systembash.com/UbuntuTOS_Ubuntu-9.10_TinyOS-2.x.zip"><strong>http</strong></a> ]</p>
<p>If you happen to have spare bandwidth, please <a href="http://systembash.com/contact/">send me a note</a> and I will link to the file via http or ftp.</p>
<h3>Notes</h3>
<ul>
<li>The default username is wcu and password is <strong>nosecurity</strong></li>
<li>The hostname is wcu-desktop, in honor of <a href="http://www.wcupa.edu">West Chester University</a> which is sponsoring my research into Wireless Sensor Networks.</li>
<li>To switch between the TinyOS 2.x and 2.1 environment, run the shell script /opt/tinyos-2.1.0/tinyos.sh or /opt/tinyos-2.x/tinyos-2.x.sh. By default the 2.x environment is loaded via ~/.bashrc/.</li>
<li>To update TinyOS 2.x with latest CVS Code:<br />
cd /opt; cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-2.x</li>
<li>I&#8217;ve testing this using <em>Mica2 </em>and<em> Micaz</em>. Let me know if you have success with other combinations as I just do not have the hardware to test.</li>
<li>Usually the programming port and the data port are on consecutive ports. In the example above, the programming device is /dev/ttyUSB0 and the data port, for serialforwarder, is /dev/ttyUSB1</li>
</ul>
<h3>Known Bugs?</h3>
<p>If you have issues while enabling USB Passthrough, such as an error like:</p>
<p>Version:1.0 StartHTML:0000000105 EndHTML:0000001970 StartFragment:0000000127 EndFragment:0000001952</p>
<p><!--StartFragment--></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="#eeeeee">
<tbody>
<tr>
<td>Result Code:</td>
<td>E_INVALIDARG (0&#215;80070057)</td>
</tr>
<tr>
<td>Component:</td>
<td>HostUSBDevice</td>
</tr>
<tr>
<td>Interface:</td>
<td>IHostUSBDevice {173b4b44-d268-4334-a00d-b6521c9a740a}</td>
</tr>
<tr>
<td>Callee:</td>
<td>IConsole {6375231a-c17c-464b-92cb-ae9e128d71c3}</td>
</tr>
</tbody>
</table>
<p>Reboot your host system. I believe this happens while reinstalling the passthrough driver for the USB device for the first time. Rebooting seems to fix this problem, and after the initial setup this problem seems to disappear.</p>
<p>If you have any other problems (or compliments!) please leave a message via the form below.</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/ubuntos-ubuntu-9-10-tinyos-2-x-virtualbox-image/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Tweaking TCP for Fast (100mbps+) Connections and Transfers on Linux</title>
		<link>http://systembash.com/content/tweaking-tcp-for-fast-100mbps-connections-and-transfers-on-linux/</link>
		<comments>http://systembash.com/content/tweaking-tcp-for-fast-100mbps-connections-and-transfers-on-linux/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 01:26:24 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[tcp/ip]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=516</guid>
		<description><![CDATA[We recently did some speed testing on a few of the servers on our network, and we were not receiving the speeds expected considering they were sitting on a physical 100mbps ethernet port. The servers were indeed on physical 100mbps connection, however wget (TCP/IP, HTTP Port 80) download tests showed only a max of about 1.5MB/sec (note the 8bit/byte conversion, so this translates to about 12mbits).]]></description>
			<content:encoded><![CDATA[<p>We recently did some speed testing on a few of the servers on our network, and we were not receiving the speeds expected considering they were sitting on a physical 100mbps ethernet port. The servers were indeed on physical 100mbps connection, however wget (TCP/IP, HTTP Port 80) download tests showed only a max of about 1.5MB/sec (note the 8bit/byte conversion, so this translates to about 12mbits).</p>
<p><a href="http://systembash.com/wp-content/uploads/2009/12/fastnetwork.png"><img class="aligncenter size-full wp-image-519" title="fastnetwork" src="http://systembash.com/wp-content/uploads/2009/12/fastnetwork.png" alt="" width="531" height="203" /></a></p>
<p>This is due to how TCP frames data packets and optimizes them for connections. I believe by default TCP on most systems assumes about a 10mbit max capable transfer rate, so it does not show performance gains on a larger pipe without modification to the kernel options which govern TCP/IP frame size and features. Some distributions may make this change for you automatically however many will not.</p>
<p>To keep things short and sweet, we took the following advice from <a href="http://www.speedguide.net/">Speedguide.net</a> on tweaking TCP parameters on linux kernel systems. This will cover Linux 2.1 and above &#8211; which means CentOS, RedHat, Ubuntu, Debian and many more distributions.</p>
<p>The TCP Parameters we will change are:</p>
<ul>
<li>/proc/sys/net/core/rmem_max - Maximum TCP Receive Window</li>
<li>/proc/sys/net/core/wmem_max &#8211; Maximum TCP Send Window</li>
<li>/proc/sys/net/ipv4/tcp_timestamps - (<a href="http://www.ietf.org/rfc/rfc1323.txt">RFC 1323</a>) timestamps add 12 bytes to the TCP header&#8230;</li>
<li>/proc/sys/net/ipv4/tcp_sack &#8211; tcp selective acknowledgements.</li>
<li>/proc/sys/net/ipv4/tcp_window_scaling &#8211; support for large TCP Windows (<a href="http://www.ietf.org/rfc/rfc1323.txt">RFC 1323</a>). Needs to be set to 1 if the Max TCP Window is over 65535.</li>
</ul>
<p>If you recall /proc/ is the volatile portion of kernel configuration, you can change it on the fly but it will be reset on reboot unless settings are changed via an init file or setting the options in /etc/sysctl.conf. To change the settings once (to test):</p>
<pre class="prettyprint">echo 256960 > /proc/sys/net/core/rmem_default
echo 256960 > /proc/sys/net/core/rmem_max
echo 256960 > /proc/sys/net/core/wmem_default
echo 256960 > /proc/sys/net/core/wmem_max
echo 0 > /proc/sys/net/ipv4/tcp_timestamps
echo 1 > /proc/sys/net/ipv4/tcp_sack
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling</pre>
<p>And to apply them for good, add the following lines to /etc/sysctl.conf:</p>
<pre class="prettyprint">net.core.rmem_default = 256960
net.core.rmem_max = 256960
net.core.wmem_default = 256960
net.core.wmem_max = 256960
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1</pre>
<p>Use &#8216;sysctl -p&#8217; to apply the changes in this file to your running Linux instance. Feel free to experiment with these numbers to see how they impact your transfers, it depends a lot on how many and how large the files are that you transferring. These changes must be made on the SERVER side, any change on the client side would not impact the download speed from the server.</p>
<p>There are several other variables to consider, and these all depend on your application so change them if you know what you are attempting to do. After changing these settings, you will see speeds of about 10MB/sec (80mbps) on a 100mbps connection. The other 20mbps are lost in TCP and other network layer overhead, which is unavoidable.</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/tweaking-tcp-for-fast-100mbps-connections-and-transfers-on-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How To Reset Windows XP, Vista, Windows 7 Passwords with Ubuntu 9.10 Live Image and a USB Drive</title>
		<link>http://systembash.com/content/how-to-reset-windows-xp-vista-windows-7-passwords-with-ubuntu-9-10-live-image-and-a-usb-drive/</link>
		<comments>http://systembash.com/content/how-to-reset-windows-xp-vista-windows-7-passwords-with-ubuntu-9-10-live-image-and-a-usb-drive/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 10:40:03 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Other Technology]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[chntpw]]></category>
		<category><![CDATA[livecd]]></category>
		<category><![CDATA[password]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=497</guid>
		<description><![CDATA[I put this together for a project in a class I am taking, and thought it would be handy for others as well. The goal is to access a Windows filesystem and reset the password for a user, for example if someone forgot the Administrator password or the account is locked out from too many [...]]]></description>
			<content:encoded><![CDATA[<p>I put this together for a project in a class I am taking, and thought it would be handy for others as well. The goal is to access a Windows filesystem and reset the password for a user, for example if someone forgot the Administrator password or the account is locked out from too many bad password login attempts. This works on all modern Windows Operating Systems: Windows 2000, 2003, XP, Vista, Win7 etc. Make sure to create a backup if you want to make sure you don&#8217;t corrupt your Windows install, as it can happen.</p>
<p>Tools used:</p>
<ul>
<li><a href="http://unetbootin.sourceforge.net/">Unetbootin</a></li>
<li><a href="http://www.ubuntu.com/GetUbuntu/download">Ubuntu 9.10 Desktop ISO</a></li>
<li>One flash drive, 1 gig or larger</li>
<li><a href="http://home.eunet.no/pnordahl/ntpasswd/">chntpw</a></li>
</ul>
<h2>Accessing the Filesystem</h2>
<p>First we use unetbootin to install Ubuntu 9.10 to a flash drive. The flash drive needs to be at least 1GB to install the image.</p>
<p style="TEXT-ALIGN:left"><a href="http://systembash.com/wp-content/uploads/2009/10/dmg77wv_74f94fzmp7_b.png"><img class="aligncenter size-full wp-image-498" title="Unetbootin settings" src="http://systembash.com/wp-content/uploads/2009/10/dmg77wv_74f94fzmp7_b.png" alt="Unetbootin settings" width="479" height="355" /></a></p>
<p style="TEXT-ALIGN:left">Select &#8220;Diskimage&#8221; and then the .iso file we downloaded of the Ubuntu 9.10 image.</p>
<p style="TEXT-ALIGN:left">Select the USB Drive and Drive Letter to install the ISO onto. Click OK:</p>
<p style="TEXT-ALIGN:left"><a href="http://systembash.com/wp-content/uploads/2009/10/dmg77wv_75c3sfj7gx_b.png"><img class="aligncenter size-full wp-image-499" title="Unetbootin doing its thing" src="http://systembash.com/wp-content/uploads/2009/10/dmg77wv_75c3sfj7gx_b.png" alt="Unetbootin doing its thing" width="479" height="355" /></a></p>
<p>Once the program is done, click &#8216;exit&#8217; and remove the USB Drive. You now have a bootable live image of Ubuntu 9.10.</p>
<p>Plug the usb drive into the target system. Boot off of the drive, you may need to change the boot options in the BIOS if it is set to boot off of the hard drive. Select &#8220;Default&#8221; in the unetbootin boot menu to boot into the Ubuntu OS. It will automatically log you in.</p>
<p>Once booted you already have access to the Windows filesystem since the ntfs filesystem driver is included in the kernel. This is nice and wasn&#8217;t the case not too long ago.</p>
<p>We chose two reasons to use unetbootin and Ubuntu 9.10. The first is the ease of use of installing a bootable image. After downloading the two packages, it is trivial to load the OS onto the drive, and since it includes ntfs drivers it allows us to access the unencrypted hard drive on boot. Since it is on a USB drive, any system made since 2000 or so should be able to boot this. You don&#8217;t need to lug around a CD or even access the CD drive.</p>
<p>To prevent easy access to the hard drive, encryption of the hard drive partition would be necessary using <a href="http://technet.microsoft.com/en-us/library/cc875821.aspx">Microsoft EFS</a> or <a href="http://www.truecrypt.org/">TrueCrypt</a> hard drive encryption software. After encrypting the hard drive, any live operating system running would not be able to decrypt the hard drive easily.</p>
<p>Furthermore, installation of a BIOS level password would ensure that any unauthorized users would not be able to boot alternative operating systems via USB, CDROM, Floppy or other method. The only way to defeat a BIOS level password would be to reset the BIOS (requiring entrance into the hardware of the system) or using an Evil Maid style attack.</p>
<p>The <a href="http://theinvisiblethings.blogspot.com/2009/10/evil-maid-goes-after-truecrypt.html">Evil Maid</a> attack is performed by a theoretical malicious party that has access to the target PC without alerting the legitimate user. Without knowledge of the authorized; a root kit or device would be installed (for example, on the USB connector of the keyboard) to sniff out the password as entered on bootup. After the user boots the system and finishes her work, ostensibly shutting down the system securely, at least to her knowledge, the Evil Maid would then collect the password entered into the BIOS, thereby defeating the BIOS password security measure.</p>
<h2>Resetting the Password</h2>
<p>We can now reset the Administrator or any other password on this system using the tool <a href="http://home.eunet.no/pnordahl/ntpasswd/">chntpw</a>. To install this package, ensure the system has a connection to the internet (via dhcp perhaps?) and run the command:</p>
<pre>sudo software-properties-gtk --enable-component=universe --enable-component=multiverse; sudo apt-get update; sudo apt-get install chntpw</pre>
<p>Alternatively, you can download the executable and place it on the USB drive to give access without connecting to the internet. chntpw is the software that modifies the SAM (Security Accounts Manager) database file. Use the terminal to change directories to the password file</p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">cd /media/path/to/disk/WINDOWS/system32/config/</span></p>
<p><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">Then execute the chntpw utility:</span></span></p>
<pre>  # sudo chntpw -u username SAM SYSTEM</pre>
<p>View the sample output:</p>
<pre>ubuntu@ubuntu:/media/B830C9BC30C981BC/WINDOWS/system32/config$ sudo chntpw SAM SECURITY
chntpw version 0.99.5 070923 (decade), (c) Petter N Hagen
Hive &lt;SAM&gt; name (from header): &lt;\SystemRoot\System32\Config\SAM&gt;
ROOT KEY at offset: 0x001020 * Subkey indexing type is: 666c &lt;lf&gt;
Page at 0x7000 is not 'hbin', assuming file contains garbage at end
File size 262144 [40000] bytes, containing 6 pages (+ 1 headerpage)
Used for data: 255/20736 blocks/bytes, unused: 9/3648 blocks/bytes.

Hive &lt;SECURITY&gt; name (from header): &lt;emRoot\System32\Config\SECURITY&gt;
ROOT KEY at offset: 0x001020 * Subkey indexing type is: 666c &lt;lf&gt;
Page at 0xe000 is not 'hbin', assuming file contains garbage at end
File size 262144 [40000] bytes, containing 13 pages (+ 1 headerpage)
Used for data: 1074/49024 blocks/bytes, unused: 9/3808 blocks/bytes.

* SAM policy limits:
Failed logins before lockout is: 0
Minimum password length        : 0
Password history count         : 0
| RID -|---------- Username ------------| Admin? |- Lock? --|
| 01f4 | Administrator                  | ADMIN  | dis/lock |
| 03ec | ASPNET                         |        | dis/lock |
| 03ed | CSC603                         | ADMIN  | dis/lock |
| 01f5 | Guest                          |        | dis/lock |
| 03e8 | HelpAssistant                  |        | dis/lock |

---------------------&gt; SYSKEY CHECK &lt;-----------------------
SYSTEM   SecureBoot            : -1 -&gt; Not Set (not installed, good!)
SAM      Account\F             : 1 -&gt; key-in-registry
SECURITY PolSecretEncryptionKey: 1 -&gt; key-in-registry

***************** SYSKEY IS ENABLED! **************
This installation very likely has the syskey passwordhash-obfuscator installed
It's currently in mode = -1, Unknown-mode
SYSKEY is on! However, DO NOT DISABLE IT UNLESS YOU HAVE TO!
This program can change passwords even if syskey is on, however
if you have lost the key-floppy or passphrase you can turn it off,
but please read the docs first!!!

** IF YOU DON'T KNOW WHAT SYSKEY IS YOU DO NOT NEED TO SWITCH IT OFF!**
NOTE: On WINDOWS 2000 it will not be possible
to turn it on again! (and other problems may also show..)

NOTE: Disabling syskey will invalidate ALL
passwords, requiring them to be reset. You should at least reset the
administrator password using this program, then the rest ought to be
done from NT.

Do you really wish to disable SYSKEY? (y/n) [n]
RID     : 0500 [01f4]
Username: Administrator
fullname:
comment : Built-in account for administering the computer/domain
homedir : 

User is member of 1 groups:
00000220 = Administrators (which has 2 members)

Account bits: 0x0210 =
[ ] Disabled        | [ ] Homedir req.    | [ ] Passwd not req. |
[ ] Temp. duplicate | [X] Normal account  | [ ] NMS account     |
[ ] Domain trust ac | [ ] Wks trust act.  | [ ] Srv trust act   |
[X] Pwd don't expir | [ ] Auto lockout    | [ ] (unknown 0x08)  |
[ ] (unknown 0x10)  | [ ] (unknown 0x20)  | [ ] (unknown 0x40)  | 

Failed login count: 1, while max tries is: 0
Total  login count: 1

- - - - User Edit Menu:
 1 - Clear (blank) user password
 2 - Edit (set new) user password (careful with this on XP or Vista)
 3 - Promote user (make user an administrator)
 4 - Unlock and enable user account [probably locked now]
 q - Quit editing user, back to user select
Select: [q] &gt;</pre>
<p>Depending on the status of the SYSKEY password security, you may only be able to blank the password and not actually change it. I recommend blanking the password and then resetting it once you log into the system.</p>
<p>You can also unlock a system if the user accounts have all been locked out due to too many login attempts or any other reason. Using these tools you can gain access to almost any unencrypted Windows system, from Windows NT up to Windows 7.</p>
<p>As a warning, If there is data on the hard drive you wish to keep, make sure to make a backup of the hard drive before performing this password as it can corrupt the Windows installation.</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/how-to-reset-windows-xp-vista-windows-7-passwords-with-ubuntu-9-10-live-image-and-a-usb-drive/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A Poor Man&#8217;s VPN: Proxy Web Connection to Remote Server (via SSH and Tunnel)</title>
		<link>http://systembash.com/content/a-poor-mans-vpn-proxy-web-connection-to-remote-server-via-ssh-and-tunnel/</link>
		<comments>http://systembash.com/content/a-poor-mans-vpn-proxy-web-connection-to-remote-server-via-ssh-and-tunnel/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 13:12:20 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://systembash.com/content/a-poor-mans-vpn-proxy-web-connection-to-remote-server-via-ssh-and-tunnel/</guid>
		<description><![CDATA[Did you ever have a situation where you needed to access a website that had an IP restriction in place? I recently had a situation where I needed to access the web via my university connection (due to IP restrictions placed on accessing databases of research papers). They do not have a VPN setup so [...]]]></description>
			<content:encoded><![CDATA[<p>Did you ever have a situation where you needed to access a website that had an IP restriction in place? I recently had a situation where I needed to access the web via my university connection (due to IP restrictions placed on accessing databases of research papers). They do not have a VPN setup so it is hard to do this off-campus.</p>
<p>I do however have access to a linux machine on campus. I am familiar with port forwarding using SSH but I had never used it to actually tunnel web traffic using a web browser on Windows. Turns out it is surprisingly easy!</p>
<p>The ssh command to use is:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ssh -C2qTnN -D 8080 username@remote_host</div></td></tr></tbody></table></div>
<p>This command sshes to the remote_host, and creates a tunnel on your localhost, port 8080. Note that you need to have private key authentication already set up for this host &#8211; it will not work with password authentication.</p>
<p>The description of the switches are (from the <a href="http://linux.die.net/man/1/ssh">ssh man page</a>):</p>
<ul>
<li>-C : Compression</li>
<li>-2 : Use SSHv2</li>
<li>-q : quiet!</li>
<li>-T : Disable pseuto-tty allocation</li>
<li>-n : Prevents reading from stdin (you need to have private key authentication set up, to prevent password authentication)</li>
<li>-N : Do not execute a remote command (or launch a shell). Just use the ssh process for port forwarding</li>
<li>-D : Allocate a socket to listen on the local side. When a connection is made to this port it is located to the remote machine. Makes SSH work as a SOCKS server. Only root can forward&nbsp;privileged&nbsp;ports like this.</li>
</ul>
<p>From here, you set up Firefox or your browser of choice to use a Socks proxy on localhost:8080. The man page says that SOCKS4 and SOCK5 should both work but I had to use SOCKS v4, SOCKS v5 did not seem to work for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/a-poor-mans-vpn-proxy-web-connection-to-remote-server-via-ssh-and-tunnel/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Ubuntu Server in Place Network Upgrade From 8.10 to 9.04</title>
		<link>http://systembash.com/content/ubuntu-server-in-place-network-upgrade-from-810-to-904/</link>
		<comments>http://systembash.com/content/ubuntu-server-in-place-network-upgrade-from-810-to-904/#comments</comments>
		<pubDate>Thu, 21 May 2009 23:22:44 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=369</guid>
		<description><![CDATA[It is easy to do an in-place upgrade of Ubuntu Server from 8.10 &#8216;Intrepid Ibex&#8216; to 9.04 &#8216;Jaunty Jackalope&#8216;. You can do this remotely over ssh or whatever you use to control your server. Best practices say to make sure to backup your server before doing the upgrade. I&#8217;ve done several servers this way with [...]]]></description>
			<content:encoded><![CDATA[<p><center><img src="http://systembash.com/wp-content/uploads/2009/05/ubuntuupgrade.png" alt="Ubuntu Upgrade" title="Ubuntu Upgrade" width="359" height="349" class="aligncenter size-full wp-image-370" /></center></p>
<p>It is easy to do an in-place upgrade of Ubuntu Server from 8.10 &#8216;<a href="https://wiki.ubuntu.com/IntrepidIbex">Intrepid Ibex</a>&#8216; to 9.04 &#8216;<a href="https://wiki.ubuntu.com/JauntyJackalope">Jaunty Jackalope</a>&#8216;. You can do this remotely over ssh or whatever you use to control your server. Best practices say to make sure to backup your server before doing the upgrade. I&#8217;ve done several servers this way with no issues!</p>
<p>Issue the command:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-get update; sudo apt-get upgrade; sudo apt-get install update-manager-core; sudo do-release-upgrade</div></td></tr></tbody></table></div>
<p>Follow any prompts to first upgrade the current distribution with the newest packages, then do the release upgrade. </p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/ubuntu-server-in-place-network-upgrade-from-810-to-904/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Easy Search and Replace in Multiple Files on Linux Command Line</title>
		<link>http://systembash.com/content/easy-search-and-replace-in-multiple-files-on-linux-command-line/</link>
		<comments>http://systembash.com/content/easy-search-and-replace-in-multiple-files-on-linux-command-line/#comments</comments>
		<pubDate>Thu, 07 May 2009 03:10:57 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Other Code]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=365</guid>
		<description><![CDATA[I recently came across a typo that existed in a bunch of html files on my web server. I thought it should be easy enough to change, but since it was in a number of files, editing it by hand would be time consuming. Fortunately, there is an easy, one liner command to replace the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across a typo that existed in a bunch of html files on my web server. I thought it should be easy enough to change, but since it was in a number of files, editing it by hand would be time consuming. Fortunately, there is an easy, one liner command to replace the text in multiple files in a sub directory using recursion.</p>
<pre>grep -lr -e '&lt;oldword&gt;' * | xargs sed -i 's/&lt;oldword&gt;/&lt;newword&gt;/g'</pre>
<p>This command broken down:</p>
<ul>
<li>grep for the word in a files, use recursion (to find files in sub directories), and list only file matches</li>
<li>| xargs passes the results from the grep command to sed</li>
<li>sed -i uses a regular expression (regex) to evaluate the change: s (search) / search word / target word / g (global replace)</li>
</ul>
<p>For more information, see man pages for grep, sed, and xarg. Also it is very handy to learn about <a href="http://www.regular-expressions.info/">regular expressions</a> as they are a valuable tool to any command line programmer!</p>
<h3>Update 2009/7/19:</h3>
<p>Thanks to reader btr we have a great one-line perl command that will perform the same task:</p>
<p>Perl provides a really nice one-line for this kind of thing:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">perl -p -i -e ’s///g’ *</div></td></tr></tbody></table></div>
<p>It also provides the option of creating a backup of each file changed:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">perl -p -i.bak -e ’s///g’ *</div></td></tr></tbody></table></div>
<p>mnemonic: PIE (”easy as pie”, etc.)<br />
google “perl pie” and you’ll get lots of info for other uses of this technique.</p>
<p><a href="http://www.linux.org/lessons/short/perlpie/perl_pie.html">http://www.linux.org/lessons/short/perlpie/perl_pie.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/easy-search-and-replace-in-multiple-files-on-linux-command-line/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>How To Turn Off Your Monitor Via Command Line in Ubuntu</title>
		<link>http://systembash.com/content/how-to-turn-off-your-monitor-via-command-line-in-ubuntu/</link>
		<comments>http://systembash.com/content/how-to-turn-off-your-monitor-via-command-line-in-ubuntu/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 14:56:01 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[energy]]></category>
		<category><![CDATA[energystar]]></category>
		<category><![CDATA[lobby]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[power]]></category>
		<category><![CDATA[saving]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=346</guid>
		<description><![CDATA[As previously written on this blog, I have set up a display in our lobby at work to display the day&#8217;s current events and meetings using Ubuntu and a tiny PC. Since this is a display which is on all day, the screensaver and monitor blanking (and other Energy Star features) are all turned off. [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://systembash.com/content/using-ubuntu-as-a-247-lobby-display-driver/">previously written</a> on this blog, I have set up a display in our lobby at work to display the day&#8217;s current events and meetings using Ubuntu and a <a href="http://www.fit-pc.com/new/">tiny PC</a>. Since this is a display which is on all day, the screensaver and monitor blanking (and other Energy Star features) are all turned off.</p>
<p>Under the auspice of wanting to save energy and also extending the life of a new monitor, someone suggested that we <strong>turn off the monitor</strong> at night using an electrical timer. A lightbulb went off in my head, that there must be a better way to do this via command line and then run it in the cron.</p>
<p>It turns out the solution is very simple. The xset command is the X server preferences command. It has a simple command to turn off the monitor:</p>
<div class="codecolorer-container text mac-classic prettyprint" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ xset dpms force off</div></td></tr></tbody></table></div>
<p>and to turn the monitor back on:</p>
<div class="codecolorer-container text mac-classic prettyprint" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ xset dpms force on</div></td></tr></tbody></table></div>
<p>You can also check the status of the X server settings by using:</p>
<div class="codecolorer-container text mac-classic prettyprint" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ xset -q</div></td></tr></tbody></table></div>
<p>Also, when dpms turns off the monitor, it will turn back on after a keypress or by moving the mouse. Since this is a lobby display, there is no keyboard or mouse installed in the system.</p>
<p>I&#8217;ve rolled this into a little bash script with on, off, and status switches:</p>
<pre class="prettyprint">#!/bin/bash
export DISPLAY=:0.0

if [ $# -eq 0 ]; then
  echo usage: $(basename $0) "on|off|status"
  exit 1
fi

if [ $1 = "off" ]; then
  echo -en "Turning monitor off..."
  xset dpms force off
  echo -en "done.\nCheck:"
  xset -q|grep "Monitor is"
elif [ $1 = "on" ]; then
  echo -en "Turning monitor on..."
  xset dpms force on
  echo -en "done.\nCheck:"
  xset -q|grep "Monitor is"
elif [ $1 = "status" ]; then
  xset -q|sed -ne 's/^[ ]*Monitor is //p'
else
  echo usage: $(basename $0) "on|off|status"
fi</pre>
<p>You can then use cron to turn off the monitor at night, and back on in the morning:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">0 20 0 0 0 /home/lobby/monitorControl.sh off<br />
0 7 0 0 0 /home/lobby/monitorControl.sh on</div></td></tr></tbody></table></div>
<p>This script will turn it off at 8pm and back on at 7am.</p>
<p>Note that this was written for an <strong>Ubuntu</strong> system, but the xset command is pretty generic so any system that runs Xserver like <strong>RedHat, CentOS, Debian, Fedora</strong>, etc should be able to use the script as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/how-to-turn-off-your-monitor-via-command-line-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Apt-get Update GPG Key Errors and Fix</title>
		<link>http://systembash.com/content/apt-get-update-gpg-key-errors-and-fix/</link>
		<comments>http://systembash.com/content/apt-get-update-gpg-key-errors-and-fix/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 19:58:30 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[gpg]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=332</guid>
		<description><![CDATA[Running sudo apt-get upgrade, I started getting this error: 1Reading package lists... Done 1W: GPG error: http://ppa.launchpad.net intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 313D312748A22A95 1W: You may want to run apt-get update to correct these problems Ah ha! But apt-get update is the command causing [...]]]></description>
			<content:encoded><![CDATA[<p>Running sudo apt-get upgrade, I started getting this error:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Reading package lists... Done</div></td></tr></tbody></table></div>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">W: GPG error: http://ppa.launchpad.net intrepid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 313D312748A22A95</div></td></tr></tbody></table></div>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">W: You may want to run apt-get update to correct these problems</div></td></tr></tbody></table></div>
<p>Ah ha! But apt-get update is the command causing this problem.</p>
<p>The solution is to import this key from the gpg servers; I don&#8217;t know why this isn&#8217;t done automatically, but here is it:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 313D312748A22A95; gpg --export --armor 313D312748A22A95 | sudo apt-key add -</div></td></tr></tbody></table></div>
<p>Resulting in:</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --recv-keys --keyserver keyserver.ubuntu.com 313D312748A22A95<br />
gpg: requesting key 48A22A95 from hkp server keyserver.ubuntu.com<br />
gpg: key 48A22A95: public key &quot;Launchpad PPA for Filip Brcic&quot; imported<br />
gpg: Total number processed: 1<br />
gpg: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unchanged: 1<br />
OK</div></td></tr></tbody></table></div>
<p>Congrats! sudo apt-get update now works properly!</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/apt-get-update-gpg-key-errors-and-fix/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>HOWTO: Installing ZFS and setting up a Raid-Z array on Ubuntu</title>
		<link>http://systembash.com/content/howto-installing-zfs-and-setting-up-a-raid-z-array-on-ubuntu/</link>
		<comments>http://systembash.com/content/howto-installing-zfs-and-setting-up-a-raid-z-array-on-ubuntu/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 06:10:06 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Configurations]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[zfs]]></category>

		<guid isPermaLink="false">http://systembash.com/?p=295</guid>
		<description><![CDATA[Readers should note that this applies to Ubuntu 8.10 Intrepid Ibex only! ZFS is a relatively new filesystem created by Sun. It is released under the CDDL License which is incompatible with Linux&#8217;s GPL License, meaning that it can not be installed natively in the kernel. Therefore, for not it is relegated to addon packages [...]]]></description>
			<content:encoded><![CDATA[<p>Readers should note that this applies to Ubuntu 8.10 Intrepid Ibex only!</p>
<p>ZFS is a relatively new filesystem created by Sun. It is released under the CDDL License which is incompatible with Linux&#8217;s GPL License, meaning that it can not be installed natively in the kernel. Therefore, for not it is relegated to addon packages and is brought to Ubuntu via the Fuse framework.</p>
<p>For more information on this see the Ubuntu Wiki article on <a href="https://wiki.ubuntu.com/ZFS/">ZFS</a>.</p>
<p>The wiki article also explains this, but getting ZFS installed on Ubuntu is actually pretty straightforward by issuing these commands:</p>
<pre class="prettyprint">$ sudo echo "deb http://ppa.launchpad.net/brcha/ubuntu intrepid main" >> /etc/apt/sources.list.d/zfs-fuse.list
$ sudo echo "deb-src http://ppa.launchpad.net/brcha/ubuntu intrepid main" >> /etc/apt/sources.list.d/zfs-fuse.list
$ sudo apt-get update
$ sudo apt-get install zfs-fuse</pre>
<p>This installs zfs onto your system. Now to create your raid-z array! Its dead simple.</p>
<pre class="prettyprint">$ sudo zpool create media -m /storage raidz /dev/sda /dev/sdb /dev/sdc</pre>
<p>In the above command:</p>
<ul>
<li> <strong>media</strong> is the name of the pool,</li>
<li><strong>/storage</strong> is the mount point (make sure it already exists),</li>
<li><strong>raidz</strong> is the type of mirroring/striping we are going to run (see more below), and</li>
<li>the rest of the options are the devices you are adding into the pool.</li>
</ul>
<p>Make sure the mount directory already exists.</p>
<p>The type of array you are creating can be the following:</p>
<ul>
<li><strong>mirror</strong> will mirror the data across disks</li>
<li><strong>raidz</strong> will mirror and stripe data across all disks, allowing 1 drive to fail without losing data</li>
<li><strong>raidz2</strong> will mirror and stripe data across all disks, allowing 2 drives to fail without losing data (but creating more overhead)</li>
</ul>
<p>That really is it! You&#8217;ll then have a raid array, mounted to your indicated mount point. You can do all kinds of cool stuff with your pool, such as add disks, export the array to a file, import an exported file to the disk, create hot spares, and more.</p>
<p>After far as speed goes, I tested the pool performance with <a href="http://www.textuality.com/bonnie/">bonnie</a> and also via real world estimates, and I&#8217;m only receiving about 20Mb/sec. Its not stellar and I plan to do some more testing as I haven&#8217;t tweaked my disks at all and I think I may be able to push it further. This slowness is caused by the checksumming that zfs does &#8212; it makes your data extremely safe but it does cause a lot of CPU overhead.</p>
<p>Hopefully ZFS will get more and more stable with time (although I haven&#8217;t had any problems with it so far!) and will be included in the Linux kernel, because it really is a great performing, easy to use file system. The uses for it could be tremendous, such as creating a desktop system as a zfs pool and creating instant disk backups from it with minimal overhead. Think: Time Machine for Linux!</p>
]]></content:encoded>
			<wfw:commentRss>http://systembash.com/content/howto-installing-zfs-and-setting-up-a-raid-z-array-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 15/22 queries in 0.006 seconds using disk: basic

Served from: systembash.com @ 2012-05-23 23:34:00 -->
