Bug#508834: update grub runs grub-probe -t fs /usr/share/grub/unicode.pf2?
Jim Bray
jimsantelmo at gmail.com
Fri Jan 1 01:31:12 UTC 2010
Update-grub has always been ridiculously slow for me also (maybe a
minute), most of it disk-thrashing. I finally ran iotop while doing an
update-grub and found that this is where it is spending its time:
grub-probe -t fs /usr/share/grub/unicode.pf2
(Note: the various copies of
transform="s,x,x,"
in the scripts do nothing, and can be replaced with
transform='#'
or the various "|sed ${transform}" could be eliminated. Just garbage,
apparently.)
I threw a set -x into grub-mkconfig, and figured out that it is hanging
up in
is_path_readable_by_grub ()
in grub-mkconfig_lib.
+ test -e /boot/grub/vbe.mod
+ GRUB_VIDEO_BACKEND=vbe
+ break
+ [ -n vbe ]
+ GRUB_TERMINAL_OUTPUT=gfxterm
+ [ -n ]
+ path=/usr/share/grub/unicode.pf2
+ is_path_readable_by_grub /usr/share/grub/unicode.pf2
+ path=/usr/share/grub/unicode.pf2
+ test -e /usr/share/grub/unicode.pf2
+ :
+ /usr/sbin/grub-probe -t fs /usr/share/grub/unicode.pf2
((it is called by this code from grub-mkconfig
# check for terminals that require fonts
case ${GRUB_TERMINAL_OUTPUT} in
gfxterm)
if [ -n "$GRUB_FONT" ] ; then
if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
GRUB_FONT_PATH=${GRUB_FONT}
else
echo "No such font or not readable by grub: ${GRUB_FONT}" >&2
exit 1
fi
else
for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
for basename in unicode unifont ascii; do
path="${dir}/${basename}.pf2"
if is_path_readable_by_grub ${path} > /dev/null ; then
))
So I threw a -v in to the grub-probe and got this mess:
+ /usr/sbin/grub-probe -v -t fs /usr/share/grub/unicode.pf2
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd0 is 234441648
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: changing current directory to /dev
/usr/sbin/grub-probe: info: changing current directory to virt
/usr/sbin/grub-probe: info: changing current directory to big
/usr/sbin/grub-probe: info: changing current directory to disk
/usr/sbin/grub-probe: info: changing current directory to by-label
/usr/sbin/grub-probe: info: changing current directory to by-uuid
/usr/sbin/grub-probe: info: changing current directory to by-path
/usr/sbin/grub-probe: info: changing current directory to by-id
/usr/sbin/grub-probe: info: changing current directory to block
/usr/sbin/grub-probe: info: changing current directory to char
/usr/sbin/grub-probe: info: changing current directory to net
/usr/sbin/grub-probe: info: changing current directory to shm
/usr/sbin/grub-probe: info: changing current directory to pts
/usr/sbin/grub-probe: info: /dev/sdb5 starts from 156505293
/usr/sbin/grub-probe: info: opening the device hd1
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: DOS partition 0 starts from 63
/usr/sbin/grub-probe: info: DOS partition 1 starts from 257040
/usr/sbin/grub-probe: info: DOS partition 2 starts from 78381135
/usr/sbin/grub-probe: info: DOS partition 4 starts from 156505293
/usr/sbin/grub-probe: info: opening hd1,5
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: reading /usr/share/grub/unicode.pf2 via OS
facilities
/usr/sbin/grub-probe: info: reading /usr/share/grub/unicode.pf2
/usr/sbin/grub-probe: info: getting the size of /usr/share/grub/unicode.pf2
/usr/sbin/grub-probe: info: reading (hd1,5)/usr/share/grub/unicode.pf2
via GRUB facilities
/usr/sbin/grub-probe: info: the size of hd1 is 625142448
/usr/sbin/grub-probe: info: comparing
All for this file:
ls -l /usr/share/grub/unicode.pf2
-rw-r--r-- 1 root root 2968057 Nov 30 08:46 /usr/share/grub/unicode.pf2
My fix:
In /usr/lib/grub/grub_
is_path_readable_by_grub ()
{
path=$1
# return if path is readable, skip the grub-probe call.
test -r $path && return 0
Works for me.
Of course it still takes way too long, and all of that is spent in
grub-probe of other things, so grub-probe is the real problem. This way
it only takes say 15 seconds instead of a minute.
Happy New Year,
Jim
More information about the Pkg-grub-devel
mailing list