<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Linux on Logan's Nest</title><link>https://blog.han.life/tags/linux/</link><description>Recent content in Linux on Logan's Nest</description><generator>Hugo</generator><language>en-au</language><lastBuildDate>Fri, 14 Mar 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.han.life/tags/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>WireGuard Setup</title><link>https://blog.han.life/posts/2025/2025-03-14-wireguard-setup/</link><pubDate>Fri, 14 Mar 2025 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2025/2025-03-14-wireguard-setup/</guid><description>&lt;p&gt;I spent some time figuring out how WireGuard works and found the guidelines, including the official ones, to be rather complex. So, I&amp;rsquo;m jotting down my learnings here.&lt;/p&gt;&#10;&lt;p&gt;If you can&amp;rsquo;t be bothered with all the key and config files, &lt;a href="https://www.wireguardconfig.com/"&gt;https://www.wireguardconfig.com/&lt;/a&gt; provides one click setup for that with QR code.&lt;/p&gt;</description></item><item><title>Extract TLD from string by bash</title><link>https://blog.han.life/posts/2021/2021-06-25-extract-tld-by-bash/</link><pubDate>Fri, 25 Jun 2021 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2021/2021-06-25-extract-tld-by-bash/</guid><description>&lt;p&gt;Faced this interesting use case when I need to extract TLD from the provided hostname string.&lt;/p&gt;&#10;&lt;p&gt;Realised simply slicing two bits from the last won&amp;rsquo;t cut when the hostname comes with mixed &lt;code&gt;.com&lt;/code&gt; and &lt;code&gt;.co.uk&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Amazon SES with Postfix in Ubuntu</title><link>https://blog.han.life/posts/2020/2020-05-15-amazon-ses-with-postfix-in-ubuntu/</link><pubDate>Fri, 15 May 2020 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2020/2020-05-15-amazon-ses-with-postfix-in-ubuntu/</guid><description>&lt;p&gt;Was looking at &lt;a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/postfix.html"&gt;https://docs.aws.amazon.com/ses/latest/DeveloperGuide/postfix.html&lt;/a&gt; but it&amp;rsquo;s not really working as it&amp;rsquo;s missing some key commands.&lt;/p&gt;&#10;&lt;p&gt;Install packages &lt;code&gt;apt install -y postfix libsasl2-modules\&lt;/code&gt; select &amp;rsquo;no configuration'&lt;/p&gt;&#10;&lt;p&gt;Config files&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;in &lt;code&gt;/etc/postfix/main.cf&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Lets Encrypt nginx SSL certificate renewal via cron</title><link>https://blog.han.life/posts/2015/2015-11-18-lets-encrypt-certificate-renewal-via-cron/</link><pubDate>Wed, 18 Nov 2015 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2015/2015-11-18-lets-encrypt-certificate-renewal-via-cron/</guid><description>&lt;p&gt;Add below as a cron entry.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/path/letsencrypt/letsencrypt-auto --server https://acme-v01.api.letsencrypt.org/directory --renew-by-default -a webroot --webroot-path /webroot/ --email youremail --text --agree-tos --agree-dev-preview -d 7979.us -d www.7979.us auth&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/etc/init.d/nginx reload&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Then configure nginx SSL like below.&lt;/p&gt;</description></item><item><title>rpmlib(FileDigests) / rpmlib(PayloadIsXz) is needed</title><link>https://blog.han.life/posts/2015/2015-05-06-rpmlibfiledigests-rpmlibpayloadisxz-is-needed/</link><pubDate>Wed, 06 May 2015 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2015/2015-05-06-rpmlibfiledigests-rpmlibpayloadisxz-is-needed/</guid><description>&lt;p&gt;This means you are attemping to install a RPM created in CentOS6+ from CentOS5.&lt;/p&gt;&#10;&lt;p&gt;For backward compatibility, rebuild rpm like: &lt;code&gt;rpmrebuild -e -p xyz.rpm&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;Then add below: &lt;code&gt;%define _binary_filedigest_algorithm 1 %define _binary_payload w9.gzdio&lt;/code&gt;&lt;/p&gt;</description></item><item><title>gnu parallel</title><link>https://blog.han.life/posts/2015/2015-04-29-gnu-parallel/</link><pubDate>Wed, 29 Apr 2015 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2015/2015-04-29-gnu-parallel/</guid><description>&lt;p&gt;So I was testing this today and this is the message I saw when I ran it:&lt;/p&gt;&#10;&lt;p&gt;`Academic tradition requires you to cite works you base your article on. When using programs that use GNU Parallel to process data for publication please cite:&lt;/p&gt;</description></item><item><title>Disable msi with minimal interruption</title><link>https://blog.han.life/posts/2013/2013-10-14-disable-msi-minimal-interruption/</link><pubDate>Mon, 14 Oct 2013 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2013/2013-10-14-disable-msi-minimal-interruption/</guid><description>&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ifconfig eth0 down&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rmmod bnx2&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;modprobe bnx2 disable_msi=1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ifconfig eth0 up&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;route add -net default netmask 0.0.0.0 gw [default gw here] eth0&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;For bonding interface:&lt;/p&gt;</description></item><item><title>3TB partition support in Linux</title><link>https://blog.han.life/posts/2012/2012-07-31-3tb-partition-support-in-linux/</link><pubDate>Tue, 31 Jul 2012 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2012/2012-07-31-3tb-partition-support-in-linux/</guid><description>&lt;p&gt;Make a GPT partition:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;parted /dev/sda&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mklabel gpt&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;unit TB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkpart primary &lt;span class="m"&gt;0&lt;/span&gt; -0&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;quit&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Format with 1% root reservation:&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;mkfs.ext4 -m1 /dev/sda1&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;Note: HP Array controller may require firmware update for 3TB disk support.&lt;/p&gt;</description></item><item><title>How to increase VM disk size without re-deploy the machine</title><link>https://blog.han.life/posts/2012/2012-07-13-how-to-increase-vm-disk-size-without-re-deploy-the-machine/</link><pubDate>Fri, 13 Jul 2012 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2012/2012-07-13-how-to-increase-vm-disk-size-without-re-deploy-the-machine/</guid><description>&lt;p&gt;Ref: &lt;a href="http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&amp;amp;docType=kc&amp;amp;docTypeID=DT"&gt;http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&amp;amp;docType=kc&amp;amp;docTypeID=DT&lt;/a&gt;_KB_1_1&amp;amp;externalId=1006371&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;[root@demo ~]# fdisk /dev/sda&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;-Create a primary partition-&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 2&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 3&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 4&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 5&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 6&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 7&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 8&#10;&lt;/span&gt;&lt;span class="lnt"&gt; 9&#10;&lt;/span&gt;&lt;span class="lnt"&gt;10&#10;&lt;/span&gt;&lt;span class="lnt"&gt;11&#10;&lt;/span&gt;&lt;span class="lnt"&gt;12&#10;&lt;/span&gt;&lt;span class="lnt"&gt;13&#10;&lt;/span&gt;&lt;span class="lnt"&gt;14&#10;&lt;/span&gt;&lt;span class="lnt"&gt;15&#10;&lt;/span&gt;&lt;span class="lnt"&gt;16&#10;&lt;/span&gt;&lt;span class="lnt"&gt;17&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@demo ~&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="c1"&gt;# fdisk -l&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Device Boot Start End Blocks Id System&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/dev/sda1 * &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="m"&gt;64&lt;/span&gt; &lt;span class="m"&gt;512000&lt;/span&gt; &lt;span class="m"&gt;83&lt;/span&gt; Linux&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Partition &lt;span class="m"&gt;1&lt;/span&gt; does not end on cylinder boundary.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/dev/sda2 &lt;span class="m"&gt;64&lt;/span&gt; &lt;span class="m"&gt;1306&lt;/span&gt; &lt;span class="m"&gt;9972736&lt;/span&gt; 8e Linux LVM&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/dev/sda3 &lt;span class="m"&gt;1306&lt;/span&gt; &lt;span class="m"&gt;6527&lt;/span&gt; 41942367+ &lt;span class="m"&gt;83&lt;/span&gt; Linux&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@demo ~&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="c1"&gt;# pvcreate /dev/sda3&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@demo ~&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="c1"&gt;# vgextend vg_demo /dev/sda3&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@demo ~&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="c1"&gt;# vgdisplay vg_demo | grep Free&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Free PE / Size &lt;span class="m"&gt;10239&lt;/span&gt; / 40.00 GiB&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@demo ~&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="c1"&gt;# lvextend -L+40.00G /dev/vg_demo/lv_root&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;root@demo ~&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="c1"&gt;# resize2fs /dev/vg_demo/lv_root&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Note: I wouldn&amp;rsquo;t do this for any production system as it looks pretty inefficient way to extend volume size.&lt;/p&gt;</description></item><item><title>Fix Hadoop leap second bug without rebooting</title><link>https://blog.han.life/posts/2012/2012-07-03-hadoop-leap-second-bug-without-rebooting/</link><pubDate>Tue, 03 Jul 2012 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2012/2012-07-03-hadoop-leap-second-bug-without-rebooting/</guid><description>&lt;p&gt;Source: http://blog.wpkg.org/2012/07/01/java-leap-second-bug-30-june-1-july-2012-fix/&lt;/p&gt;&#10;&lt;p&gt;Applied our hadoop node having CPU usage issue. (CentOS)&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;service ntpd stop&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;date &lt;span class="sb"&gt;`&lt;/span&gt;date +”%m%d%H%M%C%y.%S”&lt;span class="sb"&gt;`&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;service ntpd start&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;p&gt;Works like a charm!&lt;/p&gt;</description></item><item><title>Facebook scribe with hdfs</title><link>https://blog.han.life/posts/2012/2012-02-17-facebook-scribe-with-hdfs/</link><pubDate>Fri, 17 Feb 2012 00:00:00 +0000</pubDate><guid>https://blog.han.life/posts/2012/2012-02-17-facebook-scribe-with-hdfs/</guid><description>&lt;p&gt;packages:&lt;br&gt;&#10;libevent&lt;br&gt;&#10;hadoop-0.20-libhdfs&lt;br&gt;&#10;JDK for hdfs support&lt;/p&gt;&#10;&lt;p&gt;Boost&lt;br&gt;&#10;&lt;a href="http://sourceforge.net/projects/boost/"&gt;http://sourceforge.net/projects/boost/&lt;/a&gt;&lt;br&gt;&#10;./bootstrap.sh&lt;br&gt;&#10;./bjam&lt;br&gt;&#10;./bjam install&lt;/p&gt;&#10;&lt;p&gt;thrift&lt;br&gt;&#10;download form &lt;a href="http://thrift.apache.org/download/"&gt;http://thrift.apache.org/download/&lt;/a&gt;&lt;br&gt;&#10;./configure&lt;br&gt;&#10;make&lt;br&gt;&#10;make install&lt;/p&gt;&#10;&lt;p&gt;fb303&lt;br&gt;&#10;it&amp;rsquo;s in &lt;thrift source&gt;/contrib/fb303&lt;/p&gt;&#10;&lt;p&gt;./bootstrap.sh&lt;br&gt;&#10;./configure CPPFLAGS=&amp;quot;-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H&amp;quot;&lt;br&gt;&#10;(To avoid compile error, recompile thrift with this option if it doesn&amp;rsquo;t work)&lt;br&gt;&#10;make&lt;br&gt;&#10;make install&lt;/p&gt;</description></item></channel></rss>