Bug#411109: update-grub/grub-set-default throws an error, if /grub dir does not exist

Otavio Salvador otavio at debian.org
Fri Feb 16 12:17:10 CET 2007


Andreas John <aj at net-lab.net> writes:

> Package: grub
> Version: sid
> Severity: medium
>
> Hi,
> after dist-upgrading my sid, update-grub did not run successfully.
> The reason for that was that it called indirectly 'grub-set-default',
> which looked for a grub dir on / ! (not /boot or in my case /boot/boot
> ,as I run traditionally an own partition for /boot).

Well, there's something confuse here.

update-grub would abort if case it couldn't find your /boot/grub
directory. This is done on find_grub_dir method inside of
update-grub. Check following:

#v+
find_grub_dir ()
{
	echo  -n "Searching for GRUB installation directory ... " >&2

	for d in $grub_dirs ; do
		if [ -d "$d" ] ; then
			grub_dir="$d"
			break
		fi
	done
	
	if [ -z "$grub_dir" ] ; then
		abort "No GRUB directory found.\n To create a template run 'mkdir /boot/grub' first.\n To install grub, install it manually or try the 'grub-install' command.\n ### Warning, grub-install is used to change your MBR. ###"
	else
		echo "found: $grub_dir" >&2
	fi

	echo $grub_dir
}
#v-

and the abort method:

#v+
abort() {
	message=$@

	echo >&2
	echo -e "$message" >&2
	echo >&2
	exit 1
}
#v-

To reproduce it, I removed my grub directory and called
update-grub. It gave me the output:

#v+
otavio at neumann:~/hacking/pkg-grub$ ls -l /boot/grub
ls: /boot/grub: Arquivo ou diretório não encontrado
otavio at neumann:~/hacking/pkg-grub$ sudo update-grub
Searching for GRUB installation directory ... 
No GRUB directory found.
 To create a template run 'mkdir /boot/grub' first.
 To install grub, install it manually or try the 'grub-install' command.
 ### Warning, grub-install is used to change your MBR. ###
#v-

And the, it means the bug is somewhere else.

Please, put your fstab to me check it.

> This might have to do with the fact, that /boot ran out of disk space
> during my dist-upgrades. (I have to much different kernels I think :-))
> But in any case there should be a sanity check in update-grub that
> regenerates any missing files or dirs. An mkdir /grub solved my problem,
> but I am not sure if that was simply a dirty workaround.

No. update-grub isn't intended to be used to "install" grub and
install missing files. It's responsability is to deal with menu.lst
only.

Before running it, you should have been installed grub otherwise it
should fail.

Please, reproduce the bug and provide a complete output otherwise
would be very difficult to get it solved. I cannot reproduce it on my
machine :(

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."




More information about the Pkg-grub-devel mailing list