Has anyone come up with a preferred method of messing with grub? I need to install a hypervisor (like xen or kvm) and modify the grub.conf to make the machine boot from the new kernel. I might mess with Augeas. What do the experts say? David -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Am 15.03.2011 03:25, schrieb David Kavanagh:> Has anyone come up with a preferred method of messing with grub? I need to > install a hypervisor (like xen or kvm) and modify the grub.conf to make the > machine boot from the new kernel. > I might mess with Augeas. What do the experts say?We use Puppet to bring a short shell script to every machine which scans for available kernels and writes a grub.conf to reflect these. This is modelled after the Debian approach, albeit much simpler because some parameters in grub.conf are known to the infrastructure and can thus statically inserted by Puppet. Our script for Gentoo looks like this (feel free to use and adapt): --------------------------------------------------- #!/bin/bash # Generate GRUB config from contents of /boot. # Managed by Puppet: do not edit this file directly. It will be overwritten! set -e ROOT="<%= grub_root %>" OPTS="root=<%= part_root %> dolvm console=ttyS1,57600 console=tty0" # fail is there are no kernels found in /boot - it is probably not mounted ls /boot/kernel* >/dev/null 2>&1 cat >/boot/grub/grub.conf <<__EOT__ default 0 fallback 1 timeout 5 title Gentoo GNU/Linux root ${ROOT} kernel /boot/kernel ${OPTS} title Gentoo GNU/Linux (old) root ${ROOT} kernel /boot/kernel.old ${OPTS} __EOT__ for kernel in /boot/kernel-genkernel-*; do vers=${kernel#/boot/kernel-genkernel-} cat >>/boot/grub/grub.conf <<__EOT__ title ${vers} root ${ROOT} kernel ${kernel} ${OPTS} __EOT__ done grub --batch </boot/grub/install.grub --------------------------------------------------- Note the bare "ls" line. This causes failure in conjunction with the "-e" shell flag if there are no kernels. The preferred kernel versions have symlinks in the root directory and are included first. After that other available kernel versions follow. HTH Christian -- Dipl.-Inf. Christian Kauhaus <>< · kc@gocept.com · systems administration gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany http://gocept.com · tel +49 345 1229889 11 · fax +49 345 1229889 1 Zope and Plone consulting and development -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 03/15/2011 03:25 AM, David Kavanagh wrote:> Has anyone come up with a preferred method of messing with grub? I need > to install a hypervisor (like xen or kvm) and modify the grub.conf to > make the machine boot from the new kernel. > I might mess with Augeas. What do the experts say?Hi, don''t ever modify grub.cfg, neither with nor without puppet. It''s not meant for that. What I do is use puppet to mess with the powerful scriptlets in /etc/grub.d (e.g., I rename them to have xen before non-xen kernels and roll my own modified version of the xen finding scriptlet to correctly detect my xen config). HTH, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.