Bug#605705: grub-pc: grub does not use desktop-base background image when / is encrypted (LUKS on LVM)
Alexander Kurtz
kurtz.alex at googlemail.com
Tue Dec 14 18:05:43 UTC 2010
tags 605705 patch
thanks
Hi,
After pulling my hair out for two days because of GRUB's insanity ;-), I
think I finally got something:
Instead of fixing `05_debian_theme', I decided to rewrite it completely.
It should now be way more flexible and user-friendly and it is
definitely less error prone. For details see below.
Additionally I made two (very) small changes to the postinst and the
postrm. You'll find the patches and the new version of `05_debian_theme'
attached.
Ok, let's look into the details:
Am Donnerstag, den 02.12.2010, 23:05 +0800 schrieb Paul Wise:
> When / is encrypted, grub does not use the desktop-base background
> image. There are multiple issues involved here...
This works now, at least for me.
> The first is that the grub-pc postinst copies the wrong file
> to /boot/grub during install:
grub-pc.postinst.patch should fix that.
> The second is that 05_debian_theme may override the wallpaper but then
> does not try to copy the overridden file to /boot/grub:
It does now, but only if GRUB could otherwise not access the wallpaper
(e.g. for encrypted root file systems).
> Third is that there doesn't seem to be any cleanup of old images:
>
> pabs at chianamo:~$ ls -l /boot/grub/*.png
> -rw-r--r-- 1 root root 83K Nov 9 2008 /boot/grub/debian-blueish-wallpaper-640x480.png
> -rw-r--r-- 1 root root 50K Nov 18 12:37 /boot/grub/moreblue-orbit-grub.png
05_debian_theme does now clean up these old images, but only if they
match both in filename and checksum. Please tell me if I should add any
more files to the list of obsolete images.
> Fourth 05_debian_theme doesn't appear to have been written with
> corner-cases, flexibility or error handling in mind, for example:
I tried to do a better job here ;-)
> * if grub_background.sh somehow doesn't define WALLPAPER, things
> will break. instead it should fall back on the default wallpaper
Now it falls back to "/usr/share/images/desktop-base/desktop-grub.png".
> * fails to account for anything other than png/jpeg/tga
Well that's simply what GRUB seems to support right now. But at least
the script does now support both lower and upper case, e.g. foo.jpeg and
foo.JPEG - this might be useful since most digital cameras use upper
case file extensions.
> * no way for users to override the default easily
There are now two ways:
a) Set $GRUB_BACKGROUND in /etc/default/grub
b) Simply copy an appropriate file to /boot/grub
Note that a) should theoretically already work with the current version
if the path of the image is readable by GRUB, since `00_header'
evaluates $GRUB_BACKGROUND. However `05_debian_theme' ignores that
setting and simply overwrites it with its own configuration.
My version honors $GRUB_BACKGROUND and can also handle the case where
the image path is not accessible by GRUB.
> * only allows for one package (desktop-base) to set the default
> wallpaper
With my version, every package can simply store it's image under
`/boot/grub/zz-mypackage.png'. After running `update-grub' this should
be the new wallpaper if the user hasn't already defined another one.
However, the cleaner way would probably be to install a file
under /etc/grub.d, for example like this:
$ cat /etc/grub.d/01-mypackage
#!/bin/sh
if [ -z "${GRUB_BACKGROUND}" ]; then
GRUB_BACKGROUND="/path/to/myimage.png"
fi
> All this hardcoding of moreblue-orbit is not a good idea either. If you
> are going to hard-code this stuff, at least hard-code the default image
> name.
The only hardcoded image is now the fallback which points to
"/usr/share/images/desktop-base/desktop-grub.png". However that
file is actually a symlink which is configured by the Debian
alternatives system:
$ file /usr/share/images/desktop-base/desktop-grub.png
/usr/share/images/desktop-base/desktop-grub.png: symbolic link to `/etc/alternatives/desktop-grub'
$
$ update-alternatives --list desktop-grub
/usr/share/images/desktop-base/moreblue-orbit-grub.png
/usr/share/images/desktop-base/spacefun-grub-widescreen.png
/usr/share/images/desktop-base/spacefun-grub.png
$
Am Dienstag, den 14.12.2010, 09:41 +0800 schrieb Paul Wise:
> IIRC the postinst has always copied the file in and it still does
> AFAICT. The name of the default theme changed again and the grub
> maintainer has not yet updated the file name.
Ok, that's what I thought. My patch to the postinst removes the part
where the hardcoded image is copied.
> In my opinion that is correct, best ask the maintainer how they prefer
> to fix it though. Please note that when purging the package, /boot/grub
> will probably need to be cleaned up by the postrm.
I've patched the postrm to clear all files which `05_debian_theme' might
have created automatically.
> It would be nice but it is not essential since people using full-disk
> encryption are probably capable of finding this bug report and figuring
> out how to workaround this issue.
Well, but GRUB looks simply sad and boring without any background image. ;-)
However, that decision is up to the maintainer.
Ok, that's it!
I would be happy if you could give my new version of `05_debian_theme' a
try and send me your feedback!
Best regards
Alexander Kurtz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 05_debian_theme
Type: application/x-shellscript
Size: 4807 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20101214/b16df1d7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grub-pc.postinst.patch
Type: text/x-patch
Size: 525 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20101214/b16df1d7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grub-pc.postrm.patch
Type: text/x-patch
Size: 793 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20101214/b16df1d7/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20101214/b16df1d7/attachment.pgp>
More information about the Pkg-grub-devel
mailing list