LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch
User Name
Password
Arch This Forum is for the discussion of Arch Linux.

Notices


Reply
  Search this Thread
Old 09-11-2018, 08:36 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,898

Rep: Reputation: 55
grub-mkconfig does not get the second Linux OS.


Kernel 4.17.8-1-ARCH

Hi: Im running Arch and Debian at present. I got to boot any of them by running grub-mkconfig from Debian. I want to install a different Linux OS in the Debian partition and hence should run grub-mkconfig from Arch (grub-mkconfig -o /boot/grub/grub.cfg).

Ay, there's the rub! The OS-prober does not get the Debian OS. The os-prober section in /boot/grub/grub.cfg is empty. This file is, maybe, important:
Code:
root@darkstar/etc/default# cat grub
# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=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=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

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

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires to
# set 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"
root@darkstar/etc/default#
However it is essentially the same as the one in the debian partition. Any suggestion? This is irrelevant, but somebody may ask: I always boot in legacy (BIOS compatible) mode and the boot sector is the MBR type. To summarize, Debian and Arch installed on the hard disk up and running, grub-mkconfig run from Debian leaves both OS's ready to use, run from Arch it fails to do so.

This maybe useful:
Code:
root@darkstar/etc/grub.d# v
total 60K
-rwxr-xr-x 1 root root 8.7K Jun 24 19:22 00_header
-rwxr-xr-x 1 root root  11K Jun 24 19:22 10_linux
-rwxr-xr-x 1 root root  11K Jun 24 19:22 20_linux_xen
-rwxr-xr-x 1 root root  12K Jun 24 19:22 30_os-prober
-rwxr-xr-x 1 root root  214 Jun 24 19:22 40_custom
-rwxr-xr-x 1 root root  216 Jun 24 19:22 41_custom
-rw-r--r-- 1 root root  483 Jun 24 19:22 README
root@darkstar/etc/grub.d#

Last edited by stf92; 09-11-2018 at 10:33 PM.
 
Old 09-13-2018, 02:42 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,975
Blog Entries: 7

Rep: Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465
can you run os-prober manually? what does it find?
did you change any of the files in /etc/grub.d? 30_os-prober is owned by grub, and there should be no need to change it.
 
1 members found this post helpful.
Old 09-13-2018, 06:55 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,898

Original Poster
Rep: Reputation: 55
It finds the other OS:
Code:
root@darkstar~# os-prober
/dev/mmcblk0p3:Debian GNU/Linux 9 (stretch):Debian:linux
root@darkstar~#
No, I did not touch any of the grub files. Thanks for your reply.

Last edited by stf92; 09-13-2018 at 08:05 PM.
 
Old 09-15-2018, 02:47 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,975
Blog Entries: 7

Rep: Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465
strange, i thought os-prober would spit out the whole menu section that would then go into grub.cfg in the end.
i can't test, since i'm not dual booting (anymore).
you can alos try to run /etc/grub.d/30_os-prober manually, but i'm not sure it will work, or help with the problem.

just re-run "grub-mkconfig -o /boot/grub/grub.cfg", show us what it spits out in the terminal, and show us the resulting grub.cfg.

you can also "mv /etc/default/grub /etc/default/grub.bak" and retry the above. the config looks pretty normal to me, but maybe there's something off in there.
 
Old 09-15-2018, 02:26 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,898

Original Poster
Rep: Reputation: 55
This time it worked!
Code:
root@darkstar~# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Found Debian GNU/Linux 9 (stretch) on /dev/mmcblk0p3
done
root@darkstar~#
Code:
root@darkstar/boot/grub# cat grub.cfg
#
# 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 ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  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 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
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  738add7f-692c-4b17-a25c-0028d618e22b
else
  search --no-floppy --fs-uuid --set=root 738add7f-692c-4b17-a25c-0028d618e22b
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_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-738add7f-692c-4b17-a25c-0028d618e22b' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root  738add7f-692c-4b17-a25c-0028d618e22b
	else
	  search --no-floppy --fs-uuid --set=root 738add7f-692c-4b17-a25c-0028d618e22b
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=738add7f-692c-4b17-a25c-0028d618e22b rw  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-738add7f-692c-4b17-a25c-0028d618e22b' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-738add7f-692c-4b17-a25c-0028d618e22b' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  738add7f-692c-4b17-a25c-0028d618e22b
		else
		  search --no-floppy --fs-uuid --set=root 738add7f-692c-4b17-a25c-0028d618e22b
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=738add7f-692c-4b17-a25c-0028d618e22b rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-738add7f-692c-4b17-a25c-0028d618e22b' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  738add7f-692c-4b17-a25c-0028d618e22b
		else
		  search --no-floppy --fs-uuid --set=root 738add7f-692c-4b17-a25c-0028d618e22b
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=738add7f-692c-4b17-a25c-0028d618e22b rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initramfs-linux-fallback.img
	}
}

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

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

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Debian GNU/Linux 9 (stretch) (on /dev/mmcblk0p3)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-62468dca-d143-4a69-92ce-584eabcfb4da' {
	insmod part_msdos
	insmod ext2
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root  62468dca-d143-4a69-92ce-584eabcfb4da
	else
	  search --no-floppy --fs-uuid --set=root 62468dca-d143-4a69-92ce-584eabcfb4da
	fi
	linux /boot/vmlinuz-4.9.0-6-686-pae root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro noapic edd=off quiet
	initrd /boot/initrd.img-4.9.0-6-686-pae
}
submenu 'Advanced options for Debian GNU/Linux 9 (stretch) (on /dev/mmcblk0p3)' $menuentry_id_option 'osprober-gnulinux-advanced-62468dca-d143-4a69-92ce-584eabcfb4da' {
	menuentry 'Debian GNU/Linux (on /dev/mmcblk0p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-6-686-pae--62468dca-d143-4a69-92ce-584eabcfb4da' {
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  62468dca-d143-4a69-92ce-584eabcfb4da
		else
		  search --no-floppy --fs-uuid --set=root 62468dca-d143-4a69-92ce-584eabcfb4da
		fi
		linux /boot/vmlinuz-4.9.0-6-686-pae root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro noapic edd=off quiet
		initrd /boot/initrd.img-4.9.0-6-686-pae
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-6-686-pae (on /dev/mmcblk0p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-6-686-pae--62468dca-d143-4a69-92ce-584eabcfb4da' {
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  62468dca-d143-4a69-92ce-584eabcfb4da
		else
		  search --no-floppy --fs-uuid --set=root 62468dca-d143-4a69-92ce-584eabcfb4da
		fi
		linux /boot/vmlinuz-4.9.0-6-686-pae root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro noapic edd=off quiet
		initrd /boot/initrd.img-4.9.0-6-686-pae
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-6-686-pae (recovery mode) (on /dev/mmcblk0p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-6-686-pae-root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro single noapic edd=off-62468dca-d143-4a69-92ce-584eabcfb4da' {
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  62468dca-d143-4a69-92ce-584eabcfb4da
		else
		  search --no-floppy --fs-uuid --set=root 62468dca-d143-4a69-92ce-584eabcfb4da
		fi
		linux /boot/vmlinuz-4.9.0-6-686-pae root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro single noapic edd=off
		initrd /boot/initrd.img-4.9.0-6-686-pae
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-6-686 (on /dev/mmcblk0p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-6-686--62468dca-d143-4a69-92ce-584eabcfb4da' {
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  62468dca-d143-4a69-92ce-584eabcfb4da
		else
		  search --no-floppy --fs-uuid --set=root 62468dca-d143-4a69-92ce-584eabcfb4da
		fi
		linux /boot/vmlinuz-4.9.0-6-686 root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro noapic edd=off quiet
		initrd /boot/initrd.img-4.9.0-6-686
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-6-686 (recovery mode) (on /dev/mmcblk0p3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.9.0-6-686-root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro single noapic edd=off-62468dca-d143-4a69-92ce-584eabcfb4da' {
		insmod part_msdos
		insmod ext2
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root  62468dca-d143-4a69-92ce-584eabcfb4da
		else
		  search --no-floppy --fs-uuid --set=root 62468dca-d143-4a69-92ce-584eabcfb4da
		fi
		linux /boot/vmlinuz-4.9.0-6-686 root=UUID=62468dca-d143-4a69-92ce-584eabcfb4da ro single noapic edd=off
		initrd /boot/initrd.img-4.9.0-6-686
	}
}

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

### 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 ###
root@darkstar/boot/grub#
When I tried to run os-prober directly, as you had suggested, I had to install it first (pacman -S). Then I ran it. And this has quite changed things! Perhaps grub-mkconfig needed the os-prober program.

Alright. Now I have two grub.cfg's. One in the Debian partition, which is the one the bootloader used up until now and one in the Arch partition, the one just created. Which one will be the boot loader use the next time I boot? I can rename the grub.cfg in the Debian partition and see what happens.

EDIT: I renamed the Debian partition grub.cfg so now the bootloader could only see the one recently created. But when I booted I was presented with only a grub prompt!

Last edited by stf92; 09-15-2018 at 03:33 PM.
 
Old 09-16-2018, 01:15 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 9,975
Blog Entries: 7

Rep: Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465Reputation: 2465
Quote:
Originally Posted by stf92 View Post
When I tried to run os-prober directly, as you had suggested, I had to install it first (pacman -S). Then I ran it. And this has quite changed things! Perhaps grub-mkconfig needed the os-prober program.
not just perhaps.


Quote:
Now I have two grub.cfg's. One in the Debian partition, which is the one the bootloader used up until now and one in the Arch partition, the one just created. Which one will be the boot loader use the next time I boot?
that is entirely dependent on where you last ran the "grub-install" command.
renaming grub.cfg is totally useless and even potentially harmful.


btw, all of this could've been answered & solved throught the archwiki:
https://wiki.archlinux.org/index.php/Grub
 
1 members found this post helpful.
Old 09-16-2018, 08:34 PM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,898

Original Poster
Rep: Reputation: 55
Thanks a lot. Now I don't see in the wiki an answer to these questions: I boot in the BIOS compatibility (legacy) mood (BIOS menu). And I want an MBR type boot sector. Though I read the grub-install man page, I'm unable to find the options to accomplish those goals.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] got back reinstall grub then ran grub-mkconfig --- not found oops BW-userx Slackware 2 01-17-2018 05:19 PM
[SOLVED] Strange multiple "calling: info" with grub-mkconfig and grub-install giocitta Linux - Software 4 07-14-2017 10:13 AM
Unable to run grub-mkconfig, can't get system to boot. orsty9001 Linux - Desktop 1 01-24-2016 05:11 PM
[SOLVED] grub-mkconfig menu changes mikenash Linux - Newbie 13 04-23-2015 05:49 PM
unrecognized initrd file with grub-mkconfig (Arch linux). hen770 Linux - General 2 09-06-2011 03:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch

All times are GMT -5. The time now is 11:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration