Missing pkg-config results in configure error: possibly undefined macro

This small article is for you who wonder why a configure script under Linux failed with an error like:

configure.ac:204: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:216: error: possibly undefined macro: AC_CHECK_LIB
configure.ac:328: error: possibly undefined macro: AC_CHECK_HEADER
autoreconf: /usr/bin/autoconf failed with exit status: 1
 FAILED 

So autoreconf failed with missing macros, but you just saw you had the latest version and no clue what is wrong with the code you tried to compile!
In most cases the problem is trivial – you are missing the

pkg-config

It is a helper tool used when compiling. It helps to have the correct compiler options and not to hard-coded them in your files. So search for this tool in your Linux distro and install it.

Under CentOS 7

yum install pkgconfig

Under Ubuntu/Debian

apt-get install pkg-config

Under Gentoo

emerge -v dev-util/pkgconfig

Installation and Benchmarks with Phoronix test suite 8.2 under Ubuntu 16.04 LTS

The purpose of this article is to show you how you can test your machine – server or desktop with multiple benchmark tools. The easiest way to try some benchmarks is to use the great tool of Phoronix Test Suite, because it includes around 300 different benchmark utilities and running a test is just choosing it and then running it. No installation of additional software is required by the user. You can check for more info in their web site. Here we show you how easy is to install and run a tests:

sudo apt-get update -y
wget http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_8.2.0_all.deb
sudo apt-get install autoreconf
sudo apt-get install ./phoronix-test-suite_8.2.0_all.deb

Below is the detailed explanation of where to download and how to install the tests suite:

STEP 1) Update your system

myuser@myuserpc:~$ sudo apt update -y
Hit:1 http://gb.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:3 http://gb.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://gb.archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists... Done                     
Building dependency tree       
Reading state information... Done
106 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@myuserpc:/home/myuser# apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-4.15.0-36 linux-headers-4.15.0-36-generic linux-image-4.15.0-36-generic linux-modules-4.15.0-36-generic linux-modules-extra-4.15.0-36-generic
The following packages will be upgraded:
  apparmor apturl apturl-common bind9-host binutils dnsutils firefox firefox-locale-en fonts-opensymbol fwupd ghostscript ghostscript-x gir1.2-javascriptcoregtk-4.0
  gir1.2-webkit2-4.0 gnupg gpgv imagemagick imagemagick-6.q16 imagemagick-common initramfs-tools initramfs-tools-bin initramfs-tools-core intel-microcode libapparmor-perl
  libapparmor1 libappstream-glib8 libarchive13 libbind9-140 libcapnp-0.5.3 libcurl3 libcurl3-gnutls libdfu1 libdns-export162 libdns162 libfwupd1 libgd3 libglib2.0-0
  libglib2.0-bin libglib2.0-data libgs9 libgs9-common libisc-export160 libisc160 libisccc140 libisccfg140 libjavascriptcoregtk-4.0-18 liblcms2-2 liblcms2-utils
  liblouis-data liblouis9 liblwres141 libmagickcore-6.q16-2 libmagickcore-6.q16-2-extra libmagickwand-6.q16-2 libnux-4.0-0 libnux-4.0-common libpoppler-glib8 libpoppler58
  libreoffice-avmedia-backend-gstreamer libreoffice-base-core libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk
  libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-pdfimport libreoffice-style-breeze libreoffice-style-galaxy libreoffice-writer libsmbclient
  libwbclient0 libwebkit2gtk-4.0-37 libwebkit2gtk-4.0-37-gtk2 libx11-6 libx11-data libx11-xcb1 libxcursor1 libxkbcommon-x11-0 libxkbcommon0 libxml2
  linux-generic-hwe-16.04 linux-headers-generic-hwe-16.04 linux-image-generic-hwe-16.04 linux-libc-dev linux-signed-generic-hwe-16.04 nux-tools poppler-utils
  python3-louis python3-uno python3-update-manager python3-urllib3 samba-libs squashfs-tools tzdata uno-libs3 update-manager update-manager-core ure wpasupplicant
  x11-common xorg xserver-common
106 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 65.6 MB/242 MB of archives.
After this operation, 343 MB of additional disk space will be used.
myuser@myuserpc:~$ sudo reboot

As you can see we have kernel update so you must reboot your machine.

STEP 2) Download the Phoronix Test Suite – latest version.

As of writing this article the latest version is 8.2.0. You can check the latest version here Go to the download page and copy the URL for the latest version – “Ubuntu/Debian Package” – a deb package is available. The deb package will install all the dependency required (or most of them).

myuser@myuserpc:~$ wget http://phoronix-test-suite.com/releases/repo/pts.debian/files/phoronix-test-suite_8.2.0_all.deb

STEP 3) Install the Phoronix Test Suite 8.2.0 and the additional dependency.

We used a freshly installed Ubuntu 16.04.5 and we discovered that after a successful installation you need an additional package “autoconf”, because all tools were failing with an error.

root@myuserpc:~# apt-get install autoconf
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  automake libsigsegv2 m4
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc
The following NEW packages will be installed:
  autoconf automake libsigsegv2 m4
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1039 kB of archives.
After this operation, 3843 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 libsigsegv2 amd64 2.10-4 [14.1 kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 m4 amd64 1.4.17-5 [195 kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 autoconf all 2.69-9 [321 kB]
Get:4 http://gb.archive.ubuntu.com/ubuntu xenial/main amd64 automake all 1:1.15-4ubuntu1 [510 kB]
Fetched 1039 kB in 0s (2066 kB/s)
Selecting previously unselected package libsigsegv2:amd64.
(Reading database ... 213618 files and directories currently installed.)
Preparing to unpack .../libsigsegv2_2.10-4_amd64.deb ...
Unpacking libsigsegv2:amd64 (2.10-4) ...
Selecting previously unselected package m4.
Preparing to unpack .../archives/m4_1.4.17-5_amd64.deb ...
Unpacking m4 (1.4.17-5) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../autoconf_2.69-9_all.deb ...
Unpacking autoconf (2.69-9) ...
Selecting previously unselected package automake.
Preparing to unpack .../automake_1%3a1.15-4ubuntu1_all.deb ...
Unpacking automake (1:1.15-4ubuntu1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for doc-base (0.10.7) ...
Processing 1 added doc-base file...
Setting up libsigsegv2:amd64 (2.10-4) ...
Setting up m4 (1.4.17-5) ...
Setting up autoconf (2.69-9) ...
Setting up automake (1:1.15-4ubuntu1) ...
update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu10) ...
myuser@myuserpc:~$ sudo apt-get install ./phoronix-test-suite_8.2.0_all.deb 
[sudo] password for myuser: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'phoronix-test-suite' instead of './phoronix-test-suite_8.2.0_all.deb'
The following additional packages will be installed:
  php-cli php-common php-gd php-xml php7.0-cli php7.0-common php7.0-gd php7.0-json php7.0-opcache php7.0-readline php7.0-xml
Suggested packages:
  php-pear
The following NEW packages will be installed:
  phoronix-test-suite php-cli php-common php-gd php-xml php7.0-cli php7.0-common php7.0-gd php7.0-json php7.0-opcache php7.0-readline php7.0-xml
0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.
Need to get 2387 kB/2980 kB of archives.
After this operation, 15.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 /home/myuser/phoronix-test-suite_8.2.0_all.deb phoronix-test-suite all 8.2.0 [594 kB]
Get:2 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php-common all 1:35ubuntu6.1 [10.8 kB]
Get:3 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-common amd64 7.0.32-0ubuntu0.16.04.1 [840 kB]
Get:4 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-json amd64 7.0.32-0ubuntu0.16.04.1 [16.9 kB]
Get:5 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-opcache amd64 7.0.32-0ubuntu0.16.04.1 [77.2 kB]
Get:6 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-readline amd64 7.0.32-0ubuntu0.16.04.1 [12.9 kB]
Get:7 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-cli amd64 7.0.32-0ubuntu0.16.04.1 [1282 kB]
Get:8 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php-cli all 1:7.0+35ubuntu6.1 [2946 B]
Get:9 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-xml amd64 7.0.32-0ubuntu0.16.04.1 [113 kB]
Get:10 http://gb.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 php-xml all 1:7.0+35ubuntu6.1 [1954 B]
Get:11 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php7.0-gd amd64 7.0.32-0ubuntu0.16.04.1 [27.2 kB]
Get:12 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 php-gd all 1:7.0+35ubuntu6.1 [1924 B]
Fetched 2387 kB in 0s (2652 kB/s) 
Selecting previously unselected package php-common.
(Reading database ... 212705 files and directories currently installed.)
Preparing to unpack .../php-common_1%3a35ubuntu6.1_all.deb ...
Unpacking php-common (1:35ubuntu6.1) ...
Selecting previously unselected package php7.0-common.
Preparing to unpack .../php7.0-common_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-common (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php7.0-json.
Preparing to unpack .../php7.0-json_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-json (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php7.0-opcache.
Preparing to unpack .../php7.0-opcache_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-opcache (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php7.0-readline.
Preparing to unpack .../php7.0-readline_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-readline (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php7.0-cli.
Preparing to unpack .../php7.0-cli_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-cli (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php-cli.
Preparing to unpack .../php-cli_1%3a7.0+35ubuntu6.1_all.deb ...
Unpacking php-cli (1:7.0+35ubuntu6.1) ...
Selecting previously unselected package php7.0-xml.
Preparing to unpack .../php7.0-xml_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-xml (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php-xml.
Preparing to unpack .../php-xml_1%3a7.0+35ubuntu6.1_all.deb ...
Unpacking php-xml (1:7.0+35ubuntu6.1) ...
Selecting previously unselected package phoronix-test-suite.
Preparing to unpack .../phoronix-test-suite_8.2.0_all.deb ...
Unpacking phoronix-test-suite (8.2.0) ...
Selecting previously unselected package php7.0-gd.
Preparing to unpack .../php7.0-gd_7.0.32-0ubuntu0.16.04.1_amd64.deb ...
Unpacking php7.0-gd (7.0.32-0ubuntu0.16.04.1) ...
Selecting previously unselected package php-gd.
Preparing to unpack .../php-gd_1%3a7.0+35ubuntu6.1_all.deb ...
Unpacking php-gd (1:7.0+35ubuntu6.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1.1) ...
Setting up php-common (1:35ubuntu6.1) ...
Setting up php7.0-common (7.0.32-0ubuntu0.16.04.1) ...
Setting up php7.0-json (7.0.32-0ubuntu0.16.04.1) ...
Setting up php7.0-opcache (7.0.32-0ubuntu0.16.04.1) ...
Setting up php7.0-readline (7.0.32-0ubuntu0.16.04.1) ...
Setting up php7.0-cli (7.0.32-0ubuntu0.16.04.1) ...
Setting up php-cli (1:7.0+35ubuntu6.1) ...
Setting up php7.0-xml (7.0.32-0ubuntu0.16.04.1) ...
Setting up php-xml (1:7.0+35ubuntu6.1) ...
Setting up phoronix-test-suite (8.2.0) ...
Setting up php7.0-gd (7.0.32-0ubuntu0.16.04.1) ...
Creating config file /etc/php/7.0/mods-available/gd.ini with new version
Setting up php-gd (1:7.0+35ubuntu6.1) ..

STEP 4) Run a simple benchmark

Here it is as simple as that to run a sysbench benchmark. We included all the output of the program you can see the shared URL, too. The test is named “sysbench-tests” – this is the name of the group, the unique name is also sysbench-tests, but if you run the test again you should set another unique name (let’s say you changed something like the kernel version) so you use the same name “sysbench-tests” for the result file and “sysbench-tests-KERNEL_VERSION” for “unique name to describe this test run / configuration”, so you can compare them.
We highlighted the lines the executed commands, answers to questions of the Phoronix Test Suite and the results from the benchmarks. The second part below shows the saved results and the name and the unique name – the difference between them and what we meant a sentence above.

root@myuserpc:~# phoronix-test-suite benchmark sysbench


Phoronix Test Suite v8.2.0

    To Install:    pts/sysbench-1.0.0

    Determining File Requirements ......................................................................................................................................
    Searching Download Caches ..........................................................................................................................................

    1 Test To Install
        45MB Of Disk Space Is Needed

    pts/sysbench-1.0.0:
        Test Installation 1 of 1
        1 File Needed [2.14 MB / 1 Minute]
        File Found: sysbench-20180728.zip                                                                                                                       [2.14MB]
        Installation Size: 45 MB
        Installing Test @ 19:37:17



Sysbench 2018-07-28:
    pts/sysbench-1.0.0
    System Test Configuration
        1: CPU
        2: Memory
        3: Test All Options
        ** Multiple items can be selected, delimit by a comma. **
        Test: 3


System Information


  PROCESSOR:          AMD Ryzen Threadripper 1950X 16-Core @ 3.40GHz
    Core Count:       16
    Thread Count:     32
    Extensions:       SSE 4.2 + AVX2 + AVX + RDRAND + FSGSBASE
    Cache Size:       512 KB
    Microcode:        0x8001137
    Scaling Driver:   acpi-cpufreq ondemand

  GRAPHICS:           nouveaufb
    Display Driver:   modesetting 1.19.6
    Monitor:          PHL 284E5
    Screen:           1920x1080

  MOTHERBOARD:        ASUS ROG ZENITH EXTREME
    BIOS Version:     1402
    Chipset:          AMD Device 1450
    Audio:            NVIDIA Device 10ef
    Network:          Intel I211 Gigabit Connection + Qualcomm Atheros QCA6174 802.11ac Wireless

  MEMORY:             4 x 8192 MB DDR4-1067MHz F4-3200C14-8GTZR

  DISK:               Samsung SSD 960 PRO 512GB
    File-System:      ext4
    Mount Options:    data=ordered errors=remount-ro relatime rw
    Disk Scheduler:   NONE

  OPERATING SYSTEM:   Ubuntu 16.04
    Kernel:           4.15.0-36-generic (x86_64)
    Display Server:   X Server 1.19.6
    Compiler:         GCC 5.4.0 20160609
    Security:         __user pointer sanitization + Full AMD retpoline IBPB + SSB disabled via prctl and seccomp

    Would you like to save these test results (Y/n): y

    Recently Saved Test Results:
       socket-tests   [Today]

    Enter a name for the result file: sysbench-tests
    Enter a unique name to describe this test run / configuration: sysbench-tests

If desired, enter a new description below to better describe this result set / system configuration under test.
Press ENTER to proceed without changes.

Current Description: AMD Ryzen Threadripper 1950X 16-Core testing with a ASUS ROG ZENITH EXTREME (1402 BIOS) and nouveaufb on Ubuntu 16.04 via the Phoronix Test Suite.

New Description: 


Sysbench 2018-07-28:
    pts/sysbench-1.0.0 [Test: Memory]
    Test 1 of 2
    Estimated Trial Run Count:    3
    Estimated Test Run-Time:      2 Minutes
    Estimated Time To Completion: 3 Minutes [19:43 BST]
        Started Run 1 @ 19:41:19
        Started Run 2 @ 19:41:30
        Started Run 3 @ 19:41:41

    Test: Memory:
        6349228.7373
        6322490.2804
        6353262.9365

    Average: 6341660.65 Events Per Second
    Deviation: 0.26%

    OpenBenchmarking.org Dynamic Comparison: 
    Events Per Second > Higher Is Better
    sysbench-tests ...... 6341661 |==============
    Clang 8.0 20180820 .. 7271461 |================================
    Clang 6.0.1 ......... 7303676 |================================
    GCC 8.2.0 ........... 7311315 |================================
    GCC 9.0.0 20180819 .. 7328767 |=================================
    GCC 7.3.0 ........... 7338351 |=================================
    Result Perspective: https://openbenchmarking.org/result/1808213-PTS-GCCBENCH48


Sysbench 2018-07-28:
    pts/sysbench-1.0.0 [Test: CPU]
    Test 2 of 2
    Estimated Trial Run Count:    3
    Estimated Time To Completion: 2 Minutes [19:43 BST]
        Started Run 1 @ 19:42:16
        Started Run 2 @ 19:42:27
        Started Run 3 @ 19:42:38

    Test: CPU:
        30965.4839
        30952.6457
        30945.763

    Average: 30954.63 Events Per Second
    Deviation: 0.03%

    OpenBenchmarking.org Dynamic Comparison: 
    Events Per Second > Higher Is Better
    Core i7 5960X ........ 13595 |=========
    Core i7 8700K ........ 14330 |===========
    Ryzen 7 2700X ........ 16851 |=================
    1950X 4.1 PStateOC ... 19178 |=======================
    Core i9 7900X ........ 22118 |==============================
    2950X PBO2 ........... 23210 |=================================
    Threadripper 1950X ... 30920 |====================================================
    sysbench-tests ....... 30955 |====================================================
    1950X Stock .......... 30972 |====================================================
    1950X Stock2 ......... 30987 |====================================================
    Core i9 7960X ........ 31814 |======================================================
    Threadripper 2950X ... 33082 |=========================================================
    Core i9 7980XE ....... 33797 |===========================================================
    Threadripper 2990WX .. 56447 |==================================================================================================================
    Result Perspective: https://openbenchmarking.org/result/1809071-AR-1808115RA52

    Do you want to view the text results of the testing (Y/n): y
sysbench-tests
AMD Ryzen Threadripper 1950X 16-Core testing with a ASUS ROG ZENITH EXTREME (1402 BIOS) and nouveaufb on Ubuntu 16.04 via the Phoronix Test Suite.


sysbench-tests: 

        Processor: AMD Ryzen Threadripper 1950X 16-Core @ 3.40GHz (16 Cores / 32 Threads), Motherboard: ASUS ROG ZENITH EXTREME (1402 BIOS), Chipset: AMD Device 1450, Memory: 4 x 8192 MB DDR4-1067MHz F4-3200C14-8GTZR, Disk: Samsung SSD 960 PRO 512GB, Graphics: nouveaufb, Audio: NVIDIA Device 10ef, Monitor: PHL 284E5, Network: Intel I211 Gigabit Connection + Qualcomm Atheros QCA6174 802.11ac Wireless

        OS: Ubuntu 16.04, Kernel: 4.15.0-36-generic (x86_64), Display Server: X Server 1.19.6, Display Driver: modesetting 1.19.6, Compiler: GCC 5.4.0 20160609, File-System: ext4, Screen Resolution: 1920x1080

Sysbench 2018-07-28
Test: Memory
    Events Per Second > Higher Is Better
    sysbench-tests .. 6341661 |=====================================================

Sysbench 2018-07-28
Test: CPU
    Events Per Second > Higher Is Better
    sysbench-tests .. 30955 |=====================================================

    Would you like to upload the results to OpenBenchmarking.org (y/n): y
    Would you like to attach the system logs (lspci, dmesg, lsusb, etc) to the test result (y/n): n

Results Uploaded To: https://openbenchmarking.org/result/1810086-RA-SYSBENCHT09

We’ve made two more tests with different kernels, so here are the results (the one with no kernel version uses the latest official Ubuntu kernel at the moment – 4.15.0-36-generic):

root@myuserpc:/home/myuser# phoronix-test-suite show-result sysbench-tests

sysbench-tests
AMD Ryzen Threadripper 1950X 16-Core testing with a ASUS ROG ZENITH EXTREME (1402 BIOS) and nouveaufb on Ubuntu 16.04 via the Phoronix Test Suite.


sysbench-tests: 

        Processor: AMD Ryzen Threadripper 1950X 16-Core @ 3.40GHz (16 Cores / 32 Threads), Motherboard: ASUS ROG ZENITH EXTREME (1402 BIOS), Chipset: AMD Device 1450, Memory: 4 x 8192 MB DDR4-1067MHz F4-3200C14-8GTZR, Disk: Samsung SSD 960 PRO 512GB, Graphics: nouveaufb, Audio: NVIDIA Device 10ef, Monitor: PHL 284E5, Network: Intel I211 Gigabit Connection + Qualcomm Atheros QCA6174 802.11ac Wireless

        OS: Ubuntu 16.04, Kernel: 4.15.0-36-generic (x86_64), Display Server: X Server 1.19.6, Display Driver: modesetting 1.19.6, Compiler: GCC 5.4.0 20160609, File-System: ext4, Screen Resolution: 1920x1080

sysbench-tests-4.18.12: 

        Processor: AMD Ryzen Threadripper 1950X 16-Core @ 3.40GHz (16 Cores / 32 Threads), Motherboard: ASUS ROG ZENITH EXTREME (1402 BIOS), Chipset: AMD Device 1450, Memory: 4 x 8192 MB DDR4-1067MHz F4-3200C14-8GTZR, Disk: Samsung SSD 960 PRO 512GB, Graphics: nouveaufb, Audio: NVIDIA Device 10ef, Monitor: PHL 284E5, Network: Intel I211 Gigabit Connection + Qualcomm Atheros QCA6174 802.11ac Wireless

        OS: Ubuntu 16.04, Kernel: 4.18.12-041812-generic (x86_64), Display Server: X Server 1.19.6, Display Driver: modesetting 1.19.6, Compiler: GCC 5.4.0 20160609, File-System: ext4, Screen Resolution: 1920x1080

sysbench-tests-4.13.26: 

        Processor: AMD Ryzen Threadripper 1950X 16-Core @ 3.40GHz (16 Cores / 32 Threads), Motherboard: ASUS ROG ZENITH EXTREME (1402 BIOS), Chipset: AMD Device 1450, Memory: 4 x 8192 MB DDR4-1067MHz F4-3200C14-8GTZR, Disk: Samsung SSD 960 PRO 512GB, Graphics: nouveaufb, Audio: NVIDIA Device 10ef, Monitor: PHL 284E5, Network: Intel I211 Gigabit Connection + Qualcomm Atheros QCA6174 802.11ac Wireless

        OS: Ubuntu 16.04, Kernel: 4.13.16-041316-generic (x86_64), Display Server: X Server 1.19.6, Display Driver: modesetting 1.19.6, Compiler: GCC 5.4.0 20160609, File-System: ext4, Screen Resolution: 1920x1080

Sysbench 2018-07-28
Test: Memory
    Events Per Second > Higher Is Better
    sysbench-tests .......... 6341661 |=====================================================
    sysbench-tests-4.18.12 .. 6327526 |=====================================================
    sysbench-tests-4.13.26 .. 6265701 |===================================================

Sysbench 2018-07-28
Test: CPU
    Events Per Second > Higher Is Better
    sysbench-tests .......... 30955 |=======================================================
    sysbench-tests-4.18.12 .. 30946 |=======================================================
    sysbench-tests-4.13.26 .. 30924 |=======================================================

Throubleshooting

Error occurs if your system misses the “autoconf” package

root@myuserpc:~# phoronix-test-suite benchmark sockperf

Phoronix Test Suite v8.2.0

    To Install:    pts/sockperf-1.0.0

    Determining File Requirements ......................................................................................................................................
    Searching Download Caches ..........................................................................................................................................

    1 Test To Install
        125MB Of Disk Space Is Needed

    pts/sockperf-1.0.0:
        Test Installation 1 of 1
        1 File Needed [0.22 MB / 1 Minute]
        File Found: sockperf-3.4.zip                                                                                                                            [0.22MB]
        Installation Size: 125 MB
        Installing Test @ 18:27:11
            The installer exited with a non-zero exit status.
            ERROR: Missing Command: autoreconf
            LOG: /var/lib/phoronix-test-suite/installed-tests/pts/sockperf-1.0.0/install-failed.log


    [PROBLEM] pts/sockperf-1.0.0 is not installed. 

root@myuserpc:~# phoronix-test-suite benchmark sysbench

Phoronix Test Suite v8.2.0

    To Install:    pts/sysbench-1.0.0

    Determining File Requirements ......................................................................................................................................
    Searching Download Caches ..........................................................................................................................................

    1 Test To Install
        1 File To Download [2.14MB]
        45MB Of Disk Space Is Needed

    pts/sysbench-1.0.0:
        Test Installation 1 of 1
        1 File Needed [2.14 MB / 1 Minute]
        Downloading: sysbench-20180728.zip                                                                                                                      [2.14MB]
        Estimated Download Time: 1m ....................................................................................................................................
        Installation Size: 45 MB
        Installing Test @ 18:26:17
            The installer exited with a non-zero exit status.
            ERROR: Missing Command: autoreconf
            LOG: /var/lib/phoronix-test-suite/installed-tests/pts/sysbench-1.0.0/install-failed.log


    [PROBLEM] pts/sysbench-1.0.0 is not installed. 
root@myuserpc:~# cat /var/lib/phoronix-test-suite/installed-tests/pts/sysbench-1.0.0/install-failed.log
Archive:  sysbench-20180728.zip
7c366c6043117fbcd17eed54dcb20f9665517d1b
   creating: sysbench-master/
  inflating: sysbench-master/.gitignore  
  inflating: sysbench-master/.travis.yml  
.....
.....
./autogen.sh: 3: ./autogen.sh: autoreconf: not found
/var/lib/phoronix-test-suite/test-profiles/pts/sysbench-1.0.0/install.sh: line 6: ./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.

The setup cannot configure the downloaded source code of sysbench.

Gentoo emerge: Failed Running automake

This article is for Gentoo build problem:

Failed Running automake

but basically the problem could occur in any Linux system and the solution is logically the same.
During our @world update our emerge failed on:

>>> Emerging (44 of 95) dev-libs/libmemcached-1.0.18-r3::gentoo
 * libmemcached-1.0.18.tar.gz BLAKE2B SHA512 size 😉 ...                                                                                                            [ ok ]
>>> Unpacking source...
>>> Unpacking libmemcached-1.0.18.tar.gz to /var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/work
>>> Source unpacked in /var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/work
>>> Preparing source in /var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/work/libmemcached-1.0.18 ...
 * Applying debug-disable-enable-1.0.18.patch ...                                                                                                                    [ ok ]
 * Applying continuum-1.0.18.patch ...                                                                                                                               [ ok ]
 * Applying libmemcached-1.0.18-gcc7.patch ...                                                                                                                       [ ok ]
 * Running eautoreconf in '/var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/work/libmemcached-1.0.18' ...
 * Running libtoolize --install --copy --force --automake ...                                                                                                        [ ok ]
 * Running aclocal -I m4 -I libtest/m4 ...                                                                                                                           [ ok ]
 * Running autoconf --force ...                                                                                                                                      [ ok ]
 * Running autoheader ...                                                                                                                                            [ ok ]
 * Running automake --add-missing --copy --foreign --force-missing ...                                                                                               [ !! ]

 * Failed Running automake !
 * 
 * Include in your bugreport the contents of:
 * 
 *   /var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/temp/automake.out

 * ERROR: dev-libs/libmemcached-1.0.18-r3::gentoo failed (prepare phase):
 *   Failed Running automake !
 * 
 * Call stack:
 *     ebuild.sh, line  124:  Called src_prepare
 *   environment, line 2214:  Called eautoreconf
 *   environment, line  714:  Called eautomake
 *   environment, line  668:  Called autotools_run_tool 'automake' '--add-missing' '--copy' '--foreign' '--force-missing'
 *   environment, line  532:  Called die
 * The specific snippet of code:
 *           die "Failed Running $1 !";
 * 
 * If you need support, post the output of `emerge --info '=dev-libs/libmemcached-1.0.18-r3::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-libs/libmemcached-1.0.18-r3::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/work/libmemcached-1.0.18'
 * S: '/var/tmp/portage/dev-libs/libmemcached-1.0.18-r3/work/libmemcached-1.0.18'

>>> Failed to emerge dev-libs/libmemcached-1.0.18-r3, Log file:

We have installed automake, the dependency is OK, there is no need of new version of automake (the libmemcached did not required to install a new version as a dependency), but still the build process failed!
automake has many different versions installed on the same system and the problem is that one of your currently installed version is too old, so you must upgrade all versions (from the all different branches installed).
First check what versions are installed (equery is part of app-portage/gentoolkit):

root@srv ~ # equery list automake
 * Searching for automake ...
[I--] [??] sys-devel/automake-1.11.3:1.11
[I--] [??] sys-devel/automake-1.12.6:1.12
[I--] [??] sys-devel/automake-1.13.4:1.13
[I--] [??] sys-devel/automake-1.14.1:1.14
[IP-] [  ] sys-devel/automake-1.15.1-r2:1.15
[IP-] [  ] sys-devel/automake-1.16.1-r1:1.16

We have version from branch 1.11, 1.12, 1.13 and 1.14 – one of these version is causing the problem!
Up until now no package required as a dependency 1.15 and 1.16, so we do not have it installed.

Here we upgrade them all to their latest versions in every branch version:

root@srv ~ # emerge -vu sys-devel/automake:1.11 sys-devel/automake:1.12 sys-devel/automake:1.13 sys-devel/automake:1.14

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] sys-devel/automake-1.12.6-r2:1.12::gentoo [1.12.6:1.12::gentoo] USE="-test%" 1368 KiB
[ebuild     U  ] sys-devel/automake-1.11.6-r3:1.11::gentoo [1.11.3:1.11::gentoo] USE="-test%" 896 KiB
[ebuild     U  ] sys-devel/automake-1.14.1-r2:1.14::gentoo [1.14.1:1.14::gentoo] USE="-test%" 1455 KiB
[ebuild     U  ] sys-devel/automake-1.13.4-r2:1.13::gentoo [1.13.4:1.13::gentoo] USE="-test%" 1416 KiB

Total: 4 packages (4 upgrades), Size of downloads: 5133 KiB

As you can see we have updated version in every branch! And after updating them the building of libmemcached passed smoothly!
It’s not only in Gentoo, in most Linux distros (such as Ubuntu, CentOS, Manjaro, Mint and so on) have multiple automake version installed, so if you encounter this problem check your automake version installed for their latest versions and also if you miss some of them.

Reset lost admin password of Grafana server (CentOS 7)

It could happen to lose your Grafana admin password and luckily there is a pretty easy way to the system administrator of the Grafana server to reset the admin password.
There is really good and simple page of how you can reset the admin password with grafana-cli in the documentation of Grafana website. Probably you can check it, too.

The problem is that most distributions like the one we use (CentOS 7) it rearrange the home directory of the Grafana software and if you try to use grafana-cli you’ll end up with the error mentioned in the section below the solution we offer you here! And you really could mess up the thing and hurry to say this software is buggy!
First, “grafana-cli admin reset-admin-password ” needs to know where is your configuration file and Grafana home directory, because from the configuration it will extract what kind of back-end server you use like sqlite3 or MySQL (or other) and the path or login data if needed to the back-end, then it will reset the password with the given one. At the bottom of this article there is another method of resetting the Grafana admin password without grafana-cli – manual reset in the database.
So first you should check with what command line arguments was started your instance of Grafana server:
Keep on reading!

Upgrade self-hosted atlassian bitbucket 4.x to 5.x in CentOS 7

Here we are going to show you a real example of how we upgraded out Atlassian Bitbucket server from 4.14.4 (around April 2017 installation) with the latest version of Atlassian Bitbucket 5.14.0. We use

  1. using self-hosted instance of Bitbucket 4.14.4
  2. Linux distro – CentOS 7.
  3. MySQL server for back-end. So there is a jdbc mysql driver (which should be installed after the upgrade).
  4. NGINX is used as proxy for our main HTTPS url. So we have changed our default configuration in server (in sever.xml).
  5. Bitbucket is loaded from a URL/bitbucket – “https://dev.example.com/bitbucket/”. So we have changed our default configuration (in sever.xml).

and you’ll see there are some pitfalls you can avoid if you follow our article. The latest git program in CentOS 7 is 1.8 and is not compatible with the new Atlassian Bitbucket 5.x, so we need to solve this problem before updating the server. Check out the official upgrade page here
Keep on reading!

Manual install of base Gentoo Linux x86_64 with openrc (init) and uefi using minimal installation cd

Here we are going to show the minimum steps to install a base Gentoo Linux on your computer – server or desktop using “Minimal Installation CD”.
The installation ISO CD is generated on 11.09.2018, but you can use an older or newer one, this guide uses commands, which are available in really old ISOs (10 years ago) and probably will be available in the future, too! The idea is not to change this ISO a lot and to have only the basic tools for installation, which should be the same for a really log time! If you need more tools there two other options: Hybrid IS0, which is a LiveDVD – a system with GUI and Admin CD, which is extended version of the minimal installation CD (no GUI).

Our base Gentoo system will use:

  1. OpenRC, which is based on init to boot the server. This is the default in Gentoo, but you might have problems using Gnome
  2. GRUB 2 UEFI enabled and the server will be booted in UEFI mode. Recently most of the desktop machine and server support it and in many cases it is mandatory to use a new hardware.
  3. No GUI will be installed (KDE, Gnome, Xfce and so on), there are other tutorials for this, you can check here (coming soon)

Keep on reading!

Gentoo Minimal Installation CD (amd64 aka x86_64) – booting (in UEFI mode)

Here is the process of booting from a Gentoo Minimal Installation CD amd64 (x86_64) with UEFI mode enabled. This is not an installation guide!
You can download the CD from here: https://www.gentoo.org/downloads/ Here is the ISO file: http://distfiles.gentoo.org/releases/amd64/autobuilds/20180911T214502Z/install-amd64-minimal-20180911T214502Z.iso or you can check it in some mirror like leaseweb – http://mirror.leaseweb.com/gentoo/releases/amd64/autobuilds/current-install-amd64-minimal/install-amd64-minimal-20180911T214502Z.iso.

Our motherboard is Asus ROG Zenith Extreme motherboard using X399 chipset https://www.asus.com/th/Motherboards/ROG-ZENITH-EXTREME/ and you’ll see the BIOS options for it, but they do not differ much with the other motherboard boot options. Here also setup the network and start up an openssh server to manage our Gentoo Linux installation – (coming soon).

SCREENSHOT 1) Starting the machine

main menu
Start up

Keep on reading!

Gentoo updating KDE – package blocks

In continuing our tips for updating big or multiple packages in Gentoo this time we show how to update KDE Platform, Plasma and Apps packages. In Gentoo KDE Desktop GUI is split into three major categories:

  1. kde-frameworks
  2. kde-plasma
  3. kde-apps

How we managed to update in our current situation:

  1. Sometimes when updating a group or a package with big dependency graph it is much easier to drop the -“u” update argument and to rebuild some packages with the updates.
  2. use qlist to update/re(build) to pull currently installed packages with some name or category (categories)
  3. Remove obsolete packages – you do not need them, they can just make problems when updating, because emerge will take into consideration their requirements and dependencies and your update could be impossible!

More on the subject of update tips here: Gentoo update tips when updating packages with blocks and masked files
Keep on reading!

Ubuntu 16/18 LTS – load a new kernel without rebooting the server

Here are the commands needed to load a new kernel without rebooting your server or desktop computer. Why you need this? As said in our first article for CentOS 7 – sometime rebooting a server could take 5 to 10 minutes and loading a new kernel is just up to a minute. In fact in most cases loading the new kernel and starting the system then is just under 20-30 seconds, so upgrading your server even with new kernel is super easy lately. We tested it on Ubuntu 16 and Ubuntu 18 servers and it was successful. The system uses systemd and the process is really easy and safe for the systems.

When the processes is initiated the system shutdowns normally (shutting down all running service with systemd) and then load the system immediately with the new kernel and starts the services as usual!

So no need to worry about unflushed data or not proper shutdown of a service! It’s like a normal reboot but without a hardware reboot and is a lot faster!
Here is what is required to load a kernel without hardware rebooting your computer box:

  1. kexec-tools
  2. Load the new kernel, initram file and the command line arguments with “kexec”
  3. Start a systemd target – kexec.target

Ubuntu 16/18 LTS using kexec to load a new kernel

The real commands only for Ubuntu 16/18 LTS:

sudo apt -y install kexec-tools
sudo kexec -l /boot/vmlinuz-4.15.0-33-generic --initrd=/boot/initrd.img-4.15.0-33-generic --command-line="root=UUID=061b2936-34bf-4da3-b7d2-b8bde0899f03 ro  quiet splash"
sudo systemctl start kexec.target

Here is a real world example with all the output:
And again update your system to see if there is a new kernel and install “kexec-tools”. In our case indeed there is a new kernel – vmlinuz-4.15.0-33-generic

myuser@srv:~$ sudo apt -y upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libllvm5.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  amd64-microcode autotools-dev dblatex debhelper dh-strip-nondeterminism docbook-dsssl docbook-utils docbook-xml docbook-xsl fonts-lato fonts-lmodern fonts-texgyre
  intel-microcode iucode-tool jadetex javascript-common kernel-common kernel-package kernel-patch-scripts kernel-wedge kerneloops kerneloops-applet kernelshark kerneltop
  libfile-homedir-perl libfile-stripnondeterminism-perl libfile-which-perl libjs-jquery libllvm6.0 libmail-sendmail-perl libosp5 libostyle1c2 libpotrace0 libptexenc1
  libqpdf21 libruby2.3 libsgmls-perl libsp1c2 libsynctex1 libsys-hostname-long-perl libtexlua52 libtexluajit2 libwebpdemux1 libxml2-utils libzzip-0-13
  linux-headers-4.15.0-33 linux-headers-4.15.0-33-generic linux-image-4.15.0-33-generic linux-modules-4.15.0-33-generic linux-modules-extra-4.15.0-33-generic lmodern lynx
  lynx-common openjade po-debconf preview-latex-style prosper ps2eps python-apt rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit
  ruby2.3 rubygems-integration sgml-data sgmlspl sp tex-common tex-gyre texlive texlive-base texlive-bibtex-extra texlive-binaries texlive-extra-utils texlive-font-utils
  texlive-fonts-recommended texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base texlive-latex-base-doc texlive-latex-extra
  texlive-latex-extra-doc texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-math-extra texlive-pictures texlive-pictures-doc texlive-pstricks
  texlive-pstricks-doc tipa trace-cmd xmlto xsltproc
The following packages will be upgraded:
.....
.....
Running mktexlsr /var/lib/texmf ... done.
Building format(s) --all.
        This may take some time... done.
Processing triggers for linux-image-4.15.0-33-generic (4.15.0-33.36~16.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-33-generic
/etc/kernel/postinst.d/vboxadd:
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules.
/etc/kernel/postinst.d/zz-update-grub:
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.15.0-33-generic
Found initrd image: /boot/initrd.img-4.15.0-33-generic
Found linux image: /boot/vmlinuz-4.13.0-36-generic
Found initrd image: /boot/initrd.img-4.13.0-36-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

myuser@srv:~$ sudo apt -y install kexec-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libllvm5.0
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  kexec-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 77,4 kB of archives.
After this operation, 276 kB of additional disk space will be used.
Get:1 http://bg.archive.ubuntu.com/ubuntu xenial-updates/main amd64 kexec-tools amd64 1:2.0.16-1ubuntu1~16.04.1 [77,4 kB]
Fetched 77,4 kB in 0s (707 kB/s)      
Preconfiguring packages ...
Selecting previously unselected package kexec-tools.
(Reading database ... 253895 files and directories currently installed.)
Preparing to unpack .../kexec-tools_1%3a2.0.16-1ubuntu1~16.04.1_amd64.deb ...
Unpacking kexec-tools (1:2.0.16-1ubuntu1~16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up kexec-tools (1:2.0.16-1ubuntu1~16.04.1) ...
Generating /etc/default/kexec...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...

     ┌──────────────────────────────────────────────────────────────────┤ Configuring kexec-tools ├───────────────────────────────────────────────────────────────────┐
     │                                                                                                                                                                │ 
     │ If you choose this option, a system reboot will trigger a restart into a kernel loaded by kexec instead of going through the full system boot loader process.  │ 
     │                                                                                                                                                                │ 
     │ Should kexec-tools handle reboots (sysvinit only)?                                                                                                             │ 
     │                                                                                                                                                                │ 
     │                                                 <Yes>                                                    <No>                                                  │ 
     │                                                                                                                                                                │ 
     └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ 

On the above configuration question mark “” and press Enter.

So we performed an update and there was a new kernel vmlinuz-4.15.0-33-generic, which we would like to load without hardware reboot.
Here is our new kernel in “/boot”

myuser@srv:~$ ls -altr /boot/
total 130420
-rw-r--r--  1 root root   184840 Jan 28  2016 memtest86+_multiboot.bin
-rw-r--r--  1 root root   184380 Jan 28  2016 memtest86+.elf
-rw-r--r--  1 root root   182704 Jan 28  2016 memtest86+.bin
-rw-------  1 root root  3879946 Feb 17  2018 System.map-4.13.0-36-generic
-rw-r--r--  1 root root     2850 Feb 17  2018 retpoline-4.13.0-36-generic
-rw-r--r--  1 root root   213220 Feb 17  2018 config-4.13.0-36-generic
-rw-r--r--  1 root root  1501359 Feb 17  2018 abi-4.13.0-36-generic
-rw-r--r--  1 root root  7710912 May 17 16:50 vmlinuz-4.13.0-36-generic
-rw-------  1 root root  4041375 Aug 16 00:00 System.map-4.15.0-33-generic
-rw-r--r--  1 root root        0 Aug 16 00:00 retpoline-4.15.0-33-generic
-rw-r--r--  1 root root   216913 Aug 16 00:00 config-4.15.0-33-generic
-rw-r--r--  1 root root  1537455 Aug 16 00:00 abi-4.15.0-33-generic
-rw-------  1 root root  8108600 Aug 16 21:58 vmlinuz-4.15.0-33-generic
drwxr-xr-x 24 root root     4096 Sep  7 14:15 ..
-rw-r--r--  1 root root 51290506 Sep  7 14:15 initrd.img-4.13.0-36-generic
-rw-r--r--  1 root root 54451680 Sep  7 14:15 initrd.img-4.15.0-33-generic
drwxr-xr-x  3 root root     4096 Sep  7 14:15 .
drwxr-xr-x  5 root root     4096 Sep  7 14:16 grub

Now we know the kernel and initram file names we just check the kernel arguments in the kernel, load them with kexec and start an systemd target to load the new kernel:

myuser@srv:~$ grep vmlinuz-4.15.0-33-generic /boot/grub/grub.cfg 
        linux   /boot/vmlinuz-4.15.0-33-generic root=UUID=061b2936-34bf-4da3-b7d2-b8bde0899f03 ro  quiet splash $vt_handoff
                linux   /boot/vmlinuz-4.15.0-33-generic root=UUID=061b2936-34bf-4da3-b7d2-b8bde0899f03 ro  quiet splash $vt_handoff
                linux   /boot/vmlinuz-4.15.0-33-generic root=UUID=061b2936-34bf-4da3-b7d2-b8bde0899f03 ro  quiet splash $vt_handoff init=/sbin/upstart
                linux   /boot/vmlinuz-4.15.0-33-generic root=UUID=061b2936-34bf-4da3-b7d2-b8bde0899f03 ro recovery nomodeset 
myuser@srv:~$ sudo kexec -l /boot/vmlinuz-4.15.0-33-generic --initrd=/boot/initrd.img-4.15.0-33-generic --command-line="root=UUID=061b2936-34bf-4da3-b7d2-b8bde0899f03 ro  quiet splash"
myuser@srv:~$ sudo systemctl start kexec.target
Connection to srv closed by remote host.
Connection to srv closed.

Use the first line of the grep output above (or you can cat the file and see what is in it if you have any doubts) to take the proper kernel boot arguments and do not include anything starting with “$”.

As you can see systemd performs a normal shutdown of all services and targets.

main menu
Normal shutdown

The ssh connection is immediately closed because the reboot is initiated.
After 10-15 seconds our host is alive and the new kernel is loaded successfully:

root@test ~ $ ssh root@srv
root@srv's password: 
Last login: Wed Sep  5 17:15:08 2018 from test
[root@srv ~]# uname -a
Linux srv.local 4.15.0-33-generic #36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@srv ~]# 

Because we do not wanted to mess up the two output in one article we decided to split it in two separate ones, so here is the previous one for CentOS 7 – “CentOS 7 – load a new kernel without rebooting the CentOS 7 server”

CentOS 7 – load a new kernel without rebooting the server

Here are the commands needed to load a new kernel without rebooting your server or desktop computer. Why you need this? Sometime rebooting a server could take 5 to 10 minutes and loading a new kernel is just up to a minute. In fact in most cases loading the new kernel and starting the system then is just under 20-30 seconds, so upgrading your server even with new kernel is super easy lately. We tested it on CentOS 7 server and it was successful. The system uses systemd and the process is really easy and safe for the systems.

When the processes is initiated the system shutdowns normally (shutting down all running service with systemd) and then load the system immediately with the new kernel and starts the services as usual!

So no need to worry about unflushed data or not proper shutdown of a service! It’s like a normal reboot but without a hardware reboot and is a lot faster!
Here is what is required to load a kernel without hardware rebooting your computer box:

  1. kexec-tools
  2. Load the new kernel, initram file and the command line arguments with “kexec”
  3. Start a systemd target – kexec.target

CentOS 7 using kexec to load a new kernel

The real commands only for CentOS 7:

yum install -y kexec-tools
kexec -l /boot/vmlinuz-3.10.0-862.11.6.el7.x86_64 --initrd=/boot/initramfs-3.10.0-862.11.6.el7.x86_64.img --command-line="root=/dev/mapper/centos_srv-root ro crashkernel=auto rd.lvm.lv=centos_srv/root rd.lvm.lv=centos_srv/swap rhgb quiet LANG=en_US.UTF-8"
systemctl start kexec.target

Here is a real world example with all the output:
As you can see it is important to load the initram file and the exact arguments to the kernel. You should take them from the grub 2 configuration – /boot/grub2/grub.cfg
Here is the real output:

[root@srv ~]# yum -y update
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.neterra.net
 * extras: mirrors.neterra.net
 * updates: mirrors.neterra.net
base                                                                                                                                                 | 3.6 kB  00:00:00     
centos-sclo-rh                                                                                                                                       | 3.0 kB  00:00:00     
centos-sclo-sclo                                                                                                                                     | 2.9 kB  00:00:00     
extras                                                                                                                                               | 3.4 kB  00:00:00     
updates                                                                                                                                              | 3.4 kB  00:00:00     
(1/4): extras/7/x86_64/primary_db                                                                                                                    | 187 kB  00:00:00     
(2/4): updates/7/x86_64/primary_db                                                                                                                   | 5.2 MB  00:00:01     
(3/4): centos-sclo-sclo/x86_64/primary_db                                                                                                            | 292 kB  00:00:01     
(4/4): centos-sclo-rh/x86_64/primary_db                                                                                                              | 3.7 MB  00:00:02     
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-862.11.6.el7 will be installed
---> Package kernel-headers.x86_64 0:3.10.0-862.3.2.el7 will be updated
---> Package kernel-headers.x86_64 0:3.10.0-862.11.6.el7 will be an update
---> Package kernel-tools.x86_64 0:3.10.0-862.3.2.el7 will be updated
---> Package kernel-tools.x86_64 0:3.10.0-862.11.6.el7 will be an update
---> Package kernel-tools-libs.x86_64 0:3.10.0-862.3.2.el7 will be updated
---> Package kernel-tools-libs.x86_64 0:3.10.0-862.11.6.el7 will be an update
....
....
[root@srv ~]# yum install -y kexec-tools
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.neterra.net
 * extras: mirrors.neterra.net
 * updates: mirrors.neterra.net
Package kexec-tools-2.0.15-13.el7.x86_64 already installed and latest version
Nothing to do

So we performed an update and there was a new kernel kernel.x86_64 0:3.10.0-862.11.6.el7, which we would like to load without hardware reboot.
Here is our new kernel in “/boot”

[root@srv ~]# ls -altr /boot/
total 171812
-rw-------.  1 root root  3228420 22 Aug  2017 System.map-3.10.0-693.el7.x86_64
-rw-r--r--.  1 root root   140894 22 Aug  2017 config-3.10.0-693.el7.x86_64
-rw-r--r--.  1 root root      166 22 Aug  2017 .vmlinuz-3.10.0-693.el7.x86_64.hmac
-rwxr-xr-x.  1 root root  5877760 22 Aug  2017 vmlinuz-3.10.0-693.el7.x86_64
-rw-r--r--.  1 root root   293027 22 Aug  2017 symvers-3.10.0-693.el7.x86_64.gz
drwxr-xr-x.  3 root root       17 20 Feb  2018 efi
drwxr-xr-x.  2 root root       27 20 Feb  2018 grub
-rw-r--r--.  1 root root   611343 20 Feb  2018 initrd-plymouth.img
-rw-------.  1 root root 51315067 20 Feb  2018 initramfs-0-rescue-cc7889764e86441b8d1eb54e29e81a91.img
-rwxr-xr-x.  1 root root  5877760 20 Feb  2018 vmlinuz-0-rescue-cc7889764e86441b8d1eb54e29e81a91
-rw-------.  1 root root  3409912 21 May 23,50 System.map-3.10.0-862.3.2.el7.x86_64
-rw-r--r--.  1 root root   147823 21 May 23,50 config-3.10.0-862.3.2.el7.x86_64
-rw-r--r--.  1 root root      170 21 May 23,50 .vmlinuz-3.10.0-862.3.2.el7.x86_64.hmac
-rwxr-xr-x.  1 root root  6228832 21 May 23,50 vmlinuz-3.10.0-862.3.2.el7.x86_64
-rw-r--r--.  1 root root   304943 21 May 23,52 symvers-3.10.0-862.3.2.el7.x86_64.gz
dr-xr-xr-x. 17 root root      224 14 Jun  7,18 ..
-rw-------.  1 root root 12997841 14 Jun  7,19 initramfs-3.10.0-693.el7.x86_64kdump.img
-rw-------.  1 root root 20771492 14 Jun  7,20 initramfs-3.10.0-693.el7.x86_64.img
-rw-------.  1 root root 13007444 14 Jun  7,23 initramfs-3.10.0-862.3.2.el7.x86_64kdump.img
-rw-r--r--.  1 root root   147859 14 Aug 22,02 config-3.10.0-862.11.6.el7.x86_64
-rw-------.  1 root root  3414344 14 Aug 22,02 System.map-3.10.0-862.11.6.el7.x86_64
-rw-r--r--.  1 root root      171 14 Aug 22,02 .vmlinuz-3.10.0-862.11.6.el7.x86_64.hmac
-rwxr-xr-x.  1 root root  6242208 14 Aug 22,02 vmlinuz-3.10.0-862.11.6.el7.x86_64
-rw-r--r--.  1 root root   305158 14 Aug 22,05 symvers-3.10.0-862.11.6.el7.x86_64.gz
-rw-------.  1 root root 20774393  5 Sep 15,20 initramfs-3.10.0-862.11.6.el7.x86_64.img
drwx------.  5 root root       97  5 Sep 15,20 grub2
dr-xr-xr-x.  5 root root     4096  5 Sep 15,21 .
-rw-------.  1 root root 20782404  5 Sep 15,21 initramfs-3.10.0-862.3.2.el7.x86_64.img

Now we know the kernel and initram file names we just check the kernel arguments in the kernel, load them with kexec and start an systemd target to load the new kernel:

[root@srv ~]# grep vmlinuz-3.10.0-862.11.6.el7.x86_64 /boot/grub2/grub.cfg 
        linux16 /vmlinuz-3.10.0-862.11.6.el7.x86_64 root=/dev/mapper/centos_srv-root ro crashkernel=auto rd.lvm.lv=centos_srv/root rd.lvm.lv=centos_srv/swap rhgb quiet LANG=en_US.UTF-8
[root@srv ~]# kexec -l /boot/vmlinuz-3.10.0-862.11.6.el7.x86_64 --initrd=/boot/initramfs-3.10.0-862.11.6.el7.x86_64.img --command-line="root=/dev/mapper/centos_srv-root ro crashkernel=auto rd.lvm.lv=centos_srv/root rd.lvm.lv=centos_srv/swap rhgb quiet LANG=en_US.UTF-8"
[root@srv ~]# systemctl start kexec.target
Connection to srv closed by remote host.
Connection to srv closed.

As you can see systemd performs a normal shutdown of all services and targets.

main menu
Normal Shutdown

The ssh connection is immediately closed because the reboot is initiated.
After 10-15 seconds our host is alive and the new kernel is loaded successfully:

root@test ~ $ ssh root@srv
root@srv's password: 
Last login: Wed Sep  5 15:16:08 2018 from test
[root@srv ~]# uname -a
Linux srv.local 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@srv ~]# 

Because we do not wanted to mess up the two output from different linux distros in one article we decided to split it in two separate ones, so here is the one for Ubuntu 16/18 LTS – “Ubuntu 16/18 LTS – load a new kernel without rebooting the server