Linux kernel loading in compability mode

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
alex-n3050
Level 1
Level 1
Posts: 26
Joined: Sun Nov 22, 2015 10:54 pm

Linux kernel loading in compability mode

Post by alex-n3050 » Sun May 27, 2018 9:02 am

Grub menu of Linuxmint 17.3 Installation disk has Linux kernel loading in compability mode menu item.
I want to restore this boot method because it provides high stability to the system as a whole with the hardware environment I'm using.
Who can send me an example of a grub.cfg file with implementation of this function?

User avatar
JerryF
Level 11
Level 11
Posts: 3772
Joined: Mon Jun 08, 2015 1:23 pm
Location: Rhode Island, USA

Re: Linux kernel loading in compability mode

Post by JerryF » Sun May 27, 2018 1:30 pm

I've copied and pasted two files, grub.cfg and grub

grub.cfg:

Code: Select all

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
else
  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=hidden
    set timeout=0
  # Fallback hidden-timeout code in case the timeout_style feature is
  # unavailable.
  elif sleep --interruptible 0 ; then
    set timeout=0
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_mint_theme ###
set menu_color_normal=white/black
set menu_color_highlight=white/light-gray
### END /etc/grub.d/06_mint_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
	set gfxpayload="${1}"
	if [ "${1}" = "keep" ]; then
		set vt_handoff=vt.handoff=7
	else
		set vt_handoff=
	fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
menuentry 'Linux Mint 18.3 Cinnamon 64-bit' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-4f61d93f-3512-42fd-8a5d-cdcdd695f5ad' {
	recordfail
	load_video
	gfxmode $linux_gfx_mode
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
	else
	  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
	fi
        linux	/boot/vmlinuz-4.4.0-122-generic root=UUID=4f61d93f-3512-42fd-8a5d-cdcdd695f5ad ro  quiet splash $vt_handoff
	initrd	/boot/initrd.img-4.4.0-122-generic
}
submenu 'Advanced options for Linux Mint 18.3 Cinnamon 64-bit' $menuentry_id_option 'gnulinux-advanced-4f61d93f-3512-42fd-8a5d-cdcdd695f5ad' {
	menuentry 'Linux Mint 18.3 Cinnamon 64-bit, with Linux 4.4.0-122-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-122-generic-advanced-4f61d93f-3512-42fd-8a5d-cdcdd695f5ad' {
		recordfail
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
		else
		  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
		fi
		echo	'Loading Linux 4.4.0-122-generic ...'
	        linux	/boot/vmlinuz-4.4.0-122-generic root=UUID=4f61d93f-3512-42fd-8a5d-cdcdd695f5ad ro  quiet splash $vt_handoff
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.4.0-122-generic
	}
	menuentry 'Linux Mint 18.3 Cinnamon 64-bit, with Linux 4.4.0-122-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-122-generic-init-upstart-4f61d93f-3512-42fd-8a5d-cdcdd695f5ad' {
		recordfail
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
		else
		  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
		fi
		echo	'Loading Linux 4.4.0-122-generic ...'
	        linux	/boot/vmlinuz-4.4.0-122-generic root=UUID=4f61d93f-3512-42fd-8a5d-cdcdd695f5ad ro  quiet splash $vt_handoff init=/sbin/upstart
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.4.0-122-generic
	}
	menuentry 'Linux Mint 18.3 Cinnamon 64-bit, with Linux 4.4.0-122-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-122-generic-recovery-4f61d93f-3512-42fd-8a5d-cdcdd695f5ad' {
		recordfail
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos1'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
		else
		  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
		fi
		echo	'Loading Linux 4.4.0-122-generic ...'
	        linux	/boot/vmlinuz-4.4.0-122-generic root=UUID=4f61d93f-3512-42fd-8a5d-cdcdd695f5ad ro recovery nomodeset 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.4.0-122-generic
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/10_lupin ###
### END /etc/grub.d/10_lupin ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry 'Memory test (memtest86+)' {
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
	else
	  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
	fi
	knetbsd	/boot/memtest86+.elf
}
menuentry 'Memory test (memtest86+, serial console 115200)' {
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
	else
	  search --no-floppy --fs-uuid --set=root 4f61d93f-3512-42fd-8a5d-cdcdd695f5ad
	fi
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
grub:

Code: Select all

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
I, and others, don't recommend editing the grub.cfg file. You'll want to edit the grub file.

Then run

Code: Select all

sudo update-grub
IF your problem has been solved, please edit your original post and add [SOLVED] to the beginning of the Subject Line. It helps other members.

fabien85
Level 7
Level 7
Posts: 1544
Joined: Tue Mar 11, 2014 4:30 pm

Re: Linux kernel loading in compability mode

Post by fabien85 » Sun May 27, 2018 3:38 pm

Just a precision to complement : the second file is located at /etc/default/grub

Any change you make directly to /boot/grub/grub.cfg will be overwritten next time grub is updated. So it's best to edit /etc/default/grub for changing kernel options.

User avatar
JOPETA
Level 15
Level 15
Posts: 5665
Joined: Thu Nov 20, 2014 6:10 am
Location: En un lugar de cuyo nombre no quiero acordarme

Re: Linux kernel loading in compability mode

Post by JOPETA » Thu May 31, 2018 6:55 am

alex-n3050 wrote:
Sun May 27, 2018 9:02 am
Grub menu of Linuxmint 17.3 Installation disk has Linux kernel loading in compability mode menu item.
I want to restore this boot method because it provides high stability to the system as a whole with the hardware environment I'm using.
Who can send me an example of a grub.cfg file with implementation of this function?
You can find it mounting Linux Mint ISO file and looking into /boot/grub/grub.cfg file (cat /boot/grub/grub.cfg)

Any way, those parameters change the way the kernel is loaded ( xforcevesa , noapic, noacpi, nosplash= delete "quite splah" and a thousand more) and are not recommend to be used once the system is installed w/o knowing your real problem.

You can try one or more by editing GRUB menu default option (press E or TAB key) > look for kernel line>write them after "ro" (deleting "quite splash" is the same as "nosplash" > press F10 and see what happens when booting . Do not change nothing before...as you did here.
alex-n3050 wrote:
Wed May 23, 2018 9:11 pm
When I booted the Linux kernel, I set the following options:
GRUB_CMDLINE_LINUX_DEFAULT="hibernate=no pnpacpi=off pcie_aspm=off pcie_port_pm=off acpi=off apm=off powersave=off libata=noacpi ipv6.disable=1"
kernel can't load properly with such things in /etc/default/grub. If you want stability don't do that.

You'd better post replies in topics you have opened. :(

Edited
Last edited by JOPETA on Thu Jun 07, 2018 3:27 am, edited 3 times in total.
Ni cola de león ni cabeza de ratón, prefiero ser diente de ajo.( J. Krahe)

alex-n3050
Level 1
Level 1
Posts: 26
Joined: Sun Nov 22, 2015 10:54 pm

Re: Linux kernel loading in compability mode

Post by alex-n3050 » Sat Jun 02, 2018 8:30 am

How do I build the linux kernel in compatibility mode to boot into this mode?
I installed Linux kernel sources version 4.15.0-22 using Synaptic.
They were installed from package linux-source-4.15.0 in the /usr/src/linux-source-4.15.0 directory,
creating a directory tree with an unzipped source archive.
What to do after that? How to build them correctly?

/usr/src/linux-source-4.15.0 $ ls -al
drwxr-xr-x 4 root root 4096 май 29 22:39 .
drwxr-xr-x 11 root root 4096 июн 1 20:12 ..
drwxr-xr-x 12 root root 4096 май 29 22:39 debian
drwxr-xr-x 9 root root 4096 май 29 22:39 debian.hwe-edge
-rw-r--r-- 1 root root 129985672 май 18 21:56 linux-source-4.15.0.tar.bz2

/usr/src/linux-source-4.15.0 $ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"
Last edited by alex-n3050 on Tue Jun 05, 2018 5:22 am, edited 1 time in total.

fabien85
Level 7
Level 7
Posts: 1544
Joined: Tue Mar 11, 2014 4:30 pm

Re: Linux kernel loading in compability mode

Post by fabien85 » Sun Jun 03, 2018 9:30 am

You dont ned to build your on kernel to do this.
It's as simple as this :
1) Edit /etc/default/grub as root

Code: Select all

sudo nano /etc/default/grub
(or use your preferred editor)
2) locate the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
and add nomodeset so that the line becomes GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
3) Update grub

Code: Select all

sudo update-grub
4) Reboot and be happy

alex-n3050
Level 1
Level 1
Posts: 26
Joined: Sun Nov 22, 2015 10:54 pm

Re: Linux kernel loading in compability mode

Post by alex-n3050 » Mon Jun 04, 2018 11:18 pm

I know this solution, but I prefer to build a new kernel from the package source code from the repository, but I don't know how to do it.
I don't like 'nomodeset' because I can't use the maximum resolution of my LCD display.

fabien85
Level 7
Level 7
Posts: 1544
Joined: Tue Mar 11, 2014 4:30 pm

Re: Linux kernel loading in compability mode

Post by fabien85 » Tue Jun 05, 2018 5:52 am

I dont know what you are looking for then.
The compatibility mode that you see on a live USB is exactly this passing of the nomodeset option. There is no specific kernel for that. If you want to check, boot a live USB, highlight the compatibility mode option in the grub menu, press e to view the details (and possibly edit them), go to the line starting with "linux .." to view the options passed to the kernel.

alex-n3050
Level 1
Level 1
Posts: 26
Joined: Sun Nov 22, 2015 10:54 pm

Re: Linux kernel loading in compability mode

Post by alex-n3050 » Wed Jun 06, 2018 7:51 pm

Thanks, Your advice helped.

alex-n3050
Level 1
Level 1
Posts: 26
Joined: Sun Nov 22, 2015 10:54 pm

Re: Linux kernel loading in compability mode

Post by alex-n3050 » Wed Jun 06, 2018 9:48 pm

Maybe you can help me with this:
viewtopic.php?f=53&t=270664&p=1477708#p1477708

Post Reply

Return to “Installation & Boot”