Bug#773092: grub-efi-amd64: grub efi installation failure
On Sun, Dec 21, 2014 at 12:40:41AM +0530, Ritesh Raj Sarraf wrote: On 12/20/2014 08:34 AM, Steve McIntyre wrote: Control: tag -1 +patch Here's a tested patch. Linux lookups on VFAT are not as intelligent as you'd hope in terms of matching filenames despite case changes. Instead, I've added more code to do directory lookups and do case-insensitive matching by hand. This will now work regardless of the silliness of any existing filenames, and will default to all-caps on creation if they don't already exist. The patch fixes the reported problem. Thanks Steve. Excellent, thanks for confirming. :-) -- Steve McIntyre, Cambridge, UK.st...@einval.com liw everything I know about UK hotels I learned from Fawlty Towers -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#773092: grub-efi-amd64: grub efi installation failure
On 12/20/2014 08:34 AM, Steve McIntyre wrote: Control: tag -1 +patch Here's a tested patch. Linux lookups on VFAT are not as intelligent as you'd hope in terms of matching filenames despite case changes. Instead, I've added more code to do directory lookups and do case-insensitive matching by hand. This will now work regardless of the silliness of any existing filenames, and will default to all-caps on creation if they don't already exist. The patch fixes the reported problem. Thanks Steve. -- Ritesh Raj Sarraf | http://people.debian.org/~rrs Debian - The Universal Operating System signature.asc Description: OpenPGP digital signature
Bug#773092: grub-efi-amd64: grub efi installation failure
Control: tag -1 +patch Here's a tested patch. Linux lookups on VFAT are not as intelligent as you'd hope in terms of matching filenames despite case changes. Instead, I've added more code to do directory lookups and do case-insensitive matching by hand. This will now work regardless of the silliness of any existing filenames, and will default to all-caps on creation if they don't already exist. -- Steve McIntyre, Cambridge, UK.st...@einval.com Google-bait: http://www.debian.org/CD/free-linux-cd Debian does NOT ship free CDs. Please do NOT contact the mailing lists asking us to send them to you. From 9774672cc1b9ab3d5b30cdbeaa3cad635ef9393b Mon Sep 17 00:00:00 2001 From: Steve McIntyre st...@einval.com Date: Sat, 20 Dec 2014 01:02:34 + Subject: [PATCH 2/2] V2 of the grub-install-extra-removable patch Deal with case-insensitive filesystem issues: maybe the directories and file names we're using don't match what's already there. Check each path component as we go, and use existing ones if we can. Fixed #773092 --- debian/patches/grub-install-extra-removable.patch | 99 ++- util/grub-install.c | 80 -- 2 files changed, 153 insertions(+), 26 deletions(-) diff --git a/debian/patches/grub-install-extra-removable.patch b/debian/patches/grub-install-extra-removable.patch index cbaa47a..2a7c972 100644 --- a/debian/patches/grub-install-extra-removable.patch +++ b/debian/patches/grub-install-extra-removable.patch @@ -12,9 +12,9 @@ with new boot paths. Signed-off-by: Steve McIntyre 93...@debian.org -Bug-Debian: https://bugs.debian.org/767037 +Bug-Debian: https://bugs.debian.org/767037 https://bugs.debian.org/773092 Forwarded: Not yet -Last-Update: 2014-12-03 +Last-Update: 2014-12-20 Patch-Name: grub-install-extra-removable.patch --- @@ -22,7 +22,6 @@ Patch-Name: grub-install-extra-removable.patch 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/util/grub-install.c b/util/grub-install.c -index 7a7734e..18015da 100644 --- a/util/grub-install.c +++ b/util/grub-install.c @@ -56,6 +56,7 @@ @@ -33,7 +32,7 @@ index 7a7734e..18015da 100644 static int recheck = 0; static int update_nvram = 1; static char *install_device = NULL; -@@ -114,7 +115,8 @@ enum +@@ -114,7 +115,8 @@ OPTION_LABEL_BGCOLOR, OPTION_PRODUCT_VERSION, OPTION_UEFI_SECURE_BOOT, @@ -43,7 +42,7 @@ index 7a7734e..18015da 100644 }; static int fs_probe = 1; -@@ -217,6 +219,10 @@ argp_parser (int key, char *arg, struct argp_state *state) +@@ -217,6 +219,10 @@ removable = 1; return 0; @@ -54,7 +53,7 @@ index 7a7734e..18015da 100644 case OPTION_ALLOW_FLOPPY: allow_floppy = 1; return 0; -@@ -323,6 +329,9 @@ static struct argp_option options[] = { +@@ -323,6 +329,9 @@ N_(do not install an image usable with UEFI Secure Boot, even if the system was currently started using it. This option is only available on EFI.), 2}, @@ -64,35 +63,99 @@ index 7a7734e..18015da 100644 {0, 0, 0, 0, 0, 0} }; -@@ -829,6 +838,27 @@ fill_core_services (const char *core_services) +@@ -829,6 +838,91 @@ free (sysv_plist); } ++/* Helper routine for also_install_removable() below. Walk through the ++ specified dir, looking to see if there is a file/dir that matches ++ the search string exactly, but in a case-insensitive manner. If so, ++ return a copy of the exact file/dir that *does* exist. If not, ++ return NULL */ ++static char * ++check_component_exists(const char *dir, ++ const char *search) ++{ ++ grub_util_fd_dir_t d; ++ grub_util_fd_dirent_t de; ++ char *found = NULL; ++ ++ d = grub_util_fd_opendir (dir); ++ if (!d) ++grub_util_error (_(cannot open directory `%s': %s), ++ dir, grub_util_fd_strerror ()); ++ ++ while ((de = grub_util_fd_readdir (d))) ++{ ++ if (strcasecmp (de-d_name, search) == 0) ++ { ++ found = xstrdup (de-d_name); ++ break; ++ } ++} ++ grub_util_fd_closedir (d); ++ return found; ++} ++ ++/* Some complex directory-handling stuff in here, to cope with ++ * case-insensitive FAT/VFAT filesystem semantics. Ugh. */ +static void -+also_install_removable(const char *src, const char *base_efidir, const char *efi_suffix_upper) ++also_install_removable(const char *src, ++ const char *base_efidir, ++ const char *efi_suffix_upper) +{ + char *efi_file = NULL; + char *dst = NULL; -+ char *dir = NULL; ++ char *cur = NULL; ++ char *found = NULL; + + if (!efi_suffix_upper) +grub_util_error (%s, _(efi_suffix_upper not set)); + efi_file = xasprintf (BOOT%s.EFI, efi_suffix_upper); + -+ dir = grub_util_path_concat (3, base_efidir, EFI, BOOT); -+ grub_install_mkdir_p (dir); ++ /* We need to install in $base_efidir/EFI/BOOT/$efi_file, but we ++ * need to cope with case-insensitive stuff here. Build the path one ++ * component at a time,
Bug#773092: grub-efi-amd64: grub efi installation failure
Package: grub-efi-amd64 Version: 2.02~beta2-18 Severity: important On debconf prompt, grub-efi-amd64 asked my if I would want to force install grub onto the EFI partition. I said yes, and it failed... Setting up libwebkitgtk-3.0-0:amd64 (2.4.7-3) ... Setting up libpackagekit-glib2-18:amd64 (1.0.1-2) ... Setting up grub-common (2.02~beta2-18) ... Setting up grub2-common (2.02~beta2-18) ... Setting up grub-efi-amd64-bin (2.02~beta2-18) ... Setting up grub-efi-amd64 (2.02~beta2-18) ... Installing for x86_64-efi platform. grub-install: error: cannot open `/boot/efi/EFI/BOOT/BOOTX64.EFI': File exists. Failed: grub-install --target=x86_64-efi --force-extra-removable WARNING: Bootloader is not properly installed, system may not be bootable Generating grub configuration file ... Found background image: .background_cache.png Found linux image: /boot/vmlinuz-3.16.0-4-amd64 Found initrd image: /boot/initrd.img-3.16.0-4-amd64 Found Windows Boot Manager on /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi Adding boot menu entry for EFI firmware configuration Found Grml ISO image: /boot/grml/grml64-full_2014.03.iso Found Grml ISO image: /boot/grml/grml64-small_2014.03.iso done Setting up grub-efi (2.02~beta2-18) ... Setting up packagekit (1.0.1-2) ... Reloading dbus configuration (via systemctl): dbus.service. Setting up packagekit-tools (1.0.1-2) ... Setting up python-astroid (1.2.1-3) ... Processing triggers for libc-bin (2.19-13) ... Current status: 0 updates [-12]. Looking at that path: rrs@learner:~$ ls /boot/efi/EFI/BOOT/BOOTX64.EFI ls: cannot access /boot/efi/EFI/BOOT/BOOTX64.EFI: No such file or directory 13:49 ♒♒♒ ☹ = 2 rrs@learner:~$ ls /boot/efi/EFI/BOOT/bootx64.efi /boot/efi/EFI/BOOT/bootx64.efi* 13:49 ♒♒♒ ☺ /boot/efi is mounted as: /dev/sda2 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro) -- Package-specific info: *** BEGIN /proc/mounts /dev/mapper/LocalCrypt-ROOT / ext4 rw,relatime,errors=remount-ro,commit=600,data=writeback 0 0 /dev/sda6 /boot ext4 rw,relatime,commit=600,data=ordered 0 0 /dev/sda2 /boot/efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro 0 0 *** END /proc/mounts *** BEGIN /boot/grub/grub.cfg # # DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then set have_grubenv=true load_env fi if [ ${next_entry} ] ; then set default=${next_entry} set next_entry= save_env next_entry set boot_once=true else set default=0 fi if [ x${feature_menuentry_id} = xy ]; then menuentry_id_option=--id else menuentry_id_option= fi export menuentry_id_option if [ ${prev_saved_entry} ]; then set saved_entry=${prev_saved_entry} save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z ${boot_once} ]; then saved_entry=${chosen} save_env saved_entry fi } function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi } if [ x$feature_default_font_path = xy ] ; then font=unicode else insmod part_gpt insmod ext2 set root='hd0,gpt6' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6 33176b2c-e136-4c68-8a42-b11dfa8e052a else search --no-floppy --fs-uuid --set=root 33176b2c-e136-4c68-8a42-b11dfa8e052a fi font=/grub/unicode.pf2 fi if loadfont $font ; then set gfxmode=auto load_video insmod gfxterm set locale_dir=$prefix/locale set lang=en_US insmod gettext fi terminal_output gfxterm if [ ${recordfail} = 1 ] ; then set timeout=-1 else if [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=5 # Fallback normal timeout code in case the timeout_style feature is # unavailable. else set timeout=5 fi fi ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ### insmod part_gpt insmod ext2 set root='hd0,gpt6' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6 --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6 33176b2c-e136-4c68-8a42-b11dfa8e052a else search --no-floppy --fs-uuid --set=root 33176b2c-e136-4c68-8a42-b11dfa8e052a fi insmod png if background_image /grub/.background_cache.png; then set color_normal=white/black set color_highlight=black/white else set menu_color_normal=cyan/blue set menu_color_highlight=white/blue fi ### END /etc/grub.d/05_debian_theme ### ### BEGIN
Bug#773092: grub-efi-amd64: grub efi installation failure
On Sun, 2014-12-14 at 13:51 +0530, Ritesh Raj Sarraf wrote: Thanks for the report. grub-install: error: cannot open `/boot/efi/EFI/BOOT/BOOTX64.EFI': File exists. The code uses GRUB_UTIL_FD_O_CREATTRUNC which == O_CREAT | O_TRUNC, to open the destination file, so overwriting should be fine. Failed: grub-install --target=x86_64-efi --force-extra-removable Perhaps you could run this by hand under strace (as root). Might give some clue. Looking at that path: rrs@learner:~$ ls /boot/efi/EFI/BOOT/BOOTX64.EFI ls: cannot access /boot/efi/EFI/BOOT/BOOTX64.EFI: No such file or directory 13:49 ♒♒♒ ☹ = 2 rrs@learner:~$ ls /boot/efi/EFI/BOOT/bootx64.efi /boot/efi/EFI/BOOT/bootx64.efi* 13:49 ♒♒♒ ☺ I wonder if this is a case-sensitivity thing (BOOTX64.EFI vs bootx64.efi) and an oddity of vfat? Steve, perhaps the answer is to remove the existing file first (which I assume/hope due to the quirks of VFAT will work regardless of which case is used). Other EFI code doesn't bother, but in general it is dealing with paths which we control, e.g. /boot/efi/EFI/Debian. /boot/efi/EFI/BOOT could be expected to have stuff written by another OS in it I suppose. /dev/sda2 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro) Did all of these options come from somewhere standard like d-i or did you set them? I don't see them in current partman-efi. Ian. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#773092: grub-efi-amd64: grub efi installation failure
On 12/14/2014 04:00 PM, Ian Campbell wrote: /dev/sda2 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro) Did all of these options come from somewhere standard like d-i or did you set them? I don't see them in current partman-efi. It should have come by the installer. rrs@learner:/tmp$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # file system mount point type options dump pass /dev/mapper/LocalCrypt-ROOT / ext4 data=writeback,errors=remount-ro 0 1 # /boot was on /dev/sda6 during installation UUID=33176b2c-e136-4c68-8a42-b11dfa8e052a /boot ext4 defaults0 2 # /boot/efi was on /dev/sda2 during installation UUID=5C4B-9790 /boot/efi vfatdefaults0 1 /dev/mapper/LocalCrypt-SWAP noneswapsw 0 0 Based on the fstab comments, it looks like installer's. -- Ritesh Raj Sarraf | http://people.debian.org/~rrs Debian - The Universal Operating System signature.asc Description: OpenPGP digital signature
Bug#773092: grub-efi-amd64: grub efi installation failure
On Sun, 2014-12-14 at 16:47 +0530, Ritesh Raj Sarraf wrote: On 12/14/2014 04:00 PM, Ian Campbell wrote: /dev/sda2 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro) Did all of these options come from somewhere standard like d-i or did you set them? I don't see them in current partman-efi. It should have come by the installer. rrs@learner:/tmp$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # file system mount point type options dump pass /dev/mapper/LocalCrypt-ROOT / ext4 data=writeback,errors=remount-ro 0 1 # /boot was on /dev/sda6 during installation UUID=33176b2c-e136-4c68-8a42-b11dfa8e052a /boot ext4 defaults0 2 # /boot/efi was on /dev/sda2 during installation UUID=5C4B-9790 /boot/efi vfatdefaults0 1 /dev/mapper/LocalCrypt-SWAP noneswapsw 0 0 Based on the fstab comments, it looks like installer's. Ah, yes, I forgot that /proc/mounts would include all the in-kernel defaults but was looking at the d-i code to write /etc/fstab which doesn't. Ian -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#773092: grub-efi-amd64: grub efi installation failure
On Sun, Dec 14, 2014 at 10:30:56AM +, Ian Campbell wrote: On Sun, 2014-12-14 at 13:51 +0530, Ritesh Raj Sarraf wrote: Thanks for the report. grub-install: error: cannot open `/boot/efi/EFI/BOOT/BOOTX64.EFI': File exists. The code uses GRUB_UTIL_FD_O_CREATTRUNC which == O_CREAT | O_TRUNC, to open the destination file, so overwriting should be fine. Failed: grub-install --target=x86_64-efi --force-extra-removable Perhaps you could run this by hand under strace (as root). Might give some clue. Looking at that path: rrs@learner:~$ ls /boot/efi/EFI/BOOT/BOOTX64.EFI ls: cannot access /boot/efi/EFI/BOOT/BOOTX64.EFI: No such file or directory 13:49 ♒♒♒ ☹ = 2 rrs@learner:~$ ls /boot/efi/EFI/BOOT/bootx64.efi /boot/efi/EFI/BOOT/bootx64.efi* 13:49 ♒♒♒ ☺ I wonder if this is a case-sensitivity thing (BOOTX64.EFI vs bootx64.efi) and an oddity of vfat? Oh, ugh! That just sounds totally broken. Steve, perhaps the answer is to remove the existing file first (which I assume/hope due to the quirks of VFAT will work regardless of which case is used). Other EFI code doesn't bother, but in general it is dealing with paths which we control, e.g. /boot/efi/EFI/Debian. /boot/efi/EFI/BOOT could be expected to have stuff written by another OS in it I suppose. Yes, maybe. I'll test a bit more... -- Steve McIntyre, Cambridge, UK.st...@einval.com We're the technical experts. We were hired so that management could ignore our recommendations and tell us how to do our jobs. -- Mike Andrews -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org