Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Nov 22, 2015 12:56 pm 
Offline
Newbie

Joined: Sun Nov 22, 2015 12:18 pm
Posts: 3
I run -- well now, ran -- a PVGRUB-booted own-kernel Opensuse Leap 42.1 instance on a Linode.

Current kernel's
Code:
   ls -al /boot/{vml,ini}*
      lrwxrwxrwx 1 root root   32 Nov 22 06:36 /boot/initrd -> initrd-4.3.0-17.g6a48ac7-default
      -rw------- 1 root root  17M Nov 22 08:05 /boot/initrd-4.3.0-17.g6a48ac7-default
      -rw-r--r-- 1 root root 6.9M Nov 22 00:08 /boot/vmlinux-4.3.0-17.g6a48ac7-default.gz
      lrwxrwxrwx 1 root root   33 Nov 22 06:36 /boot/vmlinuz -> vmlinuz-4.3.0-17.g6a48ac7-default
      -rw-r--r-- 1 root root 5.9M Nov 22 00:50 /boot/vmlinuz-4.3.0-17.g6a48ac7-default


With kernel config, per

https://www.linode.com/docs/platform/kvm

"For standard paravirtualized KVM Linodes, add the following to your kernel .config file:"

Code:
   CONFIG_KVM_GUEST=y
   CONFIG_VIRTIO_PCI=y
   CONFIG_VIRTIO_PCI_LEGACY=y
   CONFIG_SCSI_VIRTIO=y
   CONFIG_VIRTIO_NET=y
   CONFIG_SERIAL_8250=y
   CONFIG_SERIAL_8250_CONSOLE=y


verifying here
Code:
   egrep "CONFIG_KVM_GUEST=|CONFIG_VIRTIO_PCI=|CONFIG_VIRTIO_PCI_LEGACY=|CONFIG_SCSI_VIRTIO=|CONFIG_VIRTIO_NET=|CONFIG_SERIAL_8250=|CONFIG_SERIAL_8250_CONSOLE=" /boot/config-4.3.0-17.g6a48ac7-default 

      CONFIG_KVM_GUEST=y
      CONFIG_VIRTIO_PCI=m
      CONFIG_VIRTIO_PCI_LEGACY=y
      CONFIG_SCSI_VIRTIO=m
      CONFIG_VIRTIO_NET=m
      CONFIG_SERIAL_8250=y
      CONFIG_SERIAL_8250_CONSOLE=y


Bootloader was grub-legacy, v0.97

Grub cfg was,
Code:
   cat /boot/grub/menu.lst
      default 0
      timeout 1
      title PVGRUB-XEN-PV (symlink)
        root (hd0)
        kernel /boot/vmlinuz root=/dev/xvdc noresume xencons=hvc0 kbdtype=us text nofb selinux=0 apparmor=0 edd=off noshell showopts splash=verbose systemd.log_level=error systemd.log_target=syslog-or-kmsg  net.ifnames=0
        initrd /boot/initrd

Worked great.

Grub-legacy's officially deprecated.

I couldn't manage to find an answer re PVGRUB2 support with Xen @Linode, and since KVM seems a done deal anyway ... I migrated my linode to KVM.

Simple/error-free migration & boots to linode-provided kernel OK.
Code:
   ...
   Welcome to openSUSE Leap 42.1 - Kernel 4.1.5-x86_64-linode61 (ttyS0).


Everything appears to be functioning normally.

Following, generally,

https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distribution-supplied-kernel-with-kvm

I switched to grub2. Note that grub-legacy is now removed/absent from the system; ONLY grub2 packages remain.

Currently,
Code:
   rpm -qa | grep -i grub
      grub2-2.02~beta2-70.1.x86_64
      grub2-i386-pc-2.02~beta2-70.1.x86_64
   rpm -qa | grep -i ^kernel | sort
      kernel-default-4.3.0-17.1.g6a48ac7.x86_64
      kernel-default-devel-4.3.0-17.1.g6a48ac7.x86_64
      kernel-devel-4.3.0-17.1.g6a48ac7.noarch
      kernel-docs-4.3.0-17.1.g6a48ac7.noarch
      kernel-firmware-20151109git-35.1.noarch
      kernel-macros-4.3.0-17.1.g6a48ac7.noarch
      kernel-source-4.3.0-17.1.g6a48ac7.noarch
      kernel-syms-4.3.0-17.1.g6a48ac7.x86_64

   cat /etc/default/grub
      # If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwards to update
      # /boot/grub2/grub.cfg.
      GRUB_DEFAULT=saved
      GRUB_HIDDEN_TIMEOUT=0
      GRUB_HIDDEN_TIMEOUT_QUIET=true
      GRUB_TIMEOUT=10
      GRUB_CMDLINE_LINUX_DEFAULT="noresume kbdtype=us text quiet selinux=0 apparmor=0 noshell splash=silent systemd.log_level=error systemd.log_target=syslog-or-kmsg net.ifnames=0"
      GRUB_CMDLINE_LINUX="console=ttyS0,19200n8"
      GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"
      GRUB_DISABLE_LINUX_UUID=true

Since on linode/KVM, the grub search path appears to be
Code:
   /boot/grub/grub.cfg

I exec
Code:
   mkinitrd
   mkdir -p /boot/grub
   grub2-mkconfig -o /boot/grub/grub.cfg
      Generating grub configuration file ...
      Found linux image: /boot/vmlinuz-4.3.0-17.g6a48ac7-default
      Found initrd image: /boot/initrd-4.3.0-17.g6a48ac7-default
      Found linux image: /boot/vmlinuz-4.3.0-17.g6a48ac7-default
      Found initrd image: /boot/initrd-4.3.0-17.g6a48ac7-default
      done

which generates
Code:
   cat /boot/grub/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 ###
      if [ -f ${config_directory}/grubenv ]; then
        load_env -f ${config_directory}/grubenv
      elif [ -s $prefix/grubenv ]; then
        load_env
      fi

      if [ "${env_block}" ] ; then
        load_env -f "${env_block}"
      fi

      if [ "${next_entry}" ] ; then
         set default="${next_entry}"
         set next_entry=
         save_env next_entry
         if [ "${env_block}" ] ; then
           save_env -f "${env_block}" next_entry
         fi
         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
      }

      if [ x$feature_default_font_path = xy ] ; then
         font=unicode
      else
      insmod ext2
      set root='hd2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd2 --hint-efi=hd2 --hint-baremetal=ahci2  5939c461-8927-4682-ab15-2ed625b79c2d
      else
        search --no-floppy --fs-uuid --set=root 5939c461-8927-4682-ab15-2ed625b79c2d
      fi
          font="/usr/share/grub2/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 [ x${boot_once} = xtrue ]; then
        set timeout=0
      elif [ x$feature_timeout_style = xy ] ; then
        set timeout_style=menu
        set timeout=10
      # Fallback normal timeout code in case the timeout_style feature is
      # unavailable.
      else
        set timeout=10
      fi
      ### END /etc/grub.d/00_header ###

      ### BEGIN /etc/grub.d/00_tuned ###
      set tuned_params=""
      ### END /etc/grub.d/00_tuned ###

      ### BEGIN /etc/grub.d/10_linux ###
      menuentry 'openSUSE Leap 42.1'  --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5939c461-8927-4682-ab15-2ed625b79c2d' {
              load_video
              set gfxpayload=keep
              insmod gzio
              insmod ext2
              set root='hd0'
              if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  022fcf42-6418-46b1-b6d7-4b0185d269e2
              else
                search --no-floppy --fs-uuid --set=root 022fcf42-6418-46b1-b6d7-4b0185d269e2
              fi
              echo    'Loading Linux 4.3.0-17.g6a48ac7-default ...'
              linux   /vmlinuz-4.3.0-17.g6a48ac7-default root=/dev/sdc console=ttyS0,19200n8 noresume kbdtype=us text quiet selinux=0 apparmor=0 noshell splash=silent systemd.log_level=error systemd.log_target=syslog-or-kmsg net.ifnames=0
              echo    'Loading initial ramdisk ...'
              initrd  /initrd-4.3.0-17.g6a48ac7-default
      }
      submenu 'Advanced options for openSUSE Leap 42.1' --hotkey=1 $menuentry_id_option 'gnulinux-advanced-5939c461-8927-4682-ab15-2ed625b79c2d' {
              menuentry 'openSUSE Leap 42.1, with Linux 4.3.0-17.g6a48ac7-default' --hotkey=2 --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.3.0-17.g6a48ac7-default-advanced-5939c461-8927-4682-ab15-2ed625b79c2d' {
                      load_video
                      set gfxpayload=keep
                      insmod gzio
                      insmod ext2
                      set root='hd0'
                      if [ x$feature_platform_search_hint = xy ]; then
                        search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  022fcf42-6418-46b1-b6d7-4b0185d269e2
                      else
                        search --no-floppy --fs-uuid --set=root 022fcf42-6418-46b1-b6d7-4b0185d269e2
                      fi
                      echo    'Loading Linux 4.3.0-17.g6a48ac7-default ...'
                      linux   /vmlinuz-4.3.0-17.g6a48ac7-default root=/dev/sdc console=ttyS0,19200n8 noresume kbdtype=us text quiet selinux=0 apparmor=0 noshell splash=silent systemd.log_level=error systemd.log_target=syslog-or-kmsg net.ifnames=0
                      echo    'Loading initial ramdisk ...'
                      initrd  /initrd-4.3.0-17.g6a48ac7-default
              }
              menuentry 'openSUSE Leap 42.1, with Linux 4.3.0-17.g6a48ac7-default (recovery mode)' --hotkey=3 --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.3.0-17.g6a48ac7-default-recovery-5939c461-8927-4682-ab15-2ed625b79c2d' {
                      load_video
                      set gfxpayload=keep
                      insmod gzio
                      insmod ext2
                      set root='hd0'
                      if [ x$feature_platform_search_hint = xy ]; then
                        search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  022fcf42-6418-46b1-b6d7-4b0185d269e2
                      else
                        search --no-floppy --fs-uuid --set=root 022fcf42-6418-46b1-b6d7-4b0185d269e2
                      fi
                      echo    'Loading Linux 4.3.0-17.g6a48ac7-default ...'
                      linux   /vmlinuz-4.3.0-17.g6a48ac7-default root=/dev/sdc console=ttyS0,19200n8
                      echo    'Loading initial ramdisk ...'
                      initrd  /initrd-4.3.0-17.g6a48ac7-default
              }
      }

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

      ### BEGIN /etc/grub.d/20_linux_xen ###
      menuentry 'openSUSE Leap 42.1, with Xen hypervisor' --class opensuse --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-simple-5939c461-8927-4682-ab15-2ed625b79c2d' {
              insmod ext2
              set root='hd0'
              if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  022fcf42-6418-46b1-b6d7-4b0185d269e2
              else
                search --no-floppy --fs-uuid --set=root 022fcf42-6418-46b1-b6d7-4b0185d269e2
              fi
              echo    'Loading Xen xen ...'
              if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                  xen_rm_opts=
              else
                  xen_rm_opts="no-real-mode edd=off"
              fi
              multiboot       /xen.gz placeholder   ${xen_rm_opts}
              echo    'Loading Linux 4.3.0-17.g6a48ac7-default ...'
              module  /vmlinuz-4.3.0-17.g6a48ac7-default placeholder root=/dev/sdc console=ttyS0,19200n8 noresume kbdtype=us text quiet selinux=0 apparmor=0 noshell splash=silent systemd.log_level=error systemd.log_target=syslog-or-kmsg net.ifnames=0
              echo    'Loading initial ramdisk ...'
              module  --nounzip   /initrd-4.3.0-17.g6a48ac7-default
      }
      submenu 'Advanced options for openSUSE Leap 42.1 (with Xen hypervisor)' $menuentry_id_option 'gnulinux-advanced-5939c461-8927-4682-ab15-2ed625b79c2d' {
              submenu 'Xen hypervisor, version xen' $menuentry_id_option 'xen-hypervisor-xen-5939c461-8927-4682-ab15-2ed625b79c2d' {
                      menuentry 'openSUSE Leap 42.1, with Xen xen and Linux 4.3.0-17.g6a48ac7-default' --class opensuse --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-4.3.0-17.g6a48ac7-default-advanced-5939c461-8927-4682-ab15-2ed625b79c2d' {
                              insmod ext2
                              set root='hd0'
                              if [ x$feature_platform_search_hint = xy ]; then
                                search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  022fcf42-6418-46b1-b6d7-4b0185d269e2
                              else
                                search --no-floppy --fs-uuid --set=root 022fcf42-6418-46b1-b6d7-4b0185d269e2
                              fi
                              echo    'Loading Xen xen ...'
                              if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                                  xen_rm_opts=
                              else
                                  xen_rm_opts="no-real-mode edd=off"
                              fi
                              multiboot       /xen.gz placeholder   ${xen_rm_opts}
                              echo    'Loading Linux 4.3.0-17.g6a48ac7-default ...'
                              module  /vmlinuz-4.3.0-17.g6a48ac7-default placeholder root=/dev/sdc console=ttyS0,19200n8 noresume kbdtype=us text quiet selinux=0 apparmor=0 noshell splash=silent systemd.log_level=error systemd.log_target=syslog-or-kmsg net.ifnames=0
                              echo    'Loading initial ramdisk ...'
                              module  --nounzip   /initrd-4.3.0-17.g6a48ac7-default
                      }
                      menuentry 'openSUSE Leap 42.1, with Xen xen and Linux 4.3.0-17.g6a48ac7-default (recovery mode)' --class opensuse --class gnu-linux --class gnu --class os --class xen $menuentry_id_option 'xen-gnulinux-4.3.0-17.g6a48ac7-default-recovery-5939c461-8927-4682-ab15-2ed625b79c2d' {
                              insmod ext2
                              set root='hd0'
                              if [ x$feature_platform_search_hint = xy ]; then
                                search --no-floppy --fs-uuid --set=root --hint-bios=hd0 --hint-efi=hd0 --hint-baremetal=ahci0  022fcf42-6418-46b1-b6d7-4b0185d269e2
                              else
                                search --no-floppy --fs-uuid --set=root 022fcf42-6418-46b1-b6d7-4b0185d269e2
                              fi
                              echo    'Loading Xen xen ...'
                              if [ "$grub_platform" = "pc" -o "$grub_platform" = "" ]; then
                                  xen_rm_opts=
                              else
                                  xen_rm_opts="no-real-mode edd=off"
                              fi
                              multiboot       /xen.gz placeholder  ${xen_rm_opts}
                              echo    'Loading Linux 4.3.0-17.g6a48ac7-default ...'
                              module  /vmlinuz-4.3.0-17.g6a48ac7-default placeholder root=/dev/sdc single console=ttyS0,19200n8
                              echo    'Loading initial ramdisk ...'
                              module  --nounzip   /initrd-4.3.0-17.g6a48ac7-default
                      }
              }
      }

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

      ### BEGIN /etc/grub.d/20_memtest86+ ###
      ### END /etc/grub.d/20_memtest86+ ###

      ### BEGIN /etc/grub.d/30_os-prober ###
      ### 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 ###

      ### BEGIN /etc/grub.d/90_persistent ###
      ### END /etc/grub.d/90_persistent ###

I then ensure the default
Code:
   grub2-set-default "openSUSE Leap 42.1"

@ Linode control panel, I select
Code:
   boot settings -> kernel -> Grub2

Then my profile, and reboot.

I get immediately dropped to a grub prompt
Code:
   grub>

`logview` @ lish doesn't provide anything more
Code:
   # logview

                                GNU GRUB  version 2.00

      Minimal BASH-like line editing is supported. For the first word, TAB     
      lists possible command completions. Anywhere else TAB lists possible     
      device or file completions.       
      

   grub>

@ the grub prompt
Code:
   grub> ls
      (hd0) (fd0) error: failure reading sector 0x6 from `fd0'.
      error: failure reading sector 0x0 from `fd0'.


What have I missed in the grub2 conversion/config?


Last edited by arby on Mon Nov 23, 2015 1:20 pm, edited 1 time in total.

Top
   
PostPosted: Sun Nov 22, 2015 9:07 pm 
Offline
Newbie

Joined: Sun Nov 22, 2015 12:18 pm
Posts: 3
Some progress. I can boot manually from grub prompt -- but not yet via grub.cfg.

For a Linode profile partition layout:
Code:
BlkDevs:
   /dev/sda   BOOT
   /dev/sdb   SWAP
   /dev/sdc   ROOT
   /dev/sdd   -
   /dev/sde   -
   /dev/sdf   -
   /dev/sdg   -
   /dev/sdh   -
   initrd     no initrd
Root/Boot device: /dev/sda


1st, boot to Linode kernel. Create grub2 -> grub symlink to satisfy KVM's apparent insistence on /boot/grub paths,
Code:
 cd /boot
 rm -rf grub
 ln -sf grub2 grub
 rm -f /boot/grub2/device.map

Reboot to 'own-kernel' profile.

At fail -> grub prompt, entering manually
Code:
 set root=(hd0)
 linux  /vmlinuz root=/dev/sdc noresume net.ifnames=0 console=ttyS0,19200n8 systemd.log_level=error systemd.log_target=kmsg
 initrd /initrd
 boot

THIS^^ boots correctly/completely to 'my kernel'
Code:
   uname -rm
    4.3.0-17.g6a48ac7-default x86_64

But creating a 'simple' custom grub2 config template,
Code:
cat /etc/default/grub
   GRUB_DEFAULT=saved
   GRUB_HIDDEN_TIMEOUT=0
   GRUB_HIDDEN_TIMEOUT_QUIET=true
   GRUB_TIMEOUT=10
   GRUB_CMDLINE_LINUX_DEFAULT=""
   GRUB_CMDLINE_LINUX="net.ifnames=0 console=ttyS0,19200n8"
   GRUB_SERIAL_COMMAND=" serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"
   GRUB_DISABLE_LINUX_UUID=true
   GRUB_DISABLE_LINUX_RECOVERY="true"

and a single-config 'custom' override
Code:
cat /boot/grub2/custom.cfg
   menuentry 'LINODE-openSUSE-kernel-default' {
    insmod gzio
    insmod ext2
    set root='hd0'

    linux  /vmlinuz root=/dev/sdc noresume net.ifnames=0 console=ttyS0,19200n8 systemd.log_level=error systemd.log_target=kmsg
    initrd  /initrd
   }

setting the boot entry
Code:
   grub2-set-default LINODE-openSUSE-kernel-default

then creating the grub.cfg
Code:
   grub2-mkconfig -o /boot/grub2/grub.cfg
   mkinitrd
   shutdown -r now

simply drops to the 'grub>' prompt again

Anyone with any idea why the manual boot works, but the auto-grub.cfg does not?


Top
   
PostPosted: Sun Nov 22, 2015 9:57 pm 
Offline
Newbie

Joined: Sun Nov 22, 2015 12:18 pm
Posts: 3
one additional step solves the problem

cd /boot
ln -sf . /boot

restart

kudos to akerl!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group