You are not logged in.
So I'm trying to obtain a vmlinux image of the vanilla kernel for debugging a crash dump, but I keep getting errors.
I used "dd if=/boot/vmlinuz-linux bs=1 skip=5337607 | zcat > vmlinux " to try and extract the vmlinux file, but it fails with the following error code:
~ > dd if=/boot/vmlinuz-linux bs=1 skip=5337607 | zcat > vmlinux
gzip: stdin: header checksum 0xb238 != computed checksum 0xba3e
I've tried with the -f and -n flag for zcat, but it still didn't work even then. Trying this with linux-zen with the proper values also gives the same error.
Help would be appreciated.
Last edited by HotDogEnemy (2021-08-08 20:11:49)
Offline
Where does the offset come from?
Try https://github.com/torvalds/linux/blob/ … ct-vmlinux
nb. that the uncompressed image will probably not contain the debug symbols and you'll not be able to create the System.map w/ https://github.com/torvalds/linux/blob/ … s/mksysmap
Offline
~ > od -t x1 -A d /boot/vmlinuz-linux | grep "1f 8b 08"
5337600 4b 43 46 47 5f 53 54 1f 8b 08 02 03 94 3c c9 72
5337600 + 7 gives the offset, since the 1f 8b 08 string starts after 8 positions from the 5337600.
If the uncompressed image does not contain the debug symbols, how should I go about creating the system.map? It's my first time diving into this topic so I'm lost.
Offline
The kernel is rather not gzip compressed… I guess you googled hat command and found an entry from errr… 2007?
If the uncompressed image does not contain the debug symbols
You need a kernel image that still has them.
If you built the kernel yourself it's in the source directory, https://wiki.archlinux.org/title/Kdump
Offline
So I'm following this archwiki page ( https://wiki.archlinux.org/title/Kernel … ild_System ) to compile the default kernel to have vmlinux in it, is commenting the following lines in the PKGBUILD all I have to do?:
echo "Stripping vmlinux..."
strip -v $STRIP_STATIC "$builddir/vmlinux"
Last edited by HotDogEnemy (2021-08-08 22:07:05)
Offline
Is there anything recorded in the journal for the issue?
Offline
Nope, the symptoms resemble a kernel panic, keyboard and mouse unresponsive, black screen with faint vertical grey bars and any audio that was playing keeps looping. System LEDs stay on.
Offline
Not stripping will preserve the symbol names.
Have you btw. tried just the regular compressed vmlinuz on a present dump?
(crash is supposd to be able to handle that and I assume we end in some kerne module anyway - which would already narrow the culprit)
Offline
I haven't yet gotten kexec to run on my computer, so I tested it on a vm and generated a crash report on it. Trying to use crash with the vmlinuz-linux file and crash dump results in it giving an error saying "vmlinuz : unsupported file format".
Offline
Then use the previously linked script to extract the uncompressed kernel.
Offline
I checked out the script, but it didn't work- the vmlinux file generated isn't usable by crash, it gives an "unsupported file format error". I tried using the vmlinux at /usr/src/linux, but crash says "crash: vmlinux: no debugging data available". I'm not sure why, the linux-headers and the kernel package are both the same version.
Offline
crash: vmlinux: no debugging data available
The kernel was built either w/o "-g" or it was stripped… try
- options=('!strip')
+ options=('debug' '!strip')
Offline
So, I tried compiling the kernel with the 'debug' option just like you said. The vmlinux that gets installed at /usr/src/linux/vmlinux still gives this error when used with crash:
[root@archlinux ~]# crash /Usr/src/linux/vmlinux /root/crashdump-2021-08-15-02\:54\:01.dump
This is even with the 'debug' line added to the options in the PKGBUILD. The file stats also show that it is not stripped and was created when I compiled and installed the kernel and kernel headers:
~ > file /usr/src/linux/vmlinux
/usr/src/linux/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=e0db7571278672e079794156fc263292cb2a6e3c, not stripped
~ > stat /usr/src/linux/vmlinux
File: /usr/src/linux/vmlinux
Size: 81185808 Blocks: 144008 IO Block: 4096 regular file
Device: 811h/2065d Inode: 6307586 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2021-08-15 02:57:04.383830237 +0530
Modify: 2021-08-14 00:56:20.000000000 +0530
Change: 2021-08-15 02:37:06.825589822 +0530
Birth: 2021-08-15 02:37:06.701587134 +0530
Using the vmlinux generated by using the extract-vmlinux script above also fails with the following output:
[root@archlinux ~]# crash /home/shivodit/vmlinux /root/crashdump-2021-08-15-02\:54\:01.dump
crash 7.3.0
Copyright (C) 2002-2021 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011, 2020-2021 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
an you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
crash: /home/shivodit/vmlinux: no .gnu_debuglink section
crash: /home/shivodit/vmlinux: no debugging data available
However, the vmlinux file in the build directory (~/build/linux/src/archlinux-linux/vmlinux in my case) works flawlessly with crash.
In case you want to see what PKGBUILD I'm using, here it is:
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
pkgbase=linux
pkgver=5.13.9.arch1
pkgrel=1
pkgdesc='Linux'
_srctag=v${pkgver%.*}-${pkgver##*.}
url="https://github.com/archlinux/linux/commits/$_srctag"
arch=(x86_64)
license=(GPL2)
makedepends=(
bc kmod libelf pahole cpio perl tar xz
xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
git
)
options=('debug' '!strip')
_srcname=archlinux-linux
source=(
"$_srcname::git+https://github.com/archlinux/linux?signed#tag=$_srctag"
config # the main kernel config file
)
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
'A2FF3A36AAA56654109064AB19802F8B0D70FC30' # Jan Alexander Steffens (heftig)
'C7E7849466FE2358343588377258734B41C31549' # David Runge <dvzrv@archlinux.org>
)
sha256sums=('SKIP'
'6b3672ffafb1b29bde3eb76dc27d1a41cc2f8349068a6532717c3d4764a2d238')
export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
cd $_srcname
echo "Setting version..."
scripts/setlocalversion --save-scmversion
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
done
echo "Setting config..."
cp ../config .config
make olddefconfig
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
make all
}
_package() {
pkgdesc="The $pkgdesc kernel and modules"
depends=(coreutils kmod initramfs)
optdepends=('crda: to set the correct wireless channels of your country'
'linux-firmware: firmware images needed for some devices')
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
replaces=(virtualbox-guest-modules-arch wireguard-arch)
cd $_srcname
local kernver="$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
echo "Installing boot image..."
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
# remove build and source links
rm "$modulesdir"/{source,build}
}
_package-headers() {
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
depends=(pahole)
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing build files..."
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
cp -t "$builddir" -a scripts
# add objtool for external module building and enabled VALIDATION_STACK option
install -Dt "$builddir/tools/objtool" tools/objtool/objtool
# add xfs and shmem for aufs building
mkdir -p "$builddir"/{fs/xfs,mm}
echo "Installing headers..."
cp -t "$builddir" -a include
cp -t "$builddir/arch/x86" -a arch/x86/include
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
# https://bugs.archlinux.org/task/13146
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# https://bugs.archlinux.org/task/20402
install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
# https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
echo "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
done
echo "Removing documentation..."
rm -r "$builddir/Documentation"
echo "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
echo "Stripping build tools..."
local file
while read -rd '' file; do
case "$(file -bi "$file")" in
application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
strip -v $STRIP_STATIC "$file" ;;
application/x-executable\;*) # Binaries
strip -v $STRIP_BINARIES "$file" ;;
application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$file" ;;
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..."
strip -v $STRIP_STATIC "$builddir/vmlinux"
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}
_package-docs() {
pkgdesc="Documentation for the $pkgdesc kernel"
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing documentation..."
local src dst
while read -rd '' src; do
dst="${src#Documentation/}"
dst="$builddir/Documentation/${dst#output/}"
install -Dm644 "$src" "$dst"
done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/share/doc"
ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
}
pkgname=("$pkgbase" "$pkgbase-headers")
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")
_package${_p#$pkgbase}
}"
done
# vim:set ts=8 sts=2 sw=2 et:
Offline