<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>linux &amp;mdash; alan</title>
    <link>https://www.franzoni.eu/alan/tag:linux</link>
    <description>Alan&#39;s musings</description>
    <language>en</language>
    <pubDate>Tue, 17 Nov 2026 00:40:52 +0000</pubDate>
    <item>
      <title>chmod and the capital X</title>
      <link>https://www.franzoni.eu/alan/chmod-and-the-capital-x</link>
      <description>&lt;![CDATA[This is one very, very, very interesting piece of ancient wisdom.&#xA;&#xA;Suppose you need to change permissions for some directories. Maybe the permissions are too strict, e.g. something like 700 for directories and 600 for files, and you need to give access to some other group and not just the owner.&#xA;&#xA;As you know, execute permission on directories is required for traversal. So you might think doing something like:&#xA;&#xA;chmod -R g+rx /var/somedirectory&#xA;&#xA;This would probably work, but would leave you in a sad state: you&#39;ll get the executable bit set on files that are not supposed to be executable at all, which may be just annoying but may get risky as well.&#xA;&#xA;A great alternative is:&#xA;&#xA;chmod -R g+rX /var/somedirectory&#xA;&#xA;the capital X means: set the executable bit only if the target a) is a directory b) has already at least one executable bit set for any one of user, group, others.&#xA;&#xA;There&#39;s another alternative that may be appealing in some situations, at least when you want to give the group the same permissions as the owner:&#xA;&#xA;chmod -R g=u /var/somedirectory&#xA;&#xA;This will give any file the group permissions identical to the user&#39;s permission.&#xA;&#xA;#MostlyUnixish #linux #ancientwisdom #chmod&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>This is one very, very, very interesting piece of ancient wisdom.</p>

<p>Suppose you need to change permissions for some directories. Maybe the permissions are too strict, e.g. something like 700 for directories and 600 for files, and you need to give access to some other group and not just the owner.</p>

<p>As you know, execute permission on directories is required for traversal. So you might think doing something like:</p>

<pre><code class="language-bash">chmod -R g+rx /var/somedirectory
</code></pre>

<p>This would probably work, but would leave you in a sad state: you&#39;ll get the executable bit set on files that are not supposed to be executable at all, which may be just annoying but may get risky as well.</p>

<p>A great alternative is:</p>

<pre><code class="language-bash">chmod -R g+rX /var/somedirectory
</code></pre>

<p>the capital X means: <em>set the executable bit only if the target a) is a directory b) has already at least one executable bit set for any one of user, group, others</em>.</p>

<p>There&#39;s another alternative that may be appealing in some situations, at least when you want to give the group the same permissions as the owner:</p>

<pre><code class="language-bash">chmod -R g=u /var/somedirectory
</code></pre>

<p>This will give any file the group permissions identical to the user&#39;s permission.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:ancientwisdom" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ancientwisdom</span></a> <a href="/alan/tag:chmod" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">chmod</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/chmod-and-the-capital-x</guid>
      <pubDate>Tue, 27 Jan 2015 22:31:00 +0000</pubDate>
    </item>
    <item>
      <title>Kill Me Softly: killing a process The Right Way</title>
      <link>https://www.franzoni.eu/alan/kill-me-softly-killing-a-process-the-right-way</link>
      <description>&lt;![CDATA[I was tired of repeating the same old pattern. Send a kill signal. Check with pgrep. Did the process exit? Send a kill -9.&#xA;&#xA;Now all my knowledge has been permanently dumped here:&#xA;&#xA;Kill Me Softly on GitHub&#xA;&#xA;If you want to kill a process by letting it to exit gracefully, and yet kill it without mercy if it&#39;s too slow to exit, that&#39;s your new favourite shell script.&#xA;&#xA;You can discuss this on Hacker News as well&#xA;&#xA;#MostlyUnixish #linux #processmanagement #kill&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>I was tired of repeating the same old pattern. Send a kill signal. Check with pgrep. Did the process exit? Send a kill -9.</p>

<p>Now all my knowledge has been permanently dumped here:</p>

<p><a href="https://github.com/alanfranz/killmesoftly" rel="nofollow">Kill Me Softly on GitHub</a></p>

<p>If you want to kill a process by letting it to exit gracefully, and yet kill it without mercy if it&#39;s too slow to exit, that&#39;s your new favourite shell script.</p>

<p>You can discuss this on <a href="https://news.ycombinator.com/item?id=8758057" rel="nofollow">Hacker News</a> as well</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:processmanagement" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">processmanagement</span></a> <a href="/alan/tag:kill" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">kill</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/kill-me-softly-killing-a-process-the-right-way</guid>
      <pubDate>Tue, 16 Dec 2014 22:30:00 +0000</pubDate>
    </item>
    <item>
      <title>Unfreezing your desktop: when Compiz goes wrong</title>
      <link>https://www.franzoni.eu/alan/unfreezing-your-desktop-when-compiz-goes-wrong</link>
      <description>&lt;![CDATA[A desktop freeze is something that&#39;s not so rare nowadays - that&#39;s not good, but we shouldn&#39;t get desperate about that.&#xA;&#xA;I like Compiz with Unity Desktop on my Ubuntu Trusty very much; I feel it&#39;s a step forward compared to traditional desktops. The only major nuisance I had on the previous versions was the inability to disable the global menu (which I like by itself, but I don&#39;t like the global menu disappearing when the mouse is not over it), but you can now disable it and have the menu on the window - even though you can&#39;t still enable an always-visible behaviour.&#xA;&#xA;The problem is: compiz sometimes gets buggy. Running a different window manager, like metacity and/or xcompmgr just doesn&#39;t seem good, you can experience other issues and you&#39;re using the stack in a way it wasn&#39;t designed for. I don&#39;t like that approach.&#xA;&#xA;So, what can you do when your desktop freezes? The symptoms are usually very clear: you can move your mouse, but you can&#39;t click nor type anything.&#xA;&#xA;You don&#39;t need to reboot nor to restart X. You can fix this without losing your work.&#xA;&#xA;Get a raw tty&#xA;&#xA;Press Ctrl+Alt+F1 and get to a raw linux console, and login with your credentials. Make sure you use the same user you&#39;re logged into X with.&#xA;&#xA;Find and kill your stuck process&#xA;&#xA;pgrep compiz&#xA;&#xA;This will print the PID of our stuck window manager.&#xA;&#xA;Let&#39;s kill it&#xA;&#xA;pkill compiz&#xA;&#xA;This won&#39;t usually be enough because the process is really stuck: if you repeat the pgrep command above, you&#39;ll find it still running - i.e. pgrep will return the very same PID as above.&#xA;&#xA;So let&#39;s kill it, really this time!&#xA;&#xA;pkill -9 compiz&#xA;&#xA;Then wait some 15-20 seconds.&#xA;&#xA;Now, if you repeat the pgrep , you&#39;ll either see a) no result or b) a different PID.&#xA;&#xA;If you see a different PID, it&#39;s Ubuntu that noticed the crashed process and relaunched it; press Ctrl+Alt+F7, and you should just get back a working desktop!&#xA;&#xA;Relaunching&#xA;&#xA;If you see nothing with pgrep, you&#39;ll need to relaunch Compiz manually.&#xA;&#xA;You cannot simply relaunch compiz on the console, because it must connect to X: the proper way to do it is:&#xA;&#xA;DISPLAY=:0 compiz&#xA;&#xA;Now switch back to your X instance with Ctrl+Alt+F7 and enjoy!&#xA;&#xA;#MostlyUnixish #linux #ancientwisdom #community #ubuntu #compiz&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>A desktop freeze is something that&#39;s not so rare nowadays – that&#39;s not good, but we shouldn&#39;t get desperate about that.</p>

<p>I like <a href="http://www.compiz.org" rel="nofollow">Compiz</a> with <a href="https://unity.ubuntu.com/" rel="nofollow">Unity Desktop</a> on my <a href="https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes" rel="nofollow">Ubuntu Trusty</a> very much; <strong>I feel it&#39;s a step forward compared to traditional desktops</strong>. The only major nuisance I had on the previous versions was the inability to disable the global menu (which I like by itself, but I don&#39;t like the global menu disappearing when the mouse is not over it), but you can now disable it and have the menu on the window – even though you can&#39;t still enable an always-visible behaviour.</p>

<p>The problem is: compiz sometimes gets buggy. Running a different window manager, like <a href="https://help.ubuntu.com/community/Metacity" rel="nofollow">metacity</a> and/or <a href="http://cgit.freedesktop.org/xorg/app/xcompmgr/" rel="nofollow">xcompmgr</a> just doesn&#39;t seem good, you can experience other issues and you&#39;re using the stack in a way it wasn&#39;t designed for. I don&#39;t like that approach.</p>

<p>So, what can you do when your desktop freezes? The symptoms are usually very clear: you can move your mouse, but you can&#39;t click nor type anything.</p>

<p><strong>You don&#39;t need to reboot nor to restart X.</strong> You can fix this without losing your work.</p>

<h2 id="get-a-raw-tty">Get a raw tty</h2>

<p>Press <em>Ctrl+Alt+F1</em> and get to a raw linux console, and login with your credentials. Make sure you use the same user you&#39;re logged into X with.</p>

<h2 id="find-and-kill-your-stuck-process">Find and kill your stuck process</h2>

<pre><code>pgrep compiz
</code></pre>

<p>This will print the PID of our stuck window manager.</p>

<p>Let&#39;s kill it</p>

<pre><code>pkill compiz
</code></pre>

<p>This <strong>won&#39;t usually be enough</strong> because the process is really stuck: if you repeat the <em>pgrep</em> command above, you&#39;ll find it still running – i.e. pgrep will return the very same PID as above.</p>

<p>So let&#39;s kill it, really this time!</p>

<pre><code>pkill -9 compiz
</code></pre>

<p>Then wait some 15-20 seconds.</p>

<p>Now, if you repeat the <em>pgrep</em> , you&#39;ll either see a) no result or b) a different PID.</p>

<p>If you see a different PID, it&#39;s Ubuntu that noticed the crashed process and relaunched it; press <em>Ctrl+Alt+F7</em>, and you should just get back a working desktop!</p>

<h2 id="relaunching">Relaunching</h2>

<p>If you see nothing with pgrep, you&#39;ll need to relaunch Compiz manually.</p>

<p>You cannot simply relaunch compiz on the console, because it must connect to X: the proper way to do it is:</p>

<pre><code>DISPLAY=:0 compiz
</code></pre>

<p>Now switch back to your X instance with <em>Ctrl+Alt+F7</em> and enjoy!</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:ancientwisdom" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ancientwisdom</span></a> <a href="/alan/tag:community" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">community</span></a> <a href="/alan/tag:ubuntu" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ubuntu</span></a> <a href="/alan/tag:compiz" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">compiz</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/unfreezing-your-desktop-when-compiz-goes-wrong</guid>
      <pubDate>Fri, 12 Dec 2014 22:28:00 +0000</pubDate>
    </item>
    <item>
      <title>Don&#39;t give a shell to system users - use su</title>
      <link>https://www.franzoni.eu/alan/dont-give-a-shell-to-system-users-use-su</link>
      <description>&lt;![CDATA[I seem very ancientwisdom-oriented these days.&#xA;&#xA;Sometimes you&#39;ve got a system user on your linux server that&#39;s used to run a specific service; it&#39;s a good practice to employ those users to achieve privilege separation, since it limits the impact of many security breaches. It&#39;s security 101, really.&#xA;&#xA;If you&#39;ve got a system user, most probably its shell would be /bin/false or /bin/nologin. Again, this is a good practice, since it would be harder for an attacker to gain shell access to your machine through that user.&#xA;&#xA;But I find that many people just change such shell, because sometimes they need to customize the environment for a user, and if you try doing something like&#xA;&#xA;su - systemuser&#xA;&#xA;you&#39;ll find yourself just back to your original shell, because su tries to invoke the shell which is set for the target user, and sudo doesn&#39;t generally help here, because its --shell option doesn&#39;t start a proper login shell for that user (most of the environment is that of the calling user).&#xA;&#xA;Very well, gentlemen: this is a wrongdoing and a potential security hole. You should never enable a shell for your system users. Instead, you should leverage an option of su:&#xA;&#xA;su - systemuser --shell /bin/bash&#xA;&#xA;That lets you choose your favourite shell on a per-launch basis.&#xA;&#xA;#MostlyUnixish #linux #ancientwisdom #su #security&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>I seem very ancientwisdom-oriented these days.</p>

<p>Sometimes you&#39;ve got a system user on your linux server that&#39;s used to run a specific service; it&#39;s a good practice to employ those users to achieve <a href="http://en.wikipedia.org/wiki/Privilege_separation" rel="nofollow">privilege separation</a>, since it limits the impact of many security breaches. It&#39;s security 101, really.</p>

<p>If you&#39;ve got a system user, most probably its shell would be <code>/bin/false</code> or <code>/bin/nologin</code>. Again, this is a good practice, since it would be harder for an attacker to gain shell access to your machine through that user.</p>

<p>But I find that many people just <strong>change</strong> such shell, because sometimes they need to customize the environment for a user, and if you try doing something like</p>

<pre><code>su - systemuser
</code></pre>

<p>you&#39;ll find yourself just back to your original shell, because <strong>su</strong> tries to invoke the shell which is set for the target user, and <code>sudo</code> doesn&#39;t generally help here, because its <code>--shell</code> option doesn&#39;t start a proper login shell for that user (most of the environment is that of the calling user).</p>

<p>Very well, gentlemen: <strong>this is a wrongdoing and a potential security hole</strong>. You should <strong>never</strong> enable a shell for your system users. Instead, you should leverage an option of <strong>su</strong>:</p>

<pre><code>su - systemuser --shell /bin/bash
</code></pre>

<p>That lets you choose your favourite shell on a per-launch basis.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:ancientwisdom" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ancientwisdom</span></a> <a href="/alan/tag:su" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">su</span></a> <a href="/alan/tag:security" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">security</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/dont-give-a-shell-to-system-users-use-su</guid>
      <pubDate>Thu, 11 Dec 2014 22:25:00 +0000</pubDate>
    </item>
    <item>
      <title>SSH hostnames configuration and shortcuts</title>
      <link>https://www.franzoni.eu/alan/ssh-hostnames-configuration-and-shortcuts</link>
      <description>&lt;![CDATA[This is another old trick, but I like to tell the world about such amenities.&#xA;&#xA;I often find people writing command lines such as:&#xA;&#xA;ssh arcane-system-user@someextremelylong.andimpossibiletotype.anderrorprone.hostname.com&#xA;&#xA;or, worse&#xA;&#xA;ssh idliketorememberwhichuser@10.20.30.40&#xA;&#xA;or maybe it was&#xA;&#xA;ssh someuserimashamedof@1.2.3.4&#xA;&#xA;yes, sometimes ssh is simply tedious.&#xA;&#xA;But you can do better. In fact, you can do much better.&#xA;&#xA;your ~/.ssh/config or /etc/ssh/ssh\_config can contain Host configuration sections; I have already blogged about such directives when I told the world about stopping key verification compliants - they&#39;re very flexible, indeed.&#xA;&#xA;Consider adding Host directives in your configuration for your most used services:&#xA;&#xA;Host myniceserver&#xA;    Hostname myniceserver.mylove.com&#xA;    Port 12345&#xA;    User teddybear&#xA;&#xA;And then you can just&#xA;&#xA;ssh myniceserver&#xA;&#xA;You can override most options on a per-server basis and/or select a certain private key for connections.&#xA;&#xA;#MostlyUnixish #linux #ssh #ancientwisdom&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>This is another old trick, but I like to tell the world about such amenities.</p>

<p>I often find people writing command lines such as:</p>

<pre><code>ssh arcane-system-user@someextremelylong.andimpossibiletotype.anderrorprone.hostname.com
</code></pre>

<p>or, worse</p>

<pre><code>ssh idliketorememberwhichuser@10.20.30.40
</code></pre>

<p>or maybe it was</p>

<pre><code>ssh someuserimashamedof@1.2.3.4
</code></pre>

<p>yes, sometimes ssh is simply tedious.</p>

<p>But you can do better. In fact, you can do <strong>much</strong> better.</p>

<p>your <em>~/.ssh/config</em> or <em>/etc/ssh/ssh_config</em> can contain <strong>Host</strong> configuration sections; I have already blogged about such directives when I told the world about stopping <a href="/alan/ssh-client-stopping-key-verification-complaints-inside-your-own-private-network" rel="nofollow">key verification compliants</a> – they&#39;re very flexible, indeed.</p>

<p>Consider adding <strong>Host</strong> directives in your configuration for your most used services:</p>

<pre><code>Host myniceserver
    Hostname myniceserver.mylove.com
    Port 12345
    User teddybear
</code></pre>

<p>And then you can just</p>

<pre><code>ssh myniceserver
</code></pre>

<p>You can override most options on a per-server basis and/or select a certain private key for connections.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:ssh" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ssh</span></a> <a href="/alan/tag:ancientwisdom" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ancientwisdom</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/ssh-hostnames-configuration-and-shortcuts</guid>
      <pubDate>Wed, 10 Dec 2014 22:24:00 +0000</pubDate>
    </item>
    <item>
      <title>I wish sudo would ask for my password less often</title>
      <link>https://www.franzoni.eu/alan/i-wish-sudo-would-ask-for-my-password-less-often</link>
      <description>&lt;![CDATA[This is a very old trick, but I find many people doesn&#39;t know about it yet.&#xA;&#xA;If you&#39;re using sudo (and you definitely should), one minor complaint is that you need to re-enter your password quite often.&#xA;&#xA;One common pseudo-solution is to completely disable the password for executing sudo with such user; while it may be a good idea sometimes, it does decrease the overall security - if you happen to forget an open shell or screen/tmux lingering somewhere, you give total power to whoever gets in touch with it.&#xA;&#xA;If you happen to let people into your sudo-enabled account with your ssh key, anybody that can get hold of your ssh key will get root access to your servers. It&#39;s not the best possible scenario.&#xA;&#xA;There&#39;s a very simply workaround: just edit your sudoers file!&#xA;&#xA;sudo visudo&#xA;&#xA;and add a line like that (or modify it if it&#39;s already there)&#xA;&#xA;Defaults    timestamp_timeout=120&#xA;&#xA;This means that sudo will ask for a password every two hours instead of the default (15 minutes on most installations). You can use -1 in order to never let it expire (I don&#39;t suggest that - 8-10 hours should be enough for everybody.)&#xA;&#xA;The only drawback is that such timeout is per shell, not system-wide - i.e. if you open multiple terminals, you&#39;ll have to enter the password again for each new terminal instance.&#xA;&#xA;#MostlyUnixish #linux #sudo&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>This is a <strong>very</strong> old trick, but I find many people doesn&#39;t know about it yet.</p>

<p>If you&#39;re using sudo <a href="https://help.ubuntu.com/community/RootSudo" rel="nofollow">(and you definitely should)</a>, one minor complaint is that you need to re-enter your password quite often.</p>

<p>One common pseudo-solution is to completely disable the password for executing sudo with such user; while it may be a good idea sometimes, it does decrease the overall security – if you happen to forget an open shell or screen/tmux lingering somewhere, you give total power to whoever gets in touch with it.</p>

<p>If you happen to let people into your sudo-enabled account with your ssh key, anybody that can get hold of your ssh key will get <strong>root access</strong> to your servers. It&#39;s not the best possible scenario.</p>

<p>There&#39;s a very simply workaround: just edit your sudoers file!</p>

<pre><code>sudo visudo
</code></pre>

<p>and add a line like that (or modify it if it&#39;s already there)</p>

<pre><code>Defaults    timestamp_timeout=120
</code></pre>

<p>This means that sudo will ask for a password every two hours instead of the default (15 minutes on most installations). You can use -1 in order to never let it expire (I don&#39;t suggest that – 8-10 hours should be enough for everybody.)</p>

<p>The only drawback is that such timeout is per shell, not system-wide – i.e. if you open multiple terminals, you&#39;ll have to enter the password again for each new terminal instance.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:sudo" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">sudo</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/i-wish-sudo-would-ask-for-my-password-less-often</guid>
      <pubDate>Tue, 11 Nov 2014 22:11:00 +0000</pubDate>
    </item>
    <item>
      <title>Ubuntu: faster release upgrade</title>
      <link>https://www.franzoni.eu/alan/ubuntu-faster-release-upgrade</link>
      <description>&lt;![CDATA[It might be high time to update to the latest Ubuntu 14.04.&#xA;&#xA;I think that the upgrade process that is provided by Canonical is slightly underoptimal: if you&#39;re using a&#xA;local mirror which can provide a very fast download of all packages, they&#39;ll usually be disabled during the upgrade process, and an official mirror (possibile one very far away) will be employed.&#xA;&#xA;This can lead to a very slow and painful upgrade process.&#xA;&#xA;The solution is easy.&#xA;&#xA;The following instructions regard moving from 12.04 (precise) to 14.04 (trusty)&#xA;&#xA;Switch your sources&#xA;&#xA;Assuming that your official ubuntu sources are configured from /etc/apt/sources.list just do something like:&#xA;&#xA;sudo sed -i.old -e &#39;s/precise/trusty/g&#39; /etc/apt/sources.list&#xA;&#xA;I&#39;m not considering other sources in /etc/apt/sources.list.d, since they&#39;ll be disabled whatsoever; but if you happen&#xA;to have ubuntu sources there as well, you should repeat the SEDding process for each file.&#xA;&#xA;Update your index&#xA;&#xA;sudo apt-get update&#xA;&#xA;Download updated packages without installing&#xA;&#xA;sudo apt-get dist-upgrade --download-only&#xA;&#xA;Revert to old sources&#xA;&#xA;sudo mv -f /etc/apt/sources.list.old /etc/apt/sources.list&#xA;&#xA;Update index again&#xA;&#xA;sudo apt-get update&#xA;&#xA;Rejoice!&#xA;&#xA;Now you can just follow the upgrade instructions and&#xA;almost nothing will be downloaded during the upgrade, because everything is already on your hard drive.&#xA;&#xA;#MostlyUnixish #ubuntu #linux #upgrade&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>It might be high time to update to the latest <a href="https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes" rel="nofollow">Ubuntu 14.04</a>.</p>

<p>I think that the upgrade process that is provided by Canonical is slightly underoptimal: if you&#39;re using a
local mirror which can provide a very fast download of all packages, they&#39;ll usually be disabled during the upgrade process, and an official mirror (possibile one very far away) will be employed.</p>

<p>This can lead to a very slow and painful upgrade process.</p>

<p>The solution is easy.</p>

<p>The following instructions regard moving from 12.04 (precise) to 14.04 (trusty)</p>

<h2 id="switch-your-sources">Switch your sources</h2>

<p>Assuming that your official ubuntu sources are configured from <code>/etc/apt/sources.list</code> just do something like:</p>

<pre><code>sudo sed -i.old -e &#39;s/precise/trusty/g&#39; /etc/apt/sources.list
</code></pre>

<p>I&#39;m not considering other sources in <code>/etc/apt/sources.list.d</code>, since they&#39;ll be disabled whatsoever; but if you happen
to have ubuntu sources there as well, you should repeat the SEDding process for each file.</p>

<h2 id="update-your-index">Update your index</h2>

<pre><code>sudo apt-get update
</code></pre>

<h2 id="download-updated-packages-without-installing">Download updated packages without installing</h2>

<pre><code>sudo apt-get dist-upgrade --download-only
</code></pre>

<h2 id="revert-to-old-sources">Revert to old sources</h2>

<pre><code>sudo mv -f /etc/apt/sources.list.old /etc/apt/sources.list
</code></pre>

<h2 id="update-index-again">Update index again</h2>

<pre><code>sudo apt-get update
</code></pre>

<h2 id="rejoice">Rejoice!</h2>

<p>Now you can just follow the <a href="https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes#Upgrading_from_Ubuntu_12.04_LTS_or_Ubuntu_13.10" rel="nofollow">upgrade instructions</a> and
almost nothing will be downloaded during the upgrade, because everything is already on your hard drive.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:ubuntu" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ubuntu</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:upgrade" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">upgrade</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/ubuntu-faster-release-upgrade</guid>
      <pubDate>Thu, 25 Sep 2014 21:04:00 +0000</pubDate>
    </item>
    <item>
      <title>apt-get update: fixing &#39;package index files are corrupted&#39;</title>
      <link>https://www.franzoni.eu/alan/apt-get-update-fixing-package-index-files-are-corrupted</link>
      <description>&lt;![CDATA[Sometimes when performing your daily apt-get update, you&#39;ll experience messages like&#xA;&#xA;blockquote&#xA;E: The package lists or status file could not be parsed or opened.&#xA;/blockquote&#xA;&#xA;or&#xA;&#xA;blockquote&#xA;The package index files are corrupted&#xA;/blockquote&#xA;&#xA;Such messages usually don&#39;t go away for quite a long time, and may prevent legitimate updates from installing.&#xA;&#xA;This usually happens even more frequently if using a proxy to access apt archives.&#xA;&#xA;While I don&#39;t know what&#39;s the root problem, I&#39;ve got a quick workaround that seems to fix the immediate error:&#xA;&#xA;pre&#xA;sudo -s -H bash -c &#39;apt-get clean &amp;&amp; rm -f /var/lib/apt/lists/ ; rm -f /var/lib/apt/lists/partial/ &amp;&amp; apt-get clean &amp;&amp; apt-get update&#39;&#xA;/pre&#xA;&#xA;#MostlyUnixish #linux #ubuntu #debian #deb #apt&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Sometimes when performing your daily <code>apt-get update</code>, you&#39;ll experience messages like</p>

<blockquote>E: The package lists or status file could not be parsed or opened.
</blockquote>

<p>or</p>

<blockquote>The package index files are corrupted
</blockquote>

<p>Such messages usually don&#39;t go away for quite a long time, and may prevent legitimate updates from installing.</p>

<p>This usually happens even more frequently if using a proxy to access apt archives.</p>

<p>While I don&#39;t know what&#39;s the root problem, I&#39;ve got a quick workaround that seems to fix the immediate error:</p>

<pre>
sudo -s -H bash -c &#39;apt-get clean &amp;&amp; rm -f /var/lib/apt/lists/* ; rm -f /var/lib/apt/lists/partial/* &amp;&amp; apt-get clean &amp;&amp; apt-get update&#39;
</pre>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:ubuntu" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ubuntu</span></a> <a href="/alan/tag:debian" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">debian</span></a> <a href="/alan/tag:deb" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">deb</span></a> <a href="/alan/tag:apt" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">apt</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/apt-get-update-fixing-package-index-files-are-corrupted</guid>
      <pubDate>Wed, 06 Mar 2013 21:45:00 +0000</pubDate>
    </item>
    <item>
      <title>ssh client: stopping key verification complaints inside your own private network</title>
      <link>https://www.franzoni.eu/alan/ssh-client-stopping-key-verification-complaints-inside-your-own-private-network</link>
      <description>&lt;![CDATA[If you develop enough software, most probably you&#39;ll have a test/development network at your service.&#xA;&#xA;In such networks, which are usually handled through a virtualization infrastructure, machines come and go very quickly.&#xA;But ssh clients are usually unhappy about that:&#xA;&#xA;alan@melquiades:/etc/ssh$ ssh root@192.168.0.208&#xA;The authenticity of host &#39;192.168.0.208 (192.168.0.208)&#39; can&#39;t be established.&#xA;RSA key fingerprint is 31:4d:8b:97:c8:57:04:85:6a:1b:72:54:46:ab:04:bc.&#xA;Are you sure you want to continue connecting (yes/no)? yes&#xA;Warning: Permanently added &#39;192.168.0.208&#39; (RSA) to the list of known hosts.&#xA;root@192.168.0.208&#39;s password: &#xA;&#xA;The first time you connect, you&#39;re asked if the fingerprint is correct. The second time you&#39;ll just be allowed to connect:&#xA;&#xA;alan@melquiades:/etc/ssh$ ssh root@192.168.0.208&#xA;root@192.168.0.208&#39;s password: &#xA;&#xA;What then if the machine at such ip address changes, because it&#39;s rebuilt or modified and the ssh host key is not retained?&#xA;&#xA;alan@melquiades:/etc/ssh$ ssh root@192.168.0.208&#xA;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&#xA;@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&#xA;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&#xA;IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&#xA;Someone could be eavesdropping on you right now (man-in-the-middle attack)!&#xA;It is also possible that a host key has just been changed.&#xA;The fingerprint for the RSA key sent by the remote host is&#xA;7b:42:03:5f:5c:8d:5a:2b:6a:a4:1e:d6:0d:05:de:38.&#xA;Please contact your system administrator.&#xA;Add correct host key in /Users/alan/.ssh/knownhosts to get rid of this message.&#xA;Offending RSA key in /Users/alan/.ssh/knownhosts:111&#xA;  remove with: ssh-keygen -f &#34;/Users/alan/.ssh/knownhosts&#34; -R 192.168.0.208&#xA;RSA host key for 192.168.0.208 has changed and you have requested strict checking.&#xA;Host key verification failed.&#xA;&#xA;From the point of view of openssh this may be a serious security breach, and you should fear such message if it happens in the wild if you haven&#39;t touched a server -&#xA;a MitM attack is probably going on!&#xA;&#xA;What about your local network? ssh-keygen -R 192.168.0.208 will solve that, but you probably didn&#39;t need host key authentication since the beginning.&#xA;&#xA;So, just add this:&#xA;&#xA;Host 192.168.0.*&#xA;    CheckHostIP no&#xA;    UserKnownHostsFile /dev/null&#xA;    StrictHostKeyChecking no&#xA;&#xA;at the beginning of your /etc/ssh/sshconfig file, and feel good.&#xA;&#xA;Now, anytime you try connecting inside your network you&#39;ll be greeted by this:&#xA;&#xA;alan@melquiades:/etc/ssh$ ssh root@192.168.0.208&#xA;Warning: Permanently added &#39;192.168.0.208&#39; (RSA) to the list of known hosts.&#xA;root@192.168.0.208&#39;s password: &#xA;&#xA;No confirmations whatsoever.&#xA;&#xA;#MostlyUnixish #linux #ssh&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>If you develop enough software, most probably you&#39;ll have a test/development network at your service.</p>

<p>In such networks, which are usually handled through a virtualization infrastructure, machines come and go very quickly.
But ssh clients are usually unhappy about that:</p>

<pre><code>alan@melquiades:/etc/ssh$ ssh root@192.168.0.208
The authenticity of host &#39;192.168.0.208 (192.168.0.208)&#39; can&#39;t be established.
RSA key fingerprint is 31:4d:8b:97:c8:57:04:85:6a:1b:72:54:46:ab:04:bc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added &#39;192.168.0.208&#39; (RSA) to the list of known hosts.
root@192.168.0.208&#39;s password: 
</code></pre>

<p>The first time you connect, you&#39;re asked if the fingerprint is correct. The second time you&#39;ll just be allowed to connect:</p>

<pre><code>alan@melquiades:/etc/ssh$ ssh root@192.168.0.208
root@192.168.0.208&#39;s password: 
</code></pre>

<p>What then if the machine at such ip address changes, because it&#39;s rebuilt or modified and the ssh host key is not retained?</p>

<pre><code>alan@melquiades:/etc/ssh$ ssh root@192.168.0.208
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
7b:42:03:5f:5c:8d:5a:2b:6a:a4:1e:d6:0d:05:de:38.
Please contact your system administrator.
Add correct host key in /Users/alan/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/alan/.ssh/known_hosts:111
  remove with: ssh-keygen -f &#34;/Users/alan/.ssh/known_hosts&#34; -R 192.168.0.208
RSA host key for 192.168.0.208 has changed and you have requested strict checking.
Host key verification failed.
</code></pre>

<p>From the point of view of openssh this may be a serious security breach, and you should fear such message if it happens in the wild if you haven&#39;t touched a server -
a MitM attack is probably going on!</p>

<p>What about your local network? <code>ssh-keygen -R 192.168.0.208</code> will solve that, but you probably didn&#39;t need host key authentication since the beginning.</p>

<p>So, just add this:</p>

<pre><code>Host 192.168.0.*
    CheckHostIP no
    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
</code></pre>

<p>at the beginning of your <code>/etc/ssh/ssh_config</code> file, and feel good.</p>

<p>Now, anytime you try connecting inside your network you&#39;ll be greeted by this:</p>

<pre><code>alan@melquiades:/etc/ssh$ ssh root@192.168.0.208
Warning: Permanently added &#39;192.168.0.208&#39; (RSA) to the list of known hosts.
root@192.168.0.208&#39;s password: 
</code></pre>

<p>No confirmations whatsoever.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:ssh" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">ssh</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/ssh-client-stopping-key-verification-complaints-inside-your-own-private-network</guid>
      <pubDate>Sun, 26 Aug 2012 20:39:00 +0000</pubDate>
    </item>
    <item>
      <title>Thunderbird temporary directory</title>
      <link>https://www.franzoni.eu/alan/thunderbird-temporary-directory</link>
      <description>&lt;![CDATA[Whenever you use Thunderbird on Linux you may encounter one annoying behaviour.&#xA;&#xA;If you open a message which is got an attachment - you just need to open the message, not to save the attachment! - Thunderbird will place such attachment in our temporary directory, usually /tmp. You find the file there, and you think you used the Save as function to place it there, so you open it and you edit it.&#xA;&#xA;Then you close Thunderbird, and poof! It clears its temporary files and deletes your modified attachment, possibily containing a day&#39;s work.&#xA;&#xA;The workaround is simple: just use a launcher that changes Thunderbird TMP directory and use that to start Thunderbird!&#xA;&#xA;!/bin/bash -e&#xA;mkdir -p /tmp/thunderbird&#xA;TMP=/tmp/thunderbird /usr/bin/thunderbird &#34;$@&#34;&#xA;&#xA;You may need to adjust the original binary path, then you can put such script in your path before your /usr/bin directory and you&#39;re done.&#xA;&#xA;#MostlyUnixish #linux #thunderbird #temporary&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>Whenever you use Thunderbird on Linux you may encounter one annoying behaviour.</p>

<p>If you open a message which is got an attachment – you just need to open the message, not to save the attachment! – Thunderbird will place such attachment in our temporary directory, usually <em>/tmp</em>. You find the file there, and you think you used the <em>Save as</em> function to place it there, so you open it and you edit it.</p>

<p>Then you close Thunderbird, and poof! It clears its temporary files and deletes your modified attachment, possibily containing a day&#39;s work.</p>

<p>The workaround is simple: just use a launcher that changes Thunderbird TMP directory and use that to start Thunderbird!</p>

<pre><code class="language-bash">#!/bin/bash -e
mkdir -p /tmp/thunderbird
TMP=/tmp/thunderbird /usr/bin/thunderbird &#34;$@&#34;
</code></pre>

<p>You may need to adjust the original binary path, then you can put such script in your path before your /usr/bin directory and you&#39;re done.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:thunderbird" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">thunderbird</span></a> <a href="/alan/tag:temporary" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">temporary</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/thunderbird-temporary-directory</guid>
      <pubDate>Thu, 23 Aug 2012 20:37:00 +0000</pubDate>
    </item>
  </channel>
</rss>