<?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>Gerrit&#039;s work in progress &#187; ubuntu</title>
	<atom:link href="http://blog.wessendorf.org/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wessendorf.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 09 Jun 2011 01:57:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Mounting NAS with Read-Write Permissions</title>
		<link>http://blog.wessendorf.org/2009/06/mounting-nas-with-read-write-permissions/</link>
		<comments>http://blog.wessendorf.org/2009/06/mounting-nas-with-read-write-permissions/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 03:01:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.wessendorf.org/?p=871</guid>
		<description><![CDATA[When I browsed my shared folders on the Lacie Ethernet Disk I noticed that I didn&#8217;t have any write access in Ubuntu, even though I explicitly gave read/write access to the NAS users. As I was never asked for a password I was quickly able to conclude that I had to provide username and password [...]]]></description>
			<content:encoded><![CDATA[<p><span class="drop w">W</span>hen I browsed my shared folders on the Lacie Ethernet Disk I noticed that I didn&#8217;t have any write access in Ubuntu, even though I explicitly gave read/write access to the NAS users. As I was never asked for a password I was quickly able to conclude that I had to provide username and password in order to gain full access to my shared folders.</p>
<p>So I entered a url like <tt>smb://username:password@ip-address/path/</tt> which worked in other situations before, but Nautilus the file browser showed me a new dialog to enter a domain (Windows) and password. No matter what I entered there, it didn&#8217;t appear to work. And I&#8217;m not sure how to remove this dialog box.</p>
<p>One way to work around this behavior is to mount the Samba/CIFS share on the command line. (CIFS is the <em>Common Internet File System</em> and replaces <tt>sambafs</tt>.) First I had to make sure that a non-root user has the permissions to mount a file system. I created a new group &#8216;samba&#8217; and added myself to it.</p>
<pre class="brush:bash;light:true;">
sudo groupadd samba
sudo adduser gerrit samba
sudo visudo
</pre>
<p>And added a new line in the &#8220;group&#8221; section:</p>
<pre class="brush:bash;">
## Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
%samba   ALL=(ALL) /bin/mount,/bin/umount,/sbin/mount.cifs,/sbin/umount.cifs
</pre>
<p>All set, now I could create a folder for my Samba share <code>mkdir ~/mnt</code> and mount:</p>
<pre class="brush:bash;light:true;">
sudo mount -t cifs //ip-address/path ~/mnt -o username=gerrit,password=xxxxxx,noexec
</pre>
<p>More details can be found in the Ubuntu help on <a href="https://help.ubuntu.com/community/SettingUpSamba">Setting up Samba</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wessendorf.org/2009/06/mounting-nas-with-read-write-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Music Networking with XMMS2, Icecast2 and Last.fm</title>
		<link>http://blog.wessendorf.org/2009/06/music-networking-with-xmms2-icecast2-and-lastfm/</link>
		<comments>http://blog.wessendorf.org/2009/06/music-networking-with-xmms2-icecast2-and-lastfm/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 05:37:54 +0000</pubDate>
		<dc:creator>gerrit</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[icecast2]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[lifestream]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xmms2]]></category>

		<guid isPermaLink="false">http://blog.wessendorf.org/?p=825</guid>
		<description><![CDATA[In the last few months I haven&#8217;t found much time to listen to music, but I decided this needs to change and I should finally dust off my old music library. About two years ago I signed up for last.fm, the social music network that makes it easy to discover new music and connect with [...]]]></description>
			<content:encoded><![CDATA[<p><span class="drop i">I</span>n the last few months I haven&#8217;t found much time to listen to music, but I decided this needs to change and I should finally dust off my old music library. About two years ago I signed up for <a href="http://www.last.fm/user/celeph"><strong>last.fm</strong></a>, the social music network that makes it easy to discover new music and connect with other music fans. I used their software on my Windows box, but I rarely work with this system anymore. After adding several other computers and laptops to the household I didn&#8217;t bother with shared music folders and last-fm anymore. This was then.</p>
<p>Today I&#8217;m trying to setup a server that makes my music available to any of my computers and operating systems in the LAN, and possibly even outside the local network. At the same time I would like to add last.fm again, however, not linked to each individual player, but only once, to the music server.</p>
<p><img src="http://blog.wessendorf.org/wp-content/uploads/2009/06/musicnetwork.png" alt="musicnetwork" title="musicnetwork" width="425" height="445" class="aligncenter size-full wp-image-846" /></p>
<p>I stored my music files on an external <a href="http://www.lacie.com/products/product.htm?pid=10994"><strong>network drive</strong></a>. This music folder is a <a href="http://wiki.samba.org/index.php/Main_Page">Samba</a> share and accessible from other computers on the network.</p>
<p>VLC is known for its network streaming features and I wrote a little about it back in <a href="http://blog.wessendorf.org/software/videolan/">May</a>. While I use it occasionally to stream videos from one computer to another I was looking for a solution that could work better as a permanent configuration, well-suited as a music library. That&#8217;s how I stumbled upon the <em>X-platform Music Multiplexing System 2</em>, <a href="http://wiki.xmms2.xmms.se/wiki/Main_Page"><strong>XMMS2</strong></a>.<span id="more-825"></span></p>
<h3>XMMS2</h3>
<p>XMMS2 is a client-server music platform which can be controlled via command line but also through a variety of other interfaces available on Linux, Windows as well as Mac. It allows you to play and manage your music collection on a local server or across the network. It is free, open-source and extensible with a growing number of plugins. </p>
<p>On my Ubuntu system, it was just a matter of seconds to install XMMS2. Ubuntu&#8217;s repositories already include everything you might need. I browsed the Synaptic package manager for&#8230; </p>
<ul>
<li><tt>xmms2</tt>, the core application with server and command line client interface.</li>
<li><tt>xmms2-plugin-smb</tt>, a Samba transport extension I needed to get access to my music share.</li>
<li><tt>xmms2-scrobbler</tt>, used to submit data to Last.fm</li>
<li><tt>esperanza</tt>, a simple player, xmms2-client and graphical user interface</li>
<li><tt>xmms2-plugin-flac</tt>, to support the flac-format</li>
<li><tt>xmms2-plugin-mp4</tt>, to support the mp4-format</li>
</ul>
<p>XMMS2&#8242;s command line interface is very easy to use thanks to its legible commands and parameters, just to mention a few:</p>
<ul>
<li>To start the server: <code>xmms2-launcher</code></li>
<li>To quit the server: <code>xmms2 quit</code></li>
<li>To add some music: <code>xmms2 add /home/gerrit/Music/track.mp3</code></li>
<li>To add a folder recursively: <code>xmms2 radd /home/gerrit/Music/electronic/</code></li>
<li>To add some music from my samba-share: <code>xmms2 add smb://username:password@edmini/music/electronic/track.mp3</code></li>
<li>To list the contents of the current playlist: <code>xmms2 list</code></li>
<li>To play: <code>xmms2 play</code></li>
<li>To stop playback: <code>xmms2 stop</code></li>
</ul>
<p>If the server is already running and you install new plugins, you may have to restart it before you can use the plugin. You can stop the server with <code>xmms2 quit</code>, or if that doesn&#8217;t work for some reason:</p>
<ol>
<li>find the process-id with  <code>ps aux | grep xmms2d</code> and</li>
<li>kill the process with <code>sudo kill processid</code>.</li>
</ol>
<p>XMMS2 makes it easy to organize music in playlists:</p>
<ul>
<li><code>xmms2 playlist list</code> lists all available playlists</li>
<li><code>xmms2 playlist create myplaylistname</code> creates a new playlist</li>
<li><code>xmms2 playlist load myplaylistname</code> loads an existing playlist</li>
<li><code>xmms2 playlist active</code> shows which playlist is currently active</li>
</ul>
<p>With a separate set of <em>media library</em> commands you can also keep track of your artists, track and album titles, cover images, etc. To display a list of related commands: <code>xmms2 mlib</code>. To search for an artist: <code>xmms2 mlib search artist:"Boards*"</code>. Standard wildcard characters like &#8216;*&#8217; and &#8216;?&#8217; are supported, too. It&#8217;s probably easier to use these mlib functions from an XMMS2 client software other than the command line. With a player like <em>Esperanza</em> you will find an easy-to-use graphical user interface for command line parameters.</p>
<p>To make the XMMS2 daemon reachable from other computers I added a tcp-socket to the configuration <code>nano ~/.config/xmms2/xmms2.conf</code></p>
<pre class="brush:bash;light:true;">
<property name="ipcsocket">unix:///tmp/xmms-ipc-gerrit;tcp://
</property>
</pre>
<p>More details on remote machines can be found in the <a href="http://wiki.xmms2.xmms.se/wiki/FAQ#How_do_I_use_clients_on_remote_machines.3F">FAQ</a>. The default port is 9667. After restarting the xmms2d daemon I was ready to test my configuration from the other computer, a Windows system.</p>
<p>I installed the Windows built of XMMS2 and Esperanza which I found <a href="http://wiki.xmms2.xmms.se/wiki/Windows">here</a>, <a href="http://xmms2.xmms.se/~puzzles/win32/">puzzle&#8217;s win32 folder</a>. I had to make sure to use the version that matches the version of my server, in this example it was <em>XMMS2-DrLecter</em>. </p>
<p>I defined the following environment variable <tt>XMMS_PATH = tcp://192.168.1.43:9667</tt> to let XMMS2 know where to find my music server.</p>
<p>The command-line version of XMMS2 works great on Windows, but I was still experiencing some problems with Esperanza (downloaded Esperanza-0.3.exe) which exited with a runtime error. Whenever I tried to launch Esperanza on Windows, the server responded with <em>&#8220;Client &#8216;Esperanza&#8217; with bad protocol version (1, not 11) connected&#8221;</em>.</p>
<p>This looked like a similar conflict I experienced with the wrong XMMS2 version before, so I looked for another version. I found the DrLecter built Esperanza4-DrL.7z <a href="http://www.schrijnen.nl/auke/">here</a>. This version works great.</p>
<p><img src="http://blog.wessendorf.org/wp-content/uploads/2009/06/esperanzawin.png" alt="Esperanza" title="Esperanza" width="448" height="286" class="aligncenter size-full wp-image-857" /></p>
<p>Now I was ready to play, stop, and control my XMMS2 daemon from my remote computers, may it run Windows or Ubuntu. However, this configuration didn&#8217;t actually stream music from my server to the remote machine. It only served as a channel to remote control the server&#8217;s playlist. The music was still played nowhere but on the server system. </p>
<h3>Icecast2</h3>
<p>Icecast2 is a streaming server, a package that will allow you to setup a simple Internet radio station. It, too, is readily available in Ubuntu&#8217;s repository and can be installed via Synaptic. After installation I updated two configuration files: <code>sudo nano /etc/icecast2/icecast.xml</code></p>
<p>There I defined some passwords where the default was marked with &#8216;<em>hackme</em>&#8216;. I also changed the ports to 9600/9601. No particular reason, other than having the Icecast2 ports relatively close to the XMMS2 default port. You can choose any port there. More details in the <a href="http://www.icecast.org/docs/icecast-2.3.1/icecast2_basicsetup.html">basic setup help</a>. I left all the other settings alone and edited <code>sudo nano /etc/default/icecast2</code> to set <tt>ENABLE=true</tt>. After that I could start Icecast2 with <code>/etc/init.d/icecast2 start</code>.</p>
<p>The Icecast admin-page should now show up with the url <tt>http://localhost:9600</tt>. But there still is no music to stream. In the next step I linked XMMS2 to Icecast, using the&#8230; </p>
<h3>xmms2-plugin-ices</h3>
<p>As part of the Ubuntu repository it was installed in a matter of a few seconds. It needed to be configured in the <em>ices</em> section of <code>nano ~/.config/xmms2/xmms2.conf</code>.</p>
<p>Make sure you stop the daemon before you make any changes, otherwise they might not be visible next time you restart. If you can&#8217;t find an <em>ices</em> section after a fresh installation, you can let XMMS2 and the plugin set a default section up for you. Try restarting the daemon. In the <em>ices</em> section I just set the password and portnumber (9600) to match what I defined for Icecast2 earlier. See also the <a href="http://wiki.xmms2.xmms.se/wiki/Using_ICES_Output">XMMS2 wiki</a>.</p>
<p>This didn&#8217;t want to work in the beginning. I received error messages about insufficient permissions. I think this was caused by the fact that XMMS2 and the plugin both ran as <em>gerrit</em>, Icecast2, however, as <em>root</em>. To solve this problem I copied the Icecast configuration (icecast.xml and admin, web-folders) to my home-folder, and changed the owner of all these files.</p>
<pre class="brush:bash;light:true;">
chown -hR gerrit ~/.icecast
sudo nano /etc/default/icecast2
</pre>
<p>Now I had to point the daemon to the new folder:</p>
<pre class="brush:bash;">
CONFIGFILE="/home/gerrit/.icecast/icecast.xml"

# Name or ID of the user and group the daemon should run under
USERID=gerrit
GROUPID=gerrit
</pre>
<p>Almost done. There still was a warning about the error- and access logfiles in <tt>/var/log/icecast2/</tt>. To solve this I had to change the owner of the log-files <code>chown gerrit /var/log/icecast2/*</code> and restart Icecast2 <code>/etc/init.d/icecast2 start</code></p>
<p>Now I could set the output plugin to <em>ices</em> and start the playback with</p>
<pre class="brush:bash;light:true;">
xmms2 config output.plugin ices
xmms2 play
</pre>
<p>The radio stream is reachable with the following address for favorite media player: <tt>http://localhost:9600/stream.ogg.m3u</tt>, or <tt>http://192.168.1.43:9600/stream.ogg.m3u</tt></p>
<p><img src="http://blog.wessendorf.org/wp-content/uploads/2009/06/vlcwin.png" alt="VLC" title="VLC" width="447" height="146" class="alignnone size-full wp-image-860" /></p>
<p>Having turned the output to Icecast, you won&#8217;t be able to hear any music on the server, unless you open the stream. If you want to return to the standard sound output, use the following command:</p>
<pre class="brush:bash;light:true;">xmms2 config output.plugin alsa</pre>
<p>At this time, both output plugins can&#8217;t be activated together to hear music both on server and remote computer. You can only hear music if you connect to the Icecast server. The <a href="http://wiki.xmms2.xmms.se/wiki/FAQ#Why_can.27t_I_use_multiple_output_plugins_at_the_same_time.3F_I_want_to_listen_to_music_and_act_as_a_stream_source">XMMS2 FAQ</a> explains:</p>
<blockquote><p>The possibility of multiple outputs involves a nontrivial solution. The biggest problem is keeping all of the outputs in sync with each other. Each output must pull audio data from a buffer following the last decoder or effect plugin in the xform chain at a rate determined by the samplerate of the underlying device. For example, streaming audio will have an exact bitrate since no actual audio hardware is used for obtaining audio data, but a soundcard&#8217;s samplerate may vary by a few Hertz with temperature, components, and voltage. We end up with an ever growing buffer (if the buffer holds data longer for slower outputs) or dropped samples (if the data is destroyed after the faster output has read it). </p>
<p>    There are also smaller issues like that the xmms2 daemon takes into account the delays caused by the output plugin when showing the current playtime, but if there are multiple outputs these delays can vary. So one of them would have to be defined as a primary output to keep this feature in use. </p>
<p>    Current plan to resolve the aforementioned problem with concurrent output and stream sourcing is to make it possible for effect plugins to keep a constant input format and stay alive through song changes. That way they can draw the data from the stream itself and it won&#8217;t have synchronizing problems because the whole chain is still simple and one-dimensional.<span class="end"/></p></blockquote>
<p>The current configuration works great now. I have a server that provides a stream of music. This stream is accessible from all other computers, and I am able to control this Internet radio stream using XMMS2 and Esperanza if needed, from any other computer running Linux or Windows. </p>
<p>At this point I could probably stop and let it be, but I want to integrate some web-services and social media tools. While I&#8217;m mostly just experimenting with a new range of Internet applications, I&#8217;m also interested in sharing my music favorites and creating some personal charts of my highlights, the most frequently played tracks, the most important artists, etc. A great tool to link my local music adventures to the web 2.0 world is last.fm.</p>
<h3>Last.fm</h3>
<p><img src="http://blog.wessendorf.org/wp-content/uploads/2009/06/lastfm.png" alt="Last.fm" title="Last.fm" width="442" height="272" class="aligncenter size-full wp-image-862" /></p>
<p>To make my XMMS2/Icecast2 server talk with Last.fm I installed the <em>xmms2-scrobbler</em> plugin&#8230;as usual, from the standard Ubuntu repository. To configure this plugin I followed the instructions I found at <a href="http://sudosys.be/?q=xmms2-scrobbler">sudosys</a>.</p>
<p>The XMMS2 configuration is stored in <tt>~/.config/xmms2</tt>, but the plugin tries to read it in <tt>~/.xmms2</tt>. To work around this, I created a symlink <code>ln -s ~/.config/xmms2 ~/.xmms2</code></p>
<p>Next, I created a new directory for the plugin configuration and created a config file with my credentials:</p>
<pre class="brush:bash;light:true;">
mkdir -p ~/.config/xmms2/clients/xmms2-scrobbler
nano ~/.config/xmms2/clients/xmms2-scrobbler/config
</pre>
<p>added</p>
<pre class="brush:bash;light:true;">
user: MY_LASTFM_USER
password: MY_LASTFM_PASS
</pre>
<p>I created another symlink for the actual xmms2-scrobbler script, so it gets executed when I launch XMMS2.</p>
<pre class="brush:bash;light:true;">
ln -s /usr/bin/xmms2-scrobbler ~/.config/xmms2/startup.d/
</pre>
<p>After restarting XMMS2 your music will show up on your last.fm profile.</p>
<p><img src="http://blog.wessendorf.org/wp-content/uploads/2009/06/facebook.png" alt="Facebook" title="Facebook" width="207" height="263" class="alignright size-full wp-image-863" />Continuing from there you can expand your network by adding other services that access last.fm for your music statistics. On Facebook you can use a <a href="http://apps.new.facebook.com/listening/">last.fm application</a> to display your charts on your page or profile.</p>
<p>You can also integrate your last.fm data into your WordPress site with the <a href="http://www.ibegin.com/labs/wp-lifestream/">LiveStream</a> plugin. There is much more you can do, especially if you write your own applications, but this is how far my own configuration goes right now.</p>
<p>I hope you found any of these notes use- or helpful. As usual, please let me know if I forgot something or made a mistake somewhere. :]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wessendorf.org/2009/06/music-networking-with-xmms2-icecast2-and-lastfm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

