OpenVZ Forum


Home » General » Support » Regenerate /boot/grub2/grub.cfg
Regenerate /boot/grub2/grub.cfg [message #53508] Fri, 03 May 2019 07:20 Go to next message
javii is currently offline  javii
Messages: 13
Registered: October 2016
Junior Member
Hi,

I made some changes to /etc/default/grub and wanted to regenerate /boot/grub2/grub.cfg.

I have used grub2-mkconfig -o /boot/grub2/grub.cfg, but it detects kernels on containers:

[root@xxxx ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.10.1.vz7.85.17
Found initrd image: /boot/initramfs-3.10.0-957.10.1.vz7.85.17.img
Found linux image: /boot/vmlinuz-3.10.0-862.20.2.vz7.73.29
Found initrd image: /boot/initramfs-3.10.0-862.20.2.vz7.73.29.img
Found linux image: /boot/vmlinuz-3.10.0-862.11.6.vz7.64.7
Found initrd image: /boot/initramfs-3.10.0-862.11.6.vz7.64.7.img
Found linux image: /boot/vmlinuz-3.10.0-862.9.1.vz7.63.3
Found initrd image: /boot/initramfs-3.10.0-862.9.1.vz7.63.3.img
Found linux image: /boot/vmlinuz-3.10.0-693.21.1.vz7.48.2
Found initrd image: /boot/initramfs-3.10.0-693.21.1.vz7.48.2.img
Found linux image: /boot/vmlinuz-0-rescue-b2e055e14ad046a4aa729806b2a333a5
Found initrd image: /boot/initramfs-0-rescue-b2e055e14ad046a4aa729806b2a333a5.im g
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop10125p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop19562p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop22984p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop23428p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop33199p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop35810p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop46234p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop53660p1
Found Ubuntu 14.04.5 LTS (14.04) on /dev/ploop55076p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop57914p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop59002p1
Found CentOS Linux release 7.6.1810 (Core) on /dev/ploop60186p1
done


Is this a bug or this is not the correct way to regenerate /boot/grub2/grub.cfg?
Re: Regenerate /boot/grub2/grub.cfg [message #53518 is a reply to message #53508] Mon, 13 May 2019 11:15 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
Hi,

javii wrote on Fri, 03 May 2019 10:20
Is this a bug or this is not the correct way to regenerate /boot/grub2/grub.cfg?


/etc/grub.d/30_os-prober calls /usr/bin/os-prober which detects that ploop devices for running (mounted) Containers contain linux distributives,
so grub2-mkconfig should consider creating a menu entry to it.

But a bit later /etc/grub.d/30_os-prober calls "linux-boot-prober" for ploop devices which detects that ploop devices are not marked a boot devices,
so grub entries are not needed to them.

So, nothing to worry about here: yes, grub detects Linux distro is installed on ploop devices,
but grub is wise enough to check the devices is not bootable and does not create redundant menu entries.


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: Regenerate /boot/grub2/grub.cfg [message #53519 is a reply to message #53518] Mon, 13 May 2019 11:26 Go to previous messageGo to next message
javii is currently offline  javii
Messages: 13
Registered: October 2016
Junior Member
Hi, our servers seems they are not wise enough, grub is generating conf for kernel containers:


[root@xxx ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-957.10.1.vz7.85.17
Found initrd image: /boot/initramfs-3.10.0-957.10.1.vz7.85.17.img
Found linux image: /boot/vmlinuz-3.10.0-862.20.2.vz7.73.29
Found initrd image: /boot/initramfs-3.10.0-862.20.2.vz7.73.29.img
Found linux image: /boot/vmlinuz-3.10.0-862.11.6.vz7.64.7
Found initrd image: /boot/initramfs-3.10.0-862.11.6.vz7.64.7.img
Found linux image: /boot/vmlinuz-3.10.0-862.9.1.vz7.63.3
Found initrd image: /boot/initramfs-3.10.0-862.9.1.vz7.63.3.img
Found linux image: /boot/vmlinuz-3.10.0-693.21.1.vz7.48.2
Found initrd image: /boot/initramfs-3.10.0-693.21.1.vz7.48.2.img
Found linux image: /boot/vmlinuz-0-rescue-e6718a50eaca4895b2d1dbf45bc7c021
Found initrd image: /boot/initramfs-0-rescue-e6718a50eaca4895b2d1dbf45bc7c021.img
Found CentOS Linux release 7.6.1810 (Core)  on /dev/ploop15360p1
Found CentOS Linux release 7.6.1810 (Core)  on /dev/ploop16120p1
Found CentOS release 5.11 (Final) on /dev/ploop24192p1
Found Ubuntu 16.04.4 LTS (16.04) on /dev/ploop25453p1
Found CentOS release 5.11 (Final) on /dev/ploop27099p1
Found CentOS Linux release 7.6.1810 (Core)  on /dev/ploop30745p1
Found CentOS release 6.10 (Final) on /dev/ploop30895p1
Found CentOS release 6.10 (Final) on /dev/ploop35412p1
Found CentOS Linux release 7.6.1810 (Core)  on /dev/ploop35431p1
Found CentOS Linux release 7.6.1810 (Core)  on /dev/ploop40339p1
Found CentOS Linux release 7.6.1810 (Core)  on /dev/ploop50665p1
Found CentOS release 6.10 (Final) on /dev/ploop53483p1
Found CentOS release 5.11 (Final) on /dev/ploop54152p1
done

[root@xxx ~]# cat /boot/grub2/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

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="${saved_entry}"
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
}

terminal_output console
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/00_tuned ###
set tuned_params=""
set tuned_initrd=""
### END /etc/grub.d/00_tuned ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Virtuozzo 7.0.10 (3.10.0-957.10.1.vz7.85.17)' --class openvz --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.10.1.vz7.85.17-advanced-8099cb68-5795-444d-9ccf-460cc7bac2b8' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod part_gpt
        insmod diskfilter
        insmod mdraid1x
        insmod ext2
        set root='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'  1a220f99-00e6-42c5-b1dd-2a01225659dd
        else
          search --no-floppy --fs-uuid --set=root 1a220f99-00e6-42c5-b1dd-2a01225659dd
        fi
        linux16 /vmlinuz-3.10.0-957.10.1.vz7.85.17 root=/dev/mapper/openvz-root ro crashkernel=auto rd.lvm.lv=openvz/root rd.md.uuid=01cba6c6:00c669cf:fad77f81:67a61f20 rd.md.uuid=89c3f1a2:c4ec6ef6:ad62b90f:715e3111 rd.md.uuid=15e18a8a:0ebcafe8:5db9e077:854a62a4 quiet
        initrd16 /initramfs-3.10.0-957.10.1.vz7.85.17.img
}
menuentry 'Virtuozzo 7.0.10 (3.10.0-862.20.2.vz7.73.29)' --class openvz --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.20.2.vz7.73.29-advanced-8099cb68-5795-444d-9ccf-460cc7bac2b8' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod part_gpt
        insmod diskfilter
        insmod mdraid1x
        insmod ext2
        set root='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'  1a220f99-00e6-42c5-b1dd-2a01225659dd
        else
          search --no-floppy --fs-uuid --set=root 1a220f99-00e6-42c5-b1dd-2a01225659dd
        fi
        linux16 /vmlinuz-3.10.0-862.20.2.vz7.73.29 root=/dev/mapper/openvz-root ro crashkernel=auto rd.lvm.lv=openvz/root rd.md.uuid=01cba6c6:00c669cf:fad77f81:67a61f20 rd.md.uuid=89c3f1a2:c4ec6ef6:ad62b90f:715e3111 rd.md.uuid=15e18a8a:0ebcafe8:5db9e077:854a62a4 quiet
        initrd16 /initramfs-3.10.0-862.20.2.vz7.73.29.img
}
menuentry 'Virtuozzo 7.0.10 (3.10.0-862.11.6.vz7.64.7)' --class openvz --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.11.6.vz7.64.7-advanced-8099cb68-5795-444d-9ccf-460cc7bac2b8' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod part_gpt
        insmod diskfilter
        insmod mdraid1x
        insmod ext2
        set root='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'  1a220f99-00e6-42c5-b1dd-2a01225659dd
        else
          search --no-floppy --fs-uuid --set=root 1a220f99-00e6-42c5-b1dd-2a01225659dd
        fi
        linux16 /vmlinuz-3.10.0-862.11.6.vz7.64.7 root=/dev/mapper/openvz-root ro crashkernel=auto rd.lvm.lv=openvz/root rd.md.uuid=01cba6c6:00c669cf:fad77f81:67a61f20 rd.md.uuid=89c3f1a2:c4ec6ef6:ad62b90f:715e3111 rd.md.uuid=15e18a8a:0ebcafe8:5db9e077:854a62a4 quiet
        initrd16 /initramfs-3.10.0-862.11.6.vz7.64.7.img
}
menuentry 'Virtuozzo 7.0.10 (3.10.0-862.9.1.vz7.63.3)' --class openvz --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-862.9.1.vz7.63.3-advanced-8099cb68-5795-444d-9ccf-460cc7bac2b8' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod part_gpt
        insmod diskfilter
        insmod mdraid1x
        insmod ext2
        set root='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'  1a220f99-00e6-42c5-b1dd-2a01225659dd
        else
          search --no-floppy --fs-uuid --set=root 1a220f99-00e6-42c5-b1dd-2a01225659dd
        fi
        linux16 /vmlinuz-3.10.0-862.9.1.vz7.63.3 root=/dev/mapper/openvz-root ro crashkernel=auto rd.lvm.lv=openvz/root rd.md.uuid=01cba6c6:00c669cf:fad77f81:67a61f20 rd.md.uuid=89c3f1a2:c4ec6ef6:ad62b90f:715e3111 rd.md.uuid=15e18a8a:0ebcafe8:5db9e077:854a62a4 quiet
        initrd16 /initramfs-3.10.0-862.9.1.vz7.63.3.img
}
menuentry 'Virtuozzo 7.0.10 (3.10.0-693.21.1.vz7.48.2)' --class openvz --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.21.1.vz7.48.2-advanced-8099cb68-5795-444d-9ccf-460cc7bac2b8' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod part_gpt
        insmod diskfilter
        insmod mdraid1x
        insmod ext2
        set root='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'  1a220f99-00e6-42c5-b1dd-2a01225659dd
        else
          search --no-floppy --fs-uuid --set=root 1a220f99-00e6-42c5-b1dd-2a01225659dd
        fi
        linux16 /vmlinuz-3.10.0-693.21.1.vz7.48.2 root=/dev/mapper/openvz-root ro crashkernel=auto rd.lvm.lv=openvz/root rd.md.uuid=01cba6c6:00c669cf:fad77f81:67a61f20 rd.md.uuid=89c3f1a2:c4ec6ef6:ad62b90f:715e3111 rd.md.uuid=15e18a8a:0ebcafe8:5db9e077:854a62a4 quiet
        initrd16 /initramfs-3.10.0-693.21.1.vz7.48.2.img
}
menuentry 'Virtuozzo 7.0.10 (0-rescue-e6718a50eaca4895b2d1dbf45bc7c021)' --class openvz --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-e6718a50eaca4895b2d1dbf45bc7c021-advanced-8099cb68-5795-444d-9ccf-460cc7bac2b8' {
        load_video
        insmod gzio
        insmod part_gpt
        insmod part_gpt
        insmod diskfilter
        insmod mdraid1x
        insmod ext2
        set root='mduuid/89c3f1a2c4ec6ef6ad62b90f715e3111'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-flop
...

Re: Regenerate /boot/grub2/grub.cfg [message #53520 is a reply to message #53519] Mon, 13 May 2019 14:09 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
i don't see menu entries for ploop devices in your config.
There are multiple menu entries because you have several kernels installed on your node.


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: Regenerate /boot/grub2/grub.cfg [message #53521 is a reply to message #53508] Mon, 13 May 2019 14:11 Go to previous messageGo to next message
javii is currently offline  javii
Messages: 13
Registered: October 2016
Junior Member
Look at the end

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'CentOS Linux release 7.6.1810 (Core)  (on /dev/ploop15360p1)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-3c124667-8950-4f97-a601-86343043b9e1' {
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  3c124667-8950-4f97-a601-86343043b9e1
        else
          search --no-floppy --fs-uuid --set=root 3c124667-8950-4f97-a601-86343043b9e1
        fi
        linux /boot/vmlinuz-3.10.0-514.10.2.el7.x86_64 root=/dev/ploop15360p1
        initrd /boot/initramfs-3.10.0-514.10.2.el7.x86_64.img
}
Re: Regenerate /boot/grub2/grub.cfg [message #53522 is a reply to message #53521] Mon, 13 May 2019 15:03 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
Ah, right, i just did not expand your previous message, sorry.

Yes, something went wrong here, may be those devices were marked as bootable,
may be something else, need to debug grub scripts to findout the reason.

i tried the same on my test node, no menu entries were generated for ploop devices of running Containers.

So you are welcome to debug grub scripts and find the difference between those ploops which trigger menu entries creation and those which do not.


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: Regenerate /boot/grub2/grub.cfg [message #53523 is a reply to message #53522] Tue, 14 May 2019 07:08 Go to previous messageGo to next message
javii is currently offline  javii
Messages: 13
Registered: October 2016
Junior Member
Ok. Sorry for ignorance, how could I debug grub scripts?
Re: Regenerate /boot/grub2/grub.cfg [message #53524 is a reply to message #53523] Tue, 14 May 2019 08:14 Go to previous message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
grub scripts are shell scripts, AFAIS,
so just insert "set -x" at the beginning of the script you are interested in and run your command,
it will generate debug output.

Probably you need this script - /etc/grub.d/30_os-prober


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Previous Topic: OpenVZ 7 node and container different kernel versions?
Next Topic: online container migration fails with Remote exception I/O operation on closed file
Goto Forum:
  


Current Time: Sat Apr 27 07:15:31 GMT 2024

Total time taken to generate the page: 0.02215 seconds