tag:blogger.com,1999:blog-4722289866131543942024-03-12T23:22:15.846+00:00SudoCodeLinux and media server meanderings, still on a <a href="http://sudocode.blogspot.co.uk/2008/10/i-ordered-fit-pc.html">Fit-PC mini server</a>.Unknownnoreply@blogger.comBlogger23125tag:blogger.com,1999:blog-472228986613154394.post-16514500181472053132015-01-03T00:07:00.000+00:002015-01-06T13:37:54.422+00:00Selectively change DNS servers for Netflix with dnsmasqI recently started using <a href="https://www.opendns.com/home-internet-security/opendns-ip-addresses/">OpenDNS name servers</a> at home to provide some basic content filtering.<br />
<br />
We also use Netflix on various devices. Configuring these devices to use custom name servers, we are able to access the US Netflix. But that customization bypasses OpenDNS. Also, it needs to be enabled on each device.<br />
<br />
I wanted to find a way to use OpenDNS name servers - preserving content filtering - by default and using the custom name servers for Netflix only. Also nice if the configuration can be done in one place rather than on each device.<br />
<br />
It looks like <a href="http://en.wikipedia.org/wiki/Dnsmasq">dnsmasq</a> works well for this.<br />
<br />
I run dnsmasq on my linux server (Ubuntu 10.04) and point my router (<a href="http://www.amazon.co.uk/TP-Link-Archer-D7-Wireless-Connections/dp/B00ISSOT4O">TP-Link Archer D7 AC1750</a>) to use that <i>as the DNS server for DHCP</i>.<br />
<br />
(Note "for DHCP" - this was the key. When I tried first setting my dnsmasq server as the router's WAN DNS server, this did not work - browsing any internet page failed on hostname resolution. It needed to be set as the router's DHCP DNS server.)<br />
<br />
<h3>
On the linux server... </h3>
I installed dnsmasq and configured it to do DNS only (not DHCP, I left that to the router).<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">sudo apt-get install dnsmasq</span><br />
<span style="font-family: Courier New, Courier, monospace;">sudo cp -p /etc/dnsmasq.conf /etc/dnsmasq.conf.0</span><br />
<br />
<h4>
/etc/dnsmasq.conf</h4>
<span style="font-family: Courier New, Courier, monospace;">domain-needed</span><br />
<span style="font-family: Courier New, Courier, monospace;">bogus-priv</span><br />
<span style="font-family: Courier New, Courier, monospace;"># not looking in /etc/resolv.conf</span><br />
<span style="font-family: Courier New, Courier, monospace;">no-resolv</span><br />
<span style="font-family: Courier New, Courier, monospace;"># opendns servers are the defaults</span><br />
<span style="font-family: Courier New, Courier, monospace;">server=208.67.222.222</span><br />
<span style="font-family: Courier New, Courier, monospace;">server=208.67.220.220</span><br />
<span style="font-family: Courier New, Courier, monospace;"># nameservers for netflix</span><br />
<span style="font-family: Courier New, Courier, monospace;"># replace x.x.x.x with working primary and secondary servers for US netflix</span><br />
<span style="font-family: Courier New, Courier, monospace;">server=/netflix.com/netflix.net/nflximg.com/x.x.x.x</span><br />
<span style="font-family: Courier New, Courier, monospace;">server=/netflix.com/netflix.net/nflximg.com/x.x.x.x</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">cache-size=5000</span><br />
<span style="font-family: Courier New, Courier, monospace;"># see what it's doing in /var/log/daemon.log (probably disable this after)</span><br />
<span style="font-family: Courier New, Courier, monospace;">log-queries</span><br />
<div>
<br />
<h4>
Restart the service</h4>
</div>
<span style="font-family: Courier New, Courier, monospace;">sudo service dnsmasq restart</span><br />
<br />
<h4>
See what it's doing</h4>
<span style="font-family: Courier New, Courier, monospace;">tail -f /var/log/daemon.log</span><br />
<br />
<h3>
On the router...</h3>
In the WAN configuration, leave OpenDNS name servers configured.<br />
<br />
In the DHCP configuration<br />
<ul>
<li>set the IP address of the linux server as the primary name server</li>
<li>set the IP address of the router as the secondary (backup if the linux server goes down).</li>
</ul>
<div>
<br /></div>
<h3>
Testing</h3>
<div>
While testing on Windows, I renewed and flushed ipconfig after each change in the DNS configuration:<br />
<br />
<span style="background-color: white; font-family: Courier New, Courier, monospace;">ipconfig /renew</span><br />
<span style="background-color: white; font-family: Courier New, Courier, monospace;">ipconfig /flushdns</span></div>
<br />
On the linux box, tail /var/log/daemon.log to confirm that dnsmasq is getting used and what it is doing.<br />
<br />
In a browser, try http://www.netflix.com in a new browser window. If it redirects to http://www.netflix.com/us then things are working.<br />
<br />
<h3>
Result</h3>
Now each device connecting to the router with DHCP is given the dnsmasq on the linux server as its primary DNS server, and the router - configured for OpenDNS - as the fall back name server.<br />
<br />
Netflix USA is served by default to all devices. If I want a device to use the default Netflix for our region, I can change the nameservers on the device to use my router's IP address (so falling back to OpenDNS servers).<br />
<br />
In all cases, we are using OpenDNS for everything apart from the Netflix domains, so general content filtering is preserved.<br />
<br />
And as a bonus, any host defined in /etc/hosts on the dnsmasq linux server becomes available by name to all DHCP hosts in the network. So I can address a couple of services (logitech media server, plex, ...) running on different boxes by name rather than by IP address.<br />
<br />
<h3>
References</h3>
<h4>
</h4>
<a href="http://www.ireckon.net/2014/05/use-getflix-or-unblock-us-servers-selectively-with-dnsmasq">http://www.ireckon.net/2014/05/use-getflix-or-unblock-us-servers-selectively-with-dnsmasq</a><br />
<a href="https://getflix.zendesk.com/hc/en-gb/articles/201056954-Can-I-selectively-use-Getflix-DNS-servers-for-specific-domains-">https://getflix.zendesk.com/hc/en-gb/articles/201056954-Can-I-selectively-use-Getflix-DNS-servers-for-specific-domains-</a><br />
<a href="http://www.raspberrypi.org/forums/viewtopic.php?t=46154">http://www.raspberrypi.org/forums/viewtopic.php?t=46154</a><br />
<a href="http://www.linux.com/learn/tutorials/516220-dnsmasq-for-easy-lan-name-services">http://www.linux.com/learn/tutorials/516220-dnsmasq-for-easy-lan-name-services</a><br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-13817337381318707092014-12-23T16:17:00.004+00:002014-12-23T16:17:25.391+00:00Devolo dLAN 200 AV Windows 8I have a pair of Devolo dLAN 200 AV powerline adapters which I haven't used in ages.<br />
<br />
I found that the configuration software which came on a CD with the adapters is incompatible with Windows 8 and the product itself is out of production.<br />
<br />
After messing around unsuccessfully with the old software in a Windows XP VM in VirtualBox, what eventually worked was much simpler. With a firmware upgrade on the adapters and a newer configuration utility which installs on Windows 8, I was able to configure the adapters to talk to each other.<br />
<ul>
<li>Download the last available firmware for the dLAN 200 AV powerline from the Devolo site: <a href="http://www.devolo.com/en/Downloads/dLAN-200-AV">http://www.devolo.com/en/Downloads/dLAN-200-AV</a></li>
<li>With a powerline adapter directly connected to the PC, double click the firmware exe. It launches and installs the firmware successfully.</li>
<li>Repeat for the other adapter(s).</li>
<li>Download and install the dLAN Cockpit utility from the Devolo site: <a href="http://www.devolo.com/en/Downloads/dLAN-200-AV-Wireless-N">http://www.devolo.com/en/Downloads/dLAN-200-AV-Wireless-N</a></li>
<li>Connect one adapter direct to the Windows PC, the other to the router.</li>
<li>Launch the Cockpit utility</li>
<li>Click Options and select Reset network to factory defaults</li>
<li>Click Add adapter and enter the security ID of the adapter connected to the router</li>
</ul>
<br />After a short wait, the second adapter appeared in the Cockpit UI showing connected.<br /><br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-72081581869861341082009-10-31T21:52:00.005+00:002009-11-17T22:03:36.886+00:00abcde: CDROM has not been defined or cannot be foundBack to <a href="http://sudocode.blogspot.com/2009/06/auto-rip-audio-cds-in-ubuntu-server.html">auto CD ripping</a> again after a bit of a break, caused by the power supply of my USB-IDE cable set packing in. This is how I connect a CD drive to my fitPC, so it was a bit of a set back. The <a href="http://myworld.ebay.ie/thinkmobile">ebay vendor</a> kindly sent me a replacement cable set, so I'm back in business.<br />
<br />
But when I fed a new music CD to the drive, it didn't rip. On investigation, I found <br />
<pre>abcde: CDROM has not been defined or cannot be found</pre>Two useful threads I found were <a href="http://ubuntuforums.org/showthread.php?p=7849371">http://ubuntuforums.org/showthread.php?p=7849371</a> and <a href="http://ubuntuforums.org/showthread.php?p=7622858">http://ubuntuforums.org/showthread.php?p=7622858</a>.<br />
<br />
I found that for some reason, instead of /dev/cdrom I only had /dev/cdrom2. Editing /etc/abcde.conf, I defined CDROM=/dev/cdrom2. That fixed the problem for abcde.<br />
<br />
The second thread showed how to get my CDROM drive at /dev/cdrom again. Following funkydan2's lead I moved /etc/udev/rules.d/70-persistant-cd.rules to one side and rebooted. The file was regenerated and /dev/cdrom reappeared.<br />
<br />
That done, I reverted /etc/abcde.conf, commenting out the CDROM=/dev/cdrom2 line.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-38284039187267061792009-09-12T22:48:00.010+01:002009-11-17T22:06:13.349+00:00Sync files to an mp3 player with WinMergeTo sync files between my PC and my mp3 player, I'm finding <a href="http://winmerge.org/">WinMerge</a> to be a fast, lightweight solution.<br />
<br />
This is a bit geeky, because WinMerge is generally a programmer's tool. Typically you open two different versions of a file or folder in WinMerge; it shows the differences in a left/right view, and lets you copy differences from one side to the other.<br />
<br />
But that's exactly what you need to selectively sync a music collection from one place to another, like to an mp3 player.<br />
<br />
What I do is to open my music collection folder (on my PC) and my mp3 player's music folder in WinMerge. It quickly scans for differences, then shows me<br />
<ul><li>which folders and files are on left or right only (e.g. not on the mp3 player).</li>
<li>which folders and files are different (e.g. different folder contents or different file size)</li>
<li>which files and folders are identical (i.e. in sync)</li>
</ul>Then it's easy to select files to copy to the mp3 player.<br />
<br />
Because I'm a geek, I store my music collection on a mini Linux file server and access it using Samba over a wireless network. <span style="font-weight: bold;">You do not have to do this!</span> But just for interest, in this environment and using the setup below, WinMerge generates the diff view of my collection of around 5,000 tracks in about 3 seconds. Of course it will work just the same but faster with files stored on your PC.<br />
<br />
The following instructions assume you have installed and launched WinMerge and have your mass storage class mp3 player connected to your PC. My player is a Sansa Clip.<br />
<br />
<span style="font-weight: bold;">1. Configure WinMerge to do fast scans of your music collection</span><br />
<br />
Edit -> Options<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlVIenf67eVEvNC3f-gHwGpQNaVlKS7HsjRKuYEX_Biyf_RorWAL7hzW6TKqLgyOnGNZpD7oV5s2vtSX-iojmh9k0xaFOBvpMDbrkJCNXsn2PG2I1_66K0Tmt-KdTWZrYQXV4mofACJTyt/s1600-h/options.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5384800179573389282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlVIenf67eVEvNC3f-gHwGpQNaVlKS7HsjRKuYEX_Biyf_RorWAL7hzW6TKqLgyOnGNZpD7oV5s2vtSX-iojmh9k0xaFOBvpMDbrkJCNXsn2PG2I1_66K0Tmt-KdTWZrYQXV4mofACJTyt/s400/options.JPG" style="cursor: pointer; height: 341px; width: 400px;" /></a><br />
<br />
Select the Compare category<br />
Tick Ignore time differences less than 3 seconds<br />
File Compare Method: Modified Date and Size<br />
<br />
Changing the file compare method from Full Contents to Modified Date and Size is key to achieving fast scan times. You don't need a byte by byte comparison to sync your mp3s. Date and filesize comparison is fast and all you need.<br />
<br />
<span style="font-weight: bold;">2. Open your music collection and your mp3 player in WinMerge</span><br />
<br />
In Select Files or Folders Dialog<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivD9_2x6o7jJyMuGRruvqi1ZwPJQ1A-Lxqe42pcfUFuKMVUu8QpUfa4NB4zCcJ4B63egOOah1MK4eW41kAR_fFGrJgwxFrlEFMBRZI0Ma1yyP5nAuk-Ap3PBdmdxvQhHRYXiF0_3GQX6a7/s1600-h/open.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5384800210537796018" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivD9_2x6o7jJyMuGRruvqi1ZwPJQ1A-Lxqe42pcfUFuKMVUu8QpUfa4NB4zCcJ4B63egOOah1MK4eW41kAR_fFGrJgwxFrlEFMBRZI0Ma1yyP5nAuk-Ap3PBdmdxvQhHRYXiF0_3GQX6a7/s400/open.JPG" style="cursor: pointer; height: 168px; width: 400px;" /></a><br />
<br />
Left: select music folder on your PC<br />
Right: select music folder on your mp3 player<br />
Filter: *.mp3<br />
Tick Include Subfolders<br />
Click OK<br />
<br />
<span style="font-weight: bold;">3. Customize the view</span><br />
<br />
You will want an Explorer tree view: View -> Tree mode<br />
<br />
It can be handy to show file size differences:<br />
<br />
Tools -> Customize Columns<br />
Add left size and right size<br />
<br />
<span style="font-weight: bold;">4. Save all this as a WinMerge project</span><br />
<br />
File -> Save Project<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi93rvted3oIxYnNCfEvS1NrptLmTIxPaiRjgpJwR3qXa0jZfGy9tYO5Ax7reLyvdfIEn8Tz1nrV1WyN6KTw0IKCMucxETPRG_nGRx3by-o6B6e_zBJ4Y5cVEbV3ibJ6H4ihOhuAJkX8uGi/s1600-h/save.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5384800185979234770" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi93rvted3oIxYnNCfEvS1NrptLmTIxPaiRjgpJwR3qXa0jZfGy9tYO5Ax7reLyvdfIEn8Tz1nrV1WyN6KTw0IKCMucxETPRG_nGRx3by-o6B6e_zBJ4Y5cVEbV3ibJ6H4ihOhuAJkX8uGi/s400/save.JPG" style="cursor: pointer; height: 238px; width: 400px;" /></a><br />
<br />
On this page you also have option to make one side read only. This is handy if you want to protect your music collection and only copy files in one direction - to your mp3 player.<br />
<br />
Next time you want to sync files, just open the project. All your configuration steps are saved.<br />
<br />
<br />
<span style="font-weight: bold;">5. Start syncing</span><br />
<br />
WinMerge is now showing your music collection in an Explorer tree view. Different icons in the tree clearly show you which folders and files are<br />
<ul><li>on left only (i.e. not on mp3 player):</li>
</ul><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIyeKb00XhHhv-Kpxgbd1NdquGTbG5G-AVBhnJVRM6D7gFsOmPb1Ig7gb9lJuJBPVvA1ghvO2Jcq0bnNs-wyIilqPDdXObSu1_cKZiMpQbthBlhnp4_jEgHjrZo3xZrqqzDoQJwMJrKBQO/s1600-h/leftonly.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5384798464152812498" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIyeKb00XhHhv-Kpxgbd1NdquGTbG5G-AVBhnJVRM6D7gFsOmPb1Ig7gb9lJuJBPVvA1ghvO2Jcq0bnNs-wyIilqPDdXObSu1_cKZiMpQbthBlhnp4_jEgHjrZo3xZrqqzDoQJwMJrKBQO/s400/leftonly.JPG" style="cursor: pointer; height: 177px; width: 400px;" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3SmexvHxlbY1U0OsNxegECGwWCO0_5jUco9B8XMCr7_dObcHAoFYRGWQuLNikS9Ot7tBkP5C0potgHP5g1PaqmJseIUCoRr8q1R5DBNaPnthJsmN3kbMJLTdEPvhoW8GCyMyS9iE_9Zvt/s1600-h/leftonly.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"></a><br />
<ul><li>on right only (i.e. only on mp3 player)</li>
<li>identical:<br />
</li>
</ul><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikSKhQmLZrFOeU2pLOu9VyGutxHJiJMXoNvwCPTupLI7u_IK5qizJNXdld7Gg52InFqZZ32MHsNZj8FpMNtn_aZjAlOxRUD1-u14xwo1kF4MII_5b_sswTWXFYQKI4z2FhfNcxfLy-PkrK/s1600-h/identical.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5384798017667768018" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikSKhQmLZrFOeU2pLOu9VyGutxHJiJMXoNvwCPTupLI7u_IK5qizJNXdld7Gg52InFqZZ32MHsNZj8FpMNtn_aZjAlOxRUD1-u14xwo1kF4MII_5b_sswTWXFYQKI4z2FhfNcxfLy-PkrK/s400/identical.JPG" style="cursor: pointer; height: 200px; width: 400px;" /></a><br />
<ul><li>or different (e.g. different folder contents, different file size)</li>
</ul>To copy from PC to mp3 player, select the files or folders to copy, then<br />
<br />
Right click the folder or file/s<br />
Copy -> Left to Right<br />
<br />
... or just hit the "Copy right" icon in the toolbar:<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBCRVbeHJMAQUn8D6o8stwSpoI_FqTaMqk4keoQcw9M_gmyY8UR-70D2wGUE35FH-CAprIzQrmyzIKAh8C4xNOaL-ye0N1bTB5K295nglbWgYVv_vFGL21gdVDwec3wGYglDqtHClMoc-Q/s1600-h/toolbar.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5384798706379956098" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBCRVbeHJMAQUn8D6o8stwSpoI_FqTaMqk4keoQcw9M_gmyY8UR-70D2wGUE35FH-CAprIzQrmyzIKAh8C4xNOaL-ye0N1bTB5K295nglbWgYVv_vFGL21gdVDwec3wGYglDqtHClMoc-Q/s400/toolbar.JPG" style="cursor: pointer; height: 77px; width: 400px;" /></a><br />
<br />
<br />
To check result of the merge, click refresh.<br />
<br />
Sin é.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-75392851763028575182009-06-04T22:51:00.006+01:002009-10-31T22:15:07.889+00:00Auto rip audio CDs in Ubuntu ServerI got my headless Linux server set up to auto rip music CDs and add them to my music library. Pop a CD in the tray and it automatically rips and tags the tracks to FLAC files and ejects the CD... and queues up a task to transcode to mp3 and then rescan my Squeezecenter library later. Here's how:<br /><br />* Detection of the audio CD and kicking stuff off is done by <a href="http://www.blogger.com/post-edit.g?blogID=472228986613154394&postID=7539285176302857518#ivman">ivman</a>.<br />* Ripping and tagging is done by <a href="http://www.blogger.com/post-edit.g?blogID=472228986613154394&postID=7539285176302857518#abcde">abcde</a>.<br />* Transcoding is done by <a href="http://www.blogger.com/post-edit.g?blogID=472228986613154394&postID=7539285176302857518#flac2mp3">flac2mp3</a>.<br />* Refreshing the library is done using the <a href="http://www.blogger.com/post-edit.g?blogID=472228986613154394&postID=7539285176302857518#cli">Squeezecenter CLI</a>.<br /><br />It took me "a while" to get it working end to end. The tough part was getting <a href="http://packages.ubuntu.com/intrepid/utils/ivman">ivman</a> configured. But that's the essential part for automation.<br /><br /><a name="ivman"><span style="font-weight: bold;">Ivman</span></a><br /><br />To install<pre>$ sudo apt-get install ivman</pre>which installs a bunch of dependencies (but no X). Then I enabled an action to start a script when ivman detects an audio CD. This is what I added to /etc/ivman/IvmConfigActions.xml:<pre><ivm:Match name="hal.volume.disc.type" value="cd_rom"><br /><ivm:Match name="hal.volume.disc.has_audio" value="true"><br /> <ivm:Match name="hal.volume.disc.has_data" value="false"><br /> <ivm:Option name="exec" value="/home/user_x/bin/rip_cd '$hal.block.device$'"/><br /> </ivm:Match><br /></ivm:Match><br /></ivm:Match></pre> The rip_cd script just invokes abcde and directs its output to a log file.<br /><br />The problem that broke my heart for ages was that ivman didn't have permission to use the cdrom drive. I got this error in the log file from abcde:<pre>cd-discid: /dev/cdrom: open: Permission denied<br />[ERROR] abcde: CD could not be read. Perhaps there's no CD in the drive?</pre>No such problem running abcde directly from the command line as the same user ivman ran as, since that user is a member of the group "cdrom".<br /><br />How I eventually got it working consistently was to configure ivman to run explicitly as the group "cdrom".<br /><br />Ivman requires you to specify both a user <em>and</em> a group for the daemon to run as - in /etc/ivman/IvmConfigBase.xml). Just because the user you specify is a member of a group, e.g. cdrom, doesn't mean that ivman will run as a member of that group.<br /><br />In my setup, ivman is now solely configured from /etc/ivman and runs as "user_x" and group "cdrom". And abcde is solely configured from /etc/abcde.conf.<br /><br />It can help to run ivman in debug mode:<br /><pre>$ sudo /etc/init.d/ivman stop<br />$ sudo ivman -d --nofork</pre><br /><a name="abcde"><span style="font-weight: bold;">ABCDE</span></a><br /><br />To install<pre>$ sudo apt-get install abcde</pre>This also installs cd-discid and probably cdparanoia (which I had installed already). Getting abcde configured is easy, especially thanks to a great guide on <a href="http://www.blogger.com/%20http://www.andrews-corner.org/abcde.html">Andrew's Corner</a>.<br /><br />I included a post-read hook in /etc/abcde.conf to enqueue a transcoding script when the CD is ripped. <pre>post_read ()<br />{<br />atq -q x | while read line; do job=`echo $line | sed -e 's/\([0123456789]*\).*/\1/'`; atrm $job; done<br />at -q x 01:00AM -f /home/user_x/bin/flac2mp3<br />}</pre> It would probably be better just to run the transcoding script as a cron job rather than "on demand". But this way works too.<br /><br />The flac2mp3 script invokes Robin Bowes' <a name="flac2mp3" href="http://projects.robinbowes.com/flac2mp3/trac">flac2mp3</a>, directing its output to a log file, and then invokes the Squeezecenter CLI to rescan the music library.<br /><br />Of course, abcde would happily take care of ripping to FLAC and mp3 at the same time. But I prefer to rip to FLAC and transcode from there. That way, if I need to change tags, I just update the FLACs and run flac2mp3 to update the tags in my mp3s.<br /><br /><a name="cli"><span style="font-weight: bold;">Squeezecenter CLI</span></a><br /><br />Squeezecenter has a telnet-based <a href="http://wiki.slimdevices.com/index.php/CLI">command line interface</a>. One of the things it supports is executing a rescan of the library. So I included the scriptlet below in my transcoding script, after transcoding completes: <pre>echo `date` "requesting squeezecenter rescan..." >> $log<br />(<br />sleep 1;<br />/bin/echo -e "rescan\r";<br />sleep 1;<br />/bin/echo -e "exit\r";<br />sleep 1;<br />) | telnet localhost 9090 >> $log 2>&1<br />echo `date` "telnet exit status: " $? >> $log</pre>Directing the output to a file was useful here (again). It helped me diagnose a problem when the "wrong" version of echo got used when the script was run from the <tt>at</tt> task, causing the telnet to fail. The fix was to use /bin/echo explicitly.<br /><br />Of course, I could just let Squeezecenter schedule a regular rescan of the music library instead of doing it on demand. But I wanted to give the CLI a try.<br /><br />Anyway, that's about it.<br /><br />Just a note on hardware. I'm still using the <a href="http://sudocode.blogspot.com/2008/10/i-ordered-fit-pc.html">fit-PC slim</a> as my server. It doesn't have a CD drive. I connect the internal DVD burner from my old PC through a cheapo IDE-USB adapter cable from ebay.Unknownnoreply@blogger.com10tag:blogger.com,1999:blog-472228986613154394.post-50949704997636360552009-02-28T01:26:00.005+00:002009-03-05T08:58:48.308+00:00Installing mediainfo on UbuntuThere's no single ready made package for mediainfo as far as I can see, so no <tt>apt-get install</tt>, but the required .deb packages are available and so can be installed using <tt>dpkg</tt>.<br /><br />Pick the appropriate packages for your system from the <a href="http://mediainfo.sourceforge.net/en/Download">mediainfo</a> sourceforge download page, then install in the correct order using <tt>dpkg -i</tt>.<br /><br />To install the CLI version on my fit-pc Ubuntu 8.10 server, I did<br /><pre>$ wget http://downloads.sourceforge.net/mediainfo/mediainfo_0.7.11-1_i386.Debian_5.0.deb<br />$ wget http://downloads.sourceforge.net/mediainfo/libmediainfo0_0.7.11-1_i386.Debian_5.0.deb<br />$ wget http://downloads.sourceforge.net/zenlib/libzen0_0.3.8-1_i386.Debian_5.0.deb<br />$ sudo dpkg -i libzen0_0.3.8-1_i386.Debian_5.0.deb<br />$ sudo dpkg -i libmediainfo0_0.7.11-1_i386.Debian_5.0.deb<br />$ sudo dpkg -i mediainfo_0.7.11-1_i386.Debian_5.0.deb</pre>Then it's good to go.Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-472228986613154394.post-31089497357105656222009-02-02T22:37:00.012+00:002015-01-03T00:16:37.815+00:00Automount USB disks in Ubuntu Server<em>I am using the usbmount package to automount a 1TB USB disk connected to my mini linux media server. This allows me to mount and unmount the external disk simply by turning it on and off, which is a convenient and power-saving arrangement.</em><br />
<br />
Since I'm now storing DVD rips for my <a href="http://sudocode.blogspot.com/2009/01/i-got-popcorn-hour.html">Popcorn Hour</a> media player, I needed to add more storage to my streaming media server. My <a href="http://sudocode.blogspot.com/2008/10/i-ordered-fit-pc.html">fit-PC</a> takes 2.5" IDE/PATA drives, so it is already fully loaded with a 250G drive. So I got a 1TB 3.5" SATA drive (Western Digital GreenPower) and put it in a USB enclosure.<br />
<br />
It's a very quiet, low power drive (about 9W generally), but I don't want it on 24/7. Spinning down the disk is one option, and I might investigate that further. But right now I want <br />
<ol>
<li>To simply switch the disk on when I need it and off when I'm done.</li>
<li>For that to be safe (without potential for losing data).</li>
<li>To include the disk in the network share I export for the Popcorn Hour.</li>
</ol>
Desktops systems automount USB disks when you plug them in or power them on. This functionality is not available by default in Ubuntu server. (The packages used depend on the desktop environment.) Following a suggestion in the <a href="https://help.ubuntu.com/community/Mount/USB">Ubuntu documentation</a>, I installed the usbmount package<br />
<blockquote>
<em>This package automatically mounts USB mass storage devices (typically USB pens) when they are plugged in, and unmounts them when they are removed. The mountpoints (/media/usb[0-7] by default), filesystem types to consider, and mount options are configurable. When multiple devices are plugged in, the first available mountpoint is automatically selected. If the device provides a model name, a symbolic link /var/run/usbmount/MODELNAME pointing to the mountpoint is automatically created. [<a href="http://packages.ubuntu.com/intrepid/usbmount">...</a>]</em></blockquote>
... which sounds ideal. And as far as I can see, it does the job.<br />
<br />
I couldn't find much online about how to configure usbmount, but I soon found /etc/usbmount/usbmount.conf. You can configure mount options per filesystem type. The default options are <br />
<pre>MOUNTOPTIONS="sync,noexec,nodev,noatime"</pre>
<br />
Out of the box, it only automounts ext2 and ext3 formatted volumes. I had formatted my new disk with XFS, so I added xfs to the configuration<br />
<br />
<pre>FILESYSTEMS="ext2 ext3 xfs"</pre>
<br />
and it seems to work fine. When I switch on the disk, I see these messages in syslog:<br />
<br />
<pre>kernel: [1034394.920087] usb 1-2: new high speed USB device using ehci_hcd and address 27
kernel: [1034395.064826] usb 1-2: configuration #1 chosen from 1 choice
kernel: [1034395.078845] scsi25 : SCSI emulation for USB Mass Storage devices
kernel: [1034395.085992] usb-storage: device found at 27
kernel: [1034395.086033] usb-storage: waiting for device to settle before scanning
kernel: [1034400.084595] usb-storage: device scan complete
kernel: [1034400.087474] scsi 25:0:0:0: Direct-Access WDC WD10 EADS-00L5B1 0041 PQ: 0 ANSI: 0
kernel: [1034400.091636] sd 25:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
kernel: [1034400.094271] sd 25:0:0:0: [sdb] Write Protect is off
kernel: [1034400.094309] sd 25:0:0:0: [sdb] Mode Sense: 03 00 00 00
kernel: [1034400.094328] sd 25:0:0:0: [sdb] Assuming drive cache: write through
kernel: [1034400.104985] sd 25:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
kernel: [1034400.113058] sd 25:0:0:0: [sdb] Write Protect is off
kernel: [1034400.113094] sd 25:0:0:0: [sdb] Mode Sense: 03 00 00 00
kernel: [1034400.113114] sd 25:0:0:0: [sdb] Assuming drive cache: write through
kernel: [1034400.120193] sdb: sdb1
kernel: [1034400.137434] sd 25:0:0:0: [sdb] Attached SCSI disk
kernel: [1034400.137980] sd 25:0:0:0: Attached scsi generic sg1 type 0
usbmount[16483]: executing command: mount -txfs -osync,noexec,nodev,noatime /dev/sdb1 /media/usb0
kernel: [1034401.228110] XFS mounting filesystem sdb1
kernel: [1034401.710070] Ending clean XFS mount for filesystem: sdb1
usbmount[16483]: executing command: run-parts /etc/usbmount/mount.d</pre>
<br />
The disk is mounted: <br />
<br />
<pre>$ mount
<snip...>
/dev/sdb1 on /media/usb0 type xfs (rw,noexec,nodev,sync,noatime)</pre>
<br />
And when I switch it off, I see<br />
<br />
<pre>kernel: [1034259.923629] usb 1-2: USB disconnect, address 26
kernel: [1034259.936251] xfs_force_shutdown(sdb1,0x1) called from line 420 of file /build/buildd/linux-2.6.27/fs/xfs/xfs_rw.c. Return address = 0xe0a9ddb4
kernel: [1034259.936334] Filesystem "sdb1": I/O Error Detected. Shutting down filesystem: sdb1
kernel: [1034259.936404] Please umount the filesystem, and rectify the problem(s)
kernel: [1034259.949818] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034259.949851] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034259.949890] xfs_force_shutdown(sdb1,0x1) called from line 420 of file /build/buildd/linux-2.6.27/fs/xfs/xfs_rw.c. Return address = 0xe0a9ddb4
kernel: [1034259.968157] Filesystem "sdb1": xfs_log_force: error 5 returned.
usbmount[16307]: executing command: umount -l /media/usb0
kernel: [1034260.050924] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.057086] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.061208] xfs_force_shutdown(sdb1,0x1) called from line 420 of file /build/buildd/linux-2.6.27/fs/xfs/xfs_rw.c. Return address = 0xe0a9ddb4
kernel: [1034260.069650] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.073675] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.077672] xfs_force_shutdown(sdb1,0x1) called from line 420 of file /build/buildd/linux-2.6.27/fs/xfs/xfs_rw.c. Return address = 0xe0a9ddb4
usbmount[16307]: executing command: run-parts /etc/usbmount/umount.d
kernel: [1034260.084706] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.084735] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.084820] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.084864] Filesystem "sdb1": xfs_log_force: error 5 returned.
kernel: [1034260.084891] Filesystem "sdb1": xfs_log_force: error 5 returned.</pre>
<br />
which doesn't look so great. But after repeatedly mounting and unmounting the disk without any apparent problems, I was getting the feeling that this was not harmful.<br />
<br />
I did a bit of searching to see whether XFS supports the sync mount option. The answer wasn't clear, so I raised a question on the <a href="http://oss.sgi.com/archives/xfs/2009-02/msg00102.html">XFS mailing list</a> to see what they thought. The initial response was discouraging, but on followup it seems like since...<br />
<ul>
<li>I am sync mounting the filesystem (what usbmount does by default), and</li>
<br />
<li>my kernel version is later than 2.6.17 (from which point write barrier support is enabled by default in XFS)</li>
</ul>
... I can keep on doing what I'm doing. I will not get corruption of the file system. (Do read the <a href="http://oss.sgi.com/archives/xfs/2009-02/msg00102.html">thread</a>, the <a href="http://xfs.org/index.php/XFS_FAQ#Q:_What_is_the_problem_with_the_write_cache_on_journaled_filesystems.3F">XFS FAQ</a> and otherwise satisfy yourself. It's your data.)<br />
<br />
The last item on my wish list was to include the disk in the network share I export for the Popcorn Hour. This is easy.<br />
<br />
Usbmount mounts the disk to /media/usb[0-7] arbitrarily, but it also creates a symbolic link in /var/run/usbmount using the disk model name, which provides a consistent reference point. I created a link in my media storage directory to that point, e.g.<br />
<pre>ln -s /home/shared/movies /var/run/usbmount/WDC_WD10_EADS-00L5B1_1/movies</pre>
<br />
Using my existing Samba share (/home/shared), this works perfectly. When the disk is on, I can browse into the linked directory from the Popcorn Hour. When the disk is off, the link is invisible.Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-472228986613154394.post-85241274583362410902009-01-23T23:24:00.004+00:002009-01-27T23:47:52.281+00:00Installing SwissCenter on Ubuntu ServerI got SwissCenter up and running on my fit-PC Slim, which is now running Ubuntu 8.10 Server.<br /><br />At first I was working off the official SwissCenter <a href="http://www.swisscenter.co.uk/content/view/49/54/">Linux install documentation</a> which is for SuSE 9.3. Later on I found this <a href="http://www.swisscenter.co.uk/component/option,com_simpleboard/Itemid,42/func,view/id,3881/catid,12/">cheatsheet</a> for installing SwissCenter on Ubuntu which is a bit out of date now, but still very useful.<br /><br /><span style="font-weight: bold;">Install apache2 and mysql</span><br /><br />I had these installed already, done in the standard way as in the <a href="https://help.ubuntu.com/8.10/serverguide/C/index.html">Ubuntu Server Guide</a>, which is to say<br /><pre>$ sudo apt-get install apache2<br />$ sudo apt-get install mysql-server</pre>Actually, I had the <a href="http://sudocode.blogspot.com/2008/10/installing-squeezecenter.html">default mysql instance disabled</a>, so re-enable it now and maybe try converging to a single mysql instance later.<br /><pre>$ cd /etc/rc2.d<br />$ sudo mv K81mysql S19mysql<br />$ sudo /etc/init.d/mysql start</pre><span style="font-weight: bold;">Install PHP</span><br /><pre>$ sudo apt-get install php5 libapache2-mod-php5 php5-mysql php5-gd</pre><span style="font-weight: bold;">Install SwissCenter</span><br /><pre>$ wget http://www.swisscenter.co.uk/downloads/swisscenter.zip<br />$ sudo mkdir -p /srv/www/swisscenter<br />$ cd /srv/www/swisscenter/<br />$ sudo unzip ~/swisscenter.zip<br />$ sudo chown -R www-data:www-data .<br /></pre>(Using www-data which is the standard apache user/group in Debian-based distributions, rather than wwwrun as specified in the SwissCenter document.)<br /><br /><span style="font-weight: bold;">Enable the site in Apache</span><br /><br />Slightly different from the document here... I appended the following to /etc/apache2/sites-available/default<br /><pre>Listen 8080<br />NameVirtualHost --myhostname--<br /><virtualhost><br />DocumentRoot "/srv/www/swisscenter"<br /><directory><br /> Options Indexes FollowSymLinks MultiViews<br /> AllowOverride None<br /> Order allow,deny<br /> Allow from all<br /></directory><br /><ifmodule><br /> DirectoryIndex index.html index.php<br /></ifmodule><br /></VirtualHost></pre>Then restarted apache.<br /><br /><span style="font-weight: bold;">Checking and configuring SwissCenter</span><br /><br />Point web browser to the SwissCenter Configuration page at http://<servername>:8080/config. On first attempt, the page showed:<br /><blockquote>Warning: dl() [function.dl]: Dynamically loaded extensions aren't enabled in /srv/www/swisscenter/base/image.php on line 50<br /><br />Fatal error: Call to undefined function imagecreatetruecolor() in /srv/www/swisscenter/base/image.php on line 251</blockquote>After a bit of searching, I found I needed to include php5-gd (included in the install command above. I didn't have it originally), so<pre>$ sudo apt-get install php5-gd<br />$ sudo /etc/init.d/apache2 restart<br /></pre>Better this time. But the page still shows some errors under Installation Checks. <blockquote>Unable to locate a TrueType font. The "Now Playing" screen will be missing track information.</blockquote> Google turned up <a href="http://www.swisscenter.co.uk/component/option,com_simpleboard/Itemid,42/func,view/id,3645/catid,12/#4575">this</a>, which helped me to find Advanced Options / Miscellaneous in the SwissCenter configuration pages where you can set the path to a TT font. I entered /usr/share/fonts/truetype/freefont/FreeSans.ttf.<br /><br />That left a warning that database is not created yet. You create it from the SwissCenter Create Database page. On first attempt, I got<br /><blockquote>Unable to create database - Is your MySQL "Root" password correct?</blockquote>Umm... Looks like I changed the default mysql root password when I installed mysql. I've forgotten it now. So I had to <a href="http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/">reset the root password</a>. Now I can create the database successfully.<br /><br />Back on the main Configuration page,<blockquote>Unable to write to the SwissCenter playlists directory (playlists)</blockquote>Under Media Management / Playlists, you enter a full path to a dir (which must be writeable by www-data user), i.e. created something like<br /><pre>$ sudo -u www-data mkdir <some_dir></pre>After all that, SwissCenter is up and ready to load some content. I pointed it to my photos and music directories for a start.<br /><br /><span style="font-weight: bold;">Accessing SwissCenter from the Popcorn Hour</span><br /><br />The simplest way for a start is to add the SwissCenter URL to the Web Services page in the Popcorn Hour, i.e. create an entry pointing to http://servername:8080.<br /><br />But you can run an additional service on the server to broadcast the SwissCenter's UPnP interface. With that running, SwissCenter shows up automatically in the Popcorn Hour's Media Sources page.<br /><br />There's a nice <a href="http://www.networkedmediatank.com/showthread.php?tid=7983">custom broadcast script</a> and a Debian init script to start and stop this broadcast service automatically. I modified the init.d script slightly to make it run in the background:<br /><pre>$ diff -upN broadcast.orig broadcast<br />--- broadcast.orig 2008-09-11 17:02:03.000000000 +0100<br />+++ broadcast 2009-01-11 02:00:52.011883945 +0000<br />@@ -46,7 +46,7 @@ do_start()<br /># 2 if daemon could not be started<br />start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \<br />|| return 1<br />- start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \<br />+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background --make-pidfile -- \<br />$DAEMON_ARGS \<br />|| return 2<br /># Add code here, if necessary, that waits for the process to be ready<br />@@ -95,7 +95,7 @@ do_reload() {<br /><br />case "$1" in<br />start)<br />- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"<br />+ log_daemon_msg "Starting $DESC" "$NAME"<br />do_start<br />case "$?" in<br />0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;<br />@@ -103,7 +103,7 @@ case "$1" in<br />esac<br />;;<br />stop)<br />- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"<br />+ log_daemon_msg "Stopping $DESC" "$NAME"<br />do_stop<br />case "$?" in<br />0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;<br /></pre><br />And that's about it.Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-472228986613154394.post-44935276670375607852009-01-08T21:18:00.005+00:002009-01-23T13:54:17.213+00:00I got a Popcorn HourI got a <a href="http://www.popcornhour.com/">Popcorn Hour</a> A-110 (AKA Networked Media Tank) media player just before Christmas.<br /><br />I've had my Squeezebox network music player for a couple of years now, and along the way I've got hooked on <ul><li>the idea of storing my digital media centrally</li><br /><li>running a low power server</li><br /><li>hacking around with Linux</li></ul>So now I'm going to have a go at streaming video. The Popcorn Hour seems like a good device to do it with.<br /><br />My video content is DVDs ripped in full to ISOs using <a href="http://www.dvdfab.com/free.htm">DVDFab</a> (free version). I'm not compressing or discarding any of the non-movie content yet. But as each title takes 6-8GB, I might look into one or both soonish...<br /><br />So far, I've had perfect success viewing this content on my TV in these ways:<br /><ol><li>From an external disk (NTFS formatted), connected to a USB port on the Popcorn Hour.</li><br /><li>From an NFS share hosted on my fit-PC mini server, with the content stored on it's internal disk.</li><br /><li>As previous, but with the content on the external disk, connected to a USB port on the fit-PC.</li><br /><li>As previous, but using Samba instead of NFS.<br /></li></ol>For options 2-4 this is streaming via a pair of <a href="http://www.devolo.com/co_EN_cs/produkte/dlan/dlan200aveasysk.html">Devolo Homeplug AV</a> adapters (AKA <a href="http://en.wikipedia.org/wiki/HomePlug_Powerline_Alliance">powerline networking</a>). One adapter is connected to my router in the <a href="http://sudocode.blogspot.com/2008/11/some-photos-of-fit-pc.html#geekShelf">"server room"</a>. The other is connected to the Popcorn Hour in the TV room.<br /><br />I hadn't expected the Homeplug setup to work. Quite a few people have reported problems with powerline networking on the <a href="http://networkedmediatank.com/">Popcorn Hour forums</a>. (And I had previously been unsuccessful streaming this way to a <a href="http://en.wikipedia.org/wiki/Hauppauge_MediaMVP">Hauppauge MVP</a> box - it stuttered badly whatever I tried.) So was resigned to somehow running a cable from one end of the house to the other. But happy day, it is working flawlessly for me - at least for this standard-def content.<br /><br />And my fit-PC handles streaming the video over NFS and Samba without breaking sweat.<br /><br /><em>Loads</em> of scope for geeky time suckage with this. So more posts may follow.<br /><br />(It took me absolutely feckin' ages to successfully export an NFS shared from a directory mounted from the NTFS formatted USB disk, but that's a whole other story.)Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-472228986613154394.post-39948022974027028492008-11-22T21:36:00.006+00:002009-01-25T21:48:38.168+00:00When apt-get fails to reinstall a packageWhile experimenting with the Moin Moin Wiki, I got into some bother attempting to uninstall and reinstall it. The problem originated from me manually removing some configuration files. <code>apt-get</code> subsequently refused to reinstall those files. I eventually resolved by using <code>dpkg</code>.<br /><br />I had initially followed the <a href="https://help.ubuntu.com/8.04/serverguide/C/moinmoin.html">installation steps for Moin Moin</a> on the Ubuntu Server Guide. So I had installed by doing <pre>$ sudo apt-get install python-moinmoin</pre> So to uninstall, I did<pre>$ sudo apt-get remove python-moinmoin</pre> I now know that that did not uninstall a base package, <code>moinmoin-common</code>, on which it depends. But I didn't notice that at first. All I saw was that some configuration files were still present in <code>/etc/moin</code>, so I <code>rm -rf</code> them.<br /><br />And there began my trouble, because thereafter I could not get <code>apt-get</code> to delete or reinstall the configuration files to that dir.<br /><br />I did various iterations of <code>apt-get install</code>, <code>apt-get remove</code> and <code>apt-get purge</code> for the <code>moinmoin-common</code> and <code>python-moinmoin</code> packages. But the remove operations never removed <code>/etc/moin</code> and the installs never installed the missing files.<br /><br />I used <code>dpkg-deb</code> to inspect the moinmoin-common archive file in <code>/var/cache/apt/archives</code>. I could see the to files I wanted were in the archive. But I could not get them to unpack to <code>/etc/moin</code>.<br /><br />A temporary workaround was to use <code>dpkg-deb</code> to extract the archive file to <code>/tmp</code>, which unpacked everything, and then manually copy the uninstallable files from there to <code>/etc/moin</code>. But I wanted to find the proper solution.<br /><br />I found <a href="http://ubuntuforums.org/showthread.php?t=467850">a thread on the Ubuntu Forums</a> outlining an equivalent problem with an apache2 installation. The advice there was to use Synaptic to remove the package. I don't have that option as I am running a headless server and Synaptic is a GUI tool. But at least there was the suggestion of a solution. If it can be done in a Debian/Ubuntu GUI, then be sure it can be done on the command line too.<br /><br />Then I found <a href="http://www.linux.com/feature/48910">a good article at Linux.com</a> which explained how you can escalate from <code>apt-get</code> to <code>dpkg</code> to resolve package management problems.<br /><br />So the happy ending was to do <pre>$ sudo dpkg --purge moinmoin-common</pre> This removed the troublesome files and the references to them that the package manager was evidently keeping. After that, I was able to cleanly reinstall Moin Moin.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-77845048388635518042008-11-20T13:19:00.003+00:002009-01-27T22:33:57.705+00:00CUPS print serverI installed <a href="https://help.ubuntu.com/8.04/serverguide/C/cups.html">CUPS</a> on my fit-PC mini Linux server to turn it into a USB print server.<br /><br />Got a USB printer? Want to let several computers share it? Want to print to it wirelessly? Well you could buy a <a href="http://www.google.com/search?q=usb+print+server">USB print server</a>. Connect one of these to your router and your printer and you can share the printer on your network. If your router is wireless, you now have a wireless print server.<br /><br />But since I already have an always-on mini Linux server, I can simply install CUPS on that and let it be my print server.<br /><br /><span style="font-weight: bold;">The setup</span><br /><ul><li>Fit-PC mini Linux server connected to my wireless router, as before.</li><li>USB laser printer (HP LaserJet 1010) connected to a USB port on the server.</li><li>CUPS installed and configured on the server to allow any PC connected to the router to use the printer.</li><li>Generic printer driver installed on Windows laptops so they can use the printer through the printer server.</li></ul>So now I have a very handy wireless print server...<br /><ul><li>I can send stuff to the printer whenever I like.</li><li>The printer itself doesn't need to be turned on - just the server. Print jobs are spooled to the server.</li><li>When I want to collect printed pages, I just turn on the printer. The server detects it and sends the pending pages.</li><li>Pending print jobs are is written to disk, so even if you turn off the server, they are there when it restarts.</li></ul><span style="font-weight: bold;">Installing and configuring CUPS on the server</span> was straightforward.<br /><pre>$ sudo apt-get install cupsys</pre>I Googled a bit for cupsys setup tips and made a few changes to /etc/cups/cupsd.conf.<br /><br />For what it's worth, here's the diff between the default configuration (Ubuntu 8.04) and my current version.<br /><pre>$ diff /etc/cups/cupsd.conf.original /etc/cups/cupsd.conf<br />18a19<br />> Listen <my-server-ip-address>:631<br />27c28<br />< DefaultAuthType Basic<br />---<br />> DefaultAuthType None<br />31c32,35<br />< Order allow,deny<br />---<br />> Order deny,allow<br />> Deny From All<br />> Allow From 127.0.0.1<br />> Allow From 192.168.2.*<br />36a41<br />> Allow 192.168.2.*<br />58a64<br />> Allow 192.168.2.*<br /></pre>I think I had to restart the server once after installing cupsys, before I could access its web interface from my laptop. (Maybe apparmor related. I'm begining to think that reboot is required to allow any newly installed HTTP service available. Could be wrong there.)<br /><br />Anyway, once it's setup right, you can point your browser to<br />http://<your-server>:631<br />to browse and manage the print server.<br /><br /><span style="font-weight: bold;">The setup on Windows laptops</span> was very easy. I used "Add Printer" to add a network printer, specifying connect by URL, and a generic PostScript driver (I used Generic / MS Publisher ImageSetter).<br /><br />There are of course many other ways to set it up, e.g. different printer driver options are covered <a href="http://www.owlfish.com/thoughts/winipp-cups-2003-07-20.html">here</a>. But this is working out nicely for me.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-57576317554570264832008-11-12T22:42:00.001+00:002009-02-16T23:54:53.036+00:00Performance of SqueezeCenter on fit-PC SlimHere is some data on the performance of SqueezeCenter on my fit-PC Slim.<br /><br /><span style="font-weight: bold;">Library rescan</span><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxevTraHEvW25xGgW6Gd01TVSu-89X18AaSH-jCgaVx9IuYOlRcFWVnw2vi0C7eHjpbdrX_NdI8LTjp5zE4quN8jMEhnTHbR5A6IMslsVOxHW1gc78Ud0e70owzV73Hj9lK8h1J-F3vCWf/s1600-h/scan_mp3.GIF"><img style="float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxevTraHEvW25xGgW6Gd01TVSu-89X18AaSH-jCgaVx9IuYOlRcFWVnw2vi0C7eHjpbdrX_NdI8LTjp5zE4quN8jMEhnTHbR5A6IMslsVOxHW1gc78Ud0e70owzV73Hj9lK8h1J-F3vCWf/s200/scan_mp3.GIF" alt="" id="BLOGGER_PHOTO_ID_5267515111824659698" border="0" /></a><br /><span style="font-style: italic;">4004 mp3 files</span><span style="font-style: italic;"></span><br /><br />* Look for new & changed music - 1:50<br />* Clear library and rescan everything - 18:01<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdrs52F69egfxH8dkE6gqFflT58FFowlp7PtLmgRbpfCzbApTNqNIJWtoKHfGZJrF2VmTK5L7JwpAIKyHsrIuHM_ryWCt6EwOoTu1rHLy6x44OA0usR9nTewN-p8aLMGPbqTuaqaUF34Nj/s1600-h/scan_flac.GIF"><img style="float: right; cursor: pointer; width: 200px; height: 90px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdrs52F69egfxH8dkE6gqFflT58FFowlp7PtLmgRbpfCzbApTNqNIJWtoKHfGZJrF2VmTK5L7JwpAIKyHsrIuHM_ryWCt6EwOoTu1rHLy6x44OA0usR9nTewN-p8aLMGPbqTuaqaUF34Nj/s200/scan_flac.GIF" alt="" id="BLOGGER_PHOTO_ID_5267515903711246546" border="0" /></a><br /><span style="font-style: italic;">3987 flac files</span><br /><br />* Clear library and rescan everything - 13:06<br /><br />Power consumption was peaked at 9 watts during rescans compared to 7 watts for normal operation.<br /><br /><br /><span style="font-weight: bold;">Web interface*</span><br /><br />Full cold load^ of the interface - 15 secs<br />Warm load - 5 secs<br /><br />*Firefox 2<br />^Clear browser cache and restart browserUnknownnoreply@blogger.com1tag:blogger.com,1999:blog-472228986613154394.post-46925571395279215712008-11-08T23:23:00.013+00:002009-01-23T13:52:45.609+00:00Some photos of the fit-PC<span style="font-style: italic;">"For those who like that sort of thing, that is the sort of thing they like."</span><br /><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibq5ixvi-qSIpvfZoJl5MTpppFjH-q2ypCXBeTdPTaRpNqpVwVFq7y5w6avuBXpFj0NHiobvXlOgvx1tA_BvVeXvRZJMgRnoxCO5JOQo3iFq5K-F7DqmLedC5C9gmMa1L8K9ynjoj2iYRD/s1600-h/fitpc_battery_s.JPG"><img style="margin: 0pt 0pt 10px 10px; cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibq5ixvi-qSIpvfZoJl5MTpppFjH-q2ypCXBeTdPTaRpNqpVwVFq7y5w6avuBXpFj0NHiobvXlOgvx1tA_BvVeXvRZJMgRnoxCO5JOQo3iFq5K-F7DqmLedC5C9gmMa1L8K9ynjoj2iYRD/s200/fitpc_battery_s.JPG" alt="" title="Keeping things in perspective..." id="BLOGGER_PHOTO_ID_5266431818557410178" border="0" /></a><br />fit-PC and a AAA battery<br /><br /><div style="text-align: right;"><br /><br /><a name="geekShelf" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY9hpwC4fh25QdzJg7JygkJJO278MBalU6MAHtxRRNR35UBcaJoaXexdP-i-r755IKx_yvDlSWBKWXW9GgJTrQ7pbeebbVMm5dfnaYGy-E3CkbkW5qXmoaq2LQmUheZ2eL58qa5Gv1WF-c/s1600-h/shelf.JPG"><img style="margin: 0pt 0pt 10px 10px; cursor: pointer; width: 200px; height: 87px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY9hpwC4fh25QdzJg7JygkJJO278MBalU6MAHtxRRNR35UBcaJoaXexdP-i-r755IKx_yvDlSWBKWXW9GgJTrQ7pbeebbVMm5dfnaYGy-E3CkbkW5qXmoaq2LQmUheZ2eL58qa5Gv1WF-c/s200/shelf.JPG" alt="" title="Geek shelf..." id="BLOGGER_PHOTO_ID_5266431602388188530" border="0" /></a><br />fit-PC on the left next to the Linksys router<br /></div><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkXPbt3Ker_RnlcyVZHBBYoCqTZV8yOwyR2N5tXMNx9sDHejfx2W_93vrWiJ2cPsTamSyyWmtqj-MtVPDMGz_ifYxSUF5rnxR0fknc3fQCWszIUnZ6Ag2RRmGtrJsXOKofcwd3nzTImDws/s1600-h/fitpc_squeezebox_s.JPG"><img style="margin: 0pt 0pt 10px 10px; cursor: pointer; width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkXPbt3Ker_RnlcyVZHBBYoCqTZV8yOwyR2N5tXMNx9sDHejfx2W_93vrWiJ2cPsTamSyyWmtqj-MtVPDMGz_ifYxSUF5rnxR0fknc3fQCWszIUnZ6Ag2RRmGtrJsXOKofcwd3nzTImDws/s200/fitpc_squeezebox_s.JPG" alt="" title="Client and server..." id="BLOGGER_PHOTO_ID_5266431477188327714" border="0" /></a><br />Squeezebox and fit-PC<br /><br /><div style="text-align: right;"><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Pw1Y8B9Z1kAfhu-wvUmvoMN3WyE5VQxLx0q5MW9mPF8fZjDo4KFIeWt9XCCI91OINXSQy4CBlLrBy-n9188jisGk1r1dTZUZDB9O2bpnYXr7gOC6QtxPZgQU0TV-xBFa2Ejq4VYxjmPA/s1600-h/monitor.JPG"><img style="margin: 0pt 0pt 10px 10px; cursor: pointer; width: 150px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Pw1Y8B9Z1kAfhu-wvUmvoMN3WyE5VQxLx0q5MW9mPF8fZjDo4KFIeWt9XCCI91OINXSQy4CBlLrBy-n9188jisGk1r1dTZUZDB9O2bpnYXr7gOC6QtxPZgQU0TV-xBFa2Ejq4VYxjmPA/s200/monitor.JPG" alt="" title="Lean and green..." id="BLOGGER_PHOTO_ID_5266431693075354338" border="0" /></a><br />Typical power consumption 7 watts<br /></div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-472228986613154394.post-75021255505282955662008-11-06T21:16:00.000+00:002008-11-06T22:04:15.258+00:00SqueezeCenter on the fit-PC SlimIt's a few weeks since I <a href="http://sudocode.blogspot.com/2008/10/installing-squeezecenter.html">installed SqueezeCenter</a> 7.2 on my mini Linux server. I'm delighted to say that it's working out great.<br /><br />Music playback on my <a href="http://www.slimdevices.com/pi_squeezebox.html">Squeezebox</a> player is flawless. The responsiveness of the player and web interface is just fine.<br /><br />My server is the recently released <a href="http://www.fit-pc.com/new/">fit-PC Slim</a> (512MB RAM), which I ordered diskless and fitted with a 250GB disk. It's running a minimal server install of Ubuntu 8.04 with a few services including SqueezeCenter.<br /><br />In its current configuration, my fit-PC draws just <strong>7 watts</strong>.<br /><br />I think that's pretty terrific. I expect to get the power consumption even lower whenever I get around to disabling the WIFI adapter in the BIOS.<br /><br />I only have one Squeezebox, so can't comment on the ability to serve multiple clients, though I have played to the Squeezebox and my laptop simultaneously without glitches. Also, no problem streaming music while performing other background tasks, like copying on new music files and transcoding from <a href="http://projects.robinbowes.com/flac2mp3/trac">FLAC to mp3</a>.<br /><br />I reckon the fit-PC is a really great fit for SqueezeCenter.Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-472228986613154394.post-1295404629942942112008-11-01T00:05:00.005+00:002008-11-03T09:50:59.093+00:00Akasa HDD enclosure - remove the jumpersI decommissioned my old server tonight and ripped out everything useful, including the 250GB IDE/PATA disk. I got an Akasa disk enclosure a few weeks ago specifically to recycle this disk. I had a couple of false starts, but they were resolved by <span style="font-weight:bold;">removing the jumpers</span> on the disk. (The Akasa manual says nothing about jumpers).<br /><br />First off, with one jumper in the master/single position, Windows XP couldn't see the disk at all. Next, I misread the jumper diagram on the disk and put it in the "limit disk capacity" setting. Now Windows could see the disk, but only 33.8 GB of it. Same story connected to Linux. Finally, I removed the jumpers altogether. Now Linux and Windows can see the disk and its full capacity.<br /><br />Formatting the disk with an NTFS partition now...Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-46470098917645972742008-10-15T13:12:00.008+01:002008-11-03T09:47:19.988+00:00Migrating subversion repositoryI have a small subversion repository on my old server. I want to migrate it to the fit-PC.<br /><br />Looking at the <a href="http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.migrate">relevant section</a> of Version Control with Subversion, it looks like it should be easy. Just create a dumpfile on the old box and load it to a new repository on the new one.<br /><br />So on the old box<pre>$ svnadmin dump repos > dumpfile</pre> and copy the dumpfile onto the new box.<br /><br />Last time I setup subversion + apache for HTTP access. This time I'm going to try svn+ssh.<br /><br />As usual, Ubuntu provides a good <a href="https://help.ubuntu.com/community/Subversion">general reference</a>.<br /><br />Install subversion <pre>$ sudo apt-get install subversion </pre> Setup a subversion user and group, add myself to the group <pre>$ sudo addgroup svn<br />$ sudo useradd -g svn -m -p <pwd> svn<br />$ sudo usermod -a -G svn <my_user> </pwd></pre> Create the repository and load the dumpfile <pre>$ sudo su svn<br />$ cd /home/svn<br />$ svnadmin create repos<br />$ svnadmin load repos < dumpfile</pre> I want svnserve process to start when the box boots, so I added this line to <code>/etc/rc.local</code>:<pre>sudo -u svn svnserve -d -r /home/svn</pre> I'll make a proper init.d script like <a href="http://www.svnforum.org/2017/viewtopic.php?t=281">this one</a> later.<br /><br />Restart the box<br /><br />Verify I am a member of the svn group <pre>$ groups</pre>Verify that svnserve process started <pre>$ ps -ef | grep svnserve</pre> Verify I can read the repository locally <pre>$ svn list svn://localhost/repos/<project>/trunk</pre><br /><b>Setup access to the repository from Eclipse on my laptop</b><br /><br />(I already have the <a href="http://subclipse.tigris.org/">subclipse</a> plugin installed).<br /><br />File / Import<br />Checkout Projects from SVN<br />Create a new repository location<br />svn+ssh://<hostname>/home/svn/repos<br /><br />That fails with an error dialog and this message on the console:<pre> The system cannot find the file specified. <br />svn: Can't create tunnel: The system cannot find the file specified. </pre><br />Back to Google... The answer is <a href="http://svn.collab.net/subclipse/help/index.jsp?topic=/org.tigris.subversion.subclipse.doc/html/reference/protocol.html">here</a>.<br /><br />The problem was that Eclipse was not configured with an SSH client. Quick fix for me was to switch the Eclipse / Team / SVN configuration from JavaHL (which requires external SSH client) to SVNKit (which includes one). Now it works.<br /><br /><span style="font-weight: bold;">Edit! Actually, not quite there yet...</span><br /><br />On attempting to commit to the repository, I got error<pre>svn: Commit failed (details follow):<br />svn: Can't create directory '/home/svn/repos/db/transactions/1-1.txn':<br />Permission denied <br /></pre> It turns out that svn+ssh does not connect to the svnserve daemon I started above, but rather creates a temporary svnserve process (on each invocation) as the ssh user. And in the setup above, the ssh user has read access to the repos, but not write access. (Just like if you use subversion + apache and don't make the repository writable by the www-data user).<br /><br />Temporary workaround (to commit my current work) is to make the whole repository writable by my ssh user<pre>$ cd /home/svn<br />$ sudo chown <sshuser>:<sshuser> -R repos<br /></pre> Now the commit succeeds.<br /><br />Next task is to read the <a href="http://svnbook.red-bean.com/en/1.5/svn.serverconfig.choosing.html">relevant section</a> of the Subversion manual more carefully. My original setup above will support working with the repository using svn://<host>/repos. I might just go with that for now.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-472228986613154394.post-38098071920649644312008-10-13T22:44:00.009+01:002008-11-06T20:26:12.807+00:00Installing SqueezeCenterRunning SqueezeCenter to feed the Squeezebox music player is my old server's main duty. So it's first up for installation on my new fit-PC.<br /><br />Edit /etc/apt/sources.list to add <pre>deb http://debian.slimdevices.com stable main<br /><br />$ sudo apt-get update<br />$ sudo apt-get install squeezecenter</pre> The web interface is not available from my laptop until I restart the box (something to do with apparmor?). On restart, I can access the web interface fine.<br /><br />SqueezeCenter installs mysql (unless you have it already) and SqueezeCenter then runs its own mysql instance, in addition to the default one. I don't want two mysql instances running on my little server, so I'll disable the default one for now:<pre>$ cd /etc/rc2.d<br />$ cat README<br />$ sudo mv S18mysql-ndb K82mysql-ndb<br />$ sudo mv S19mysql K81mysql<br />$ sudo mv S17mysql-ndb-mgm K83mysql-ndb-mgm</pre> Alternative would be to get squeezecenter to use the default mysql instance instead, and disable the dedicated squeezecenter one. Supposed to be possible. I'll try that whenever I end up with some other application which needs mysql.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-472228986613154394.post-35727669072672494292008-10-12T22:16:00.002+01:002008-10-15T17:07:25.470+01:00Initial setupThe first thing I want to do is get rid of the monitor and keyboard, so<br /><br />$ sudo apt-get install openssh-server<br />$ sudo apt-get install screen<br /><br /><a href="http://www.programmersheaven.com/2/Screen">(Screen</a> is great. I use it whenever I need to kick off some long-duration command. It means I can close the laptop, dropping my ssh session, but still reconnect to the console running the command whenever I want to.)<br /><br />Edit /etc/network/interfaces to change from DHCP to static IP address, which is covered well <a href="http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html">here</a>.<br /><br /><span style="font-weight: bold;">Serial console</span><br /><br />I never tried this before...<br /><br />I ordered the serial cable with my fit-PC and got a €3 generic USB RS-232 adapter cable from <a href="http://stores.ebay.ie/THINK-MOBILE">this store</a> on ebay.<br /><br />The instructions on the <a href="http://www.fit-pc.com/wiki/index.php?title=How_to_Serial_Console">fit-PC wiki</a> were great. On the other side, all I had to do was check which COM port the USB adapter was on using Windows device manager, and then create a serial PuTTY session using the same configuration.<br /><br />With this setup, I get GRUB and kernel output to, and login from, the serial console. This is a real bonus compared to my old PC server.<br /><br />I'd really like to be able to configure the fit-PC BIOS over the serial connection as well, but it sounds like that might be <a href="http://www.fit-pc.com/forum/viewtopic.php?t=13">a bit more difficult</a>.<br /><br />Anyway, BIOS configuration changes aside, I can ditch the keyboard and monitor now. My fit-PC is ready to be a headless server.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-472228986613154394.post-19877325610113283632008-10-11T20:54:00.007+01:002009-02-16T23:54:07.003+00:00Ubuntu USB stick install, part 2I finally got a successful install. But it took several attempts and a lot of Google.<br /><br /><span style="font-weight: bold;">First attempt</span><br /><br />In the fit-PC BIOS setup, I set <code>Drive C: Nand Flash</code> but neglected to set <code>Drive D: IDE</code>. So when the installer got round to the partitioning stage it could only see the USB stick, not the hard disk. <span style="font-style: italic;">Hit reset button and start again...</span><br /><br /><span style="font-weight: bold;">Second attempt</span><br /><br />I didn't create a separate ext3 /boot partition, just XFS root and /home partitions. Apparently installing GRUB on an XFS partition is not a good thing. Near the end of the install, the installer offers to install LILO for me. Now I dimly remembered going through LILO versus GRUB before and preferring GRUB, so I try to install GRUB anyway. The installer warns me that this is a bad idea. When I ignore that this makes a fatal error in the install which then hangs. <span style="font-style: italic;">Grit teeth, hit reset button and start again...</span><br /><br /><span style="font-weight: bold;">Third and fourth attempts</span><br /><br />I created a separate ext3 /boot partition to stay sweet with GRUB. So I now have <pre>#1 primary 100MB ext3 /boot<br />#1 primary 4GB XFS /<br />#5 logical 246GB XFS /home<br /></pre> Now the install completed successfully each time. But it all ended in tears when I tried to reboot the fit-PC. Each time, it immediately dropped to a debugger interface, saying <code>Embedded BIOS Debugger Breakpoint Trap</code> and refused to do anything else. <span style="font-style: italic;">Weep, hit the sack and try again in the morning...</span><br /><br />I noticed that after each install attempt, I could no longer boot from the USB stick. It gave <code>GRUB Error 21</code>. I could fix the stick by reconnecting it to my old Linux box and doing <code>install-mbr /dev/sdb</code>. But why?<br /><br />I finally guessed that the Ubuntu installer must be installing GRUB to the MBR of my USB stick, instead of the hard disk in my fit-PC where I needed it. Armed with that hunch, Google finally gave me some answers, like <a href="http://linuxhelp.blogspot.com/2005/11/how-to-repair-corrupt-mbr-and-boot.html">this</a>, <a href="http://ubuntuforums.org/showthread.php?t=887788">this</a> and <a href="http://www.linuxquestions.org/questions/ubuntu-63/installing-ubunto-7.04-on-external-usb-drive-to-boot-from-and-run-from-error-17-549353/">this</a>.<br /><br /><span style="font-weight: bold;">Fifth attempt</span><br /><br />I let the Ubuntu installer run to the very end, where it tells you to reboot. At that point, I opened a console and took a look around.<br /><br />I found (fdisk) that my hard disk partitions were mounted on /target. So I did <pre># chroot /target<br /># grub-install /dev/sdb</pre> to install GRUB into the MBR of the hard disk. Then I went back to the installer's console and let it finish.<br /><br />On restart I removed the USB stick, hit DEL to enter the BIOS setup, reverted to <code>Drive C: IDE</code> and saved to reboot.<br /><br />On first attempt GRUB started (phew) but said <pre>Error 21: Selected disk does not exist<br />Press any key to continue...</pre> So I did. Then GRUB gives the menu list of image it can boot and allows you to edit and boot them. I edited the entry for the first image. It's first line was <code>root (hd1,0)</code>. I edited that to <code>root (hd0,0)</code> and the hit 'b' to boot. The system booted at last.<br /><br />Once in, I took a look at /boot/grub/menu.list. All three had <code>root (hd1,0)</code>.<br /><br />I rebooted to confirm that GRUB would fail again with same error.<br />It did. I fixed as before. Once back in, I edited /boot/grub/menu.list to change all the hd1 to hd0 and rebooted again.<br /><br />At last, the system boots successfully. Now I can get on with the more interesting stuff.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-84510598983419635072008-10-10T22:45:00.004+01:002008-10-13T23:38:17.002+01:00fit-PC BIOS notesOnce you have a bootable device attached to fit-PC, you enter the BIOS by holding down DEL key after resetting the box.<br /><br />To reset the BIOS to factory defaults, hit down arrow 8 times, then hit enter. You never know when that might come in handy.<br /><br />There's a "print out" of the BIOS menus <a href="http://www.fit-pc.com/wiki/index.php?title=BIOS_Options">here</a> on the fit-PC wiki.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-472228986613154394.post-59075657558703458112008-10-10T21:59:00.009+01:002009-02-16T23:53:12.890+00:00Ubuntu USB stick install on fit-PC, part 1Hard disk installed. Bootable USB stick ready. Here we go...<br /><br />Following the <a href="http://www.fit-pc.com/forum/viewtopic.php?t=528">advice on the fit-PC forum</a> I made the following BIOS settings:<br /><pre>Drive C: Nand Flash | Boot 1st<br />Drive D: IDE</pre> It booted to the installer from the USB stick. I chose the <code>cli</code> boot option and set it off.<br /><br />So that's the USB stick part over then, I thought. Just a normal install from here. (Wrong! See part 2 for the gory details.)<br /><br />The installer's first big question is partitioning. I went with <pre>#1 primary 4GB XFS /<br />#5 logical 246GB XFS /home</pre> No swap. I can <a href="https://help.ubuntu.com/community/SwapFaq">add it later</a> if I need it.<br /><br />I'm giving <a href="http://en.wikipedia.org/wiki/XFS">XFS</a> a try this time because I might end up storing some ISO files on this disk. It's supposed to be a good file system for large files.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-61713056207807472132008-10-09T21:00:00.004+01:002008-10-10T15:13:53.222+01:00Preparing to install from a USB stickSince I ordered the diskless version of fit-PC, I need to add a hard disk and an operating system.<br /><br />For the hard disk (2.5" IDE), I ordered a 250GB Western Digital Scorpio.<br /><br />While I waited for the disk to arrive, I got ready to install the OS.<br /><br />I'll stick with Ubuntu. I don't have a USB CD drive, so I'll try to install it from a USB memory stick. I followed the instructions <a href="https://help.ubuntu.com/8.04/installation-guide/i386/boot-usb-files.html">here</a> to make put a bootable installer on to my USB stick. The warnings about checking the correct device name are important! AFAIK the only way to be sure is to mount and list the device. Mine was /dev/sdb1.<br /><br />I want a minimal server installation, so I just copied the netboot image and left it at that. I'll pull the packages I need from the network as I need them.<br /><br />I initially tried <pre>$ sudo zcat boot.img.gz > /dev/sdb1</pre> but that was giving permission errors. So instead<pre>$ sudo su<br /># zcat boot.img.gz > /dev/sdb1</pre> did the job. I tried booting my laptop from the USB stick, but it said it was not a bootable device, so I followed the instructions on that same page to install an MBR.<br /><br />I tried again to boot my laptop. This time it booted to a prompt <pre>MBR FA:</pre> Ummm... Back to Google. I found the answer <a href="http://www.entropicblur.com/dectop/guide.html">here</a> - first enter "a", then "1" and it launched the text-based installer. Good. Hopefully it'll do the same on the fit-PC.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-472228986613154394.post-50281824439343217752008-10-08T21:00:00.004+01:002009-02-02T22:32:46.759+00:00I ordered a fit-PCI ordered a mini PC to replace my old Linux server.<br /><br />Ever since I got a <a href="http://en.wikipedia.org/wiki/Squeezebox_%28network_music_player%29">Squeezebox</a> network music player a couple of years ago, I've been running a vintage Pentium III desktop PC as a music server. It's currently running the <a href="http://www.ubuntu.com/">Ubuntu</a> OS (8.04 Server Edition) and is hosting<br /><ul><li><a href="http://www.slimdevices.com/pi_features.html">SqueezeCenter</a> music server<br /></li><li><a href="http://en.wikipedia.org/wiki/Samba_software">Samba</a> file server, and<br /></li><li>a small <a href="http://subversion.tigris.org/">Subversion</a> repository</li></ul>I also use it to transcode my music files from <a href="http://flac.sourceforge.net/">FLAC</a> to MP3, which it does... slowly but surely.<br /><br />It's been fine, but is a bit big, noisy and wasteful. So I've been looking for something small, quiet and energy efficient to replace it.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ3IgiuNU7UbHskAmBCl8bi5u3ndb41biegXTZyA1kw32CHA3_71lv2qZ3XhkiKa99z75DnBGsa6iqWBtXebW5iW_Ttets2ICDd39gBR5GPJpus6BsohNFLeYTahkJ9VrHEYTrdcIijCAL/s1600-h/fitpc.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ3IgiuNU7UbHskAmBCl8bi5u3ndb41biegXTZyA1kw32CHA3_71lv2qZ3XhkiKa99z75DnBGsa6iqWBtXebW5iW_Ttets2ICDd39gBR5GPJpus6BsohNFLeYTahkJ9VrHEYTrdcIijCAL/s200/fitpc.jpg" alt="fit-PC Slim" title="fit-PC Slim" id="BLOGGER_PHOTO_ID_5255436779401751602" border="0" /></a>I settled on the new <a href="http://www.fit-pc.com/">fit-PC Slim</a> - a tiny, fanless PC with a 500MHz processor, 512MB RAM and 4-6W power consumption. It should be a drop in replacement for the old box, I hope, with a bit of room to spare.<br /><br />The stock version comes with a smallish 60GB hard disk, so I ordered the diskless version and will get a bigger disk separately.<br /><br />I asked them to ship me a cable for the mini RS-232 port, so I can try using the <a href="http://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/intro-why.html">serial console</a>. Which might be fun.Unknownnoreply@blogger.com0