Difference between revisions of "Talk:GRUB"

From ArchWiki
Jump to: navigation, search
(Possible mistake?)
(grub standalone)
 
(202 intermediate revisions by 26 users not shown)
Line 1: Line 1:
== GRUB Legacy stuff should be removed ==
+
== Alpha sorting for kernel names without versions ==
  
I mean, seriously, the page is loaded with too much information anyway. And also because of this: http://www.archlinux.org/news/grub-legacy-no-longer-supported/ --[[User:DSpider|DSpider]] ([[User talk:DSpider|talk]]) 17:41, 29 August 2012 (UTC)
+
When installing the "linux" and "linux-lts" kernels on a basic install, the ''/etc/grub.d/10_linux'' in 2.02-beta1 will try and use a numeric-oriented sorting routine that doesn't work well for kernels without any versions in the names of the files. I've submitted a feature request and patch for this upstream:
  
== EFI ==
+
* https://savannah.gnu.org/bugs/index.php?42597
  
Is there any reason why grub should be installed to /boot/efi/efi/grub and not to /boot/efi? UEFI wants to have the efi-image unter <EFI SYSTEM PARTITION>/efi/name, so /boot/efi/grub should do the trick.
+
Forum discussion w/patch:
Additionally, mounting (e.g.) /dev/sda1 to /boot/efi and just placing the grub there will possibly conflict with having a LVM+LUKS setup, where /boot will then be encrypted. At the moment I'm running a funtoo installation on a thinkpad x121e with /dev/sda1 (200MB, fat32, sectors 1 - 201) mounted to /boot and /dev/sda2 being a LUKS encrypted system. /boot contains the bzImage and /boot/efi/boot/bootx64.efi is the grub-image.
+
  
Note: there should possibly be a section/table here containing information what firmware expects what name. having /boot/efi/grub/grub.efi didn't work for me, and as noted in the thinkwiki for an x220, /boot/efi/boot/bootx64.efi works fine. --[[User:Rochus|Rochus]] 13:59, 16 August 2011 (EDT)
+
* https://bbs.archlinux.org/viewtopic.php?pid=1428523
  
 +
: [//gist.github.com/fstirlitz/7639129 I solved this (and other problems) long ago…] why nobody applied this patch to the Arch package is beyond me. [[User:Fstirlitz|felix]] ([[User talk:Fstirlitz|talk]]) 14:11, 8 August 2014 (UTC)
  
@Rochus: You have mounted your EFISYS partition at /boot ir you are using same part as both EFISYS and /boot and it is FAT32 formatted. The actual path is <EFI_SYS_PART>/efi/grub/grub.efi wherein <EFI_SYS_PART> is usually /boot/efi or in your case /boot itself.
+
::What is the current sate of this issue? --[[User:Stevenmw|Stevenmw]] ([[User talk:Stevenmw|talk]]) 10:56, 6 December 2014 (UTC)
  
But I do not understand your argument about mounting EFISYS at /boot/efi conflicting with LVM+LUKS. I don't have such a config in my system to understand what you are coming to say. <EFI_SYS_PART>/efi/boot/bootx64.efi is just a fallback path incase there's no boot entry in UEFI Boot Manager (see efibootmgr section). I already mentioned in the article that "If you have mounted EFISYS part at a different mountpoint, replace /boot/efi with that mountpoint in all the commands". I suppose that explains it. It is better to have /boot separate from EFISYS partition. I have /dev/sda1 as 200 MiB FAT32 EFISYS mounted at /boot/efi and /dev/sda3 as 400 MiB ext4 /boot part. For /boot/efi/grub/grub.efi to work you have to add a boot entry to grub.efi in the UEFI Boot Manager using efibootmgr utility. -- [[User:the.ridikulus.rat|Keshav P R]] 23:15, 28 August 2011 (IST)
+
:::I'd leave this open right now, as it seems a candidate for merging with [[GRUB/Tips and tricks#Multiple entries]]. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 19:36, 22 December 2014 (UTC)
  
== GRUB_GFXMODE may not work with a depth parameter ==
+
== Manually generate grub.cfg ==
  
I'm installing on an i5 system with Intel graphics, and found that I could not get a background image if I used any depth parameter in GRUB_GFXMODE=; if I used the 0x value I got the same errors. I would get a black screen with a blue box, titled "Out of Range" and some H. Frequency and V. Frequency parameters. The boot continued in the background, and eventually I got the normal scroll of information during the boot. What I found was that if I just used a resolution, e.g., 800x600, with nothing more, it worked fine. Not sure if this is something for the wiki here or elsewhere, or something to post in the forums; but it should be somewhere to save the next person the hassle of figuring it out, I think. -- [[User:Timm|Timm]] 13:08, 29 October 2011 (EDT)
+
In previous revisions, instructions on manually creating a grub.cfg were removed [https://wiki.archlinux.org/index.php?title=GRUB&diff=347960&oldid=347954], and later added to [[GRUB/Tips and tricks]] [https://wiki.archlinux.org/index.php?title=GRUB/Tips_and_tricks&oldid=349645#Manually_creating_grub.cfg]. This was discussed with [https://wiki.archlinux.org/index.php?title=Talk:GRUB&diff=349659&oldid=349657].
 +
However, as it turns out manually creating a grub.cfg is in fact ''encouraged'' upstream [https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html#Simple-configuration]. This is especially true in Arch as we don't have versioned kernels: {{Bug|16702}} (and thus no changing vmlinuz/initrd paths). As such I believe we should reduce the role of grub-mkconfig, expand on grub.cfg and move it back to the main article. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 14:24, 27 June 2015 (UTC)
 +
: I don't see a problem with this.
 +
: From upstream: '' In the meantime, those who feel that it would be easier to write grub.cfg directly are encouraged to do so... and to '''disable any system provided by their distribution to automatically run grub-mkconfig.'''''
 +
: Correct me if I'm wrong here but I don't think we have anything that automatically calls grub-mkconfig. Therefore manually creating/editing grub.cfg shouldn't be a problem. -- [[User:Chazza|Chazza]] ([[User talk:Chazza|talk]]) 15:01, 27 June 2015 (UTC)
 +
 
 +
::+1, this will also avoid random notes [https://wiki.archlinux.org/index.php?title=Multiboot_USB_drive&diff=379818&oldid=379749 like this] in other articles. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 19:21, 27 June 2015 (UTC)
 +
 
 +
::Nothing calls grub-mkconfig, no. Yet, I tend to disagree. Reasons: (1) the article is still too long anyway and the fresh start on manually creating grub.cfg is a good base to expand in tips&tricks. (2) Reducing grub-mkconfig basically also means having to touch most content that covers the main options in /etc/default/grub. If I see it right, the Arch package comes with defaults there. (3) Thankfully grub-mkconfig automatically figures menu entry names, but also determines a root= UUID by default these days. The latter not a big problem for simple roots, but cumbersome to describe for others (e.g. when a device mapper is used, lvm, luks, ...). Likewise, grub-mkconfig also uses output from {{Pkg|os-prober}} to automatically generate entries.
 +
::So, I don't think it is a straight-forward task and make things clearer. The instances one would save on "Now re-generate the configuration: ..." would probably have to be replaced with "Now better check the result with grub-script-check /boot/grub/grub.cfg" ... I think it would be better to give [[GRUB/Tips and tricks#Manually creating grub.cfg]] more prominence and expand the fresh base there as required/wanted. Also some of the lengthy menu entry examples of [[GRUB#Automatically generating using .2Fetc.2Fgrub.d.2F40 custom and grub-mkconfig]] could be moved to a section there; they basically work/serve as examples for both (copy pasting into /etc/grub.d/40_custom or /boot/grub/grub.cfg). --[[User:Indigo|Indigo]] ([[User talk:Indigo|talk]]) 21:51, 27 June 2015 (UTC)
 +
 
 +
:::I agree with [[User:Indigo|Indigo]]. -- [[User:6arms1leg|6arms1leg]] ([[User talk:6arms1leg|talk]]) 12:48, 28 June 2015 (UTC)
 +
 
 +
::About (1), the inclusion on manually generating grub.cfg would be accompanied by (another, but needed) rewrite of the GRUB article. On (2), similar argument as in (1), and things like modules can be expanded on where needed. (3) It's not because you're not using grub-mkconfig, that you won't use tools such as ''grub-probe'' and ''grub-script-check'' to facilitate some tasks.
 +
::As to clarity, most people just run "grub-mkconfig" without understanding the process at hand, and as such, have difficulties when problems arise.
 +
::Note: I won't have much time to work on this (besides other tasks, I'd prefer to create [[fdisk]] first). -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 15:48, 28 July 2015 (UTC)
  
 
== Custom keyboard layout ==
 
== Custom keyboard layout ==
 +
 
Hi. Could we add a section explaining how you can set your preferred keyboard layout within GRUB2? As i found [http://lists.gnu.org/archive/html/grub-devel/2011-06/msg00008.html here], we need the ckbcomp script, which can be obtained from Debian console-setup package.
 
Hi. Could we add a section explaining how you can set your preferred keyboard layout within GRUB2? As i found [http://lists.gnu.org/archive/html/grub-devel/2011-06/msg00008.html here], we need the ckbcomp script, which can be obtained from Debian console-setup package.
  
 
Here's how I made things work:
 
Here's how I made things work:
  
  ckbcomp it | grub-mklayout -o /boot/grub/it.gkb
+
sudo mkdir /boot/grub/layouts
 +
  ckbcomp it |sudo grub-mklayout -o /boot/grub/layouts/it.gkb
  
 
Then, I manually edited {{ic|/boot/grub/grub.cfg}}, adding the following lines:
 
Then, I manually edited {{ic|/boot/grub/grub.cfg}}, adding the following lines:
Line 31: Line 48:
 
<nowiki>
 
<nowiki>
 
terminal_input at_keyboard
 
terminal_input at_keyboard
keymap (hd0,2)/boot/grub/it.gkb
+
keymap it
 
</nowiki>}}
 
</nowiki>}}
  
Line 38: Line 55:
 
Cheers. --[[User:Hilinus|Hilinus]] 12:50, 26 December 2011 (EST)
 
Cheers. --[[User:Hilinus|Hilinus]] 12:50, 26 December 2011 (EST)
  
 
+
:I followed [http://lists.gnu.org/archive/html/grub-devel/2011-03/msg00051.html instructions] on the grub-devel mailing list. First you insert  
 
+
I followed [http://lists.gnu.org/archive/html/grub-devel/2011-03/msg00051.html instructions] on the grub-devel mailing list. First you insert  
+
  
 
{{hc|/etc/default/grub|
 
{{hc|/etc/default/grub|
Line 47: Line 62:
 
</nowiki>}}
 
</nowiki>}}
  
in {{ic|/etc/default/grub}}. Then you get ckbcomp Perl script from Ubuntu or Debian and execute (for Slovene layout)
+
:in {{ic|/etc/default/grub}}. Then you get ckbcomp Perl script from Ubuntu or Debian and execute (for Slovene layout)
  
$ ckbcomp si | grub-mklayout -o si.gkb
+
:{{bc|<nowiki>
Unknown key KP_Comma
+
$ ckbcomp si | grub-mklayout -o si.gkb
Unknown key KP_Comma
+
Unknown key KP_Comma
Unknown key KP_Comma
+
Unknown key KP_Comma
Unknown key KP_Comma
+
Unknown key KP_Comma
Unknown keycode 0x79
+
Unknown key KP_Comma
$ sudo mv si.gkb /boot/grub/
+
Unknown keycode 0x79
 +
$ sudo mv si.gkb /boot/grub/
 +
</nowiki>}}
  
After that you add  
+
:After that you add  
  
 
{{hc|/etc/grub.d/40_custom|
 
{{hc|/etc/grub.d/40_custom|
Line 65: Line 82:
 
</nowiki>}}
 
</nowiki>}}
  
to {{ic|/etc/grub.d/40_custom}} and finally generate new grub.cfg with
+
:to {{ic|/etc/grub.d/40_custom}} and finally generate new grub.cfg with
  
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
+
:{{bc|$ sudo grub-mkconfig -o /boot/grub/grub.cfg}}
  
Cheers. --[[User:drevo|drevo]] 17:47, 6 January 2012 (EST)
+
:Cheers. --[[User:drevo|drevo]] 17:47, 6 January 2012 (EST)
  
 +
::The version  of ckbcomp I got from Debian Squeeze kept giving this error:
  
 +
::{{bc|Unknown name $sun_t6_custom}}
  
 +
::The Ubuntu Precise version worked out of the box.
  
The version  of ckbcomp I got from Debian Squeeze kept giving this error:
+
::A temporary solution for layouts would be an AUR package for ckbcomp or to distribute .gkb files somehow, but the proper solution would be for grub-mklayout to accept keymaps(5) files.
  
Unknown name $sun_t6_custom
+
::--[[User:Schizius|Schizius]] ([[User talk:Schizius|talk]]) 18:44, 26 July 2012 (UTC)
  
The Ubuntu Precise version worked out of the box.
+
:::This won't work if /boot is on another root partition. At home / is on lvm and /boot on standard MBR partition. This was historical. But since grub.cfg is generated with the root partition in lvm, it can't find my keyboard layout.
 +
:::The clean solution is to create a new file ''/etc/grub.d/50_keymap''and put this:
  
A temporary solution for layouts would be an AUR package for ckbcomp or to distribute .gkb files somehow, but the proper solution would be for grub-mklayout to accept keymaps(5) files.
+
:::{{bc|<nowiki>
 
+
#!/bin/sh
--[[User:Schizius|Schizius]] ([[User talk:Schizius|talk]]) 18:44, 26 July 2012 (UTC)
+
set -e
 
+
# Include the GRUB helper library for grub-mkconfig.
== Please make the different options for changing the MBR more clear ==
+
. /usr/share/grub/grub-mkconfig_lib
 
+
KEYMAP_FILE=/boot/grub/bepo.gkb
The three options [https://wiki.archlinux.org/index.php/GRUB2#Install_grub-bios_boot_files here] are only separated by a bit unclear titles, and if people follow the links, they might be confused.[[User:Jasper1984|Jasper1984]] ([[User talk:Jasper1984|talk]]) 16:03, 20 July 2012 (UTC)
+
if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${KEYMAP_FILE}"`"; then
 
+
return 6--~~~~
== Backing up grub-legacy bootcode ==
+
fi
 
+
KEYMAP_FILE=$(make_system_path_relative_to_its_root "${KEYMAP_FILE}")
Both grub2 and grub-legacy write to the space between the end of the MBR and the beginning of the first partition.  I'm no expert on this matter; I just learned about it today.  That said, it makes me question the usefulness of the dd backup/restore method in the [https://wiki.archlinux.org/index.php/GRUB2#Backup_Important_Data Backup Important Data] section. --[[User:Alphaniner|Alphaniner]] ([[User talk:Alphaniner|talk]]) 20:07, 25 July 2012 (UTC)
+
cat <<EOF
:As far as I know, only GRUB2 uses the post-MBR gap. GRUB2 will notice when there is not enough space at the post-MBR gap and return a warning message (without overwriting anything, see [[https://wiki.archlinux.org/index.php/GRUB2#msdos-style_error_message]]) [[User:6arms1leg|6arms1leg]] ([[User talk:6arms1leg|talk]]) 15:45, 22 August 2012 (UTC)
+
insmod keylayouts
 
+
keymap "${KEYMAP_FILE}"
== GRUB2 + Windows 7 TrueCrypt-encrypted partition ==
+
EOF
 
+
</nowiki>}}
[http://www.reddit.com/r/archlinux/comments/xdwsa/finally_did_the_grub2_update_migrating_away_from/ here is a link to my notes from my experience going thru this] and [http://ubuntuforums.org/showpost.php?p=10113708&postcount=25 Ubuntu Forum post which helped me a GREAT DEAL with this issue]
+
- below is a quick HOWTO ::
+
 
+
# ls -al /mnt/win7drive/Users/me/Documents/TrueCrypt\ Rescue\ Disk.iso
+
    -rwx------ 2 me users 1835008 Sep  5  2011 /mnt/win7/Users/me/Documents/TrueCrypt Rescue Disk.iso
+
 
+
# sudo cp /mnt/win7/Users/me/Documents/TrueCrypt\ Rescue\ Disk.iso /boot/
+
# mv /boot/TrueCrypt\ Rescue\ Disk.iso /boot/truecryptDesktop.iso
+
 
+
# pacman -S syslinux
+
 
+
# cp /usr/lib/syslinux/memdisk /boot/
+
 
+
# ls -alt /boot
+
    total 26388
+
    drwxr-xr-x  5 root root    4096 Jul 29 04:01 .
+
    -rw-r--r--  1 root root    26140 Jul 29 04:01 memdisk
+
    -rwx------  1 root root  1835008 Jul 29 03:59 truecryptDesktop.iso
+
            ....  ....
+
 
+
#mount | grep /boot
+
    /dev/sda3 on /boot type ext3 (rw,relatime,data=ordered)
+
 
+
# vi /etc/grub.d/40_custom
+
+
menuentry "Microsoft Windows 7 x64 Home Premium" {
+
    insmod part_msdos
+
    set root='(hd0,msdos3)'
+
    linux16 ($root)/memdisk iso raw
+
    initrd16 ($root)/truecryptDesktop.iso
+
}
+
 
+
# sudo grub-mkconfig -o /boot/grub/grub.cfg
+
 
+
--[[User:Fnord0|Fnord0]] ([[User talk:Fnord0|talk]]) 17:59, 30 July 2012 (UTC)
+
 
+
== grub-mkconfig with several os ==
+
 
+
I use several OS (Windows, Arch, Ubuntu, Gentoo) on different partitions.  os-prober only found Arch, Windows and Ubuntu -- strangely not Gentoo.  But when I mount the gentoo partition, it's found.  I don't know, whether this is the case, because I resized the partition, gentoo lives on, or whether this is the `default' behaviour.  If so, should the Wiki mention that mounting the partitions help?
+
 
+
--[[User:Skunk|Skunk]] ([[User talk:Skunk|talk]]) 19:46, 30 July 2012 (UTC)
+
 
+
== Need simplified steps ==
+
 
+
I think [[GRUB2#Preliminary_Requirements_for_GRUB2]] part is optional in some cases. If so, it should be noted as optional.
+
 
+
{{Pkg|os-prober}} is quite useful, it should be put at the beginning of the articles, such as preparation.
+
 
+
In my case, I only did the backup, install grub-bios, install os-prober, [[GRUB2#Install_to_440-byte_MBR_boot_code_region]], edit {{ic|/etc/grub.d/40_custom}}, and finally grub-mkconfig. My computer is dual-boot with Windows 7.
+
  
--[[User:Allencch|Allencch]] ([[User talk:Allencch|talk]]) 00:23, 1 August 2012 (UTC)
+
:::So that the root partition is detected, loaded, and then the file is read within that partition.
  
== encrypted /boot ==
+
:::--[[User:Glandos|Glandos]] ([[User talk:Glandos|talk]]) 08:23, 14 November 2013 (UTC)
  
Just so I remember when I come back to edit the article, grub-install (2.00) currently requires the GRUB_CRYPTODISK_ENABLE environment variable be set to "y". --[[User:Buhman|Buhman]] ([[User talk:Buhman|talk]]) 05:58, 10 October 2012 (UTC)
+
::::Is Glandos's solution to be used in addition to the Perl script, or is it a standalone solution? I get the vague sense that it is to be used as an additional step only when your /boot is located in its own partition. If someone can clarify this, I will add the above steps to the wiki and test them out, because I was looking for a solution to this same issue. [[User:Ingengnue|ingegnue]] ([[User talk:Ingengnue|talk]]) 09:39, 5 October 2014 (UTC)
  
== Possible mistake? ==
+
::::::There is a discussion further down the page about restructuring and cleaning up the GRUB article. I will make a suggestion to add a section like this in that discussion. This way we can see how much demand there is for it and get suggestions about where to put it and how to structure it. I will make a note of all of this information, and gather some more to build content for the section. Since I am moving this suggestion to the main discussion below, I move to close this. If anyone has any feedback regarding this please add it please. I move to close this so I may add it to the main section below. (All information has been saved in roder to reproduce if necessary.)
 +
::::::--[[User:Stevenmw|Stevenmw]] ([[User talk:Stevenmw|talk]]) 19:30, 3 December 2014 (UTC)
  
Hi there,
+
:::::::Reopening this talk since I've hit this issue myself... -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 06:31, 3 August 2015 (UTC)
since I do not feel familiar with Grub2 yet, you might check that:
+
  
[[GRUB2#Install_to_Partition_or_Partitionless_Disk]]
+
== grub standalone ==
  
# grub-install --target=i386-pc --recheck --debug --force /dev/sdaX
+
two things:
Should /dev/sdaX be /dev/sdX?
+
  
--[[User:Mrln|Mrln]] ([[User talk:Mrln|talk]]) 14:13, 1 March 2013 (UTC)
+
1- I think the switch
: This section is about installing to partition. So it is indeed /dev/sdaX. -- [[User:Fengchao|Fengchao]] ([[User talk:Fengchao|talk]]) 08:43, 4 March 2013 (UTC)
+
--fonts="unicode"
 +
have to be removed since it is already the default behaviour
 +
(source: man grub-mkstandalone)
  
 +
2- before executing the command `grub-mkstandalone ...`, create the directory in your ''esp'' (e.g. /boot/EFI)
 +
otherwise it will fail
  
--But the section does also have "Partitionless Disk" in its name, and there is the following text snippet just before the example given: "  to a partitionless disk (also called superfloppy) or to a floppy disk".
+
--[[User:NTia89|nTia89]] ([[User talk:NTia89|talk]]) 09:34, 9 April 2016 (UTC)
I am not sure, but afaik for a Partitionless Disk the syntax given is indeed wrong (should be /dev/sdX). Not sure how the section could be reworded to make it not-confusing. Giving two separate examples runs the danger of making the whole article too bloated. [[User:Bwid|Bwid]] ([[User talk:Bwid|talk]]) 09:35, 4 March 2013 (UTC)
+

Latest revision as of 09:44, 9 April 2016

Alpha sorting for kernel names without versions

When installing the "linux" and "linux-lts" kernels on a basic install, the /etc/grub.d/10_linux in 2.02-beta1 will try and use a numeric-oriented sorting routine that doesn't work well for kernels without any versions in the names of the files. I've submitted a feature request and patch for this upstream:

Forum discussion w/patch:

I solved this (and other problems) long ago… why nobody applied this patch to the Arch package is beyond me. felix (talk) 14:11, 8 August 2014 (UTC)
What is the current sate of this issue? --Stevenmw (talk) 10:56, 6 December 2014 (UTC)
I'd leave this open right now, as it seems a candidate for merging with GRUB/Tips and tricks#Multiple entries. -- Alad (talk) 19:36, 22 December 2014 (UTC)

Manually generate grub.cfg

In previous revisions, instructions on manually creating a grub.cfg were removed [1], and later added to GRUB/Tips and tricks [2]. This was discussed with [3]. However, as it turns out manually creating a grub.cfg is in fact encouraged upstream [4]. This is especially true in Arch as we don't have versioned kernels: FS#16702 (and thus no changing vmlinuz/initrd paths). As such I believe we should reduce the role of grub-mkconfig, expand on grub.cfg and move it back to the main article. -- Alad (talk) 14:24, 27 June 2015 (UTC)

I don't see a problem with this.
From upstream: In the meantime, those who feel that it would be easier to write grub.cfg directly are encouraged to do so... and to disable any system provided by their distribution to automatically run grub-mkconfig.
Correct me if I'm wrong here but I don't think we have anything that automatically calls grub-mkconfig. Therefore manually creating/editing grub.cfg shouldn't be a problem. -- Chazza (talk) 15:01, 27 June 2015 (UTC)
+1, this will also avoid random notes like this in other articles. -- Lahwaacz (talk) 19:21, 27 June 2015 (UTC)
Nothing calls grub-mkconfig, no. Yet, I tend to disagree. Reasons: (1) the article is still too long anyway and the fresh start on manually creating grub.cfg is a good base to expand in tips&tricks. (2) Reducing grub-mkconfig basically also means having to touch most content that covers the main options in /etc/default/grub. If I see it right, the Arch package comes with defaults there. (3) Thankfully grub-mkconfig automatically figures menu entry names, but also determines a root= UUID by default these days. The latter not a big problem for simple roots, but cumbersome to describe for others (e.g. when a device mapper is used, lvm, luks, ...). Likewise, grub-mkconfig also uses output from os-prober to automatically generate entries.
So, I don't think it is a straight-forward task and make things clearer. The instances one would save on "Now re-generate the configuration: ..." would probably have to be replaced with "Now better check the result with grub-script-check /boot/grub/grub.cfg" ... I think it would be better to give GRUB/Tips and tricks#Manually creating grub.cfg more prominence and expand the fresh base there as required/wanted. Also some of the lengthy menu entry examples of GRUB#Automatically generating using .2Fetc.2Fgrub.d.2F40 custom and grub-mkconfig could be moved to a section there; they basically work/serve as examples for both (copy pasting into /etc/grub.d/40_custom or /boot/grub/grub.cfg). --Indigo (talk) 21:51, 27 June 2015 (UTC)
I agree with Indigo. -- 6arms1leg (talk) 12:48, 28 June 2015 (UTC)
About (1), the inclusion on manually generating grub.cfg would be accompanied by (another, but needed) rewrite of the GRUB article. On (2), similar argument as in (1), and things like modules can be expanded on where needed. (3) It's not because you're not using grub-mkconfig, that you won't use tools such as grub-probe and grub-script-check to facilitate some tasks.
As to clarity, most people just run "grub-mkconfig" without understanding the process at hand, and as such, have difficulties when problems arise.
Note: I won't have much time to work on this (besides other tasks, I'd prefer to create fdisk first). -- Alad (talk) 15:48, 28 July 2015 (UTC)

Custom keyboard layout

Hi. Could we add a section explaining how you can set your preferred keyboard layout within GRUB2? As i found here, we need the ckbcomp script, which can be obtained from Debian console-setup package.

Here's how I made things work:

sudo mkdir /boot/grub/layouts
ckbcomp it |sudo grub-mklayout -o /boot/grub/layouts/it.gkb

Then, I manually edited /boot/grub/grub.cfg, adding the following lines:

/boot/grub/grub.cfg

terminal_input at_keyboard
keymap it

This worked for me, but as of now, i think it's a very dirty method. Is there some support for keyboard layouts within /etc/default/grub?

Cheers. --Hilinus 12:50, 26 December 2011 (EST)

I followed instructions on the grub-devel mailing list. First you insert
/etc/default/grub

GRUB_TERMINAL_INPUT=at_keyboard
in /etc/default/grub. Then you get ckbcomp Perl script from Ubuntu or Debian and execute (for Slovene layout)
$ ckbcomp si | grub-mklayout -o si.gkb
Unknown key KP_Comma
Unknown key KP_Comma
Unknown key KP_Comma
Unknown key KP_Comma
Unknown keycode 0x79
$ sudo mv si.gkb /boot/grub/
After that you add
/etc/grub.d/40_custom

insmod keylayouts
keymap /boot/grub/si.gkb
to /etc/grub.d/40_custom and finally generate new grub.cfg with
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Cheers. --drevo 17:47, 6 January 2012 (EST)
The version of ckbcomp I got from Debian Squeeze kept giving this error:
Unknown name $sun_t6_custom
The Ubuntu Precise version worked out of the box.
A temporary solution for layouts would be an AUR package for ckbcomp or to distribute .gkb files somehow, but the proper solution would be for grub-mklayout to accept keymaps(5) files.
--Schizius (talk) 18:44, 26 July 2012 (UTC)
This won't work if /boot is on another root partition. At home / is on lvm and /boot on standard MBR partition. This was historical. But since grub.cfg is generated with the root partition in lvm, it can't find my keyboard layout.
The clean solution is to create a new file /etc/grub.d/50_keymapand put this:
#!/bin/sh
set -e
# Include the GRUB helper library for grub-mkconfig.
. /usr/share/grub/grub-mkconfig_lib
KEYMAP_FILE=/boot/grub/bepo.gkb
if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${KEYMAP_FILE}"`"; then
	return 6--~~~~
fi
KEYMAP_FILE=$(make_system_path_relative_to_its_root "${KEYMAP_FILE}")
cat <<EOF
insmod keylayouts
keymap "${KEYMAP_FILE}"
EOF
So that the root partition is detected, loaded, and then the file is read within that partition.
--Glandos (talk) 08:23, 14 November 2013 (UTC)
Is Glandos's solution to be used in addition to the Perl script, or is it a standalone solution? I get the vague sense that it is to be used as an additional step only when your /boot is located in its own partition. If someone can clarify this, I will add the above steps to the wiki and test them out, because I was looking for a solution to this same issue. ingegnue (talk) 09:39, 5 October 2014 (UTC)
There is a discussion further down the page about restructuring and cleaning up the GRUB article. I will make a suggestion to add a section like this in that discussion. This way we can see how much demand there is for it and get suggestions about where to put it and how to structure it. I will make a note of all of this information, and gather some more to build content for the section. Since I am moving this suggestion to the main discussion below, I move to close this. If anyone has any feedback regarding this please add it please. I move to close this so I may add it to the main section below. (All information has been saved in roder to reproduce if necessary.)
--Stevenmw (talk) 19:30, 3 December 2014 (UTC)
Reopening this talk since I've hit this issue myself... -- Alad (talk) 06:31, 3 August 2015 (UTC)

grub standalone

two things:

1- I think the switch

--fonts="unicode"

have to be removed since it is already the default behaviour (source: man grub-mkstandalone)

2- before executing the command `grub-mkstandalone ...`, create the directory in your esp (e.g. /boot/EFI) otherwise it will fail

--nTia89 (talk) 09:34, 9 April 2016 (UTC)