# Newly compiled kernel won't boot

## azp

I upgraded my kernel to the 4.13-version as per the ordinary steps: make olddefconfig, based on my already running kernel, and then make -j9 all && make modules_install firmware_install install && grub-mkconfig ... 

To my surprise, the kernel didn't boot, it just gets stuck at "Booting 4.13.8". So I booted the old kernel, 4.12.10, and tried recompiling the new kernel again. It still didn't work. I then tried re-compiling the 4.12.10 kernel, and after installing that, surprisingly, it didn't boot anymore. So it seems that something is going wrong either with the compilation or the installation. 

I'm not getting any output at all, just the kernel version and that it's about to boot, but nothing more happens. Normally I'm running with the 'quiet' flag, but even when removing that I'm not getting any debug output.

How can I debug what's going wrong? Any pointers?

GCC version is 6.4.0. I haven't changed any use flags for GCC compared to when the kernel booted successfully.

----------

## comprookie2000

Did you try booting into single user mode?

I put a S instead of single on the kernel line for some reason, can't remember why.

----------

## eccerr0r

Seems a bunch of people are complaining about EFI systems lately, including me?  I'm not sure if your kernel is actually hanging or is it just not printing to the screen (and eventually completes boot?)

Curious, I vaguely recall that simply adding 'single' in the kernel command line no longer works, even for openrc which uses softlevel=sysinit or something like that to do an abbreviated boot sequence?  I haven't tried in a long time but recalled at one point that specifying 'single' didn't work...

----------

## azp

I'm running with systemd on a non-UEFI system. Just a plain old BIOS.

The weird thing for me is that if I recompiled a properly booting kernel, it stopped booting successfully. I haven't tried checking for differences between them, before and after re-compile though. But I figured it must be GCC-related, or some basic package that the kernel is depending on. Like glibc?

I haven't tried single-user mode (hadn't heard of it before), perhaps I should see if it might get further.

As it is now, it's like it gets stuck unpacking the kernel or something, NOTHING happens after the grub boot line runs. I've tried waiting for hours, it never gets anywhere.

Is it possible that it has anything to do with the stack smash protector? I'm not sure if that has been enabled before or not? I'm running with only -O2 optimizations.

```
root@skare$ emerge --info gcc systemd

Portage 2.3.13 (python 3.5.4-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-6.4.0, glibc-2.25-r9, 4.11.7-gentoo x86_64)

=================================================================

                         System Settings

=================================================================

System uname: Linux-4.11.7-gentoo-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.4.1

KiB Mem:    12303176 total,    683428 free

KiB Swap:   12418208 total,  12418208 free

Timestamp of repository gentoo: Sun, 05 Nov 2017 08:30:01 +0000

Head commit of repository gentoo: 25577f7704e8fa8df6b1dabe7c51a5819bb3e687

sh bash 4.4_p12

ld GNU ld (Gentoo 2.29.1 p2) 2.29.1

ccache version 3.3.4 [disabled]

app-shells/bash:          4.4_p12::gentoo

dev-java/java-config:     2.2.0-r3::gentoo

dev-lang/perl:            5.26.1-r1::gentoo

dev-lang/python:          2.7.14::gentoo, 3.4.6::gentoo, 3.5.4::gentoo, 3.6.3::gentoo

dev-util/ccache:          3.3.4-r1::gentoo

dev-util/cmake:           3.9.4::gentoo

dev-util/pkgconfig:       0.29.2::gentoo

sys-apps/baselayout:      2.4.1-r2::gentoo

sys-apps/openrc:          0.34.5::gentoo

sys-apps/sandbox:         2.12::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.11.6-r2::gentoo, 1.15.1-r1::gentoo

sys-devel/binutils:       2.29.1-r1::gentoo

sys-devel/gcc:            6.4.0::gentoo

sys-devel/gcc-config:     1.9.0::gentoo

sys-devel/libtool:        2.4.6-r4::gentoo

sys-devel/make:           4.2.1-r1::gentoo

sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)

sys-libs/glibc:           2.25-r9::gentoo

Repositories:

AzP

    location: /usr/local/portage

    masters: gentoo

java

    location: /var/lib/layman/java

    sync-type: laymansync

    sync-uri: git://anongit.gentoo.org/proj/java.git

    masters: gentoo

    priority: 50

mva

    location: /var/lib/layman/mva

    sync-type: laymansync

    sync-uri: git://github.com/msva/mva-overlay

    masters: gentoo

    priority: 50

steam-overlay

    location: /var/lib/layman/steam-overlay

    sync-type: laymansync

    sync-uri: git://github.com/anyc/steam-overlay.git

    masters: gentoo

    priority: 50

sunrise

    location: /var/lib/layman/sunrise

    sync-type: laymansync

    sync-uri: git://anongit.gentoo.org/proj/sunrise-reviewed.git

    masters: gentoo

    priority: 50

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: 9999

    sync-rsync-extra-opts: 

Installed sets: @esteam, @system

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="*"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-march=native -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

EMERGE_DEFAULT_OPTS="--jobs=10 --with-bdeps=y --load-average=50 --keep-going"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://mirror.mdfnet.se/gentoo ftp://mirror.mdfnet.se/gentoo"

LANG="en_US.utf8"

LDFLAGS="-Wl,--as-needed"

MAKEOPTS="-j4"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"

PORTAGE_TMPDIR="/var/tmp"

USE="24bpp 256-color 3dnow 3dnowext 64bit S3TC X a52 aac aacplus aalib accessibility acl acpi aio alsa amazon amd64 amr amrnb amrwb apng asf aspell autoipd avahi avi bash-completion bidi binary-drivers bluetooth bookmarks branding btrfs bzip2 c++0x cairo ccache cdda cdr cg cgi clang clangstaticanalyzer cleartype cleartype_hinting cli clutter cmake colord cover coverart cracklib crypt css cue cups curl custom-optimization cxx daap dbus dconf debugger device-mapper devil dga dhclient dirac divx dmx dns dri dri3 drm dts dvd dvdr dvdread emboss encode evo exif f2fs fakevim fam fastcgi fat fbcon ffmpeg firefox flac fluidsynth fontconfig fortran fpm freeimage freerdp ftp fuse g3dvl gaim gd gdbm gdu gflags ggi gif gimp git glamor glew glib glsl glut gmail gmailtimestamps gmedia gnome gnome-keyring gnome-online-accounts gnome-shell gold google gphoto2 gpm gstreamer gtk gtk2 gtk3 gtkhtml gvim gzip h224 h281 h323 howl-compat hpijs hwdb iconv icq icu idn imap inotify introspection iphone ipv6 jabber java java6 jingle jpeg jpeg2k kdrive lame lcms ldap libinput libnotify libsecret libsexy libssh2 libv4l libv4l2 llvm llvm-shared-libs lm_sensors mad madwifi mbox md5sum mdnsresponder-compat mh midi mikmod mime minizip mmxext mng moc mod modplug modules mozembed mozilla moznocompose moznoirc moznomail moznoroaming mozsha1 mozsvg mp2 mp3 mp4 mp4live mpeg msn multimedia musepack musicbrainz nas nautilus ncurses nemesi networkmanager new-hpcups nfsv41 nls nptl nsplugin ntfs ntfsprogs nx ofa ogg openal opencl opencore-amr openexr opengl openmp openssl opensslcrypt optimization pam pango pcntl pcre pdf pdflib perl php pidgin pipechan plasma png pnm policykit pop ppds private-headers pulseaudio pvr python python3 qml qt4 qt5 qtscript quicktime radio raw rdesktop rdp readline realmedia reiser4 reiserfs rtc s3tc samba sasl schroedinger scintilla sdl seccomp secure-delete session sid sip sndfile sockets spell sql sqlite srt sse3 sse4 sse4.1 sse4.2 sse4_1 sse4_2 ssh ssl ssse3 staging startup-notification static-analyzer steamruntime subtitles subversion suid svg system-cairo system-ffmpeg system-harfbuzz system-icu system-jpeg system-libvpx system-llvm system-snappy systemd tcpd telepathy teletext tga theora threads tiff tls tracker transcode truetype udev udisks unicode upcall upnp upower usb user-session v4l v4l2 vaapi valgrind vdpau video videos vim vim-pager vim-syntax vim-with-x vorbis vte vulkan wav wavpack wayland webdav webdav-neon webdav-serf webkit webkit2 webm webp webphoto webstart widgets wifi winbind wma wma-fixed wmf wmp wxwidgets x264 x265 xanim xattr xcb xcomposite xdmcp xext xfs xinerama xkb xml xmp xrandr xv xvid zeitgeist zeroconf zip zlib zoran" ABI_X86="64" ALSA_CARDS="emu10k1 hda_intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="libinput roccat_konextd" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en sv" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="i386 arm x86_64" QEMU_USER_TARGETS="i386 arm x86_64" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================

                        Package Settings

=================================================================

sys-devel/gcc-6.4.0::gentoo was built with the following:

USE="cxx fortran (multilib) nls nptl openmp pch sanitize ssp vtv (-altivec) (-awt) -cilk -debug -doc (-fixed-point) (-gcj) -go -graphite (-hardened) (-jit) (-libssp) -mpx -objc -objc++ -objc-gc -pgo (-pie) -regression-test -vanilla" ABI_X86="(64)"

sys-apps/systemd-235-r1::gentoo was built with the following:

USE="acl curl gcrypt idn kmod lz4 pam policykit seccomp ssl xkb -apparmor -audit -build -cryptsetup -elfutils -gnuefi -http -importd -libidn2 -lzma -nat -qrcode (-selinux) -sysv-utils -test -vanilla" ABI_X86="32 (64) (-x32)"
```

```
root@skare$ eselect profile list

Available profile symlink targets:

  [1]   default/linux/amd64/13.0

  [2]   default/linux/amd64/13.0/selinux

  [3]   default/linux/amd64/13.0/desktop

  [4]   default/linux/amd64/13.0/desktop/gnome

  [5]   default/linux/amd64/13.0/desktop/gnome/systemd *

  [6]   default/linux/amd64/13.0/desktop/plasma

  [7]   default/linux/amd64/13.0/desktop/plasma/systemd

  [8]   default/linux/amd64/13.0/developer

  [9]   default/linux/amd64/13.0/no-multilib

  [10]  default/linux/amd64/13.0/systemd

  [11]  default/linux/amd64/13.0/x32

  [12]  hardened/linux/amd64

  [13]  hardened/linux/amd64/selinux

  [14]  hardened/linux/amd64/no-multilib

  [15]  hardened/linux/amd64/no-multilib/selinux

  [16]  hardened/linux/amd64/x32

  [17]  hardened/linux/musl/amd64

  [18]  hardened/linux/musl/amd64/x32

  [19]  default/linux/uclibc/amd64

  [20]  hardened/linux/uclibc/amd64
```

----------

## mir3x

Check manually grub.conf ?

Maybe it forgot to add init=systemdsomething 

or something else.

Why u used 4.13.8 not 4.13.11 anyway ?

----------

## azp

Single user mode didn't help, it never gets that far. For extra testing, I tried adding it to the properly booting kernel, and there it worked as it should, i.e. I ended up in single user mode.

----------

## azp

 *mir3x wrote:*   

> Check manually grub.conf ?
> 
> Maybe it forgot to add init=systemdsomething 
> 
> or something else.
> ...

 

I've gone through it and nothing weird there. Like I said, entry 1 and entry 2 is exactly the same, but 2 works and 1 doesn't.

```
linux   /boot/vmlinuz-4.11.7-gentoo root=/dev/sdd1 ro init=/usr/lib/systemd/systemd rootfstype=ext4 systemd.show_status=1
```

Regarding the question of .8 vs .11, it doesn't really matter since it doesn't boot anyway. I've tried .13.1, .13.4 and .13.8, as they came out, to no avail.

----------

## mir3x

Ok i got idea, add:

earlyprintk=vga

to boot params

( not sure if it should be 'vga', maybe 'keep', or'tty0')

earlyprintk=[ vga | serial ][,ttyS n [, baudrate ]][,keep]

----------

## azp

I've recompiled a new kernel (4.12.12) with an older working config (4.11.7), using olddefconfig, and suddenly it has started booting. I wonder if there was something wrong with a package or so before, when building the non-working kernels. I've made a diff of the config, and there are only three things changed:

```
  1123 #                                                                               |  1123 #

  1124 # Bus devices                                                                   |  1124 # Bus devices

  1125 #                                                                               |  1125 #

  1126 # CONFIG_CONNECTOR is not set                                                   |  1126 CONFIG_CONNECTOR=y                                                             

       --------------------------------------------------------------------------------|  1127 CONFIG_PROC_EVENTS=y                                                           

  1127 CONFIG_MTD=y                                                                    |  1128 CONFIG_MTD=y
```

and

```
  1466 # CONFIG_DM_DEBUG is not set                                                    |  1467 # CONFIG_DM_DEBUG is not set

  1467 CONFIG_DM_CRYPT=m                                                               |  1468 # CONFIG_DM_CRYPT is not set                                                   

  1468 # CONFIG_DM_SNAPSHOT is not set                                                 |  1469 # CONFIG_DM_SNAPSHOT is not set
```

I'll try rebuilding a kernel without those options to see if it changes anything, otherwise I don't know what has fixed the issue, but I'm glad it's working now.

----------

## eccerr0r

yes, most curious, also binutils needs to be added into the suspect lineup.

Were you using vanilla or gentoo-sources?  Does the other work?

----------

## azp

 *eccerr0r wrote:*   

> yes, most curious, also binutils needs to be added into the suspect lineup.
> 
> Were you using vanilla or gentoo-sources?  Does the other work?

 

I'm using gentoo-sources, and I've never tried using vanilla.

The 4.13 kernel is still not booting, for some reason.

Regardinge the "what fixed the issue", I still don't know. I'm unable to create a 4.12 kernel that doesn't boot, regardless of re-setting the settings above.

----------

## azp

 *azp wrote:*   

>  *eccerr0r wrote:*   yes, most curious, also binutils needs to be added into the suspect lineup.
> 
> Were you using vanilla or gentoo-sources?  Does the other work? 
> 
> I'm using gentoo-sources, and I've never tried using vanilla.
> ...

 

And suddenly, the 4.13.11 just managed to boot! I just tried it this time, after running the 4.12 for a while, just for fun and thought "what the heck". I have no idea why it just worked... Perhaps something in the hardware is about to break? The disk is a fairly new SSD though, so I would be surprised if that is acting up.

The motherboard and the CPU is quite old, I bought it in March in 2009, and I've been meaning to replace it for a while. Perhaps it's about to give up now...

----------

