Difference between revisions of "Talk:GRUB"

From ArchWiki
Jump to: navigation, search
(Standalone UEFI)
(Custom keyboard layout: use the layout directory)
(47 intermediate revisions by 22 users not shown)
Line 1: Line 1:
'''Q:''' So what are the advantages of using grub2 instead of grub-gfx ? --[[User:Oliwer|Oliwer]] 23:44, 26 December 2008 (EDT)
+
== GRUB Legacy stuff should be removed ==
  
'''A''': Grub-gfx only adds the support for .xpm files, grub2 instead has builtin support for .tga, .jpeg/.jpg and .png formats. At some point the .tft files will also be supported (the ones that grub2-gxmenu supports) but I dunno when that's gonna happen.
+
I mean, seriously, the page is loaded with too much information anyway. And also because of this: https://www.archlinux.org/news/grub-legacy-no-longer-supported/ --[[User:DSpider|DSpider]] ([[User talk:DSpider|talk]]) 17:41, 29 August 2012 (UTC)
--[[User:Det|Det]] 10:22, 24 February 2010 (EST)
+
  
----
+
== EFI ==
----
+
  
== Grub2 1.98 ==
+
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.
 +
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.
  
The new stuff brought by 1.98 should probably be explained. --[[User:Det|Det]] 10:57, 16 March 2010 (EDT)
+
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)
  
'''E:''' I added a few "/etc/default/grub notes". The article only needs a bit expansion and the move from those notes I made to the actual instructions, anymore. --[[User:Det|Det]] 13:44, 28 March 2010 (EDT)
 
  
'''E2:''' OK, done. I changed the notes to the actual instructions and removed the '''Expansion''' flag. If somebody feels that the other stuff too, such as what's in /etc/grub.d/* should be mentioned here, you are free to re-add the flag. I did some other stuff too, which you can check from the page history if you are interested. The only problem is that I'm still that stupid that I test the changes by updating the page itself, which makes the page history go nuts. Just give me some time to get used to the magic *Show preview* button :). --[[User:Det|Det]] 15:58, 8 April 2010 (EDT)
+
@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.  
  
== Upgrading from grub 0.97 to grub2 - MBR ==
+
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)
  
To fix the problem described on section [[GRUB2#Other]] you can remove grub 0.97 from MBR by following command:
+
== GRUB_GFXMODE may not work with a depth parameter ==
<pre>dd if=/dev/zero of=/dev/sdX bs=446 count=1</pre>
+
where /dev/sdX is hard disk with grub installed in MBR (I have no idea if that works when you have grub installed on partition instead of hd, like /dev/sda1).
+
  
It is good idea to create backup of bootloader before that by executing:
+
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)
<pre>dd if=/dev/sdX of=your/backup.img bs=446 count=1</pre>
+
After that you can install grub2 on MBR, and it works (hopefully) without any dirty hacks.
+
  
== Make up your mind on when to modprobe dm-mod ==
+
== Custom keyboard layout ==
@Skodabenz & NTia89
+
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.
:On Feb 17 NTia89 took the time to suggest the probing of dm-mod at the beginning of the Installation section, not deleting it from the section below but just inserting a note. On Mar 15 Skodabenz only removed the modprobe command inserted by NTia89, but not the related note, so this leaves the article inaccurate on stating when to load dm-mod. I think either the note should be removed (if Skodabenz is right), or the modprobe dm-mod command should be moved to the beginning of the Installation section (if NTia89 is right)). I cannot test this at the moment. -- [[User:Kynikos|Kynikos]] 14:13, 15 March 2011 (EDT)
+
  
@Kynikos: Whether grub2 install happens during Arch Linux installation or in a existing system, dm-mod (device-mapper module) needs to be loaded for the sake of grub-setup utility. Even during Arch Linux installation, the user has to anyway go to one of the bootloader installation section where dm-mod loading comes again. Therefore i do not think it is appropriate to move it to the beginning of the Installation section since it is not specific to Arch Linux installation. Also where is the 'related note' you are talking about? -- [[User:the.ridikulus.rat|Keshav P R]] 17:37, 16 March 2011 (EDT)
+
Here's how I made things work:
  
:Perfectly explained, thanks. The "related note" is this one I've just removed ([https://wiki.archlinux.org/index.php?title=GRUB2&action=historysubmit&diff=133989&oldid=133721 see diff]); it was added by NTia89 when he edited the article. -- [[User:Kynikos|Kynikos]] 19:53, 16 March 2011 (EDT)
+
sudo mkdir /boot/grub/layouts
 +
ckbcomp it |sudo grub-mklayout -o /boot/grub/layouts/it.gkb
  
== EFI ==
+
Then, I manually edited {{ic|/boot/grub/grub.cfg}}, adding the following lines:
  
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.
+
{{hc|/boot/grub/grub.cfg|
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.
+
<nowiki>
 +
terminal_input at_keyboard
 +
keymap it
 +
</nowiki>}}
  
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)
+
This worked for me, but as of now, i think it's a very dirty method. Is there some support for keyboard layouts within {{ic|/etc/default/grub}}?
  
 +
Cheers. --[[User:Hilinus|Hilinus]] 12:50, 26 December 2011 (EST)
  
@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.
 
  
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)
 
  
== grub-mkconfig and UEFI ==
+
I followed [http://lists.gnu.org/archive/html/grub-devel/2011-03/msg00051.html instructions] on the grub-devel mailing list. First you insert
  
The grub-mkconfig script seems to be hardcoded to have /boot/grub as the grub install. Is the best answer for this to mount /efi/grub as /boot/grub or edit the script?
+
{{hc|/etc/default/grub|
 +
<nowiki>
 +
GRUB_TERMINAL_INPUT=at_keyboard
 +
</nowiki>}}
  
http://comments.gmane.org/gmane.comp.boot-loaders.grub.devel/17950 -- [[User:The.ridikulus.rat|Keshav P R]] 09:57, 19 October 2011 (EDT)
+
in {{ic|/etc/default/grub}}. Then you get ckbcomp Perl script from Ubuntu or Debian and execute (for Slovene layout)
  
== Confusing information on a running system; combining MBR and GPT information; an initial MBR portion that seems contradicted later ==
+
$ 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/
  
I started working through this; it looks like the installation is easy, at the top.  Then there are more MBR instructions that require additional preparation, but it isn't clear if this is replacement information to the initial instructions, or more detailed information.  If the top information is inadequate, it should be deleted and put into the MBR detailed instructions.  If it is one way of doing it that does not require the more detailed instructions, that should be noted as well.
+
After that you add
  
Should be clear now -- [[User:The.ridikulus.rat|Keshav P R]] 14:53, 24 October 2011 (EDT)
+
{{hc|/etc/grub.d/40_custom|
 +
<nowiki>
 +
insmod keylayouts
 +
keymap /boot/grub/si.gkb
 +
</nowiki>}}
  
Ok, another one. I know I'm literal, and sometimes that's good, other times bad.
+
to {{ic|/etc/grub.d/40_custom}} and finally generate new grub.cfg with
  
The page talks about installing to the 440-byte area.
+
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Then later it talks about replacing legacy in that area.
+
That doesn't make sense to me.
+
  
What I'm really seeing, I think, is that there are so many ways of going about this that it might make sense to split this page into a couple; EFI - GPT - MBR.  There may be some duplication in that, but trying to figure out what applies to what is difficult, at least for me.  I think the overlapping technology changes make it seem more difficult than it is.
+
Cheers. --[[User:drevo|drevo]] 17:47, 6 January 2012 (EST)
  
I've been trying unsuccessfully to install this for a couple of days (gave up on a running system and just started from scratch; good backups are handy things); and while it may make more sense for me to do it in a different order, I don't understand it enough to feel comfortable contributing many changes to the article, as my interpretation may well be wrong.  I'm no newbie, but neither am I a master.
 
  
------
 
  
There are many ways to install grub2 - UEFI is easy part, only one way (to the UEFI SYSTEM PARTITION). But in case of bios, you can install to the disk's MBR boot code region (in which case it becomes the primary or the only bootloader of the system), to a partition (in which case it need to be chainloaded from the primary bootloader) or generate the core.img (again needs to be chainloaded by another bootloader, difference being chainloading a file instead of partition boot sector). I created the sections in the article based on my understanding of the sectioning etc. I tried to avoid duplication mainly.
 
  
About your problem, its better to open a thread in the forum wherein we can discuss what exactly is preventing you from installing grub2. I have installed grub2-bios to MBR 440-byte area (GPT partitioning) and grub2-efi-x86_64 to UEFISYS partition (both in the same system and in the same disk).
+
The version  of ckbcomp I got from Debian Squeeze kept giving this error:
  
(also please sign your text - I don't know who is talking here) -- [[User:The.ridikulus.rat|Keshav P R]] 17:44, 27 October 2011 (EDT)
+
Unknown name $sun_t6_custom
  
------
+
The Ubuntu Precise version worked out of the box.
  
Ok, sorry about that.  I'm a long time arch user but new to working in the wiki. -- [[User:Timm|Timm]] 11:24, 29 October 2011 (EDT)
+
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.
  
== Moving the partitioning information to the preface ==
+
--[[User:Schizius|Schizius]] ([[User talk:Schizius|talk]]) 18:44, 26 July 2012 (UTC)
  
In the article, I think it would be a good idea to move the information on partitions to the preface section, as I think it is a preliminary consideration that people should see as they begin, rather than running across it in the text.  I know people should read all of the instructions before beginning, but in real life that rarely happens.  However, since that's a significant change in the page, I didn't want to do that when I wasn't involved in the original page creation; not sure of the etiquette on that.  -- [[User:Timm|Timm]] 11:33, 29 October 2011 (EDT)
+
== Please make the different options for changing the MBR more clear ==
  
I rearranged the text. Is it ok now? -- [[User:The.ridikulus.rat|Keshav P R]] 11:47, 29 October 2011 (EDT)
+
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)
  
I don't think so.  If you are installing on a new install, the information about the partitions still isn't evident, as it is down in the sections about installing on a running system, or in the UEFI section.  I'd suggest moving the information up to a new section either in the preface or right after it, called partitioning information or such.  Either something like "Note: In a GPT system you will need a partition, etc.  In a UEFI system you will need a partition, etc.", or just moving the existing text on the partition information, which seems to cover the information well.  That way people get their system hardware set up before they begin the process of installing.  No matter how much you simplify this, it is a complex process, and IMHO will be far less frustrating to people if they don't get halfway through the install and only then realize they don't have the necessary partitions.  This is, I think, even more important to those of us who are used to being able to set up our partitions in the install, because at least as far as I understand it, you can't do some of this through the arch install process. -- [[User:Timm|Timm]] 13:00, 29 October 2011 (EDT)
+
== Backing up grub-legacy bootcode ==
  
== GRUB_GFXMODE may not work with a depth parameter ==
+
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)
 +
: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)
  
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)
+
== GRUB2 + Windows 7 TrueCrypt-encrypted partition ==
  
== grub-mkstandalone? ==
+
[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 ::
  
And where is that coming from? It's not part of grub2-common.
+
# 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
  
Future update https://bugs.archlinux.org/task/23901 , but grub-mkstandalone is a very important tool -- [[User:The.ridikulus.rat|Keshav P R]] 15:13, 24 December 2011 (EST)
+
# sudo cp /mnt/win7/Users/me/Documents/TrueCrypt\ Rescue\ Disk.iso /boot/
 +
# mv /boot/TrueCrypt\ Rescue\ Disk.iso /boot/truecryptDesktop.iso
  
== Why did you remove double quotes in efibootmgr part ==
+
# pacman -S syslinux
  
@Fallacy: Why did you do https://wiki.archlinux.org/index.php?title=GRUB2&diff=175798&oldid=174885 . You even removed the part that explained why this is being done. I am reverting it because that command simply will not work without double backward slashes.
+
# cp /usr/lib/syslinux/memdisk /boot/
  
: You mean FelipeC? Notice that I changed from to double quotes (") to single quotes ('), thus the backslash escaping is not needed. See:
+
# 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
 +
            ....  ....
  
  % echo -E "\\foo\\bar"
+
  #mount | grep /boot
\foo\bar
+
    /dev/sda3 on /boot type ext3 (rw,relatime,data=ordered)
% echo -E '\foo\bar'
+
\foo\bar
+
  
: The two strings are exactly identical. -- [[User:Felipec|FelipeC]] 16:03, 24 December 2011 (EST)
+
# 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
 +
}
  
== Standalone UEFI ==
+
# sudo grub-mkconfig -o /boot/grub/grub.cfg
  
I went through the ordeal of trying to figure out how to make the section "Create GRUB2 Standalone UEFI Application" work, however, it's a complete mess.
+
--[[User:Fnord0|Fnord0]] ([[User talk:Fnord0|talk]]) 17:59, 30 July 2012 (UTC)
  
First of all, grub-mkstandalone does not exist. Secondly, grub_efi_x86_64-install already has an option to specify which modules you want to install in the image (maybe this should be added as a note on the section that explains grub_efi_x86_64-install). And thirdly, the script is doing a bunch of unnecessary steps, like saving and restoring $PWD, while it's always changing directory to $PWD, so doing nothing at all, and also unsetting the environment variables, which happens when the script finishes anyway.
+
== grub-mkconfig with several os ==
  
I rewrote the whole thing so it actually works, and it's actually simple. Too much stuff to write as the summary of the change. -- [[User:Felipec|FelipeC]] 16:32, 24 December 2011 (EST)
+
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?
  
grub-mkstandalone does exist (http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/head:/util/grub-mkstandalone.in). Like I mentioned it is coming in a update to grub2-common for which I have sent the updated PKGBUILD to Ronald Van Haren (pressh). Do you have any idea how grub2 actually works internally and how different tools are involved. The upstream does not recommend using --modules directly in grub-install or grub-mkimage for the sake of stability. Like I mentioned grub-mkstandalone embeds a memdisk inside the generated grub_standalone.efi file and the prefix is (memdisk)/boot/grub . For the record I wrote most of the UEFI related stuff in this page. Maybe unsetting the env variables were unnecessary (I rewrote another local script of mine which had export and unset commands) but the $PWD etc are required once you understand how grub-mkstandalone works. Go to https://bugs.archlinux.org/task/23901#comment84826 for the updated PKGBUILDs. With grub_standalone.efi, you don't need the modules to exist in the same directory since they are present in the file itself. It is not same as using grub-install with --modules. -- [[User:The.ridikulus.rat|Keshav P R]] 17:04, 24 December 2011 (EST)
+
--[[User:Skunk|Skunk]] ([[User talk:Skunk|talk]]) 19:46, 30 July 2012 (UTC)
  
:The fact that you wrote a lot of stuff doesn't mean you are automatically right. I looked at the script, and it's '''clearly''' not intended for what you want to use it. It's intended to create a '''rescue''' image, and if you look at the code, at the end of the day it's using grub-mkimage, the same as grub*-install. The only difference is that, as you say, it creates a memdisk image, but it uses that image to put '''all''' modules inside. So really, there's no advantage to the normal GRUB 2 setup, except that you don't need a filesystem. But given that EFI already requires a filesystem anyway, there's no point in using a tool that is intended for rescue images.
+
== Need simplified steps ==
  
:And BTW, I tried grub*-install specifying all the modules that I use and the dependencies, and then I removed all the contents in /boot/efi/efi/grub (except grub.efi and grub.cfg), and guess what... It works perfectly fine. So that solution is already better.
+
I think [[GRUB2#Preliminary_Requirements_for_GRUB2]] part is optional in some cases. If so, it should be noted as optional.
  
:-- [[User:Felipec|FelipeC]] 12:56, 10 January 2012 (EST)
+
{{Pkg|os-prober}} is quite useful, it should be put at the beginning of the articles, such as preparation.
  
Specifying all the modules embeds all the modules in the grub.efi and thus all the modules are already loaded when grub.efi is launched, which can cause stability issues, as some modules conflict with another and stuff like that. The reason the script is named grub-mkstandalone is because it is a creates a standalone image which is portable, the difference being all the modules are part of memdisk, not directly part of the image. If you want to know the finer details as to why mkstandalone is recommended I suggest you talk to grub2 lead developer phcoder in #grub irc channel in freenode.  
+
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.
  
The "script" you looked at puts all the modules in the memdisk image, but in that way the modules are not automatically loaded when grub.efi is launched, thus maintaining stability. THAT IS NOT THE CASE WITH grub*-install <all modulues> or grub-mkimage <all modules>. -- [[User:The.ridikulus.rat|Keshav P R]] 11:14, 15 January 2012 (EST)
+
--[[User:Allencch|Allencch]] ([[User talk:Allencch|talk]]) 00:23, 1 August 2012 (UTC)
  
== Custom keyboard layout ==
+
== encrypted /boot ==
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:
+
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)
  
ckbcomp it | grub-mklayout -o /boot/grub/it.gkb
+
== Possible mistake? ==
  
Then, I manually edited {{ic|/boot/grub/grub.cfg}}, adding the following lines:
+
Hi there,
 +
since I do not feel familiar with Grub2 yet, you might check that:
  
{{hc|/boot/grub/grub.cfg|
+
[[GRUB2#Install_to_Partition_or_Partitionless_Disk]]
<nowiki>
+
terminal_input at_keyboard
+
keymap (hd0,2)/boot/grub/it.gkb
+
</nowiki>}}
+
  
This worked for me, but as of now, i think it's a very dirty method. Is there some support for keyboard layouts within {{ic|/etc/default/grub}}?
+
# grub-install --target=i386-pc --recheck --debug --force /dev/sdaX
 +
Should /dev/sdaX be /dev/sdX?
  
Cheers. --[[User:Hilinus|Hilinus]] 12:50, 26 December 2011 (EST)
+
--[[User:Mrln|Mrln]] ([[User talk:Mrln|talk]]) 14:13, 1 March 2013 (UTC)
 +
: 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)
  
  
 +
--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".
 +
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)
  
I followed [http://lists.gnu.org/archive/html/grub-devel/2011-03/msg00051.html instructions] on the grub-devel mailing list. First you insert
+
== Boot Arch iso from LVM (LVM hook in Arch iso?) ==
  
{{hc|/etc/default/grub|
+
I added the following in /etc/grub.d/40_custom:
<nowiki>
+
GRUB_TERMINAL_INPUT=at_keyboard
+
</nowiki>}}
+
  
in {{ic|/etc/default/grub}}. Then you get ckbcomp Perl script from Ubuntu or Debian and execute (for Slovene layout)
+
menuentry "archlinux-2013.03.01-dual.iso" --class iso {
 +
    insmod loopback
 +
    insmod iso9660
 +
    insmod part_gpt
 +
    insmod lvm
 +
    insmod ext2
 +
    set root='lvm/vg0-arch'
 +
    set isofile='/home/jordy/data/isos/archlinux-2013.03.01-dual.iso'
 +
    loopback loop $isofile
 +
    linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201303 img_dev=$root img_loop=$isofile earlymodules=loop
 +
    initrd (loop)/arch/boot/x86_64/archiso.img
 +
}
  
$ ckbcomp si | grub-mklayout -o si.gkb
+
My / is on LVM, the iso boots, but it can't mount the loop device (the iso) because the LVM hook hasn't been run before that. Is there a way to fix this and enable the LVM hook in the iso (without modifying it)
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
+
[[User:Jordz|jordz]] ([[User talk:Jordz|talk]]) 22:34, 24 March 2013 (UTC)
  
{{hc|/etc/grub.d/40_custom|
+
==<s>Move to GRUB</s>==
<nowiki>
+
insmod keylayouts
+
keymap /boot/grub/si.gkb
+
</nowiki>}}
+
  
to {{ic|/etc/grub.d/40_custom}} and finally generate new grub.cfg with
+
I suggest we move this article to GRUB, as that is the name of the bootloader, and that page already redirects here. -- [[User:Lonaowna|Lonaowna]] ([[User talk:Lonaowna|talk]]) 16:31, 26 April 2013 (UTC)
  
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
+
: I agree, but doing this properly would require moderator intervention, because the target already exists. --[[User:Buhman|Buhman]] ([[User talk:Buhman|talk]]) 18:53, 26 April 2013 (UTC)
  
Cheers. --[[User:drevo|drevo]] 17:47, 6 January 2012 (EST)
+
:: Agreed. I've [[User talk:Kynikos#Move request|asked a mod]]. -- [[User:Lonaowna|Lonaowna]] ([[User talk:Lonaowna|talk]]) 20:50, 26 April 2013 (UTC)
 +
 
 +
:::Done, the name of the bootloader doesn't include any version number, see https://www.gnu.org/software/grub/ -- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 04:44, 27 April 2013 (UTC)

Revision as of 11:49, 25 September 2013

GRUB Legacy stuff should be removed

I mean, seriously, the page is loaded with too much information anyway. And also because of this: https://www.archlinux.org/news/grub-legacy-no-longer-supported/ --DSpider (talk) 17:41, 29 August 2012 (UTC)

EFI

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. 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. --Rochus 13:59, 16 August 2011 (EDT)


@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.

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. -- Keshav P R 23:15, 28 August 2011 (IST)

GRUB_GFXMODE may not work with a depth parameter

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. -- Timm 13:08, 29 October 2011 (EDT)

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)

Please make the different options for changing the MBR more clear

The three options here are only separated by a bit unclear titles, and if people follow the links, they might be confused.Jasper1984 (talk) 16:03, 20 July 2012 (UTC)

Backing up grub-legacy bootcode

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 Backup Important Data section. --Alphaniner (talk) 20:07, 25 July 2012 (UTC)

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 [[1]]) 6arms1leg (talk) 15:45, 22 August 2012 (UTC)

GRUB2 + Windows 7 TrueCrypt-encrypted partition

here is a link to my notes from my experience going thru this and 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

--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?

--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.

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 /etc/grub.d/40_custom, and finally grub-mkconfig. My computer is dual-boot with Windows 7.

--Allencch (talk) 00:23, 1 August 2012 (UTC)

encrypted /boot

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". --Buhman (talk) 05:58, 10 October 2012 (UTC)

Possible mistake?

Hi there, since I do not feel familiar with Grub2 yet, you might check that:

GRUB2#Install_to_Partition_or_Partitionless_Disk

# grub-install --target=i386-pc --recheck --debug --force /dev/sdaX

Should /dev/sdaX be /dev/sdX?

--Mrln (talk) 14:13, 1 March 2013 (UTC)

This section is about installing to partition. So it is indeed /dev/sdaX. -- Fengchao (talk) 08:43, 4 March 2013 (UTC)


--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". 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. Bwid (talk) 09:35, 4 March 2013 (UTC)

Boot Arch iso from LVM (LVM hook in Arch iso?)

I added the following in /etc/grub.d/40_custom:

menuentry "archlinux-2013.03.01-dual.iso" --class iso {

   insmod loopback
   insmod iso9660
   insmod part_gpt
   insmod lvm
   insmod ext2
   set root='lvm/vg0-arch'
   set isofile='/home/jordy/data/isos/archlinux-2013.03.01-dual.iso'
   loopback loop $isofile
   linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201303 img_dev=$root img_loop=$isofile earlymodules=loop
   initrd (loop)/arch/boot/x86_64/archiso.img

}

My / is on LVM, the iso boots, but it can't mount the loop device (the iso) because the LVM hook hasn't been run before that. Is there a way to fix this and enable the LVM hook in the iso (without modifying it)

jordz (talk) 22:34, 24 March 2013 (UTC)

Move to GRUB

I suggest we move this article to GRUB, as that is the name of the bootloader, and that page already redirects here. -- Lonaowna (talk) 16:31, 26 April 2013 (UTC)

I agree, but doing this properly would require moderator intervention, because the target already exists. --Buhman (talk) 18:53, 26 April 2013 (UTC)
Agreed. I've asked a mod. -- Lonaowna (talk) 20:50, 26 April 2013 (UTC)
Done, the name of the bootloader doesn't include any version number, see https://www.gnu.org/software/grub/ -- Kynikos (talk) 04:44, 27 April 2013 (UTC)