Bug#302716: dpkg screws up GRUB's menu.lst
Here's a patch that will make 'update-grub' give a warning if the
currently mounted root partition does not match kopts. Tested and seems to
work. Apply with cd /sbin; patch update-grub < update-grub.patch
*** update-grub.old Sun Apr 3 15:14:22 2005
--- update-grub Sun Apr 3 15:27:14 2005
***************
*** 548,551 ****
--- 548,574 ----
}
+ check_root_partition()
+ {
+ current_opt=$1
+ kernel_version=$2
+
+ current_root_partition=$(find_root_device)
+ future_root_partition=$(echo "$current_opt" | sed -n 's/.*root=\(.*\)\ .*/\1/p')
+
+ if [ "$future_root_partition" ] ; then
+ if [ "$current_root_partition" != "$future_root_partition" ] ; then
+ echo
+ echo " WARNING!"
+ echo "Kernel $kernel_version will mount $future_root_partition as the root partition."
+ echo "This differs from current root partition ($current_root_partition)."
+ echo
+ echo "If this is not what you want, edit GRUB'smenu.lst and"
+ echo - adjust the \""$current_opt"\" parameter passed to the kernel
+ echo "- adjust the \"kopts\" default parameter to prevent such problems in the future."
+ echo
+ fi
+ fi
+ }
+
write_kernel_entry()
{
***************
*** 791,794 ****
--- 814,819 ----
currentOpt=$(get_kernel_opt $kernelVersion)
+ check_root_partition "$currentOpt" "$kernelVersion"
+
write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel" \
"$currentOpt" "" "$initrd"
Reply to: