<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>tag:blog.danieljanus.pl,2019:category:ubuntu</id>
  <title>Daniel Janus – Ubuntu</title>
  <link href="http://blog.danieljanus.pl/category/ubuntu/"/>
  <updated>2008-04-25T00:00:00Z</updated>
  <author>
    <name>Daniel Janus</name>
    <uri>http://danieljanus.pl</uri>
    <email>dj@danieljanus.pl</email>
  </author>
  <entry>
    <id>tag:blog.danieljanus.pl,2008-04-25:post:best-os-ever</id>
    <title>Best OS ever</title>
    <link href="http://blog.danieljanus.pl/best-os-ever/"/>
    <updated>2008-04-25T00:00:00Z</updated>
    <content type="html">&lt;div&gt;&lt;p&gt;If you are reading this on a box that does not have an impressive amount of RAM (say, 512 MB or less) and is running a fairly recent Linux, then for goodness sake, drop everything you are doing right now and follow the instructions in this entry. I’m going to show you how to make your system use the memory in a more efficient way, &lt;em&gt;yielding an effect almost equivalent to increasing its amount — with no expenses whatsoever!&lt;/em&gt; Sounds good? Read on.&lt;/p&gt;&lt;p&gt;You see, there’s this Linux kernel module for kernels 2.6.17 and up (that’s what the phrase fairly recent in the previous paragraph macroexpands to), called &lt;a href="http://code.google.com/p/compcache"&gt;Compcache&lt;/a&gt;. It works by slicing out a contiguous chunk of your RAM (25% by default, but it’s settable, of course) and setting it up as a swap space with highmost priority. The trick is that pages that are swapped out to this area are compressed using the &lt;a href="http://www.oberhumer.com/opensource/lzo/"&gt;LZO&lt;/a&gt; algorithm, which provides very fast compression/decompression while maintaining a decent compression ratio. In this way, more unused pages can fit in memory, and less of them are swapped out to disk, which can considerably cut down disk swap usage. I’ve enabled it in my system and it doesn’t seem to cause any problems, while providing a visible efficiency boost. Here’s how I did it on a freshly-installed &lt;a href="http://www.ubuntu.com/products/whatisubuntu/804features/"&gt;Ubuntu Hardy&lt;/a&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;I installed the Ubuntu package &lt;code&gt;build-essential&lt;/code&gt;, then downloaded Compcache from its site, extracted it, entered its directory and compiled it by saying make. So far, so easy.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Unfortunately, one cannot say &lt;code&gt;make install&lt;/code&gt; — creating a flexible cross-distro &lt;code&gt;install&lt;/code&gt; target is admittedly hard. So I installed it by hand, ensuring that my system enables it automatically on boot-up.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;I created a directory &lt;code&gt;/lib/modules/2.6.24-16-generic/ubuntu/compcache/&lt;/code&gt; and copied the four kernel modules (&lt;code&gt;compcache.ko&lt;/code&gt;, &lt;code&gt;lzo1x_compress.ko&lt;/code&gt;, &lt;code&gt;lzo1x_decompress.ko&lt;/code&gt;, and &lt;code&gt;tlsf.ko&lt;/code&gt;) created by the compilation to that directory.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Next, I ran &lt;code&gt;depmod -a&lt;/code&gt; to make the modules loadable by &lt;code&gt;modprobe&lt;/code&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;I edited the file &lt;code&gt;/etc/modules&lt;/code&gt; and added a line at the end, containing the single word &lt;code&gt;compcache&lt;/code&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;I copied the shell scripts &lt;code&gt;use_compcache.sh&lt;/code&gt; and &lt;code&gt;unuse_compcache.sh&lt;/code&gt; that come with compcache to &lt;code&gt;/usr/local/bin&lt;/code&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;I created an executable script &lt;code&gt;/etc/init.d/compcache&lt;/code&gt; with the following contents:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;&lt;code class="hljs bash"&gt;&lt;span class="hljs-meta"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="hljs-keyword"&gt;case&lt;/span&gt; &lt;span class="hljs-string"&gt;&amp;quot;&lt;span class="hljs-variable"&gt;$1&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span class="hljs-keyword"&gt;in&lt;/span&gt;
  start)
    /usr/local/bin/use_compcache.sh ;;
  stop)
    /usr/local/bin/unuse_compcache.sh ;;
&lt;span class="hljs-keyword"&gt;esac&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;The last step was to create a symlink &lt;code&gt;/etc/rc2.d/S02compcache&lt;/code&gt; pointing to that script.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I then rebooted the system and verified that the new swapspace is in use:&lt;/p&gt;&lt;pre&gt;&lt;code class="hljs bash"&gt;nathell@chamsin:~$ &lt;span class="hljs-built_in"&gt;cat&lt;/span&gt; /proc/swaps
Filename        Type        Size    Used    Priority
/dev/sdb2       partition   996020  0       -1
/dev/ramzswap0  partition   128896  111396  100
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With the final release of Hardy installed on my main box and compcache optimizing its memory usage, I do not hesitate to call this combo the best OS I have ever had installed.&lt;/p&gt;&lt;p&gt;And no, I don’t own a Mac. :-/&lt;/p&gt;&lt;/div&gt;</content>
  </entry>
  <entry>
    <id>tag:blog.danieljanus.pl,2008-04-07:post:ubuntu-postinstall</id>
    <title>Ubuntu post-installation tricks</title>
    <link href="http://blog.danieljanus.pl/ubuntu-postinstall/"/>
    <updated>2008-04-07T00:00:00Z</updated>
    <content type="html">&lt;div&gt;&lt;p&gt;Yesterday, my level of frustration with my old operating system at work exceeded a critical point, and I installed a fresh daily build of the not-yet-released &lt;a href="https://wiki.ubuntu.com/HardyHeron"&gt;Ubuntu 8.04&lt;/a&gt; in place of it. Then, in addition to usual post-installation chores like setting up mail, hardware, etc., I performed a couple of steps to make the system more pleasurable to use. Here’s what I did, just in case someone finds this useful.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;p&gt;First, I tweaked the font rendering. This was one area that has long been a PITA for Linux users (at least for me, since 2000 or so), but as far as Ubuntu is concerned, they introduced a change to Freetype somewhere along the way between Feisty and Gutsy which, when set up properly, makes the font rendering on LCD displays far superior for me to that of, say, Windows XP, in particular at small font sizes. The way to enable it is to enable sub-pixel rendering, and set the hinting level to “slight.” This results in a rendering very close to what the author of &lt;a href="http://www.antigrain.com/research/font_rasterization"&gt;Texts Rasterization Exposures&lt;/a&gt; managed to achieve.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;I installed the package &lt;code&gt;msttcorefonts&lt;/code&gt; to get Microsoft’s free-as-in-beer set of core TrueType fonts, including Times New Roman, Arial, Georgia, etc. There are very many sites out there on the Web that were designed with these fonts in mind, and this is one of the few areas Microsoft doesn’t completely suck at.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Next I enabled bitmap fonts. The way to do this is to become root, cd to &lt;code&gt;/etc/fonts/conf.d&lt;/code&gt;, remove the symlink named &lt;code&gt;70-no-bitmaps.conf&lt;/code&gt;, and make a symlink pointing to &lt;code&gt;/etc/fonts/conf.avail/70-yes-bitmaps.conf&lt;/code&gt; instead. This would come in handy in the next step.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Which was installing my favourite console font. Unfortunately, it doesn’t come preinstalled with the Gnome-based Ubuntu, but it was no big deal. The font is named console8x16 and it comes with Kubuntu’s (and KDE’s) default terminal emulator, Konsole. So I downloaded &lt;a href="http://packages.ubuntu.com/hardy/konsole"&gt;an appropriate package&lt;/a&gt; (manually, without the help of APT, because all I wanted was the font, not the package itself). I then installed Midnight Commander (which I use a lot, if only for its great vfs feature, which allows to access, inter alia, Debian/Ubuntu packages as if they were directories), grabbed the file &lt;code&gt;console8x16.pcf.gz&lt;/code&gt;, installed it in &lt;code&gt;/usr/share/fonts/X11/misc&lt;/code&gt;, changed to that directory, ran &lt;code&gt;mkfontdir&lt;/code&gt; and &lt;code&gt;mkfontscale&lt;/code&gt;, logged out and restarted the X server.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;The last step was to use this font for Emacs, too. So I installed Emacs, created the file &lt;code&gt;~/.Xdefaults&lt;/code&gt; containing the single line&lt;/p&gt;&lt;pre&gt;&lt;code&gt;Emacs*font: -misc-console-medium-r-normal--16-160-72-72-c-80-iso10646-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and ran &lt;code&gt;xrdb ~/.Xdefaults&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Then I got round to configuring Emacs itself. But that’s a story for another post.&lt;/p&gt;&lt;/div&gt;</content>
  </entry>
</feed>
