<?xml version="1.0" encoding="utf-8"?>
        <?xml-stylesheet type="text/css" href="http://sysphere.org/~anrxc/j/styles/feed.css"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
 xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>Unknown and partly hidden</title>
<atom:link href="http://sysphere.org/~anrxc/j/rss.xml" rel="self" type="application/rss+xml" />
<link>http://sysphere.org/~anrxc/j</link>
<description>journal of Adrian C. (anrxc)</description>
<dc:language>en-us</dc:language>
<dc:creator>anrxc</dc:creator>
<dc:date>2012-12-09T05:24:14+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://sysphere.org/~anrxc/j/archives/2012/12/09/hybrid_ircd_for_arch_linux/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2012/12/09/hybrid_ircd_for_arch_linux/index.html</guid>
<title>Hybrid IRCD for Arch Linux</title>
<dc:date>2012-12-09T05:24:12+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> main, code</dc:subject>
<description><![CDATA[<p>

<a href="http://www.ircd-hybrid.org/">Hybrid</a> IRCD has been a
favorite of mine for many years. I tried it once because
a <a href="http://idolnet.org/">Croatian IRC network</a> ran it and it
stuck with me. I'm very happy to announce Hybrid packages for Arch
Linux are available in AUR from today. I worked on it as a side
project for a while and finished today thanks to the blizzard that
kept me inside this weekend. Hybrid server is available
as <a href="https://aur.archlinux.org/packages/ircd-hybrid/">ircd-hybrid</a>,
and <em>Hybserv2</em> services are available
as <a href="https://aur.archlinux.org/packages/ircd-hybrid-serv/">ircd-hybrid-serv</a>. They
adhere to standards set by all other ircd providers, default
configuration for both is usable out of the box, and examples for
connecting services to the server are included. They were built and
tested on both arches, only component not tested by me
are <em>systemd</em> service files.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2012/12/09/gnulinux_and_thinkpad_t420/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2012/12/09/gnulinux_and_thinkpad_t420/index.html</guid>
<title>GNU/Linux and ThinkPad T420</title>
<dc:date>2012-12-09T04:58:05+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> main, desktop, work</dc:subject>
<description><![CDATA[<p>

I got a new workstation last month, a 14" laptop from the ThinkPad T
series. The complete guide
for <a href="http://www.tuxmobil.org/">TuxMobil</a> about installing
Arch Linux on it
is <a href="http://sysphere.org/~anrxc/j/articles/thinkpad-t420/index.html">here</a>.
<br /><br />

It replaced a (thicker and heavier)
13" <a href="http://sysphere.org/~anrxc/j/articles/probook/index.html">HP
ProBook 4320s</a> which I used a little over a year, before giving up
on it. In some ways ProBook was excellent, certified for <em>SUSE
Linux</em> it had complete Linux support down to the most
insignificant hardware components. In other ways it was the worst
laptop I ever used. That ProBook series has chiclet-style keyboards,
and I had no idea just how horrible they can be. Completely flat keys,
widely spread and with bad feedback caused me a lot of wrist
pain. Even after a year I never got used to the keyboard, and I was
making a lot of typos, on average I would miss-type even my login
every second boot. At the most basic level my job can be described as
a "typist" so all this is just plain unacceptable. <br /><br />

The touchpad however is worse than the keyboard. It's a "clickpad",
with one big surface serving as both the touchpad area and the button
area. To get it in a usable state
a <a href="https://aur.archlinux.org/packages/xf86-input-synaptics-led/">number</a>
of <a href="https://aur.archlinux.org/packages/synaptics-led/">patches</a>
are needed, coupled with an
extensive <a href="http://sysphere.org/~anrxc/j/articles/probook/xorg.conf.d/11-synaptics.conf">user-space
configuration</a>. But even after a year of tweaking it was never just
right. The most basic of operations like selecting text, dragging
windows or pressing the middle button is an exercise in
patience. Sadly <em>clickpads</em> are present in a huge number of
laptops today. <br /><br />

Compared to the
excellent <a href="http://www.thinkwiki.org/wiki/UltraNav">UltraNav</a>
device in the ThinkPad they are worlds apart. Same is true of the
keyboard in T420, which is simply the best laptop keyboard I've ever
used. I stand behind these words as I just ordered another T420, for
personal use. One could say these laptops are in different categories,
but that's not entirely true. I had to avoid
the <strong>latest</strong> ThinkPad models because of the
chiclet-style keyboards they now have. Lenovo is claiming that's
"keyboard evolution", to me they just seem cheaper to produce, and
this machine could be the last ThinkPad I'll ever own. If this trend
continues I don't know where to turn next for decent professional
grade hardware. <br /><br /

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2012/10/01/net-installing_arch_linux/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2012/10/01/net-installing_arch_linux/index.html</guid>
<title>Net-installing Arch Linux</title>
<dc:date>2012-10-01T01:53:20+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work</dc:subject>
<description><![CDATA[<p>

Recently I had to figure out the most efficient way of net-installing
<a href="http://www.archlinux.org/">Arch Linux</a> on remote servers
that fits into the deployment process, with many other operating
systems, which runs a <em>DHCP</em> and <em>TFTP</em> daemons serving
various operating system images. <br /><br />

The Arch
Linux <a href="https://wiki.archlinux.org/index.php/Install_Arch_from_network_via_PXE">PXE
wiki</a> put me on the right track and I downloaded the
<a href="ftp://ftp.archlinux.org/iso/archboot/latest/">archboot-x86_64
ISO</a>, which I temporarily mounted, so I can copy the key parts of
the image:

<pre>
# wget http://mirrors.kernel.org/archlinux/iso/archboot/2012.06/archlinux-2012.06-1-archboot-x86_64.iso 
# mkdir /mnt/archiso
# mount -o loop,ro archlinux-2012.06-1-archboot-x86_64.iso /mnt/archiso
</pre>

Let's say the TFTP daemon serves images
using <a href="http://www.syslinux.org/wiki/index.php/PXELINUX">pxelinux</a>,
chrooted in <em>/srv/tftpboot</em>. The images are stored in
the <em>images/</em> sub-directory and the top
level <em>pxelinux.cfg</em> configuration gets copied from the
appropriate <em>images/operating-system/</em> directory automatically
based on the operating system selection in the provisioning tool:

<pre>
# mkdir -p images/arch/arch-installer/amd64/
# cp -ar /mnt/archiso/boot/* images/arch/arch-installer/amd64/
</pre>

The <em>boot</em> directory of the archboot ISO contains the kernel
and <em>initrd</em> images, and
a <a href="http://www.syslinux.org">syslinux</a> installation. I
proceeded to create the pxelinux configuration to boot them, ignoring
syslinux:

<pre>
# cd images/arch/
# mkdir arch-installer/amd64/pxelinux.cfg/
# emacs arch-installer/amd64/pxelinux.cfg/default

  prompt 1
  timeout 1
  label linux
    kernel images/arch/arch-installer/amd64/vmlinuz_x86_64
    append initrd=images/arch/arch-installer/amd64/initramfs_x86_64.img gpt panic=60 vga=normal loglevel=3

# ln -s arch-installer/amd64/pxelinux.cfg ./pxelinux.cfg
</pre>

To better visualize the end result, here's the final directory layout:

<blockquote>
arch-installer/ <br />
arch-installer/amd64/ <br />
arch-installer/amd64/grub/* <br />
arch-installer/amd64/pxelinux.cfg/ <br />
arch-installer/amd64/pxelinux.cfg/default <br />
arch-installer/amd64/syslinux/* <br />
arch-installer/amd64/initramfs_x86_64.img <br />
arch-installer/amd64/vmlinuz_x86_64 <br />
arch-installer/amd64/vmlinuz_x86_64_lts <br />
pxelinux.cfg/ <br />
pxelinux.cfg/default <br />
</blockquote>

I left the possibility of including <em>i686</em> images in the
future, but that is not likely ever to happen due to almost
non-existent demand for this operating system on our servers. Because
of that fact I didn't spend any time on further automation, like
automated RAID assembly or package pre-selection. On the servers I
deployed assembling big RAID arrays manually was tedious, but really
nothing novel compared to dozens you have to rebuild or create every
day. <br /><br />

From a fast mirror the base operating system installs from the
Arch <em>[core]</em> repository in a few minutes, and included is
support for a variety of boot loaders, with my favorite being syslinux
which in Arch Linux has an excellent installer script
<em>"syslinux-install_update"</em> with RAID auto detection. I also
like the fact <em>2012.06-1</em> archboot ISO still includes the
curses menu based installer, which was great for package selection,
and the step where the base configuration files are listed for
editing. Supposedly the latest desktop images now only have helper
scripts for performing installations - but I wouldn't know for sure as
I haven't booted an ISO in a long time, Arch is an operating system
you install only once, the day you buy the workstation. <br /><br />

Another good thing purely from the deployment standpoint is the
rolling releases nature, as the image can be used to install the
latest version of the operating system at any time. Or at least until
the <em>systemd</em> migration which might obsolete the image, but I
dread that day for other reasons - I just don't see its place on
servers, or our managed service with dozens of proprietary software
distributions. But right now, we can deploy Arch Linux half way around
the globe in 10 minutes, life is great.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2012/08/26/more_on_redis/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2012/08/26/more_on_redis/index.html</guid>
<title>More on Redis</title>
<dc:date>2012-08-26T03:35:12+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work</dc:subject>
<description><![CDATA[<p>

In managed hosting you're not often present in design stages of new
applications and sometimes you end up supporting strange
infrastructure. Or at least that was my experience in the past. So
little by little I found my self supporting huge
(persistent) <a href="http://redis.io/">Redis</a> databases, against
my better judgment. <br /><br />

Someone sent me a link to
the <a href="http://redis.io/topics/sentinel">Redis Sentinel</a>
beta <a href="http://antirez.com/post/redis-sentinel-beta-released.html">announcement</a>
last month. It may even make it into the <em>2.6</em> release... but
all of this I had to implement on my own long ago. A lot of developers
I supported didn't even want to use the <em>2.4</em> branch (in my
opinion just the memory fragmentation improvements are more than
enough reason to ditch <em>2.2</em> forever). Another highly
anticipated Redis feature,
the <a href="http://redis.io/topics/cluster-spec">Redis Cluster</a>,
may not even make it into the <em>2.6</em> release. That's too bad,
there's too much features with Redis that are always "just around the
corner", yet I have a feeling I'll be supporting Redis 2.4 for at
least another 3 years, with all its flaws and shortcomings (I
scratched the surface in my last article with <strong>AOF</strong>
corruption, and not-so-cheap hardware needed for reliable persistent
storage). <br /><br />

Typically I would split members of a Redis cluster across 2 or more
power sources and switches. But that's just common sense for any HA
setup, as is not keeping all your masters together. Redis doesn't have
multi-master replication so a backup 'master' is always passive, and
is just another slave of the primary with slaves of its own. If the
primary master fails only half of the slaves have to be failed-over to
the backup master. This has its problems (ie. double complexity of
replication monitoring by the fail-over agents), but the benefits
outweight failing-over a whole cluster to the new master. That could
take half a day, as fail-over is an expensive operation (it is a full
re-sync from the master). You can find replication implementation
details <a href="http://redis.io/topics/replication">here</a>. <br /><br />

If you can't allow slaves to serve stale data (tunable
in <em>redis.conf</em>) you need enough redundancy in the pool to be
able to run at half capacity for at least a few hours, until at least
one of the outdated slaves is fully re-synced to its new master. And
that finally brings me to knowing when is the right time to
fail-over. <br /><br />

Any half decent load balancer can export the status of a backend pool
through an API, or just a HTTP page (if yours can't it's time to use
the open source <a href="http://haproxy.org">HAproxy</a>). That
information is ripe for exploiting to our advantage, but we need to be
weary of false positives. I can't share my own solutions, but you will
want all N slaves confirming that the master pool is truly degraded,
and initiate fail-overs one by one to avoid harmonics if you are
serving stale data, or all at once if you aren't. For all that you
will need them to communicate with each other, and
a <a href="http://www.zeromq.org/">simple message broker</a> can do
the job well. <br /><br />

As I am writing these last notes I realized I haven't mentioned
another fundamental part of any Redis deployment I do - backups. This
article documents
the <a href="http://redis.io/topics/persistence">persistence
implementation</a> in Redis, and explains that
the <strong>RDB</strong> engine snapshots are good for taking
backups. RDB is never modified directly, and snapshots are renamed
into their final destination atomically only when they are
complete. From here it's trivial to write a script that initiates a
background save, waits until it's done and transfers the fresh
snapshot off site.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2012/03/05/infrastructure_you_can_blog_about/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2012/03/05/infrastructure_you_can_blog_about/index.html</guid>
<title>Infrastructure you can blog about</title>
<dc:date>2012-03-05T00:06:07+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work</dc:subject>
<description><![CDATA[<p>

I spent last 5 months planning and building new infrastructure for one
of the biggest websites out there. I was working around the clock
while developers were rewriting the site, throwing away an ancient
code base and replacing it with a modern framework. I found no new
interesting topics to write about in that time being completely
focused on the project, while the RSS feed of this journal was
constantly the most requested resource on the web server. I'm sorry
there was nothing new for you there. But I learned some valuable
lessons during the project, and they might be interesting enough to
write about. Everything I learned about Puppet, which was also a part
of this project, I shared in
my <a href="http://sysphere.org/~anrxc/j/archives/2011/11/06/pulling_strings/index.html">previous
entry</a>. I'll focus on other parts of the cluster this
time. <br /><br />

Here's a somewhat simplified representation of the cluster: <br />
<img alt="Network diagram" src="http://sysphere.org/~anrxc/j/images/netinfr-030412.png" /></a>
<br /><br />

Following the traffic path first thing you may ask your self is
"<em>why is Varnish Cache behind HAproxy?</em>". Indeed placing it in
front in order to serve as many clients as soon as possible is
logical. <a href="https://www.varnish-cache.org/">Varnish Cache</a> is
good software, but often unstable (developers are very quick to fix
bugs given a proper bug report, I must say). Varnish Cache plugins (so
called <em>vmods</em>) are even more unstable, crashing varnish often
and degrading cache efficiency. This is why HAproxy is imperative in
front, to route around crashed instances. But it's the same old
HAproxy that has proven it self balancing numerous high availability
setups. Also, Varnish Cache as a load balancer is a nice try, but I
won't be using it as such any time soon. Another thing you may ask is
"<em>how is Varnish Cache logging requests to Syslog when it has no
Syslog support?</em>". I found FIFOs work good enough - and remember
traffic is enormous, so that says a lot. <br /><br />

Though with a more mature threaded implementation I can't see my self
using <a href="http://www.rsyslog.com/http://www.rsyslog.com/">Rsyslog</a>
over <a href="http://www.balabit.com/network-security/syslog-ng/opensource-logging-system/overview">syslog-ng</a>
on big log servers in the near future. Hopefully threaded syslog-ng
only gets better, resolving this dilemma for me for all
times. Configuration of rsyslog feels awkward (though admittedly
syslog-ng is not a joy to configure either). Version packaged in
Debian <strong>stable</strong> has bugs, one of which made it
impossible to apply different templates to different network
sources. Which is a huge problem when it's going to be around for
years. I had to resort to packaging my own, but ultimately dropped it
completely for <strong>non</strong> threaded syslog-ng which is
working pretty good. <br /><br />

Last thing worth sharing are <a href="http://redis.io/">Redis</a>
experiences. It's really good software (ie. as alternative
to <a href="http://memcached.org/">Memcached</a>) but ultimately I
feel disappointed with the replication implementation. Replication,
with persistence engines in use, and with databases over 25GB in size
is a nightmare to administrate. When a slave (re)connects to a master
it initiates a <em>SYNC</em> which triggers a <em>SAVE</em> on the
master, and a full resync is performed. This is an extremely expensive
operation, and makes cluster wide automatic fail-over to a backup
master very hard to implement right. I've also
experienced <a href="http://redis.io/topics/persistence">AOF</a>
corruption which could not be detected
by <em>redis-check-aof</em>. This makes <em>BGREWRITEAOF</em> jobs
critical to execute regularly, but with big databases this is another
extremely expensive operation, especially if performed under
traffic. The following has proven it self as a best solution for high
performing Redis servers; 4x147GB 15k SAS disks in (h/w) RAID10, and
Xeon 5000 series CPUs. <br /><br />

While working on this the running joke was I'm building infrastructure
you can blog about (but otherwise do little else with it). But it does
do a little more than just look impressive on paper.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/11/06/pulling_strings/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/11/06/pulling_strings/index.html</guid>
<title>Pulling strings</title>
<dc:date>2011-11-06T00:17:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work, code, books</dc:subject>
<description><![CDATA[<p>

After one year of managing a network
of <a href="http://sysphere.org/~anrxc/j/archives/2010/11/17/cfengine3_bootstrap/index.html">10
servers with Cfengine</a> I'm currently building two clusters of 50
servers with Puppet (which I'm using for the first time), and have
various notes to share. With my experience I had a feeling Cfengine
just isn't right for this project, and didn't consider it
seriously. These servers are all running <em>Debian GNU/Linux</em> and
Puppet felt natural because of the
good <a href="http://packages.debian.org/search?keywords=puppet">Debian
integration</a>, and the number of users whom also produced a lot of
resources. Chef was out of the picture soon because of
the <a href="http://wiki.opscode.com/display/chef/Architecture">scary
architecture</a>; <em>CouchDB</em>, <em>Solr</em>
and <em>RabbitMQ</em>... coming from Cfengine this seemed like a bad
joke. You probably need to hire a Ruby developer when it
breaks. Puppet is somewhat better in this regard. <br /><br />

Puppet master needs Ruby, and has a built-in file server using
<em>WEBrick</em>. My first disappointment with Puppet was
WEBrick. Though
<em>PuppetLabs</em> claim you can scale it up to 20 servers, that
proved way off, the built-in server has problems serving as little as
5 agents/servers, and you get to see many dropped connections and
failed catalog transfers. I was forced to switch to <em>Mongrel</em>
and <em>Nginx</em> as frontend very early in the project, on both
clusters. This method works much better (even
though <em>Apache+Passenger</em> is the recommended method now from
PuppetLabs), and it's not a huge complication compared to WEBrick (and
Cfengine which doesn't make you jump through any hoops). Part of the
reason for this failure is my pull interval, which is 5 minutes with a
random sleep time of up to 3 minutes to avoid harmonics (which is
still a high occurrence with these intervals and WEBrick fails
miserably). In production a customer can not wait on 30/45 minute pull
intervals to get his IP address whitelisted for a service, or some
other mundane task, it must happen within 10 minutes... but I'll come
to these kind of unrealistic ideas a little later. <br /><br />

Unlike the Cfengine article I have no bootstrapping notes, and no
code/modules to share. By default the fresh started puppet agent will
look for a host called "puppet" and pull in what ever you defined to
bootstrap servers in your <em>manifests</em>. As for modules, I wrote
a ton of code and though I'd like to share it, my employer owns
it. But unlike Cfengine v3 there's a lot
of <a href="http://docs.puppetlabs.com/">resources out there for
Puppet</a> which can teach you everything you need to know, so I don't
feel obligated to even ask. <br /><br />

Interesting enough, published modules would not help you get your job
done. You will have to write your own, and your team members will have
to learn how to use your modules, which also means writing a lot of
documentation. Maybe my biggest disappointment is getting
disillusioned by most Puppet advocates and DevOps prophets. I found
articles and modules most of them write, and experiences they share
have nothing to do with the real world. It's like they host servers in
a magical land where everything is done in one way and all servers are
identical. Hosting big websites and their apps is a much, much
different affair. <br /><br />

Every customer does things differently, and I had to write custom
modules for each of them. Just between these two clusters a module
managing Apache is different, and you can abstract your code a lot but
you reach a point where you simply can't push it any more. Or if you
can, you create a mess that is unusable by your team members, and I'm
trying to make their jobs better not make them miserable. One customer
uses an <em>Isilon NAS</em>, the other has a content distribution
network, one uses Nginx as a frontend, other has chrooted web servers,
one writes logs to a NFS, other to a Syslog cluster... Now imagine
this on a scale with 2,000 customers and 3 times the servers and most
of the published infrastructure design guidelines become
laughable. Instead you find your self implementing custom solutions,
and inventing your own rules, best that you can... <br /><br />

I'm ultimately here to tell you that the projects are in a better
state then they would be with the usual cluster management policy. My
best moment was an e-mail from a team member saying "<em>I read the
code, I now understand it</em> [Puppet]<em>. This is fucking
awesome!</em>". I knew at that moment I managed to build something
good (or good enough), despite the shortcomings I found, and with
nothing more than
using <a href="http://puppetlabs.com/">PuppetLabs</a>
resources. Actually, that is not completely honest. Because I did buy
and read the
book <a href="http://www.amazon.com/Pro-Puppet-James-Turnbull/dp/1430230576/">Pro
Puppet</a> which contains an excellent chapter on using <em>Git</em>
for collaboration on modules between sysadmins and developers, with
proper implementation of development, testing and production
(Puppet)environments.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/09/29/reamde/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/09/29/reamde/index.html</guid>
<title>Reamde</title>
<dc:date>2011-09-29T03:45:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> books</dc:subject>
<description><![CDATA[<p>

I received a copy
of <a href="http://www.amazon.com/Reamde-Novel-Neal-Stephenson/dp/0061977969/">REAMDE
by Neal Stepehenson</a>, his latest book, two weeks before publication
date and slowly worked my way through it. Having finished it I can say
I really liked it. A lot of reviewers are disappointed that it wasn't
nearly as complex as his earlier work, like <em>Cryptonomicon</em>
and <em>Anathem</em>. But it was still a 1200 pages volume of
Stephenson awesomeness. This is a thriller set in modern day, not an
SF book. <br /><br />

Reason I enjoyed it a lot are the characters, a lot of them were
(black or whitehat) hackers, sysadmins, programmers and
gamers. Perhaps I felt closer to them than some readers did, who might
have expected an epic historical novel or SF from
Stephenson. <br /><br />

Book opens up with Richard, a CEO of <em>Corporation 9592</em> that
produces a massive online role-playing game called T'Rain. Somewhat
like WoW but with a twist, the idea behind the world and how it was
built is one of the best chapters in the book. Some hackers found a
way to exploit a vulnerability shared by T'Rain players and wrote
malware that encrypts their data with PGP and holds them for
ransom. Payment is done in gold in the T'Rain world. At some point
they ransom data of some <em>carders</em>, and their handlers who are
very bad people and all hell breaks loose. Mobsters and terrorist
cells get involved and story jumps to multiple continents. Neal
Stephenson once said he likes making a good yarn, and he delivered on
it again.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/06/26/building_a_vdr_with_arch_linux/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/06/26/building_a_vdr_with_arch_linux/index.html</guid>
<title>Building a VDR with Arch Linux</title>
<dc:date>2011-06-26T01:10:29+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> dvb, media</dc:subject>
<description><![CDATA[<p>

Early in the last decade I had a so called <em>SatDSL</em>
subscription, it was very expensive but the only way to get decent
bandwidth. With the subscription I received a DVB-S PC tuner,
a <a href="http://images.google.com/images?q=Technisat+SkyStar2">Technisat
SkyStar2</a>. A few years later when the subscription ran out I was
left with the tuner and got interested in other ways of using the
hardware. Those were some dark times for content providers, encryption
systems
were <a href="http://en.wikipedia.org/wiki/Pirate_decryption">getting
hacked</a> left and right. The <em>Wired</em> magazine
ran <a href="http://www.wired.com/politics/security/news/2008/05/tarnovsky?currentPage=all">a
great piece</a> a few years ago about this period. Personally I was
more interested in <a href="http://dvbsnoop.sourceforge.net/">network
traffic</a> at the time, as a lot of it was not
encrypted. <br /><br />

I used <a href="http://www.tvdr.de/">VDR</a> software back then to
build an approximation of a commercial SAT receiver. A friend put
together an infra-red receiver for use
with <a href="http://www.lirc.org/">LIRC</a> and I was set. With the
rising popularity of HDTV and
the <a href="http://en.wikipedia.org/wiki/DVB-S2">DVB-S2 standard</a>
my current 'receiver' was getting outdated. It had a <em>Duron
1200</em> CPU, with 300MB of <em>SDRAM</em> and a 320GB of storage. I
was putting money on the side for several years to build a replacement
(and get an appropriate HD TV set), and finally did it this
year. These past few months I
used <a href="https://www.archlinux.org/">Arch Linux</a> with VDR, and
built it piece by piece as a hobby. On the hardware side I used:

<blockquote>
MBO: Asrock M3AUCC <br />
CPU: AthlonII X3 455 <br />
RAM: 4GB DDR3<br />
HDD: 1TB disks (RAID1) <br />
GFX: GeForce GT240 (VDPAU) <br />
DVB: SkyStar HD2 (DVB-S2 tuners) <br />
LCD: Philips 43" HDTV
</blockquote>

I didn't go with one of the <em>Ion</em> systems, because I don't
watch
<em>that</em> much TV, and the box will be put to many other uses
(<a href="http://sysphere.org/~anrxc/j/archives/2010/05/31/introducing_rybackup_again/index.html">backups</a>, <a href="http://sysphere.org/~anrxc/j/articles/tor/index.html">TOR
gateway</a>, media streaming, distributed compiling, etc.). Every
piece was carefully selected, and folks on the VDR mailing list helped
me choose a suitable graphics card for HDTV, with
good <a href="http://en.wikipedia.org/wiki/VDPAU">VDPAU
support</a>. As usual with Linux even that careful selection wasn't
enough to ensure a smooth ride. <br /><br />

The sound-card drivers were deadlocking the machine, and it took a few
days of experimentation to resolve it. The SkyStar HD2 cards work
great with the <strong>mantis</strong> driver, but support for their
infra-red receiver is missing. However experimental support is
available through
a <a href="http://www.mail-archive.com/linux-media@vger.kernel.org/msg31742.html">patch</a>
published on the Linux-media mailing list, earlier this
year. <br /><br />

All my previous VDRs were powered
by <a href="http://www.slackware.com/">Slackware Linux</a>, and I
developed some habits and preferences in running VDR. So I didn't use
the <a href="http://sourceforge.net/apps/trac/archvdr/">ArchVDR
project</a>, or <a href="https://wiki.archlinux.org/index.php/VDR">VDR
packages</a>, although they are good projects. I prefer to keep every
VDR installation under a single directory tree, with the one currently
in use always being symlinked to <em>/opt/VDR</em>. I swap them a lot,
always patching (<em>liemikuutio</em>, <em>ttxtsubs</em>...), and
testing a lot of plugins. <br /><br />

Instead of using <em>runvdr</em> and other popular scripts for
controlling VDR I wrote my own script long ago. I call
it <a href="http://sysphere.org/~anrxc/local/sources/vdrctl">vdrctl</a>,
it's much simpler but provides extensive control over loaded plugins
and their own options, and has support for passing commands directly
to a running VDR with <em>svdrpsend</em>. As the window manager I
used <a href="http://awesome.naquadah.org">awesome</a> this time,
opposed to <a href="http://www.fvwm.org/">FVWM</a> that can be seen in
this <a href="http://sysphere.org/gallery/VDR">old
gallery</a>. Awesome runs in a <em>fullscreen</em> layout, and with
some
useful <a href="http://git.sysphere.org/vicious/">widgets</a>. <br /><br />


For playing other media my long time favorite
is <a href="http://oxine.sourceforge.net/">Oxine</a>,
a <a href="http://www.xine-project.org/home">Xine</a> frontend well
suited for TV sets. But I don't use its VDR support as one might
expect (I use
the <a href="http://home.vr-web.de/~rnissl/">vdr-xine</a> plugin with
regular <em>xine-ui</em>), instead I connect VDR with Oxine through
the <a href="http://sourceforge.net/projects/externalplayer/">externalplayer-plugin</a>. It's
special in that it breaks the VDR connection to LIRC prior to
launching an external player allowing to seamlessly control both
applications. <br /><br />

Arch Linux makes it easy to build your own packages of all the media
software to include VDPAU
support. Official <a href="http://www.archlinux.org/packages/extra/i686/mplayer/">mplayer</a>
already has it, Xine is available in the <em>AUR</em>
as <a href="http://aur.archlinux.org/packages.php?ID=34570">xine-lib-vdpau</a>
and so on. But even more important, the good packaging infrastructure
and management makes it easy to build and <strong>maintain</strong>
custom kernels (for IR support ie.). It truly is the perfect VDR
platform.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/06/22/org-mode_and_the_cycle/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/06/22/org-mode_and_the_cycle/index.html</guid>
<title>org-mode and the cycle</title>
<dc:date>2011-06-22T03:57:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work, code, emacs</dc:subject>
<description><![CDATA[<p>

<a href="http://sysphere.org/temp/OrgTutorial/tutorial-11.png"><img class="left"
alt="Org-Mode Screenshot"
src="http://sysphere.org/~anrxc/j/images/orgmodethumb.png" /></a> I go
through 50 or so support tickets, and <em>Nagios</em> alerts that must
be acted on, in a given shift. There's also long term projects to
manage. That's a lot of work, and <strong>a lot of
distractions</strong> for a single work day. To keep it all under
control I turned to the book
"<a href="http://www.amazon.com/Management-System-Administrators-Thomas-Limoncelli/dp/0596007833/">Time
Management for Sysadmins</a>" after enjoying some other books of the
author. The book promotes a "cycle" system, with one TODO list/sheet
per day, where all unfinished items from the previous day are
transferred onto the next, and a few minutes invested in prioritizing
and planning the day. There's much more to the method, but that's the
gist of it, avoiding the "never ending TODO list of
DOOM". <br /><br />

Tools of choice for the author are pen and paper, or a <em>PDA</em> is
suggested as an alternative. I wouldn't carry a journal and don't own a
PDA, but I already depended
on <a href="http://orgmode.org/">org-mode</a> heavily for my personal
projects management and nothing could replace that, really. So while I
was planning how to apply this new found wisdom and pair it with
<em>org-mode</em> I came up with a system I wish to describe here. I
wanted to do that for a long time, even though it's very specific to
my needs, so most likely nobody can make use of it as is. But perhaps
it gives you ideas, and even that would be great <br /><br />

Org-mode is a top notch project management tool, inside a good
editor. Great tools for the job. Yet it's very easy to fall into the
"list of doom" trap. In the context of org-mode its gurus actually
recommend keeping big lists with a small number of files, because of
good agenda overview and unlimited possibilities of org-mode... but I
decided to avoid it and imitate the system the book promotes with one
list per day, and project in my case (author splits them into
sub-tasks, for day lists). If you're familliar with the cycle system
and thinking it doesn't make sense read on, org-mode agenda view is
the key. <br /><br />

I start my day with a terminal emulator, and I realized it would be
best to have a dedicated tool that can be used from the command
line. So I
wrote <a href="http://sysphere.org/~anrxc/local/sources/mkscratch.sh">mkscratch</a>,
a simple tool that sets me up with a scratchpad for the day, helps
managing the old pads, but also pads of long term projects. It's not
actually that specific to org-mode, yet it was written with it in mind
so headers and file extensions reflect that. But it is easily a
general purpose editor wrapper for creating scratchpads or project
pads. <br /><br />

This is how I tie it all together, day-to-day pads are
in <em>~/work/pads</em>, and once invoked <em>mkscratch</em> creates a
pad for the day, if one doesn't already exist, and
links <em>~/pad.org</em> to
<em>~/work/pads/MM-DD.org</em>. Then it starts Emacs if not already
running, and opens the pad for the day. I might have scheduled a task
days or months in advance and created a pad for that day, then only
linking of <em>~/pad.org</em> is performed and editor is opened. Long
term projects get their own directories below
<em>~/work/projects</em> (because projects have other files as
baggage), with some project identifier as the directory name, while
the main pad for every project is
called <strong>project.org</strong>. This is of some importance (see
the <em>.emacs</em> snippet below). <br /><br />

A good part of the author's cycle system is maintaining a calendar
with meetings and project deadlines meticulously marked.  From the
calendar items are copied onto the list for the day when their time is
up (during those few minutes of planning, before the day starts or at
the end of the previous day). While contemplating how to translate
that to org-mode I realized using the <em>Agenda View</em> as is will
do just fine, if only I could gather all scheduled items and
approaching deadlines from all the files (pads and projects) into this
single view. Even though it's not a very conventional usage pattern
for org-mode (remember, we have up to 300 files near the years end),
it can be done easily in <em>.emacs</em>:

<pre>
;; Files that are included in org-mode agenda
(setq org-agenda-files
  (cons "~/work/pads/"
    (file-expand-wildcards 
     "~/work/projects/*/project.org"))
)
</pre>

One of
my <a href="http://sysphere.org/~anrxc/j/archives/2009/05/04/awesome_and_org-mode/index.html">past
articles</a> described connecting my window manager with org-mode for
taking quick notes. I use the same method now for appending to pad
files, not always, but it's very useful to quickly store a task when
you're in the middle of something. <br /><br />

A few years ago I wrote
another <a href="http://sysphere.org/~anrxc/j/archives/2009/04/01/employing_org-mode/index.html">short
article</a> on org-mode, using it for project management while
freelancing, it describes a different method but a part of it focused
on
using <a href="http://sysphere.org/~anrxc/j/articles/gnupg/index.html">GPG</a>
to encrypt project files. The same can be applied
here. <strong>EasyPG</strong> is now a part of Emacs, and every pad
can be encrypted on the fly, and decrypted without any overhead in
usage (even more so when using the GPG agent). <br /><br />

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/04/05/lilo_to_syslinux_migration/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/04/05/lilo_to_syslinux_migration/index.html</guid>
<title>LILO to syslinux migration</title>
<dc:date>2011-04-05T03:12:38+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> main, desktop</dc:subject>
<description><![CDATA[<p>

I've been using <em>LILO</em> for a long time, from my first GNU/Linux
installation. Some people have the idea that it's a dead project, but
it's not, development
is <a href="https://alioth.debian.org/projects/lilo/">still
active</a>. It never failed to boot for me. Until last night, when it
failed to use an <em>XZ</em> compressed
Linux <strong>v2.6.38.2</strong>. I would never give up LILO
for <em>Grub</em>, but I was contemplating a switch
to <a href="http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project">syslinux</a>
after watching
the <a href="http://dieter.plaetinck.be/can_we_build_a_simple_cross-distribution_installation_framework.html">Fosdem
talk by Dieter Plaetinck</a> last month. <br /><br />

I had no more excuses to delay it any longer, so I switched. All my
machines have <em>/boot</em> as the first partition on the disk, they
are flagged bootable, and use the <em>ext2</em> file-system. Migrating
to syslinux was simple:

<blockquote>
# pacman -Syu syslinux <br />
# /usr/sbin/syslinux-install_update -i -a -m <br />
<br />
# cp -arp /etc/lilo.conf /etc/lilo.conf.bak <br />
# pacman -Rns lilo
</blockquote>

The <b>syslinux-install_update</b> options stand for installing it to
the <strong>MBR</strong>, where it replaces LILO. Then I wrote a
configuration file: <em>/boot/syslinux/syslinux.cfg</em>. Actually, I
wrote one in advance, because even though you might find it funny, it
was a big deal for me to continue using my boot prompt as is. I've
been using
the <a href="http://kde-look.org/content/show.php?content=29675">LILO
fingerprint menu</a> for years. Not being able to port it would be a
deal breaker. But it wasn't complex, actually. <br /><br />

If you want to use the <em>Fingerprint</em> theme, grab it
from <em>KDE-Look</em>, convert the <strong>BMP</strong> to
the <em>PNG</em> format and save it as <em>splash.png</em>. I'll
include my whole <em>syslinux.cfg</em> for reference, but the
important bits for the theme are menu and graphics sections. I didn't
bother to tweak the ANSI settings as I don't intend to use them, so I
copied them from
the <a href="http://projects.archlinux.org/svntogit/packages.git/tree/syslinux/repos/core-i686/">Arch
Linux menu</a>. Settings below will give you a pretty much identical
look and feel (shadows could use a bit more work), and also provide a
nice bonus over LILO when editing the boot options (by
pressing <strong>Tab</strong>, as in LILO):

<pre>
#
# /boot/syslinux/syslinux.cfg
#
# General settings
UI vesamenu.c32
DEFAULT linux
PROMPT 0
TIMEOUT 250

# Menu settings
MENU WIDTH 28
MENU MARGIN 4
MENU ROWS 3
MENU VSHIFT 16
MENU HSHIFT 11
MENU TIMEOUTROW 13
MENU TABMSGROW 11
MENU CMDLINEROW 11
MENU HELPMSGROW 16
MENU HELPMSGENDROW 29

# Graphical boot menu
#
# Fingerprint menu
#  http://kde-look.org/content/show.php/Fingerprint+Lilo-splash?content=29675
MENU BACKGROUND splash.png
#
#          element      ansi    f/ground  b/ground  shadow
MENU COLOR sel          7;37;40 #ffffffff #90000000 std
MENU COLOR unsel        37;44   #ff000000 #80000000 std
MENU COLOR timeout_msg  37;40   #00000000 #00000000 none
MENU COLOR timeout      1;37;40 #00000000 #00000000 none
MENU COLOR border       30;44   #00000000 #00000000 none
MENU COLOR title        1;36;44 #00000000 #00000000 none
MENU COLOR help         37;40   #00000000 #00000000 none
MENU COLOR msg07        37;40   #00000000 #00000000 none
MENU COLOR tabmsg       31;40   #00000000 #00000000 none

# Boot menu settings
LABEL linux
        MENU LABEL GNU/Linux
        LINUX ../vmlinuz26
        APPEND root=/dev/sda2 ro rootflags=data=ordered i915.modeset=1 video=VGA-1:1152x864 drm_kms_helper.poll=0
        INITRD ../kernel26.img

LABEL recovery
        MENU LABEL Recovery
        LINUX ../vmlinuz26
        APPEND root=/dev/sda2 ro rootflags=data=ordered
        INITRD ../kernel26-fallback.img
</pre>

You can find the documentation, and menu options explained on
the <a href="http://syslinux.zytor.com/wiki/index.php/Doc/menu">syslinux
wiki</a>. If you achieve an even more faithful copy send me an e-mail
with the new values. Thank you.

</p>]]></description>

</item>
</channel>
</rss>
