#Pernel Kanic
1 messages · Page 1 of 1 (latest)
https://pastebin.com/wN0bHZsM genkernel log
https://imgur.com/a/IJBav9W kernel panic
Try extracting busybox from the compiled initrd image and run it with the command ./busybox sh. If it segfaults it confirms that busybox is the problem and not the kernel. Next step is to know how to make it build properly with musl/clang so it doesn't segfault.
Segmentation fault
``` 
i can try to compile with -O2 instead of -O3
but in my main system kernel compiled with -Ofast and works fine
How about the -march flag, do you specify one? (Does clang even support -march; I have zero knowledge on clang.)
By the way, I'm pretty sure others would have already suggested that you use gentoo-kernel or gentoo-kernel-bin instead, although it's still interesting to know how this bug comes up and how it can be fixed.
march native
i have tried to install gentoo-kernel-bin but i have error with portage (compile). However i tested the kernel which compiled on my main system and it's work fine, but module amdgpu doesn't work. I want to compile kernel on this (not my main) system
of course clang supports march lol
😂
seems like the issue here is busybox tho
if it segfaults both when extracted and booting
if init dies your kernel will die
I'm pretty sure
Here are a few more suggestions I can give: First step is to reproduce the segfault error in the busybox package itself. You can compile it temporarily with a different CFLAGS value and not install it in tbe system by using CFLAGS="new values" ebuild /path/to/busybox-version.ebuild clean install. Then go to the image dir in /var/tmp/portage/. Find the compiled busybox and run it with busybox sh. Repeat with different flags yo find what works and what doesn't.
oh yea you said so here
yes this is good troubleshooting
I think it has something to do with -march native. You might want a more conservative value. Maybe disable a few CPU features too, like avx512 maybe?
/var/tmp/portage/sys-apps/busybox-1.36.1/image/bin #
compiled with march=native -O2 -pipe
i can try to compile with the same flags as the kernel
to make sure that this is the problem
march=native -O2 -pipe
is already VERY safe
if you want to confirm konsolebox's hypothesis
do
-march=x86-64
for generic amd64
if it's actually march=native
which happens very rarely
but sometimes
I know some packages that need march=x86-64-v2
"-march=native -ftree-vectorize -Ofast -flto=thin -pipe"
It would be nice if you get to reproduce the segfault too, because that would confirm that you're using the same busybox version or at least has similar set of buggy code. If not, it might be just busybox used by genkernel that gets buggy against musl/clang.
massive ricer flags, I respect it if you know what they do
(I do the same)
but try to debug it with safe flags
xd
/var/tmp/portage/sys-apps/busybox-1.36.1/image/bin # ```
busybox works
with this flags

curious
then why doesnt it work in initramfs
Difference in busybox version probably. I'm sure there's a way to make genkernel use a different version.
#BUSYBOX_CONFIG="/path/to/file"
# NOTE: Since genkernel 3.4.41 the version of
# busybox, lvm, mdadm, ... have been moved to
# /usr/share/genkernel/defaults/software.sh in order to
# reduce the merging you have to do during etc-update.
# You can still override these settings in here.
GKPKG_BUSYBOX_PV="${GKPKG_BUSYBOX_PV:-1.34.1}"
GKPKG_BUSYBOX_DEPS="libxcrypt"
GKPKG_BUSYBOX_SRCTAR="${GKPKG_BUSYBOX_SRCTAR:-${DISTDIR}/busybox-${GKPKG_BUSYBOX_PV}.tar.bz2}"
GKPKG_BUSYBOX_SRCDIR="${GKPKG_BUSYBOX_SRCDIR:-busybox-${GKPKG_BUSYBOX_PV}}"
GKPKG_BUSYBOX_BINPKG="${GKPKG_BUSYBOX_BINPKG:-%%CACHE%%/busybox-${GKPKG_BUSYBOX_PV}-%%ARCH%%.tar.xz}"
i can try to compile 1.34.1
with this flags
but i have only 1.34.1-r2 ebuild
i'll try it
/var/tmp/portage/sys-apps/busybox-1.34.1-r2/image/bin #``` works fine

You can try specifying a different hopefully nonbuggy version with VERSION_BUSYBOX
Or GKPKG_BUSYBOX_PV maybe if it doesn't work.
GKPKG_BUSYBOX_PV=version genkernel ...
i set the 1.36.1 version
i went to rebuild the kernel
it will take about 20 minutes
You can also just rebuild the initrd with genkernel initramfs next time.

exactly
works
ok ill try this with the kernel
i deleted the kernel so im going to compile and test quickly now
i hope amdgpu will load normally
ok not quickly with lto(
initramfs can be used if you already had a full kernel build and install. But if you rebuild your kernel with different settings or compiler, you might want to rerun initramfs again (unless you used all) since it might need to recopy a few updated stuff like modules.
iuse all