Wireguard Server-Client configuration

Setting up Wireguard based VPN is quite easy. Depending on your distribution you install kernel headers (as Wireguard is loaded kernel module), install Wireguard and configure it and you’re off to the races. With Linux kernel 5.6 Wireguard will be built in so this process will be even simpler. Installation Currently on my Ubuntu (18.04) based server, I had to do the following: apt-get update apt-get install linux-headers-$(uname -r) add-apt-repository ppa:wireguard/wireguard apt-get install wireguard Since that automatically built kernel module, loading it with:...

April 11, 2020 · 2 min · Ivan Tomica

Mounting NFS from Host machine inside VM on Fedora

For the past few weeks I’ve been trying to solve few particular set of problems which I won’t go into detail here, perhaps in another post. One of the challenges I’ve faced is how to export NFS from my ZFS pool on Fedora host machine and mount it within Ubuntu based VM. The whole process is quite simple and straight forward so here we go. In order to be able to use NFS at all we first need to install required components on the host machine:...

November 19, 2019 · 2 min · Ivan Tomica

PostgreSQL online VACUUM with pg_repack

Those familiar with PostgreSQL know how it internally manages blocks for storing data and how when you delete some entry it is only marked dead (dead tuples). In order to reclaim space VACUUM needs to be run. Vacuuming database won’t give that space back to the operating system, instead, it will just reclaim it for further use. If you specify VACUUM FULL in that case PostgreSQL will return free space back to the operating system, but running such action requires locking the tables which depending on the database size and the time it takes might not be optimal solution to run anytime....

June 9, 2019 · 1 min · Ivan Tomica

Reboot with kexec on Ubuntu 18.04

First off, what is kexec? - It is a system call that enables you to load and boot into another kernel from currently running kernel. That effectively means; doing reboot without going through the whole POST/Firmware load process. To use kexec we can rely on systemd to handle process for us. The only work we need to do is to install kexec-tools package and adjust some configs sudo apt-get update sudo apt-get install kexec-tools Since Ubuntu usually relies on booting from grub we can tweak some settings to default to loading default grub kernel when we run kexec....

March 16, 2019 · 2 min · Ivan Tomica

Remove EFI grub timeout

Ever since I’ve set up EFI boot on my machine using grub I had this issue with timeout option not wanting to go away. Digging into the issue I first looked at /boot/grub/grub.cfg where I found this piece of code: if [ $grub_platform = efi ]; then set timeout=30 if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu fi fi “This is weird” I said to myself, where does that come from?...

February 16, 2019 · 1 min · Ivan Tomica

Moving Ubuntu to Root-on-ZFS

My main rig is running Ubuntu 18.04. To be more precise I opted out at install time to use Ubuntu Mate 18.04 but later on installed AwesomeWM and use that instead now. But without digressing much, I decided it was time to move my root (/) to ZFS. Why? - Because it is awesome! ZFS is my favorite FS of choice for some time now. I don’t use it everywhere (am trying to be smart about it) but I prefer to do whenever I have the chance....

February 1, 2019 · 5 min · Ivan Tomica

Atlassian Confluence in Docker

Recently I’ve been tasked to set up Confluence server installation. One of my friends was in need and I decided it would be nice to play a bit with the whole setup. As this is pro-bono and really not quite production install (meaning they use it, but it is not so downtime critical) there was a place to experiment with it a bit thus I decided to run Confluence in a Docker....

January 29, 2019 · 2 min · Ivan Tomica

Fixing URxvt copy/paste

URxvt, or if you wish to call it rxvt-unicode, has this weird thing turned on by default where it binds ctrl+shift keys to all sorts of insanity (keycap picture insert mode and stuff like that). Dammit, I want my “normal” terminal behavior back! By “normal” I think that if I press: Ctrl + Shift + V -> paste contents of my main clipboard (from X) Ctrl + Shift + C -> copy current selection to clipboard So to restore that functionality here’s the magic thing you need in your ....

January 23, 2019 · 1 min · Ivan Tomica

Hide other users processes on Linux

By default proc is mounted in a way that allows inspection of other users processes by any account on the system. This can be a security risk if attacker gets hold of one of the accounts on the machine as it can freely inspect processes and gather information that it perhaps shouldn’t have. In order to restrict access we can add hidepid mount option to /etc/fstab: proc /proc proc defaults,hidepid=2 0 0 To re-mount current /proc you can use:...

April 22, 2018 · 1 min · Ivan Tomica

Using File Descriptors to calculate progress in Linux

ProcFS in Linux has many useful information about process and its status. In this particular case I’ll show you how to determine progress while copying the file with cp. Same principle can be used for many other situations as well; like importing MySQL dump or whatever you comes up on your mind :-) So in this situation I am copying the ~98GB file to another directory: cp -a /input/archive.tar.gz /output/ First, let’s find PID of this process....

April 21, 2018 · 2 min · Ivan Tomica