Linux Trace Tool lttng on Raspbian: Kernel tracer not available - lttng

I have installed lttng on my Raspbian running on a Raspberry Pi 3 Model B+.
I get the following error when following a first demo from the website (as root):
# lttng create my-kernel-session --output=/tmp/my-kernel-trace
Spawning a session daemon
Session my-kernel-session created.
Traces will be written in /tmp/my-kernel-trace
A process is started correctly I assume:
# ps aux | grep lttng-sessiond
root 601 0.0 0.5 129320 5404 ? Ssl 12:00 0:00 lttng-sessiond --daemonize
root 652 0.0 0.0 4372 572 pts/0 S+ 12:30 0:00 grep lttng-sessiond
The following command returns an error:
# lttng list --kernel
Error: Unable to list kernel events: Kernel tracer not available
Error: Command error
Note that the following command does not list anything:
# lsmod | grep lttng
#
Are the lttng kernel modules not loaded? Is this the cause of the problem?
By the way, I am able to trace an application as explained in https://lttng.org/docs/v2.9/#doc-tracing-your-own-user-application.
I have installed lttng following the Debian installation:
# apt-get install lttng-modules-dkms
# apt-get install liblttng-ust-dev
# apt-get install lttng-tools
# apt-get install liblttng-ust-agent-java
# apt-get install python3-lttngust
And the following is installed:
# dpkg -l | grep lttng
ii liblttng-ctl0:armhf 2.9.3-1 armhf LTTng control and utility library
ii liblttng-ust-agent-java 2.9.0-2+deb9u1 all LTTng 2.0 Userspace Tracer (Java agent library)
ii liblttng-ust-agent-java-jni:armhf 2.9.0-2+deb9u1 armhf LTTng 2.0 Userspace Tracer (Java agent JNI interface)
ii liblttng-ust-ctl2:armhf 2.9.0-2+deb9u1 armhf LTTng 2.0 Userspace Tracer (trace control library)
ii liblttng-ust-dev:armhf 2.9.0-2+deb9u1 armhf LTTng 2.0 Userspace Tracer (development files)
ii liblttng-ust-java 2.9.0-2+deb9u1 all LTTng 2.0 Userspace Tracer (Java support library)
ii liblttng-ust-java-jni:armhf 2.9.0-2+deb9u1 armhf LTTng 2.0 Userspace Tracer (JNI interface)
ii liblttng-ust-python-agent0:armhf 2.9.0-2+deb9u1 armhf LTTng 2.0 Userspace Tracer (Python agent native library)
ii liblttng-ust0:armhf 2.9.0-2+deb9u1 armhf LTTng 2.0 Userspace Tracer (tracing libraries)
ii lttng-modules-dkms 2.9.0-1 all Linux Trace Toolkit (LTTng) kernel modules (DKMS)
ii lttng-tools 2.9.3-1 armhf LTTng control and utility programs
ii python3-lttngust 2.9.0-2+deb9u1 all LTTng 2.0 Userspace Tracer (Python 3 UST agent)
Some more info on my Linux distribution:
# uname -a
Linux realtimepi 4.14.52-rt34-v7+ #5 SMP PREEMPT RT Wed Aug 1 14:22:59 CEST 2018 armv7l GNU/Linux
And:
# cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Did I incorrectly install lttng, is there a mismatch with my Linux distribution, are the lttng kernel modules not correctly loaded, or is there a different problem?
Thanks,
Bart

From the uname -a output I can see that you are running a PREEMPT RT Linux kernel as you probably know because your hostname is realtimepi.
When you are running a kernel that was not packaged by your distribution you can't simply install the lttng-modules kernel modules as the Linux kernel header files installed on your machine would not match the ones expected by the modules package.
To use the lttng-modules, you will need to compile them from source. Have a look at the documentation on that subject: https://lttng.org/docs/v2.10/#doc-building-from-source. In your case, i believe you only need to build the modules from source.
Make sure you uninstall the lttng-modules-dkms package and then restart the lttng-sessiond process before trying again.

There is a problem with the RT kernel. This causes the following warning when compiling lttng-modules:
depmod: WARNING: /lib/modules/4.14.66-rt40-v7/extra/lttng-tracer.ko needs unknown symbol __migrate_disabled
Although this is reported as a warning, it causes the error.
If you adapt the source code of the lttng-modules 2.10 branch as explained in this bug report and compile lttng-modules again, the warning is absent and the kernel events can be listed.
Thank you fdeslaur for this answer!

Related

Raspberry Pi 3 stretch mailutils segmentation fault

I have a problem when sending email from my Pi.
Recently I upgraded from jessie to stretch.
I want to send email with my Gmail account.
Installed ssmtp and mailutils.
sendmail can send emails.
But mail command always fails.
Mail -V also outputs segmentation fault.
I removed and purged mailutils but no change.
I catched core file and traced with gdb:
GNU gdb (Raspbian 7.7.1+dfsg-5+rpi1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mail...(no debugging symbols found)...done.
warning: core file may not match specified executable file.
[New LWP 1620]
Dwarf Error: wrong version in compilation unit header (is 9661, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/80/04807a641723782e258f53fccb18b50d586940.debug]
Dwarf Error: wrong version in compilation unit header (is -17502, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/c3/90f5fdedf442d80621e7884a8b7661e9c8050f.debug]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Dwarf Error: wrong version in compilation unit header (is 30469, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/44/d64b51763b6272bc47bd01723b6bdf68f38a1c.debug]
Dwarf Error: wrong version in compilation unit header (is -25664, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/09/4b30e8c4ded4dca627b8adf5e6324125084005.debug]
Dwarf Error: wrong version in compilation unit header (is -27107, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/81/ceb8fe32848c140c8a3d1741242c6a996bdb0d.debug]
Dwarf Error: wrong version in compilation unit header (is -31079, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/e5/8601123ae22d2f43220005658f6cc8a9ad89f5.debug]
Core was generated by `mail -V'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x76277654 in nettle_yarrow256_update ()
from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
(gdb)
#0 0x76277654 in nettle_yarrow256_update ()
from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
(gdb) bt
Cannot access memory at address 0x0
#0 0x76277654 in nettle_yarrow256_update ()
from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
#1 0x7610bf6c in ?? () from /usr/lib/arm-linux-gnueabihf/libgnutls-deb0.so.28
Cannot access memory at address 0x0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) frame 0
#0 0x76277654 in nettle_yarrow256_update ()
from /usr/lib/arm-linux-gnueabihf/libnettle.so.6
(gdb) frame 1
#1 0x7610bf6c in ?? () from /usr/lib/arm-linux-gnueabihf/libgnutls-deb0.so.28
(gdb)
:~ $ dpkg -l | grep mailutils
ii libmailutils5:armhf 1:3.1.1-1 armhf GNU Mail abstraction library
ii mailutils 1:3.1.1-1 armhf GNU mailutils utilities for handling mail
ii mailutils-common 1:3.1.1-1 all Common files for GNU mailutils
:~ $ dpkg -l | grep libnettle
ii libnettle4:armhf 2.7.1-5+deb8u2 armhf low level cryptographic library (symmetric and one-way
cryptos)
ii libnettle6:armhf 3.3-1+deb9u1 armhf low level cryptographic library (symmetric and one-way
cryptos)
: sudo apt-cache policy mailutils
mailutils:
installed version: 1:3.1.1-1
candidate: 1:3.1.1-1
version table:
*** 1:3.1.1-1 500
500 http://ftp.jaist.ac.jp/raspbian stretch/main armhf Packages
100 /var/lib/dpkg/status
The latest mailutils version is 3.14.

Issue of "Compiler lacks asm-goto support" with CentOS8+gcc 8.3.1

I have installed CentOS 8.2.2004 minimal onto my PC, using a USB stick.
This PC which has no Internet connection, only has a TP-LINK TL-WN725N USB WiFi dongle , so I have to install linux driver for it. I went to TP-LINK website and downloaded the linux driver(https://static.tp-link.com/2018/201802/20180227/TL-WN725N_V3_Linux.zip) wants to compile/build/install it so make my PC can connect to Internet by this Wifi dongle. However, i met below compiler error:
arch/x86/Makefile:184: *** Compiler lacks asm-goto support.. Stop.
make: *** [Makefile:1367: modules] Error 2
Original CentOS 8.2.2004 minimal has no gcc/make/kernel dev installed, so I have to install them separately by rpm, below are what I have installed:
rpm -qa|grep kernel
kernel-tools-libs-4.18.0-193.el8.x86_64
kernel-modules-4.18.0-193.el8.x86_64
kernel-tools-4.18.0-193.el8.x86_64
kernel-4.18.0-193.el8.x86_64
kernel-core-4.18.0-193.el8.x86_64
kernel-devel-4.18.0-193.el8.x86_64
rpm -qa|grep gcc
gcc-8.3.1-5.el8.0.2.x86_64
gcc-toolset-9-runtime-9.0-4.el8.x86_64
libgcc-8.3.1-5.el8.0.2.x86_64
gcc-c++-8.3.1-5.el8.0.2.x86_64
rpm -qa|grep make
cmake-3.11.4-7.el8.x86_64
automake-1.16.1-6.el8.noarch
make-4.2.1-10.el8.x86_64
as --version
GNU assembler version 2.30-73.el8
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-redhat-linux'.
uname -r
4.18.0-193.el8.x86_64
cat /proc/version
Linux vrsion 4.18.0-193.el8.x86_64(mockbuild#kbuilder.bsys.centos.org)(gcc version 8.3.1 20191121(Red Hat 8.3.1-5)(GCC))#1 SMP Fri May 8 10:59:10 UTC 2020
What's wrong?
Hoping someone can help me out.
Thanks
You are probably missing the elfutils-libelf-devel package.
This package is from the baseos but isn't always needed. You will likely need it for out of tree kernel modules compilation.

Exec format error 32-bit executable Windows Subsystem for Linux?

When I try to execute a 32-bit file compiled with gcc -m32 main.c -o main on Windows Subsystem for Linux, I get the following error: bash: ./main: cannot execute binary file: Exec format error.
If I compile it without -m32 it runs.
Any solution for running 32-bit executable on WSL?
QEMU and binfmt support light the way :)
https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520
After reading that the WSLInterop between WSL and Windows processes used binfmt, I was tinkering with QEMU to try some ARM development, and incidentally discovered how to get 32-bit support working.
Edit: requires "Fall Creators Update", 1709, build 16299 or newer
Install qemu and binfmt config:
sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
You'll need to reactivate binfmt support every time you start WSL:
sudo service binfmt-support start
Enable i386 architecture packages:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc:i386
Try it out:
$ file /usr/bin/gcc-5
/usr/bin/gcc-5: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=2637bb7cb85f8f12b40f03cd015d404930c3c790, stripped
$ /usr/bin/gcc-5 --version
gcc-5 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc helloworld.c -o helloworld
$ ./helloworld
Hello, world!
$ file helloworld
helloworld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=3a0c7be5c6a8d45613e4ef2b7b3474df6224a5da, not stripped
And to prove it really was working, disable i386 support and try again:
$ sudo service binfmt-support stop
* Disabling additional executable binary formats binfmt-support [ OK ]
$ ./helloworld
-bash: ./helloworld: cannot execute binary file: Exec format error
32-bit ELF support isn't provided by WSL (yet). There doesn't seem to be any progress since the UserVoice was raised - you are out luck.
See UserVoice: Please add 32 bit ELF support to the kernel and Support for 32-bit i386 ELF binaries.
If possible, switch to a real Linux ;-)
Since this was originally posted, the support has been available on WSL2 which does support real Linux kernel! So that should be the preferred way.
As noted in the linked github issue, there's also qemu-user which can be used if WSL1 is still used.
WSL2 runs in a real virtual machine using a real Linux kernel, therefore it's actually possible to do anything a Linux VM can do, including running 32-bit code. Just install 32-bit libs by running
sudo dpkg --add-architecture i386
sudo apt-get update
For more information read
Announcing WSL 2
WSL 2 FAQ

FTDI library error on ARMv7

I have a router Asus RT-AC68R with 32GB memory pen mounted to /opt. On it is installed entware including all the tools to build programs natively on the platform ARMv7. Router use TomatoUSB firmware.
I wrote a program to support the module based on the chip FT245 connected via USB to the router. The program compiled on Linux x86_64 and it works correctly on a standard Linux PC. It was - of course - necessary installing library supplied by the manufacturer (FTDI). The manufacturer provides these libraries for various platforms, including the ARMv7 versions soft and hard float. On router I installed library hard float.
These libraries are HERE
So I'm trying to compile the program, prior to the installation of the pen FTDI libraries, according to the documentation. Unfortunately, after starting the program an library error occurs.
Below the way I compile this program (named arco) and the result of running this program on my ARMv7 based router.
root#asus:/opt# gcc -Wl,-rpath=/opt/usr/local/lib -Wl,--dynamic-linker=/opt/lib/ld-linux.so.3 -L/opt/usr/local/lib -O2 -pipe -march=armv7-a -mtune=cortex-a9 -fno-caller-saves -mfloat-abi=soft -l ftd2xx arco.c -o arco
root#asus:/opt# ./arco
./arco: error while loading shared libraries: /opt/usr/local/lib/libftd2xx.so: internal error
Additional information about my dev environment:
root#asus:/opt/FTDI# echo $PATH
/opt/bin:/opt/sbin:/opt/bin:/opt/sbin:/bin:/usr/bin:/sbin:/usr/sbin:/home/root:/mmc/sbin:/mmc/bin:/mmc/usr/sbin:/mmc/usr/bin:/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin:
root#asus:/opt/FTDI# echo $LD_LIBRARY_PATH
/lib:/usr/lib:/usr/local/lib:/opt/lib:/opt/usr/lib:/opt/include
root#asus:/opt/FTDI# opkg list-installed|grep gcc
gcc - 5.4.0-1
libgcc - 5.4.0-5
root#asus:/opt# uname -a
Linux asus 2.6.36.4brcmarm #5 SMP PREEMPT Tue Aug 16 22:49:47 CEST 2016 armv7l GNU/Linux
I am fairly new when it comes to platform ARMv7 but maybe there is something in compilation options I use:
-mfloat-abi=soft
a library installed is hard-float. I do not know if this could be the reason so expect council colleagues.
Thank you in advance for your answers!

Booting u-boot in Mac OS X's qemu

I'm trying to build u-boot, and run it in qemu on Mac OS X.
I found this site, and followed the instructions:
http://imvoid.wordpress.com/2013/05/17/booting-uboot-in-qemu/
For cross compilation on Mac OS X, I could build the tools - How to make ARM cross compilation on Mac OS X (error: invalid listing option `r' - cross compiling error)
For u-boot, I tried the newest edition (2014) that causes core dump, and some earlier version (2010) that doesn't compile, so I used the 2013/10 version (https://dl.dropboxusercontent.com/u/1234/2014/u-boot-2013.10.tar.bz2) to get the uboot.bin.
However, when I run the binary with qemu-system-arm -M versatilepb -m 128M -nographic -kernel u-boot.bin;, there is no crash, but I see nothing from the screen.
What might be wrong? I uploaded the binary.
https://dl.dropboxusercontent.com/u/1234/2014/u-boot.bin
And the 2014 version that crashes.
https://dl.dropboxusercontent.com/u/1234/2014/u-boot_2014.bin
Try using the ELF format file u-boot, instead of u-boot.bin.
$ qemu-system-arm -M versatilepb -m 128M -nographic -kernel u-boot
U-Boot 2014.10-rc2-00312-g9169305 (Oct 06 2014 - 20:43:26)
DRAM: 128 MiB
WARNING: Caches not enabled
Flash: Flash protect error at address 37ec0000
Flash protect error at address 37fc0000
64 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: SMC91111-0
Warning: SMC91111-0 using MAC address from net device
Warning: Your board does not use generic board. Please read
doc/README.generic-board and take action. Boards not
upgraded by the late 2014 may break or be removed.
VersatilePB #
I built u-boot commit 91693055995733e268874ae75568ae316233e116 on my OS X 10.9.5 system. I used the ARM toolchain binaries available here. Untar gcc-arm-none-eabi-4_8-2014q3-20140805-mac.tar.bz2 anywhere (e.g. $HOME)
$ git clone http://git.denx.de/u-boot.git
$ cd u-boot
$ make versatilepb_config
$ make CROSS_COMPILE=~/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-
I used Qemu from Homebrew.
$ qemu-system-arm --version
QEMU emulator version 2.1.2, Copyright (c) 2003-2008 Fabrice Bellard

Resources