Resizing a btrfs parition

This is a simple note to myself, in case I need to re-do this again. How to resize a btrfs partition to maximum size (or full capacity)

  1. Resize the partition using parted
  2. Resize the btrfs filesystem using

    Would it make sense to create an alias, so that also btrfs filesystem resize 100% or other percentages would work?

In a nutshell example

Detailed example

First resize the partition (I use parted for that purpose)

Done.

Getting VeraCrypt running on a custom build Kernel

Having your own compiled Linux Kernel is a nice thing for various reasons. First, you are not stuck with the (depending on your distribution possibly outdated) Kernel versions your distribution and you highly customize your experience. Some people want to have a super-fast lightweight Kernel, I'm more on the other side of the spectrum. But that's a matter of flavor.

A side-effect is that you learn a lot more about Linux - inevitably issues will arise, from not working KVM (upcoming post) because of iptable issues to VeraCrypt that cannot operate with Kernel support.


Getting your custom Kernel ready for VeraCrypt

I've encountered the following error

device-mapper: reload ioctl on veracrypt1 failed: Invalid argument
Command failed

I've started with that. ioctl based errors normally are a good indicator that something in your Kernel configuration is or missing or misconfigured.
In this case it was the missing support for crypto targets in the device mapper (I suppose).

Fortunately the Gentoo-Forums provide some very useful informations. Make sure you have configured the following options in your Kernel

Device Drivers --->
[*] Multiple devices driver support (RAID and LVM) --->
<*> Device mapper support
<*> Crypt target support
[*] Block Devices --->
<*> Loopback device support
File systems --->
<*> FUSE (Filesystem in Userspace) support
[*] Cryptographic API --->
<*> RIPEMD-160 digest algorithm
<*> SHA384 and SHA512 digest algorithms
<*> Whirlpool digest algorithms
<*> LRW support
<*> XTS support
<*> AES cipher algorithms
<*> Serpent cipher algorithm
<*> Twofish cipher algorithm

Re-build your Kernel, and everything should work fine 🙂

Ubuntu - Building own Kernel

One of the reasons why I like Ubuntu is its simple usage. Most stuff works out-of-the-box or is configurable pretty easy. So it's also pretty easy to compile your own kernel.

The reason I wanted to build my own kernel were some issues with the amdgpu graphics card. Since Kernel 4.15 AMD has pushed it's recent open-source drivers upstream, so I wanted to give it a try.

In a nutshell

In principle you have to follow those simple steps

  1. MAKE SURE GRUB HAS A TIMEOUT so you can select an old kernel, in case something went wrong
  2. Download kernel sources from kernel.org
  3. Extract the sources into a directory and change into that directory
  4. Copy current configuration from /boot/config-uname -r to .config
  5. Check current configuration using make localmodconfig
  6. Compile using make [-j8]
  7. Install by using sudo make modules_install install

More details

For now I'm assuming we want to compile the current stable kernel, witch is 4.15.6

  1. Download kernel sources from kernel.org - I won't post a direct link to a kernel, because that will become outdated pretty soon!
  2. Extract the sources into a directory and change into that directory

I download the file and extract it with tar. For me it was like

In general it's save to hit the return key and just use the default values. But keep that in mind, if you run into problems you might have a more detailed look and the options

Now it's time to compile the kernel. Use -j4 to use 4 threads for building. I in general use up to 16, but that depends on your system. People report in general good results in taking a number between 1x and 2x the number of CPU cores you have. I have 8, so I choose 16, but that's up to you

Now watch the build process and grab a cup of coffee. That might take a while ....

If the build process completes, then run a simply a make modules_install and make install to install the new kernel

In Ubuntu this triggers a grub-update as well, so it should work the next time you boot into your system.

Nice 🙂

Ubuntu Linux - Map Wacom to one screen when using multiple screens

Quick Know-how post. How to limit a Wacom tablet in Ubuntu Linux to one screen, if you are having multiple displays.

Keywords: Wacom, Ubuntu, Linux, multiple screens, multiple displays


We need to gather system information with xrandr and xinput. First we use xrandr to determine the display, where the tablet should be active. Run xrandr

I want to have it on the primary display, witch is in my case DP-4.

Next we need to list the devices using xinput | grep -i Wacom

For me, it's id 12 to 15. No we map the Wacom tablet to DP-4

Done 🙂

Civilization Beyond Earth - Fix for Arch Linux

I love the Civilization series. One of my favourites is Beyond Earth, where luckily a Linux Version exists on Steam. Awesome! 🙂

Unfortunately under Arch Linux this doesn't work out of the box but needs some fixing. First of all you need to run steam-native, instead of steam. For debugging it's the best to run it in a terminal. If you start Civ Beyond Earth and end up with a similar error like

Then you need to install the lib32-intel-tbb lib from the AUR. I had to enable multilib and install gcc-multilib, but then it build and I could finally start Civilization Beyond Earth.

Civilization Beyond Earth - In game (just at the beginning)

Another victory for the good cause! 🙂

OCaml interpreter - Adding history support

I need to learn OCaml for one of my computer science courses. Although I am more the procedural programmer type, I like some of the concepts of functional languages and am also using them on a daily basis.

Some of the concepts are quite handy and nice - list comprehension, filter and lambda functions. They can help you keep your code clean and state-less.

Although I like Haskell a lot, i dislike OCaml for several reasons. One of them is that the interpreter doesn't support curses-like history. Unless you use the very nice rlwrap tool (in Linux)

And finally you can scroll back up to your mistyped command.

Privilege escalation bug in Linux Kernel

... and how to deal with it right:

Bug filed and fixed on February 17, patches are already in circulation. Exploit will be made available in some days to allow the administrators to update.

The fix was just a two-liner but still: Fixed-on-the-same-day-as-filed. That's how it should work 🙂

And in the Windows world we still have unpatched Zero-day exploits, after three months of responsible disclosure. THREE MONTHS!! STILL UNPATCHED!!

Shared memory C++ class - Standalone

Since  needed it for one of my research projects, I have created an offspin of the SharedMemory class in my FlexLib2 library.

The created SharedMemory class supports the creation of SharedMemory segments in the OpenMPI context. In the end you will have a shared memory segment on every machine, where the program is executed.

Shared memory example
Shared memory example

An example code is included. It compiles on gcc 4.8.4 on Ubuntu 14.04 with C++98 and C++11 Standart.

It includes a Makefile and an example program. Checkout the README file for details. And: Have fun 🙂

[Link to the source]

 

If you need some more info about how to deal with POSIX shared memory on a Linux system, I can recommend this following article.

Cool Linux Terminal: cool-retro-term

CoolRetroTerminal
Fallout-Like Terminal makes your work more fun 🙂

Having a boring task in the terminal to do? Why not putting it into a fancy Fallout-Like Terminal??Get cool-retro-term 🙂
Compilation instructions are on the GitHub page.

Have fun 🙂