Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.89 KB

Grub.md

File metadata and controls

52 lines (39 loc) · 1.89 KB

Workaround centos boot system being a piece of crap

install grub

install grub & non-xen kernel. Centos5/5 relies on:

  • anaconda creating valid /boot/grub/grub.conf
  • currently running kernel = kernel in /boot/grub/grub.conf

in other words, no grub.conf => fuck you, no update-grub that is in decent distros, and grub-install usually doesnt work correctly...

to fix it:

  • create grub.conf; example for kvm with serial console:

       # grub.conf generated by anaconda
       #
       # Note that you do not have to rerun grub after making changes to this file
       # NOTICE:  You do not have a /boot partition.  This means that
       #          all kernel and initrd paths are relative to /, eg.
       #          root (hd0,0)
       #          kernel /boot/vmlinuz-version ro root=/dev/xvda1
       #          initrd /boot/initrd-version.img
       #boot=/dev/xvda
       default=0
       timeout=5
       #splashimage=(hd0,0)/boot/grub/splash.xpm.gz
       serial --unit=0 --speed=9600
       terminal --timeout=5 serial console
       title CentOS (<%= @kernelrelease %>)
           root (hd0,0)
           kernel /boot/vmlinuz-<%= @kernelrelease %> ro root=LABEL=/ console=ttyS0 console=tty1
           initrd /boot/initrd-<%= @kernelrelease %>.img
    

specify both consoles (tty1/ttyS0) if you want to have both vnc and virsh console console

  • install kernel & grub, setup initrd

      yum install -y kernel grub
      export ver=target_kernel_version # whatever version just installed, should match kernel file name
      mkinitrd --with virtio_pci --with virtio_blk --allow-missing -f /boot/initrd-$ver.img $ver
    
  • add device.map `(hd0) /dev/xvda'

  • install grub (if grub-install fails)

      device (hd0) /dev/vda
      root (hd0,0)
      setup (hd0)
    
  • fixup /etc/fstab, virtio device nodes are vd*

  • fixup console in /etc/inittab if needed