Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Installed ubuntu 12.10 on a Asus vivobook (X202E, but many similar models around) by resizing the original windows8 partition, disabled safeboot, and installed in EFI mode.

this is my Partition table

Model: ATA Hitachi HTS54505 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system     Name                          Flags
 1      0.00GB  0.32GB  0.31GB  fat32           EFI system partition          boot
 2      0.32GB  0.94GB  0.63GB  ntfs            Basic data partition          hidden, diag
 3      0.94GB  1.08GB  0.13GB                  Microsoft reserved partition  msftres
 4      1.08GB  201GB   200GB   ntfs            Basic data partition
 5      201GB   210GB   8.39GB  linux-swap(v1)  Basic data partition
 6      210GB   262GB   52.4GB  ext4            Basic data partition
 7      262GB   479GB   217GB   ext4            Basic data partition
 8      479GB   500GB   21.5GB  ntfs            Basic data partition          hidden, diag

At first I couldn't boot windows 8. but a search here pointed me to edit the custom40 file in /etc/grub.d to add

insmod part_gpt
insmod ntfs
root '(hd0,gpt4)'
(and here i think it was Chainloader +1, not sure)

all was fine, until the 13.04 update. now i have the following in grub.cfg:

cat /boot/grub/grub.cfg
menuentry 'Windows 8 (loader) (on /dev/sda4)' --class windows --class os $menuentry_id_option 'osprober-chain-BEE60B1AE60AD317' {
    insmod part_gpt
    insmod ntfs
    set root='hd0,gpt4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  BEE60B1AE60AD317
      search --no-floppy --fs-uuid --set=root BEE60B1AE60AD317
    drivemap -s (hd0) ${root}
    chainloader +1

And my 40_custom file is gone! well, not gone, but it has the initial contents...

When I select this option, i get can't find command 'drivemap' and invalid EFI file path

I think there are a few questions now:

1) why the update removed my custom grub file?

2) Why grub generates a config file with a command that it has no clue about?

3) what do i do to fix that?

For number 3, if I may be picky, i'd like something with a little more insight than install boot-repair and i'd really like to start to build my knowledge of GPT and EFI to the level I had it with (sane) partitions.

really appreciate any input here.

share|improve this question

The drivemap and chainloader +1 options are used to boot BIOS-mode OSes from a BIOS version of GRUB; but your system is EFI-based and has an EFI-mode Windows installation, so any GRUB entry with those options is doomed to failure. Instead, you'd need something like this:

menuentry "Windows 8" {
    insmod part_gpt
    insmod chain
    set root='(hd0,gpt1)'
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi

I make no promises that this will work, though; GRUB is very finicky when it comes to booting Windows, and what works on one computer often fails on another.

I don't know why your /etc/grub.d/40_custom file was wiped clean. This is the first time I've heard of that happening. My only guess is that Boot Repair, or some other tool intended to help fix GRUB problems, might be responsible.

You might have better luck replacing or supplementing GRUB with another boot manager, such as gummiboot or my own rEFInd. These programs are less finicky about booting Windows, and they can also boot Linux kernels that include the EFI stub loader, which means most 3.3.0 and later kernels. In the case of rEFInd, installing the Debian binary package should set everything up correctly, provided that you have not run Boot Repair. If you have run Boot Repair, you should undo its file-juggling act before proceeding; if you don't, you'll get GRUB when you try to launch Windows.

Since you say you want to learn more about this subject, I recommend my Web page on EFI boot loaders. Also, check out Matthew Garrett's blog; it covers many topics, including some (mostly technical) discussions of EFI boot issues.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.