https://wiki.archlinux.org/api.php?action=feedcontributions&user=Niasar&feedformat=atomArchWiki - User contributions [en]2024-03-29T14:21:38ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=GRUB&diff=569020GRUB2019-03-17T20:13:14Z<p>Niasar: /* GRUB configuration file not updating with ALPM hook when grub boot directory not set to /boot */ changed some white spaces for better look.</p>
<hr />
<div>[[Category:Boot loaders]]<br />
[[Category:GNU]]<br />
[[ar:GRUB]]<br />
[[cs:GRUB]]<br />
[[de:GRUB]]<br />
[[el:GRUB]]<br />
[[es:GRUB]]<br />
[[fa:گراب]]<br />
[[fr:GRUB]]<br />
[[he:GRUB]]<br />
[[id:GRUB]]<br />
[[it:GRUB]]<br />
[[ja:GRUB]]<br />
[[nl:GRUB]]<br />
[[pt:GRUB]]<br />
[[ru:GRUB]]<br />
[[zh-hans:GRUB]]<br />
[[zh-hant:GRUB]]<br />
{{Related articles start}}<br />
{{Related|Arch boot process}}<br />
{{Related|Master Boot Record}}<br />
{{Related|GUID Partition Table}}<br />
{{Related|Unified Extensible Firmware Interface}}<br />
{{Related|GRUB Legacy}}<br />
{{Related|GRUB/EFI examples}}<br />
{{Related|GRUB/Tips and tricks}}<br />
{{Related|Multiboot USB drive}}<br />
{{Related articles end}}<br />
[https://www.gnu.org/software/grub/ GRUB] (GRand Unified Bootloader) is a [[Boot loader|multi-boot loader]]. It is derived from [http://www.nongnu.org/pupa/ PUPA] which was a research project to develop the replacement of what is now known as [[GRUB Legacy]]. The latter had become too difficult to maintain and GRUB was rewritten from scratch with the aim to provide modularity and portability [https://www.gnu.org/software/grub/grub-faq.html#q1]. The current GRUB is also referred to as GRUB 2 while GRUB Legacy corresponds to versions 0.9x.<br />
<br />
{{Note|In the entire article {{ic|''esp''}} denotes the mountpoint of the [[EFI system partition]] aka ESP.}}<br />
<br />
== BIOS systems ==<br />
<br />
=== GUID Partition Table (GPT) specific instructions ===<br />
<br />
On a BIOS/[[GPT]] configuration, a [https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html#BIOS-installation BIOS boot partition] is required. GRUB embeds its {{ic|core.img}} into this partition.<br />
<br />
{{Note|<br />
* Before attempting this method keep in mind that not all systems will be able to support this partitioning scheme. Read more on [[Partitioning#GUID Partition Table]].<br />
* The BIOS boot partition is only needed by GRUB on a BIOS/GPT setup. On a BIOS/MBR setup, GRUB uses the post-MBR gap for the embedding the {{ic|core.img}}. On GPT, however, there is no guaranteed unused space before the first partition.<br />
* For [[UEFI]] systems this extra partition is not required, since no embedding of boot sectors takes place in that case. However, UEFI systems still require an [[EFI system partition]].<br />
}}<br />
<br />
Create a mebibyte partition ({{ic|1=+1M}} with ''fdisk'' or ''gdisk'') on the disk with no file system and with partition type GUID {{ic|21686148-6449-6E6F-744E-656564454649}}.<br />
<br />
* Select partition type {{ic|BIOS boot}} for [[fdisk]].<br />
* Select partition type code {{ic|ef02}} for [[gdisk]].<br />
* For [[parted]] set/activate the flag {{ic|bios_grub}} on the partition.<br />
<br />
This partition can be in any position order but has to be on the first 2 TiB of the disk. This partition needs to be created before GRUB installation. When the partition is ready, install the bootloader as per the instructions below.<br />
<br />
The space before the first partition can also be used as the BIOS boot partition though it will be out of GPT alignment specification. Since the partition will not be regularly accessed performance issues can be disregarded, though some disk utilities will display a warning about it. In ''fdisk'' or ''gdisk'' create a new partition starting at sector 34 and spanning to 2047 and set the type. To have the viewable partitions begin at the base consider adding this partition last.<br />
<br />
=== Master Boot Record (MBR) specific instructions ===<br />
<br />
Usually the post-MBR gap (after the 512 byte [[MBR]] region and before the start of the first partition) in many MBR partitioned systems is 31 KiB when DOS compatibility cylinder alignment issues are satisfied in the partition table. However a post-MBR gap of about 1 to 2 MiB is recommended to provide sufficient room for embedding GRUB's {{ic|core.img}} ({{Bug|24103}}). It is advisable to use a partitioning tool that supports 1 MiB [[Partitioning#Partition alignment|partition alignment]] to obtain this space as well as to satisfy other non-512-byte-sector issues (which are unrelated to embedding of {{ic|core.img}}).<br />
<br />
=== Installation ===<br />
<br />
[[Install]] the {{Pkg|grub}} package. (It will replace {{AUR|grub-legacy}} if that is already installed.) Then do:<br />
<br />
# grub-install --target=i386-pc /dev/sd'''X'''<br />
<br />
where {{ic|/dev/sd'''X'''}} is the disk where GRUB is to be installed (for example, disk {{ic|/dev/sda}} and '''not''' partition {{ic|/dev/sda1}}).<br />
<br />
Now you must [[#Generate the main configuration file]].<br />
<br />
If you use [[LVM]] for your {{ic|/boot}}, you can install GRUB on multiple physical disks.<br />
<br />
{{Tip|See [[GRUB/Tips and tricks#Alternative installation methods]] for other ways to install GRUB, such as to a USB stick.}}<br />
<br />
See {{man|8|grub-install}} and [https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html#BIOS-installation GRUB Manual] for more details on the ''grub-install'' command.<br />
<br />
== UEFI systems ==<br />
<br />
{{Note|<br />
* It is recommended to read and understand the [[Unified Extensible Firmware Interface]], [[Partitioning#GUID Partition Table]] and [[Arch boot process#Under UEFI]] pages.<br />
* When installing to use UEFI it is important to boot the installation media in UEFI mode, otherwise ''efibootmgr'' will not be able to add the GRUB UEFI boot entry. Installing to the [[#Default/fallback boot path|fallback boot path]] will still work even in BIOS mode since it does not touch the NVRAM.<br />
* To boot from a disk using UEFI, an EFI system partition is required. Follow [[EFI system partition#Check for an existing partition]] to find out if you have one already, otherwise you need to create it.<br />
}}<br />
<br />
=== Installation ===<br />
<br />
{{Note|<br />
* UEFI firmwares are not implemented consistently across manufacturers. The procedure described below is intended to work on a wide range of UEFI systems but those experiencing problems despite applying this method are encouraged to share detailed information, and if possible the turnarounds found, for their hardware-specific case. A [[GRUB/EFI examples]] article has been provided for such cases.<br />
* The section assumes you are installing GRUB for x86_64 systems. For IA32 (32-bit) UEFI systems (not to be confused with 32-bit CPUs), replace {{ic|x86_64-efi}} with {{ic|i386-efi}} where appropriate.<br />
}}<br />
<br />
First, [[install]] the packages {{Pkg|grub}} and {{Pkg|efibootmgr}}: ''GRUB'' is the bootloader while ''efibootmgr'' is used by the GRUB installation script to write boot entries to NVRAM.<br />
<br />
Then follow the below steps to install GRUB:<br />
<br />
# [[EFI system partition#Mount the partition|Mount the EFI system partition]] and in the remainder of this section, substitute {{ic|''esp''}} with its mount point.<br />
# Choose a bootloader identifier, here named {{ic|GRUB}}. A directory of that name will be created in {{ic|''esp''/EFI/}} to store the EFI binary and this is the name that will appear in the UEFI boot menu to identify the GRUB boot entry.<br />
# Execute the following command to install the GRUB EFI application {{ic|grubx64.efi}} to {{ic|''esp''/EFI/GRUB/}} and install its modules to {{ic|/boot/grub/x86_64-efi/}}.<br />
<br />
# grub-install --target=x86_64-efi --efi-directory=''esp'' --bootloader-id=GRUB<br />
<br />
After the above install completed the main GRUB directory is located at {{ic|/boot/grub/}}. Note that {{ic|grub-install}} also tries to [[GRUB/Tips and tricks#Create a GRUB entry in the firmware boot manager|create an entry in the firmware boot manager]], named {{ic|GRUB}} in the above example.<br />
<br />
Remember to [[#Generate the main configuration file]] after finalizing the configuration.<br />
<br />
{{Tip|If you use the option {{ic|--removable}} then GRUB will be installed to {{ic|''esp''/EFI/BOOT/BOOTX64.EFI}} (or {{ic|''esp''/EFI/BOOT/BOOTIA32.EFI}} for the {{ic|i386-efi}} target) and you will have the additional ability of being able to boot from the drive in case EFI variables are reset or you move the drive to another computer. Usually you can do this by selecting the drive itself similar to how you would using BIOS. If dual booting with Windows, be aware Windows usually places an EFI executable there, but its only purpose is to recreate the UEFI boot entry for Windows.}}<br />
<br />
{{Note|<br />
* {{ic|--efi-directory}} and {{ic|--bootloader-id}} are specific to GRUB UEFI, {{ic|--efi-directory}} replaces {{ic|--root-directory}} which is deprecated. <br />
* You might note the absence of a ''device_path'' option (e.g.: {{ic|/dev/sda}}) in the {{ic|grub-install}} command. In fact any ''device_path'' provided will be ignored by the GRUB UEFI install script. Indeed, UEFI bootloaders do not use a MBR bootcode or partition boot sector at all.<br />
}}<br />
<br />
See [[#UEFI|UEFI troubleshooting]] in case of problems. Additionally see [[GRUB/Tips and tricks#UEFI further reading]].<br />
<br />
== Configuration ==<br />
<br />
On an installed system, GRUB loads the {{ic|/boot/grub/grub.cfg}} configuration file each boot. You can follow [[#Generated grub.cfg]] for using a tool, or [[#Custom grub.cfg]] for a manual creation.<br />
<br />
=== Generated grub.cfg ===<br />
<br />
This section only covers editing the {{ic|/etc/default/grub}} configuration file. See [[GRUB/Tips and tricks]] for more information.<br />
<br />
Remember to always [[#Generate the main configuration file]] after making changes to {{ic|/etc/default/grub}} and/or files in {{ic|/etc/grub.d/}}.<br />
<br />
==== Generate the main configuration file ====<br />
<br />
After the installation, the main configuration file {{ic|/boot/grub/grub.cfg}} needs to be generated. The generation process can be influenced by a variety of options in {{ic|/etc/default/grub}} and scripts in {{ic|/etc/grub.d/}}. <br />
<br />
If you have not done additional configuration, the automatic generation will determine the root filesystem of the system to boot for the configuration file. For that to succeed it is important that the system is either booted or chrooted into. <br />
<br />
{{Note|<br />
* Remember that {{ic|/boot/grub/grub.cfg}} has to be re-generated after any change to {{ic|/etc/default/grub}} or files in {{ic|/etc/grub.d/}}.<br />
* The default file path is {{ic|/boot/grub/grub.cfg}}, not {{ic|/boot/grub/i386-pc/grub.cfg}}.<br />
* If you are trying to run ''grub-mkconfig'' in a chroot or ''systemd-nspawn'' container, you might notice that it does not work, complaining that ''grub-probe'' cannot get the "canonical path of /dev/sdaX". In this case, try using ''arch-chroot'' as described in the [https://bbs.archlinux.org/viewtopic.php?pid&#61;1225067#p1225067 BBS post].<br />
* If you are installing GRUB in chroot environment using LVM and the {{ic|grub-mkconfig}} hangs indefinitely, see [[#Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds]].<br />
}}<br />
<br />
Use the ''grub-mkconfig'' tool to generate {{ic|/boot/grub/grub.cfg}}:<br />
<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
By default the generation scripts automatically add menu entries for all installed Arch Linux [[kernel]]s to the generated configuration.<br />
<br />
{{Tip|<br />
* After installing or removing a [[kernel]], you just need to re-run the above ''grub-mkconfig'' command.<br />
* For tips on managing multiple GRUB entries, for example when using both {{Pkg|linux}} and {{Pkg|linux-lts}} kernels, see [[GRUB/Tips and tricks#Multiple entries]].<br />
}}<br />
<br />
To automatically add entries for other installed operating systems, see [[#Detecting other operating systems]]. <br />
<br />
You can add additional custom menu entries by editing {{ic|/etc/grub.d/40_custom}} and re-generating {{ic|/boot/grub/grub.cfg}}. Or you can create {{ic|/boot/grub/custom.cfg}} and add them there. Changes to {{ic|/boot/grub/custom.cfg}} do not require re-running ''grub-mkconfig'', since {{ic|/etc/grub.d/40_custom}} adds the necessary {{ic|source}} statement to the generated configuration file.<br />
<br />
{{Tip|{{ic|/etc/grub.d/40_custom}} can be used as a template to create {{ic|/etc/grub.d/''nn''_custom}}, where {{ic|''nn''}} defines the precedence, indicating the order the script is executed. The order scripts are executed determine the placement in the GRUB boot menu. {{ic|''nn''}} should be greater than {{ic|06}} to ensure necessary scripts are executed first.}}<br />
<br />
See [[#Boot menu entry examples]] for custom menu entry examples.<br />
<br />
==== Detecting other operating systems ====<br />
<br />
To have ''grub-mkconfig'' search for other installed systems and automatically add them to the menu, [[install]] the {{Pkg|os-prober}} package and [[mount]] the partitions that contain the other systems. Then re-run ''grub-mkconfig''.<br />
<br />
===== MS Windows =====<br />
<br />
Often, partitions containing Windows will be automatically discovered by {{Pkg|os-prober}}. However, NTFS partitions may not always be detected when mounted with the default Linux drivers. If GRUB is not detecting it, try installing {{Pkg|ntfs-3g}} and remounting.<br />
<br />
Encrypted Windows partitions may need to be decrypted before mounting. For BitLocker, this can be done with {{AUR|dislocker}}. This should be sufficient for {{Pkg|os-prober}} to add the correct entry.<br />
<br />
==== Additional arguments ====<br />
<br />
To pass custom additional arguments to the Linux image, you can set the {{ic|GRUB_CMDLINE_LINUX}} + {{ic|GRUB_CMDLINE_LINUX_DEFAULT}} variables in {{ic|/etc/default/grub}}. The two are appended to each other and passed to kernel when generating regular boot entries. For the ''recovery'' boot entry, only {{ic|GRUB_CMDLINE_LINUX}} is used in the generation.<br />
<br />
It is not necessary to use both, but can be useful. For example, you could use {{ic|1=GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=''uuid-of-swap-partition'' quiet"}} where {{ic|''uuid-of-swap-partition''}} is the [[UUID]] of your swap partition to enable resume after [[hibernation]]. This would generate a recovery boot entry without the resume and without {{ic|quiet}} suppressing kernel messages during a boot from that menu entry. Though, the other (regular) menu entries would have them as options.<br />
<br />
By default ''grub-mkconfig'' determines the [[UUID]] of the root filesystem for the configuration. To disable this, uncomment {{ic|1=GRUB_DISABLE_LINUX_UUID=true}}. <br />
<br />
For generating the GRUB recovery entry you have to ensure that {{ic|GRUB_DISABLE_RECOVERY}} is not set to {{ic|true}} in {{ic|/etc/default/grub}}.<br />
<br />
See [[Kernel parameters]] for more info.<br />
<br />
==== LVM ====<br />
<br />
{{Merge|#Installation|grub-mkconfig is capable of detecting that it needs the {{ic|lvm}} module, specifying it in {{ic|GRUB_PRELOAD_MODULES}} is not required. Move warning to [[#Installation]] & [[#Installation_2]] or create a [[Help:Style#"Known issues" section|Known issues section]] and document it there.}}<br />
<br />
{{Warning|GRUB does not support thin-provisioned logical volumes.}}<br />
<br />
If you use [[LVM]] for your {{ic|/boot}} or {{ic|/}} root partition, make sure that the {{ic|lvm}} module is preloaded:<br />
<br />
{{hc|/etc/default/grub|2=<br />
GRUB_PRELOAD_MODULES="... lvm"<br />
}}<br />
<br />
==== RAID ====<br />
<br />
{{Merge|#Installation|grub-mkconfig is capable of detecting that it needs the {{ic|mdraid09}} and/or {{ic|mdraid1x}} modules, specifying them in {{ic|GRUB_PRELOAD_MODULES}} is not required. Summarize the double grub-install in a note and move it to [[#Installation]]; move {{ic|set root}} stuff to [[#Custom grub.cfg]].}}<br />
<br />
GRUB provides convenient handling of [[RAID]] volumes. You need to load GRUB modules {{ic|mdraid09}} or {{ic|mdraid1x}} to allow you to address the volume natively:<br />
<br />
{{hc|/etc/default/grub|2=<br />
GRUB_PRELOAD_MODULES="... mdraid09 mdraid1x"<br />
}}<br />
<br />
For example, {{ic|/dev/md0}} becomes:<br />
<br />
set root=(md/0)<br />
<br />
whereas a partitioned RAID volume (e.g. {{ic|/dev/md0p1}}) becomes:<br />
<br />
set root=(md/0,1)<br />
<br />
To install grub when using RAID1 as the {{ic|/boot}} partition (or using {{ic|/boot}} housed on a RAID1 root partition), on BIOS systems, simply run ''grub-install'' on both of the drives, such as:<br />
<br />
# grub-install --target=i386-pc --debug /dev/sda<br />
# grub-install --target=i386-pc --debug /dev/sdb<br />
<br />
Where the RAID 1 array housing {{ic|/boot}} is housed on {{ic|/dev/sda}} and {{ic|/dev/sdb}}.<br />
<br />
{{Note|GRUB supports booting from [[Btrfs]] RAID 0/1/10, but ''not'' RAID 5/6. You may use [[mdadm]] for RAID 5/6, which is supported by GRUB.}}<br />
<br />
==== Encrypted /boot ====<br />
<br />
GRUB also has special support for booting with an encrypted {{ic|/boot}}. This is done by unlocking a [[LUKS]] blockdevice in order to read its configuration and load any [[initramfs]] and [[kernel]] from it. This option tries to solve the issue of having an [[dm-crypt/Specialties#Securing the unencrypted_boot partition|unencrypted boot partition]].<br />
<br />
{{Note|{{ic|/boot}} is '''not''' required to be kept in a separate partition; it may also stay under the system's root {{ic|/}} directory tree.}}<br />
<br />
{{Warning|GRUB does not support LUKS2 headers; see [https://savannah.gnu.org/bugs/?55093 GRUB bug #55093]. Make sure to specify {{ic|1=--type luks1}} when creating the encrypted partition using {{ic|cryptsetup luksFormat}}.}}<br />
<br />
To enable this feature encrypt the partition with {{ic|/boot}} residing on it using [[LUKS]] as normal. Then add the following option to {{ic|/etc/default/grub}}:<br />
<br />
{{hc|/etc/default/grub|output=<br />
GRUB_ENABLE_CRYPTODISK=y<br />
}}<br />
<br />
This option is used by grub-install to generate the grub {{ic|core.img}}, so make sure to [[#Installation|install grub]] after modifying this option.<br />
<br />
Without further changes you will be prompted twice for a passhrase: the first for GRUB to unlock the {{ic|/boot}} mount point in early boot, the second to unlock the root filesystem itself as implemented by the initramfs. You can use a [[Dm-crypt/Device encryption#With a keyfile embedded in the initramfs|keyfile]] to avoid this.<br />
<br />
{{Warning|<br />
* If you want to [[#Generate the main configuration file|generate the main configuration file]], make sure that {{ic|/boot}} is mounted.<br />
* In order to perform system updates involving the {{ic|/boot}} mount point, ensure that the encrypted {{ic|/boot}} is unlocked and mounted before performing an update. With a separate {{ic|/boot}} partition, this may be accomplished automatically on boot by using [[crypttab]] with a [[Dm-crypt/Device encryption#With a keyfile embedded in the initramfs|keyfile]].<br />
}}<br />
<br />
{{Note|<br />
* If you use a special keymap, a default GRUB installation will not know it. This is relevant for how to enter the passphrase to unlock the LUKS blockdevice.<br />
* If you experience issues getting the prompt for a password to display (errors regarding cryptouuid, cryptodisk, or "device not found"), try reinstalling GRUB and appending {{ic|1=--modules="part_gpt part_msdos"}} to the end of your {{ic|grub-install}} command.<br />
}}<br />
<br />
{{Tip|1=You can use [https://bbs.archlinux.org/viewtopic.php?id=234607 pacman hooks]to automount your {{ic|/boot}} when upgrades need to access related files.}}<br />
<br />
=== Custom grub.cfg ===<br />
<br />
{{Expansion|Add instructions on how to write a custom {{ic|/boot/grub/grub.cfg}}. See [[User:Eschwartz/Grub]] for a proposed draft.|section=Manually generate grub.cfg}}<br />
<br />
This section describes the manual creation of GRUB boot entries in {{ic|/boot/grub/grub.cfg}} instead of relying on ''grub-mkconfig''.<br />
<br />
A basic GRUB config file uses the following options:<br />
<br />
* {{ic|(hd''X'',''Y'')}} is the partition ''Y'' on disk ''X'', partition numbers starting at 1, disk numbers starting at 0<br />
* {{ic|1=set default=''N''}} is the default boot entry that is chosen after timeout for user action<br />
* {{ic|1=set timeout=''M''}} is the time ''M'' to wait in seconds for a user selection before default is booted<br />
* {{ic|<nowiki>menuentry "title" {entry options}</nowiki>}} is a boot entry titled {{ic|title}}<br />
* {{ic|1=set root=(hd''X'',''Y'')}} sets the boot partition, where the kernel and GRUB modules are stored (boot need not be a separate partition, and may simply be a directory under the "root" partition ({{ic|/}})<br />
<br />
==== Boot menu entry examples ====<br />
<br />
{{Tip|These boot entries can also be used when using a {{ic|/boot/grub/grub.cfg}} generated by ''grub-mkconfig''. Add them to {{ic|/etc/grub.d/40_custom}} and [[#Generate the main configuration file|re-generate the main configuration file]] or add them to {{ic|/boot/grub/custom.cfg}}.}}<br />
<br />
For tips on managing multiple GRUB entries, for example when using both {{Pkg|linux}} and {{Pkg|linux-lts}} kernels, see [[GRUB/Tips and tricks#Multiple entries]].<br />
<br />
For [[Archiso]] and [[Archboot]] boot menu entries see [[Multiboot USB drive#Boot entries]].<br />
<br />
===== GRUB commands =====<br />
<br />
====== "Shutdown" menu entry ======<br />
<br />
{{bc|<br />
menuentry "System shutdown" {<br />
echo "System shutting down..."<br />
halt<br />
}<br />
}}<br />
<br />
====== "Restart" menu entry ======<br />
<br />
{{bc|<br />
menuentry "System restart" {<br />
echo "System rebooting..."<br />
reboot<br />
}<br />
}}<br />
<br />
====== "Firmware setup" menu entry (UEFI only) ======<br />
<br />
{{bc|1=<br />
if [ ${grub_platform} == "efi" ]; then<br />
menuentry "Firmware setup" {<br />
fwsetup<br />
}<br />
fi<br />
}}<br />
<br />
===== EFI binaries =====<br />
<br />
When launched in UEFI mode, GRUB can chainload other EFI binaries.<br />
<br />
{{Tip|1=To show these menu entries only when GRUB is launched in UEFI mode, enclose them in the following {{ic|if}} statement:<br />
<br />
{{bc|1=<br />
if [ ${grub_platform} == "efi" ]; then<br />
''place UEFI-only menu entries here''<br />
fi<br />
}}<br />
<br />
}}<br />
<br />
====== UEFI Shell ======<br />
<br />
You can launch [[Unified Extensible Firmware Interface#UEFI Shell|UEFI Shell]] by using placing it in the root of the [[EFI system partition]] and adding this menu entry:<br />
<br />
{{bc|1=<br />
menuentry "UEFI Shell" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --file /shellx64.efi<br />
chainloader /shellx64.efi<br />
}<br />
}}<br />
<br />
====== gdisk ======<br />
<br />
Download the [[gdisk#gdisk EFI application|gdisk EFI application]] and copy {{ic|gdisk_x64.efi}} to {{ic|''esp''/EFI/tools/}}.<br />
<br />
{{bc|1=<br />
menuentry "gdisk" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --file /EFI/tools/gdisk_x64.efi<br />
chainloader /EFI/tools/gdisk_x64.efi<br />
}<br />
}}<br />
<br />
====== Chainloading an Arch Linux .efi file ======<br />
<br />
If you have an ''.efi'' file generated from following [[Secure Boot]] or other means, you can add it to the boot menu. For example:<br />
<br />
{{bc|1=<br />
menuentry "Arch Linux .efi" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --fs-uuid ''FILESYSTEM_UUID''<br />
chainloader /EFI/arch/vmlinuz.efi<br />
}<br />
}}<br />
<br />
===== Dual-booting =====<br />
<br />
====== GNU/Linux ======<br />
<br />
Assuming that the other distribution is on partition {{ic|sda2}}:<br />
<br />
{{bc|1=<br />
menuentry "Other Linux" {<br />
set root=(hd0,2)<br />
linux /boot/vmlinuz (add other options here as required)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
}<br />
}}<br />
<br />
Alternatively let GRUB search for the right partition by ''UUID'' or ''label'':<br />
<br />
{{bc|1=<br />
menuentry "Other Linux" {<br />
# assuming that UUID is 763A-9CB6<br />
search --no-floppy --set=root --fs-uuid 763A-9CB6<br />
<br />
# search by label OTHER_LINUX (make sure that partition label is unambiguous)<br />
#search --no-floppy --set=root --label OTHER_LINUX<br />
<br />
linux /boot/vmlinuz (add other options here as required, for example: root=UUID=763A-9CB6)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
}<br />
}}<br />
<br />
====== Windows installed in UEFI/GPT mode ======<br />
<br />
This mode determines where the Windows bootloader resides and chain-loads it after GRUB when the menu entry is selected. The main task here is finding the EFI system partition and running the bootloader from it.<br />
<br />
{{Note|This menuentry will work only in UEFI boot mode and only if the Windows bitness matches the UEFI bitness. It will not work in BIOS installed GRUB. See [[Dual boot with Windows#Windows UEFI vs BIOS limitations]] and [[Dual boot with Windows#Bootloader UEFI vs BIOS limitations]] for more information.}}<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "efi" ]; then<br />
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {<br />
insmod part_gpt<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid<br />
chainloader /EFI/Microsoft/Boot/bootmgfw.efi<br />
}<br />
fi<br />
}}<br />
<br />
where {{ic|$hints_string}} and {{ic|$fs_uuid}} are obtained with the following two commands. <br />
<br />
The {{ic|$fs_uuid}} command determines the UUID of the EFI system partition:<br />
<br />
{{hc|1=# grub-probe --target=fs_uuid ''esp''/EFI/Microsoft/Boot/bootmgfw.efi|2=<br />
1ce5-7f28<br />
}}<br />
<br />
Alternatively one can run {{ic|blkid}} (as root) and read the UUID of the EFI system partition from there.<br />
<br />
The {{ic|$hints_string}} command will determine the location of the EFI system partition, in this case harddrive 0:<br />
<br />
{{hc|1=# grub-probe --target=hints_string ''esp''/EFI/Microsoft/Boot/bootmgfw.efi|2=<br />
--hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1<br />
}}<br />
<br />
These two commands assume the ESP Windows uses is mounted at {{ic|''esp''}}. There might be case differences in the path to Windows's EFI file, what with being Windows, and all.<br />
<br />
====== Windows installed in BIOS/MBR mode ======<br />
<br />
{{Note|GRUB supports booting {{ic|bootmgr}} directly and [https://www.gnu.org/software/grub/manual/grub.html#Chain_002dloading chainloading] of partition boot sector is no longer required to boot Windows in a BIOS/MBR setup.}}<br />
<br />
{{Warning|It is the '''system partition''' that has {{ic|/bootmgr}}, not your "real" Windows partition (usually {{ic|C:}}). The system partition's [[Persistent block device naming#by-label|filesystem label]] is {{ic|System Reserved}} or {{ic|SYSTEM}} and the partition is only about 100 to 549 MiB in size. See [[Wikipedia:System partition and boot partition]] for more information.}}<br />
<br />
Throughout this section, it is assumed your Windows partition is {{ic|/dev/sda1}}. A different partition will change every instance of {{ic|hd0,msdos1}}.<br />
<br />
{{Note|These menu entries will work only in BIOS boot mode. It will not work in UEFI installed GRUB. See [[Dual boot with Windows#Windows UEFI vs BIOS limitations]] and [[Dual boot with Windows#Bootloader UEFI vs BIOS limitations]] .}}<br />
<br />
In both examples {{ic|''XXXXXXXXXXXXXXXX''}} is the filesystem UUID which can be found with command {{ic|lsblk --fs}}.<br />
<br />
For Windows Vista/7/8/8.1/10:<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "pc" ]; then<br />
menuentry "Microsoft Windows Vista/7/8/8.1/10 BIOS/MBR" {<br />
insmod part_msdos<br />
insmod ntfs<br />
insmod ntldr <br />
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ''XXXXXXXXXXXXXXXX''<br />
ntldr /bootmgr<br />
}<br />
fi<br />
}}<br />
<br />
For Windows XP:<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "pc" ]; then<br />
menuentry "Microsoft Windows XP" {<br />
insmod part_msdos<br />
insmod ntfs<br />
insmod ntldr <br />
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ''XXXXXXXXXXXXXXXX''<br />
ntldr /ntldr<br />
}<br />
fi<br />
}}<br />
<br />
{{Note|In some cases, GRUB may be installed without a clean Windows 8, in which case you cannot boot Windows without having an error with {{ic|\boot\bcd}} (error code {{ic|0xc000000f}}). You can fix it by going to Windows Recovery Console ({{ic|cmd.exe}} from install disk) and executing:<br />
<br />
X:\> bootrec.exe /fixboot<br />
X:\> bootrec.exe /RebuildBcd<br />
<br />
Do '''not''' use {{ic|bootrec.exe /Fixmbr}} because it will wipe GRUB out.<br />
Or you can use Boot Repair function in the Troubleshooting menu - it will not wipe out GRUB but will fix most errors.<br />
Also you would better keep plugged in both the target hard drive and your bootable device '''ONLY'''. Windows usually fails to repair boot information if any other devices are connected.<br />
}}<br />
<br />
== Using the command shell ==<br />
<br />
Since the MBR is too small to store all GRUB modules, only the menu and a few basic commands reside there. The majority of GRUB functionality remains in modules in {{ic|/boot/grub/}}, which are inserted as needed. In error conditions (e.g. if the partition layout changes) GRUB may fail to boot. When this happens, a command shell may appear.<br />
<br />
GRUB offers multiple shells/prompts. If there is a problem reading the menu but the bootloader is able to find the disk, you will likely be dropped to the "normal" shell:<br />
<br />
grub><br />
<br />
If there is a more serious problem (e.g. GRUB cannot find required files), you may instead be dropped to the "rescue" shell:<br />
<br />
grub rescue><br />
<br />
The rescue shell is a restricted subset of the normal shell, offering much less functionality. If dumped to the rescue shell, first try inserting the "normal" module, then starting the "normal" shell:<br />
<br />
grub rescue> set prefix=(hdX,Y)/boot/grub<br />
grub rescue> insmod (hdX,Y)/boot/grub/i386-pc/normal.mod<br />
rescue:grub> normal<br />
<br />
=== Pager support ===<br />
<br />
GRUB supports pager for reading commands that provide long output (like the {{ic|help}} command). This works only in normal shell mode and not in rescue mode. To enable pager, in GRUB command shell type:<br />
<br />
sh:grub> set pager=1<br />
<br />
=== Using the command shell environment to boot operating systems ===<br />
<br />
grub><br />
<br />
The GRUB's command shell environment can be used to boot operating systems.<br />
A common scenario may be to boot Windows / Linux stored on a drive/partition via '''chainloading'''.<br />
<br />
''Chainloading'' means to load another boot-loader from the current one, ie, chain-loading.<br />
<br />
The other bootloader may be embedded at the start of a partitioned disk (MBR), at the start of a partition or a partitionless disk (VBR), or as an EFI binary in the case of UEFI.<br />
<br />
==== Chainloading a partition's VBR ====<br />
<br />
set root=(hdX,Y)<br />
chainloader +1<br />
boot<br />
<br />
X=0,1,2...<br />
Y=1,2,3...<br />
<br />
For example to chainload Windows stored in the first partition of the first hard disk,<br />
<br />
set root=(hd0,1)<br />
chainloader +1<br />
boot<br />
<br />
Similarly GRUB installed to a partition can be chainloaded.<br />
<br />
==== Chainloading a disk's MBR or a partitionless disk's VBR ====<br />
<br />
set root=hdX<br />
chainloader +1<br />
boot<br />
<br />
==== Chainloading Windows/Linux installed in UEFI mode ====<br />
<br />
insmod fat<br />
set root=(hd0,gpt4)<br />
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi<br />
boot<br />
<br />
{{ic|insmod fat}} is used for loading the FAT file system module for accessing the Windows bootloader on the EFI system partition.<br />
{{ic|(hd0,gpt4)}} or {{ic|/dev/sda4}} is the EFI system partition in this example.<br />
The entry in the {{ic|chainloader}} line specifies the path of the ''.efi'' file to be chain-loaded.<br />
<br />
==== Normal loading ====<br />
<br />
See the examples in [[#Using the rescue console]]<br />
<br />
=== Using the rescue console ===<br />
<br />
See [[#Using the command shell]] first. If unable to activate the standard shell, one possible solution is to boot using a live CD or some other rescue disk to correct configuration errors and reinstall GRUB. However, such a boot disk is not always available (nor necessary); the rescue console is surprisingly robust.<br />
<br />
The available commands in GRUB rescue include {{ic|insmod}}, {{ic|ls}}, {{ic|set}}, and {{ic|unset}}. This example uses {{ic|set}} and {{ic|insmod}}. {{ic|set}} modifies variables and {{ic|insmod}} inserts new modules to add functionality.<br />
<br />
Before starting, the user must know the location of their {{ic|/boot}} partition (be it a separate partition, or a subdirectory under their root):<br />
<br />
grub rescue> set prefix=(hdX,Y)/boot/grub<br />
<br />
where X is the physical drive number and Y is the partition number.<br />
<br />
{{Note|With a separate boot partition, omit {{ic|/boot}} from the path (i.e. type {{ic|1=set prefix=(hdX,Y)/grub}}).}}<br />
<br />
To expand console capabilities, insert the {{ic|linux}} module:<br />
<br />
grub rescue> insmod i386-pc/linux.mod<br />
<br />
or simply<br />
<br />
grub rescue> insmod linux<br />
<br />
This introduces the {{ic|linux}} and {{ic|initrd}} commands, which should be familiar.<br />
<br />
An example, booting Arch Linux:<br />
<br />
set root=(hd0,5)<br />
linux /boot/vmlinuz-linux root=/dev/sda5<br />
initrd /boot/initramfs-linux.img<br />
boot<br />
<br />
With a separate boot partition (e.g. when using UEFI), again change the lines accordingly: <br />
<br />
{{Note|Since boot is a separate partition and not part of your root partition, you must address the boot partition manually, in the same way as for the prefix variable.}}<br />
<br />
set root=(hd0,5)<br />
linux (hdX,Y)/vmlinuz-linux root=/dev/sda6<br />
initrd (hdX,Y)/initramfs-linux.img<br />
boot<br />
<br />
{{Note|If you experienced {{ic|error: premature end of file /YOUR_KERNEL_NAME}} during execution of {{ic|linux}} command, you can try {{ic|linux16}} instead.}}<br />
<br />
After successfully booting the Arch Linux installation, users can correct {{ic|grub.cfg}} as needed and then reinstall GRUB.<br />
<br />
To reinstall GRUB and fix the problem completely, changing {{ic|/dev/sda}} if needed. See [[#Installation]] for details.<br />
<br />
== Troubleshooting ==<br />
<br />
=== F2FS and other unsupported file systems ===<br />
<br />
GRUB does not support [[F2FS]] file system. In case the root partition is on an unsupported file system, an alternative {{ic|/boot}} partition with a supported file system must be created. In some cases, the development version of GRUB {{aur|grub-git}} may have native support for the file system.<br />
<br />
If GRUB is used with an unsupported filesystem it is not able to extract the [[UUID]] of your drive so it uses classic non-persistent {{ic|/dev/''sdXx''}} names instead. In this case you might have to manually edit {{ic|/boot/grub/grub.cfg}} and replace {{ic|1=root=/dev/''sdXx''}} with {{ic|1=root=UUID=''XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX''}}. You can use the {{ic|blkid}} command to get the UUID of your device, see [[Persistent block device naming]].<br />
<br />
=== Intel BIOS not booting GPT ===<br />
<br />
Some Intel BIOS's require at least one bootable MBR partition to be present at boot, causing GPT-partitioned boot setups to be unbootable.<br />
<br />
This can be circumvented by using (for instance) fdisk to mark one of the GPT partitions (preferably the 1007 KiB partition you have created for GRUB already) bootable in the MBR. This can be achieved, using fdisk, by the following commands: Start fdisk against the disk you are installing, for instance {{ic|fdisk /dev/sda}}, then press {{ic|a}} and select the partition you wish to mark as bootable (probably #1) by pressing the corresponding number, finally press {{ic|w}} to write the changes to the MBR.<br />
<br />
{{Note|The bootable-marking must be done in {{ic|fdisk}} or similar, not in GParted or others, as they will not set the bootable flag in the MBR.}}<br />
<br />
With cfdisk, the steps are similar, just {{ic|cfdisk /dev/sda}}, choose bootable (at the left) in the desired hard disk, and quit saving.<br />
<br />
With recent version of parted, you can use {{ic|disk_toggle pmbr_boot}} option. Afterwards verify that Disk Flags show pmbr_boot.<br />
<br />
# parted /dev/sd''x'' disk_toggle pmbr_boot<br />
# parted /dev/sd''x'' print<br />
<br />
More information is available [http://www.rodsbooks.com/gdisk/bios.html here]<br />
<br />
=== Enable debug messages ===<br />
<br />
{{Note|This change is overwritten when [[#Generate the main configuration file]].}}<br />
<br />
Add:<br />
<br />
set pager=1<br />
set debug=all<br />
<br />
to {{ic|grub.cfg}}.<br />
<br />
=== "No suitable mode found" error ===<br />
<br />
If you get this error when booting any menuentry:<br />
<br />
error: no suitable mode found<br />
Booting however<br />
<br />
Then you need to initialize GRUB graphical terminal ({{ic|gfxterm}}) with proper video mode ({{ic|gfxmode}}) in GRUB. This video mode is passed by GRUB to the linux kernel via 'gfxpayload'. In case of UEFI systems, if the GRUB video mode is not initialized, no kernel boot messages will be shown in the terminal (atleast until KMS kicks in).<br />
<br />
{{Remove|''grub-install'' copies {{ic|unicode.pf2}} to {{ic|/boot/grub/fonts/}}, there is no need to do it manually.}}<br />
<br />
Copy {{ic|/usr/share/grub/unicode.pf2}} to {{ic|${GRUB_PREFIX_DIR}}} ({{ic|/boot/grub/}} in case of BIOS and UEFI systems). If GRUB UEFI was installed with {{ic|1=--boot-directory=''esp''/EFI}} set, then the directory is {{ic|''esp''/EFI/grub/}}:<br />
<br />
# cp /usr/share/grub/unicode.pf2 ${GRUB_PREFIX_DIR}<br />
<br />
If {{ic|/usr/share/grub/unicode.pf2}} does not exist, install {{Pkg|bdf-unifont}}, create the {{ic|unifont.pf2}} file and then copy it to {{ic|1=${GRUB_PREFIX_DIR}}}:<br />
<br />
# grub-mkfont -o unicode.pf2 /usr/share/fonts/misc/unifont.bdf<br />
<br />
Then, in the {{ic|grub.cfg}} file, add the following lines to enable GRUB to pass the video mode correctly to the kernel, without of which you will only get a black screen (no output) but booting (actually) proceeds successfully without any system hang.<br />
<br />
After that add the following code (common to both BIOS and UEFI):<br />
<br />
{{bc|1=<br />
loadfont "unicode"<br />
set gfxmode=auto<br />
set gfxpayload=keep<br />
insmod all_video<br />
insmod gfxterm<br />
terminal_output gfxterm<br />
}}<br />
<br />
=== msdos-style error message ===<br />
<br />
grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding will not be possible!<br />
grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.<br />
However, blocklists are UNRELIABLE and its use is discouraged.<br />
grub-setup: error: If you really want blocklists, use --force.<br />
<br />
This error may occur when you try installing GRUB in a VMware container. Read more about it [https://bbs.archlinux.org/viewtopic.php?pid=581760#p581760 here]. It happens when the first partition starts just after the MBR (block 63), without the usual space of 1 MiB (2048 blocks) before the first partition. Read [[#Master Boot Record (MBR) specific instructions]]<br />
<br />
=== UEFI ===<br />
<br />
==== Common installation errors ====<br />
<br />
* If you have a problem when running ''grub-install'' with ''sysfs'' or ''procfs'' and it says you must run {{ic|modprobe efivars}}, try [[Unified Extensible Firmware Interface#Mount efivarfs]].<br />
* Without {{ic|--target}} or {{ic|--directory}} option, grub-install cannot determine for which firmware to install. In such cases {{ic|grub-install}} will print {{ic|source_dir does not exist. Please specify --target or --directory}}.<br />
* If after running grub-install you are told your partition does not look like an EFI partition then the partition is most likely not {{ic|Fat32}}.<br />
<br />
==== Drop to rescue shell ====<br />
<br />
If GRUB loads but drops into the rescue shell with no errors, it can be due to one of these two reasons:<br />
<br />
* It may be because of a missing or misplaced {{ic|grub.cfg}}. This will happen if GRUB UEFI was installed with {{ic|--boot-directory}} and {{ic|grub.cfg}} is missing,<br />
* It also happens if the boot partition, which is hardcoded into the {{ic|grubx64.efi}} file, has changed.<br />
<br />
==== GRUB UEFI not loaded ====<br />
<br />
An example of a working UEFI:<br />
<br />
{{hc|# efibootmgr -v|<br />
BootCurrent: 0000<br />
Timeout: 3 seconds<br />
BootOrder: 0000,0001,0002<br />
Boot0000* GRUB HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\EFI\GRUB\grubx64.efi)<br />
Boot0001* Shell HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\shellx64.efi)<br />
Boot0002* Festplatte BIOS(2,0,00)P0: SAMSUNG HD204UI<br />
}}<br />
<br />
If the screen only goes black for a second and the next boot option is tried afterwards, according to [https://bbs.archlinux.org/viewtopic.php?pid=981560#p981560 this post], moving GRUB to the partition root can help. The boot option has to be deleted and recreated afterwards. The entry for GRUB should look like this then:<br />
<br />
Boot0000* GRUB HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\grubx64.efi)<br />
<br />
==== Default/fallback boot path ====<br />
<br />
Some UEFI firmwares require a bootable file at a known location before they will show UEFI NVRAM boot entries. If this is the case, {{ic|grub-install}} will claim {{ic|efibootmgr}} has added an entry to boot GRUB, however the entry will not show up in the VisualBIOS boot order selector. The solution is to install GRUB at the default/fallback boot path:<br />
<br />
# grub-install --target=x86_64-efi --efi-directory=''esp'' '''--removable'''<br />
<br />
Alternatively you can move an already installed GRUB EFI executable to the default/fallback path:<br />
<br />
# mv ''esp''/EFI/grub ''esp''/EFI/BOOT<br />
# mv ''esp''/EFI/BOOT/grubx64.efi ''esp''/EFI/BOOT/BOOTX64.EFI<br />
<br />
=== Invalid signature ===<br />
<br />
If trying to boot Windows results in an "invalid signature" error, e.g. after reconfiguring partitions or adding additional hard drives, (re)move GRUB's device configuration and let it reconfigure:<br />
<br />
# mv /boot/grub/device.map /boot/grub/device.map-old<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
{{ic|grub-mkconfig}} should now mention all found boot options, including Windows. If it works, remove {{ic|/boot/grub/device.map-old}}.<br />
<br />
=== Boot freezes ===<br />
<br />
If booting gets stuck without any error message after GRUB loading the kernel and the initial ramdisk, try removing the {{ic|add_efi_memmap}} kernel parameter.<br />
<br />
=== Arch not found from other OS ===<br />
<br />
Some have reported that other distributions may have trouble finding Arch Linux automatically with {{ic|os-prober}}. If this problem arises, it has been reported that detection can be improved with the presence of {{ic|/etc/lsb-release}}. This file and updating tool is available with the package {{Pkg|lsb-release}}.<br />
<br />
=== Warning when installing in chroot ===<br />
<br />
When installing GRUB on a LVM system in a chroot environment (e.g. during system installation), you may receive warnings like<br />
<br />
/run/lvm/lvmetad.socket: connect failed: No such file or directory<br />
<br />
or<br />
<br />
WARNING: failed to connect to lvmetad: No such file or directory. Falling back to internal scanning.<br />
<br />
This is because {{ic|/run}} is not available inside the chroot. These warnings will not prevent the system from booting, provided that everything has been done correctly, so you may continue with the installation.<br />
<br />
=== GRUB loads slowly ===<br />
<br />
GRUB can take a long time to load when disk space is low. Check if you have sufficient free disk space on your {{ic|/boot}} or {{ic|/}} partition when you are having problems.<br />
<br />
=== error: unknown filesystem ===<br />
<br />
GRUB may output {{ic|error: unknown filesystem}} and refuse to boot for a few reasons. If you are certain that all [[UUID]]s are correct and all filesystems are valid and supported, it may be because your [[#GUID Partition Table (GPT) specific instructions|BIOS Boot Partition]] is located outside the first 2 TiB of the drive [https://bbs.archlinux.org/viewtopic.php?id=195948]. Use a partitioning tool of your choice to ensure this partition is located fully within the first 2 TiB, then reinstall and reconfigure GRUB.<br />
<br />
=== grub-reboot not resetting ===<br />
<br />
GRUB seems to be unable to write to root BTRFS partitions [https://bbs.archlinux.org/viewtopic.php?id=166131]. If you use grub-reboot to boot into another entry it will therefore be unable to update its on-disk environment. Either run grub-reboot from the other entry (for example when switching between various distributions) or consider a different file system. You can reset a "sticky" entry by executing {{ic|grub-editenv create}} and setting {{ic|1=GRUB_DEFAULT=0}} in your {{ic|/etc/default/grub}} (do not forget {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}).<br />
<br />
=== Old BTRFS prevents installation ===<br />
<br />
If a drive is formatted with BTRFS without creating a partition table (eg. /dev/sdx), then later has partition table written to, there are parts of the BTRFS format that persist. Most utilities and OS's do not see this, but GRUB will refuse to install, even with --force<br />
<br />
# grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..<br />
# grub-install: error: filesystem `btrfs' does not support blocklists.<br />
<br />
You can zero the drive, but the easy solution that leaves your data alone is to erase the BTRFS superblock with {{ic|wipefs -o 0x10040 /dev/sdx}}<br />
<br />
=== Windows 8/10 not found ===<br />
<br />
A setting in Windows 8/10 called "Hiberboot", "Hybrid Boot" or "Fast Boot" can prevent the Windows partition from being mounted, so {{ic|grub-mkconfig}} will not find a Windows install. Disabling Hiberboot in Windows will allow it to be added to the GRUB menu.<br />
<br />
=== VirtualBox EFI mode ===<br />
<br />
Install GRUB to the [[#Default/fallback boot path|default/fallback boot path]].<br />
<br />
See also [[VirtualBox#Installation in EFI mode]].<br />
<br />
=== Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds ===<br />
<br />
If grub-mkconfig hangs and gives error: {{ic|WARNING: Device /dev/''xxx'' not initialized in udev database even after waiting 10000000 microseconds}}.<br />
<br />
You may need to provide {{ic|/run/lvm/}} access to the chroot environment using:<br />
<br />
# mkdir /mnt/hostlvm<br />
# mount --bind /run/lvm /mnt/hostlvm<br />
# arch-chroot /mnt<br />
# ln -s /hostlvm /run/lvm<br />
<br />
See {{Bug|61040}} and [https://bbs.archlinux.org/viewtopic.php?pid=1820949#p1820949 workaround].<br />
<br />
<br />
=== GRUB configuration file not updating with ALPM hook when grub boot directory not set to /boot ===<br />
<br />
If your GRUB installation not using ''/boot'' as boot directory (e.g. you put it to efi partition) it is possible, that [[pacman#Hooks|ALPM hook]] will not update ''grub.cfg'' when it will be requested by pacman (e.g. when installing new kernel or updating initramfs). Reason: update-grub only updates files in ''/boot'' directory.<br />
<br />
To solve this problem you may create '''symlink''' in ''/boot'' to directory, that contains ''grub.cfg'' file. For example, if you gave --boot-directory=/boot/efi/EFI/grub argument to grub-install, then you need to execute this:<br />
{{bc|<nowiki># ln -s /boot/efi/EFI/grub /boot/grub</nowiki>}}<br />
<br />
Or you may alter ''99-grub.hook'' [[pacman#Hooks|ALPM hook]]:<br />
<br />
Open it with nano editor:<br />
{{bc|<nowiki># nano /usr/share/libalpm/hooks/99-grub.hook</nowiki>}}<br />
<br />
It originally looks like this:<br />
{{bc|<nowiki>[Trigger]<br />
Type = File<br />
Operation = Install<br />
Operation = Upgrade<br />
Operation = Remove<br />
Target = boot/vmlinuz-*<br />
<br />
[Action]<br />
Description = Updating Grub-Bootmenu<br />
When = PostTransaction<br />
Exec = update-grub</nowiki>}}<br />
<br />
You need to change '''Exec''' parameter in '''Action''' section to this:<br />
<br />
{{bc|<nowiki>Exec = grub-mkconfig -o <path_to_your_grub_directory></nowiki>}}<br />
<br />
== See also ==<br />
<br />
* [[Wikipedia:GNU GRUB]]<br />
* [https://www.gnu.org/software/grub/manual/grub.html Official GRUB Manual]<br />
* [https://help.ubuntu.com/community/Grub2 Ubuntu wiki page for GRUB]<br />
* [https://help.ubuntu.com/community/UEFIBooting GRUB wiki page describing steps to compile for UEFI systems]<br />
* [[Wikipedia:BIOS Boot partition]]<br />
* [http://web.archive.org/web/20160424042444/http://members.iinet.net/~herman546/p20/GRUB2%20Configuration%20File%20Commands.html#Editing_etcgrub.d05_debian_theme How to configure GRUB]<br />
* [http://www.linuxjournal.com/article/4622 Boot with GRUB]</div>Niasarhttps://wiki.archlinux.org/index.php?title=GRUB&diff=569019GRUB2019-03-17T20:11:06Z<p>Niasar: edited my solution to easier one</p>
<hr />
<div>[[Category:Boot loaders]]<br />
[[Category:GNU]]<br />
[[ar:GRUB]]<br />
[[cs:GRUB]]<br />
[[de:GRUB]]<br />
[[el:GRUB]]<br />
[[es:GRUB]]<br />
[[fa:گراب]]<br />
[[fr:GRUB]]<br />
[[he:GRUB]]<br />
[[id:GRUB]]<br />
[[it:GRUB]]<br />
[[ja:GRUB]]<br />
[[nl:GRUB]]<br />
[[pt:GRUB]]<br />
[[ru:GRUB]]<br />
[[zh-hans:GRUB]]<br />
[[zh-hant:GRUB]]<br />
{{Related articles start}}<br />
{{Related|Arch boot process}}<br />
{{Related|Master Boot Record}}<br />
{{Related|GUID Partition Table}}<br />
{{Related|Unified Extensible Firmware Interface}}<br />
{{Related|GRUB Legacy}}<br />
{{Related|GRUB/EFI examples}}<br />
{{Related|GRUB/Tips and tricks}}<br />
{{Related|Multiboot USB drive}}<br />
{{Related articles end}}<br />
[https://www.gnu.org/software/grub/ GRUB] (GRand Unified Bootloader) is a [[Boot loader|multi-boot loader]]. It is derived from [http://www.nongnu.org/pupa/ PUPA] which was a research project to develop the replacement of what is now known as [[GRUB Legacy]]. The latter had become too difficult to maintain and GRUB was rewritten from scratch with the aim to provide modularity and portability [https://www.gnu.org/software/grub/grub-faq.html#q1]. The current GRUB is also referred to as GRUB 2 while GRUB Legacy corresponds to versions 0.9x.<br />
<br />
{{Note|In the entire article {{ic|''esp''}} denotes the mountpoint of the [[EFI system partition]] aka ESP.}}<br />
<br />
== BIOS systems ==<br />
<br />
=== GUID Partition Table (GPT) specific instructions ===<br />
<br />
On a BIOS/[[GPT]] configuration, a [https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html#BIOS-installation BIOS boot partition] is required. GRUB embeds its {{ic|core.img}} into this partition.<br />
<br />
{{Note|<br />
* Before attempting this method keep in mind that not all systems will be able to support this partitioning scheme. Read more on [[Partitioning#GUID Partition Table]].<br />
* The BIOS boot partition is only needed by GRUB on a BIOS/GPT setup. On a BIOS/MBR setup, GRUB uses the post-MBR gap for the embedding the {{ic|core.img}}. On GPT, however, there is no guaranteed unused space before the first partition.<br />
* For [[UEFI]] systems this extra partition is not required, since no embedding of boot sectors takes place in that case. However, UEFI systems still require an [[EFI system partition]].<br />
}}<br />
<br />
Create a mebibyte partition ({{ic|1=+1M}} with ''fdisk'' or ''gdisk'') on the disk with no file system and with partition type GUID {{ic|21686148-6449-6E6F-744E-656564454649}}.<br />
<br />
* Select partition type {{ic|BIOS boot}} for [[fdisk]].<br />
* Select partition type code {{ic|ef02}} for [[gdisk]].<br />
* For [[parted]] set/activate the flag {{ic|bios_grub}} on the partition.<br />
<br />
This partition can be in any position order but has to be on the first 2 TiB of the disk. This partition needs to be created before GRUB installation. When the partition is ready, install the bootloader as per the instructions below.<br />
<br />
The space before the first partition can also be used as the BIOS boot partition though it will be out of GPT alignment specification. Since the partition will not be regularly accessed performance issues can be disregarded, though some disk utilities will display a warning about it. In ''fdisk'' or ''gdisk'' create a new partition starting at sector 34 and spanning to 2047 and set the type. To have the viewable partitions begin at the base consider adding this partition last.<br />
<br />
=== Master Boot Record (MBR) specific instructions ===<br />
<br />
Usually the post-MBR gap (after the 512 byte [[MBR]] region and before the start of the first partition) in many MBR partitioned systems is 31 KiB when DOS compatibility cylinder alignment issues are satisfied in the partition table. However a post-MBR gap of about 1 to 2 MiB is recommended to provide sufficient room for embedding GRUB's {{ic|core.img}} ({{Bug|24103}}). It is advisable to use a partitioning tool that supports 1 MiB [[Partitioning#Partition alignment|partition alignment]] to obtain this space as well as to satisfy other non-512-byte-sector issues (which are unrelated to embedding of {{ic|core.img}}).<br />
<br />
=== Installation ===<br />
<br />
[[Install]] the {{Pkg|grub}} package. (It will replace {{AUR|grub-legacy}} if that is already installed.) Then do:<br />
<br />
# grub-install --target=i386-pc /dev/sd'''X'''<br />
<br />
where {{ic|/dev/sd'''X'''}} is the disk where GRUB is to be installed (for example, disk {{ic|/dev/sda}} and '''not''' partition {{ic|/dev/sda1}}).<br />
<br />
Now you must [[#Generate the main configuration file]].<br />
<br />
If you use [[LVM]] for your {{ic|/boot}}, you can install GRUB on multiple physical disks.<br />
<br />
{{Tip|See [[GRUB/Tips and tricks#Alternative installation methods]] for other ways to install GRUB, such as to a USB stick.}}<br />
<br />
See {{man|8|grub-install}} and [https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html#BIOS-installation GRUB Manual] for more details on the ''grub-install'' command.<br />
<br />
== UEFI systems ==<br />
<br />
{{Note|<br />
* It is recommended to read and understand the [[Unified Extensible Firmware Interface]], [[Partitioning#GUID Partition Table]] and [[Arch boot process#Under UEFI]] pages.<br />
* When installing to use UEFI it is important to boot the installation media in UEFI mode, otherwise ''efibootmgr'' will not be able to add the GRUB UEFI boot entry. Installing to the [[#Default/fallback boot path|fallback boot path]] will still work even in BIOS mode since it does not touch the NVRAM.<br />
* To boot from a disk using UEFI, an EFI system partition is required. Follow [[EFI system partition#Check for an existing partition]] to find out if you have one already, otherwise you need to create it.<br />
}}<br />
<br />
=== Installation ===<br />
<br />
{{Note|<br />
* UEFI firmwares are not implemented consistently across manufacturers. The procedure described below is intended to work on a wide range of UEFI systems but those experiencing problems despite applying this method are encouraged to share detailed information, and if possible the turnarounds found, for their hardware-specific case. A [[GRUB/EFI examples]] article has been provided for such cases.<br />
* The section assumes you are installing GRUB for x86_64 systems. For IA32 (32-bit) UEFI systems (not to be confused with 32-bit CPUs), replace {{ic|x86_64-efi}} with {{ic|i386-efi}} where appropriate.<br />
}}<br />
<br />
First, [[install]] the packages {{Pkg|grub}} and {{Pkg|efibootmgr}}: ''GRUB'' is the bootloader while ''efibootmgr'' is used by the GRUB installation script to write boot entries to NVRAM.<br />
<br />
Then follow the below steps to install GRUB:<br />
<br />
# [[EFI system partition#Mount the partition|Mount the EFI system partition]] and in the remainder of this section, substitute {{ic|''esp''}} with its mount point.<br />
# Choose a bootloader identifier, here named {{ic|GRUB}}. A directory of that name will be created in {{ic|''esp''/EFI/}} to store the EFI binary and this is the name that will appear in the UEFI boot menu to identify the GRUB boot entry.<br />
# Execute the following command to install the GRUB EFI application {{ic|grubx64.efi}} to {{ic|''esp''/EFI/GRUB/}} and install its modules to {{ic|/boot/grub/x86_64-efi/}}.<br />
<br />
# grub-install --target=x86_64-efi --efi-directory=''esp'' --bootloader-id=GRUB<br />
<br />
After the above install completed the main GRUB directory is located at {{ic|/boot/grub/}}. Note that {{ic|grub-install}} also tries to [[GRUB/Tips and tricks#Create a GRUB entry in the firmware boot manager|create an entry in the firmware boot manager]], named {{ic|GRUB}} in the above example.<br />
<br />
Remember to [[#Generate the main configuration file]] after finalizing the configuration.<br />
<br />
{{Tip|If you use the option {{ic|--removable}} then GRUB will be installed to {{ic|''esp''/EFI/BOOT/BOOTX64.EFI}} (or {{ic|''esp''/EFI/BOOT/BOOTIA32.EFI}} for the {{ic|i386-efi}} target) and you will have the additional ability of being able to boot from the drive in case EFI variables are reset or you move the drive to another computer. Usually you can do this by selecting the drive itself similar to how you would using BIOS. If dual booting with Windows, be aware Windows usually places an EFI executable there, but its only purpose is to recreate the UEFI boot entry for Windows.}}<br />
<br />
{{Note|<br />
* {{ic|--efi-directory}} and {{ic|--bootloader-id}} are specific to GRUB UEFI, {{ic|--efi-directory}} replaces {{ic|--root-directory}} which is deprecated. <br />
* You might note the absence of a ''device_path'' option (e.g.: {{ic|/dev/sda}}) in the {{ic|grub-install}} command. In fact any ''device_path'' provided will be ignored by the GRUB UEFI install script. Indeed, UEFI bootloaders do not use a MBR bootcode or partition boot sector at all.<br />
}}<br />
<br />
See [[#UEFI|UEFI troubleshooting]] in case of problems. Additionally see [[GRUB/Tips and tricks#UEFI further reading]].<br />
<br />
== Configuration ==<br />
<br />
On an installed system, GRUB loads the {{ic|/boot/grub/grub.cfg}} configuration file each boot. You can follow [[#Generated grub.cfg]] for using a tool, or [[#Custom grub.cfg]] for a manual creation.<br />
<br />
=== Generated grub.cfg ===<br />
<br />
This section only covers editing the {{ic|/etc/default/grub}} configuration file. See [[GRUB/Tips and tricks]] for more information.<br />
<br />
Remember to always [[#Generate the main configuration file]] after making changes to {{ic|/etc/default/grub}} and/or files in {{ic|/etc/grub.d/}}.<br />
<br />
==== Generate the main configuration file ====<br />
<br />
After the installation, the main configuration file {{ic|/boot/grub/grub.cfg}} needs to be generated. The generation process can be influenced by a variety of options in {{ic|/etc/default/grub}} and scripts in {{ic|/etc/grub.d/}}. <br />
<br />
If you have not done additional configuration, the automatic generation will determine the root filesystem of the system to boot for the configuration file. For that to succeed it is important that the system is either booted or chrooted into. <br />
<br />
{{Note|<br />
* Remember that {{ic|/boot/grub/grub.cfg}} has to be re-generated after any change to {{ic|/etc/default/grub}} or files in {{ic|/etc/grub.d/}}.<br />
* The default file path is {{ic|/boot/grub/grub.cfg}}, not {{ic|/boot/grub/i386-pc/grub.cfg}}.<br />
* If you are trying to run ''grub-mkconfig'' in a chroot or ''systemd-nspawn'' container, you might notice that it does not work, complaining that ''grub-probe'' cannot get the "canonical path of /dev/sdaX". In this case, try using ''arch-chroot'' as described in the [https://bbs.archlinux.org/viewtopic.php?pid&#61;1225067#p1225067 BBS post].<br />
* If you are installing GRUB in chroot environment using LVM and the {{ic|grub-mkconfig}} hangs indefinitely, see [[#Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds]].<br />
}}<br />
<br />
Use the ''grub-mkconfig'' tool to generate {{ic|/boot/grub/grub.cfg}}:<br />
<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
By default the generation scripts automatically add menu entries for all installed Arch Linux [[kernel]]s to the generated configuration.<br />
<br />
{{Tip|<br />
* After installing or removing a [[kernel]], you just need to re-run the above ''grub-mkconfig'' command.<br />
* For tips on managing multiple GRUB entries, for example when using both {{Pkg|linux}} and {{Pkg|linux-lts}} kernels, see [[GRUB/Tips and tricks#Multiple entries]].<br />
}}<br />
<br />
To automatically add entries for other installed operating systems, see [[#Detecting other operating systems]]. <br />
<br />
You can add additional custom menu entries by editing {{ic|/etc/grub.d/40_custom}} and re-generating {{ic|/boot/grub/grub.cfg}}. Or you can create {{ic|/boot/grub/custom.cfg}} and add them there. Changes to {{ic|/boot/grub/custom.cfg}} do not require re-running ''grub-mkconfig'', since {{ic|/etc/grub.d/40_custom}} adds the necessary {{ic|source}} statement to the generated configuration file.<br />
<br />
{{Tip|{{ic|/etc/grub.d/40_custom}} can be used as a template to create {{ic|/etc/grub.d/''nn''_custom}}, where {{ic|''nn''}} defines the precedence, indicating the order the script is executed. The order scripts are executed determine the placement in the GRUB boot menu. {{ic|''nn''}} should be greater than {{ic|06}} to ensure necessary scripts are executed first.}}<br />
<br />
See [[#Boot menu entry examples]] for custom menu entry examples.<br />
<br />
==== Detecting other operating systems ====<br />
<br />
To have ''grub-mkconfig'' search for other installed systems and automatically add them to the menu, [[install]] the {{Pkg|os-prober}} package and [[mount]] the partitions that contain the other systems. Then re-run ''grub-mkconfig''.<br />
<br />
===== MS Windows =====<br />
<br />
Often, partitions containing Windows will be automatically discovered by {{Pkg|os-prober}}. However, NTFS partitions may not always be detected when mounted with the default Linux drivers. If GRUB is not detecting it, try installing {{Pkg|ntfs-3g}} and remounting.<br />
<br />
Encrypted Windows partitions may need to be decrypted before mounting. For BitLocker, this can be done with {{AUR|dislocker}}. This should be sufficient for {{Pkg|os-prober}} to add the correct entry.<br />
<br />
==== Additional arguments ====<br />
<br />
To pass custom additional arguments to the Linux image, you can set the {{ic|GRUB_CMDLINE_LINUX}} + {{ic|GRUB_CMDLINE_LINUX_DEFAULT}} variables in {{ic|/etc/default/grub}}. The two are appended to each other and passed to kernel when generating regular boot entries. For the ''recovery'' boot entry, only {{ic|GRUB_CMDLINE_LINUX}} is used in the generation.<br />
<br />
It is not necessary to use both, but can be useful. For example, you could use {{ic|1=GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=''uuid-of-swap-partition'' quiet"}} where {{ic|''uuid-of-swap-partition''}} is the [[UUID]] of your swap partition to enable resume after [[hibernation]]. This would generate a recovery boot entry without the resume and without {{ic|quiet}} suppressing kernel messages during a boot from that menu entry. Though, the other (regular) menu entries would have them as options.<br />
<br />
By default ''grub-mkconfig'' determines the [[UUID]] of the root filesystem for the configuration. To disable this, uncomment {{ic|1=GRUB_DISABLE_LINUX_UUID=true}}. <br />
<br />
For generating the GRUB recovery entry you have to ensure that {{ic|GRUB_DISABLE_RECOVERY}} is not set to {{ic|true}} in {{ic|/etc/default/grub}}.<br />
<br />
See [[Kernel parameters]] for more info.<br />
<br />
==== LVM ====<br />
<br />
{{Merge|#Installation|grub-mkconfig is capable of detecting that it needs the {{ic|lvm}} module, specifying it in {{ic|GRUB_PRELOAD_MODULES}} is not required. Move warning to [[#Installation]] & [[#Installation_2]] or create a [[Help:Style#"Known issues" section|Known issues section]] and document it there.}}<br />
<br />
{{Warning|GRUB does not support thin-provisioned logical volumes.}}<br />
<br />
If you use [[LVM]] for your {{ic|/boot}} or {{ic|/}} root partition, make sure that the {{ic|lvm}} module is preloaded:<br />
<br />
{{hc|/etc/default/grub|2=<br />
GRUB_PRELOAD_MODULES="... lvm"<br />
}}<br />
<br />
==== RAID ====<br />
<br />
{{Merge|#Installation|grub-mkconfig is capable of detecting that it needs the {{ic|mdraid09}} and/or {{ic|mdraid1x}} modules, specifying them in {{ic|GRUB_PRELOAD_MODULES}} is not required. Summarize the double grub-install in a note and move it to [[#Installation]]; move {{ic|set root}} stuff to [[#Custom grub.cfg]].}}<br />
<br />
GRUB provides convenient handling of [[RAID]] volumes. You need to load GRUB modules {{ic|mdraid09}} or {{ic|mdraid1x}} to allow you to address the volume natively:<br />
<br />
{{hc|/etc/default/grub|2=<br />
GRUB_PRELOAD_MODULES="... mdraid09 mdraid1x"<br />
}}<br />
<br />
For example, {{ic|/dev/md0}} becomes:<br />
<br />
set root=(md/0)<br />
<br />
whereas a partitioned RAID volume (e.g. {{ic|/dev/md0p1}}) becomes:<br />
<br />
set root=(md/0,1)<br />
<br />
To install grub when using RAID1 as the {{ic|/boot}} partition (or using {{ic|/boot}} housed on a RAID1 root partition), on BIOS systems, simply run ''grub-install'' on both of the drives, such as:<br />
<br />
# grub-install --target=i386-pc --debug /dev/sda<br />
# grub-install --target=i386-pc --debug /dev/sdb<br />
<br />
Where the RAID 1 array housing {{ic|/boot}} is housed on {{ic|/dev/sda}} and {{ic|/dev/sdb}}.<br />
<br />
{{Note|GRUB supports booting from [[Btrfs]] RAID 0/1/10, but ''not'' RAID 5/6. You may use [[mdadm]] for RAID 5/6, which is supported by GRUB.}}<br />
<br />
==== Encrypted /boot ====<br />
<br />
GRUB also has special support for booting with an encrypted {{ic|/boot}}. This is done by unlocking a [[LUKS]] blockdevice in order to read its configuration and load any [[initramfs]] and [[kernel]] from it. This option tries to solve the issue of having an [[dm-crypt/Specialties#Securing the unencrypted_boot partition|unencrypted boot partition]].<br />
<br />
{{Note|{{ic|/boot}} is '''not''' required to be kept in a separate partition; it may also stay under the system's root {{ic|/}} directory tree.}}<br />
<br />
{{Warning|GRUB does not support LUKS2 headers; see [https://savannah.gnu.org/bugs/?55093 GRUB bug #55093]. Make sure to specify {{ic|1=--type luks1}} when creating the encrypted partition using {{ic|cryptsetup luksFormat}}.}}<br />
<br />
To enable this feature encrypt the partition with {{ic|/boot}} residing on it using [[LUKS]] as normal. Then add the following option to {{ic|/etc/default/grub}}:<br />
<br />
{{hc|/etc/default/grub|output=<br />
GRUB_ENABLE_CRYPTODISK=y<br />
}}<br />
<br />
This option is used by grub-install to generate the grub {{ic|core.img}}, so make sure to [[#Installation|install grub]] after modifying this option.<br />
<br />
Without further changes you will be prompted twice for a passhrase: the first for GRUB to unlock the {{ic|/boot}} mount point in early boot, the second to unlock the root filesystem itself as implemented by the initramfs. You can use a [[Dm-crypt/Device encryption#With a keyfile embedded in the initramfs|keyfile]] to avoid this.<br />
<br />
{{Warning|<br />
* If you want to [[#Generate the main configuration file|generate the main configuration file]], make sure that {{ic|/boot}} is mounted.<br />
* In order to perform system updates involving the {{ic|/boot}} mount point, ensure that the encrypted {{ic|/boot}} is unlocked and mounted before performing an update. With a separate {{ic|/boot}} partition, this may be accomplished automatically on boot by using [[crypttab]] with a [[Dm-crypt/Device encryption#With a keyfile embedded in the initramfs|keyfile]].<br />
}}<br />
<br />
{{Note|<br />
* If you use a special keymap, a default GRUB installation will not know it. This is relevant for how to enter the passphrase to unlock the LUKS blockdevice.<br />
* If you experience issues getting the prompt for a password to display (errors regarding cryptouuid, cryptodisk, or "device not found"), try reinstalling GRUB and appending {{ic|1=--modules="part_gpt part_msdos"}} to the end of your {{ic|grub-install}} command.<br />
}}<br />
<br />
{{Tip|1=You can use [https://bbs.archlinux.org/viewtopic.php?id=234607 pacman hooks]to automount your {{ic|/boot}} when upgrades need to access related files.}}<br />
<br />
=== Custom grub.cfg ===<br />
<br />
{{Expansion|Add instructions on how to write a custom {{ic|/boot/grub/grub.cfg}}. See [[User:Eschwartz/Grub]] for a proposed draft.|section=Manually generate grub.cfg}}<br />
<br />
This section describes the manual creation of GRUB boot entries in {{ic|/boot/grub/grub.cfg}} instead of relying on ''grub-mkconfig''.<br />
<br />
A basic GRUB config file uses the following options:<br />
<br />
* {{ic|(hd''X'',''Y'')}} is the partition ''Y'' on disk ''X'', partition numbers starting at 1, disk numbers starting at 0<br />
* {{ic|1=set default=''N''}} is the default boot entry that is chosen after timeout for user action<br />
* {{ic|1=set timeout=''M''}} is the time ''M'' to wait in seconds for a user selection before default is booted<br />
* {{ic|<nowiki>menuentry "title" {entry options}</nowiki>}} is a boot entry titled {{ic|title}}<br />
* {{ic|1=set root=(hd''X'',''Y'')}} sets the boot partition, where the kernel and GRUB modules are stored (boot need not be a separate partition, and may simply be a directory under the "root" partition ({{ic|/}})<br />
<br />
==== Boot menu entry examples ====<br />
<br />
{{Tip|These boot entries can also be used when using a {{ic|/boot/grub/grub.cfg}} generated by ''grub-mkconfig''. Add them to {{ic|/etc/grub.d/40_custom}} and [[#Generate the main configuration file|re-generate the main configuration file]] or add them to {{ic|/boot/grub/custom.cfg}}.}}<br />
<br />
For tips on managing multiple GRUB entries, for example when using both {{Pkg|linux}} and {{Pkg|linux-lts}} kernels, see [[GRUB/Tips and tricks#Multiple entries]].<br />
<br />
For [[Archiso]] and [[Archboot]] boot menu entries see [[Multiboot USB drive#Boot entries]].<br />
<br />
===== GRUB commands =====<br />
<br />
====== "Shutdown" menu entry ======<br />
<br />
{{bc|<br />
menuentry "System shutdown" {<br />
echo "System shutting down..."<br />
halt<br />
}<br />
}}<br />
<br />
====== "Restart" menu entry ======<br />
<br />
{{bc|<br />
menuentry "System restart" {<br />
echo "System rebooting..."<br />
reboot<br />
}<br />
}}<br />
<br />
====== "Firmware setup" menu entry (UEFI only) ======<br />
<br />
{{bc|1=<br />
if [ ${grub_platform} == "efi" ]; then<br />
menuentry "Firmware setup" {<br />
fwsetup<br />
}<br />
fi<br />
}}<br />
<br />
===== EFI binaries =====<br />
<br />
When launched in UEFI mode, GRUB can chainload other EFI binaries.<br />
<br />
{{Tip|1=To show these menu entries only when GRUB is launched in UEFI mode, enclose them in the following {{ic|if}} statement:<br />
<br />
{{bc|1=<br />
if [ ${grub_platform} == "efi" ]; then<br />
''place UEFI-only menu entries here''<br />
fi<br />
}}<br />
<br />
}}<br />
<br />
====== UEFI Shell ======<br />
<br />
You can launch [[Unified Extensible Firmware Interface#UEFI Shell|UEFI Shell]] by using placing it in the root of the [[EFI system partition]] and adding this menu entry:<br />
<br />
{{bc|1=<br />
menuentry "UEFI Shell" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --file /shellx64.efi<br />
chainloader /shellx64.efi<br />
}<br />
}}<br />
<br />
====== gdisk ======<br />
<br />
Download the [[gdisk#gdisk EFI application|gdisk EFI application]] and copy {{ic|gdisk_x64.efi}} to {{ic|''esp''/EFI/tools/}}.<br />
<br />
{{bc|1=<br />
menuentry "gdisk" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --file /EFI/tools/gdisk_x64.efi<br />
chainloader /EFI/tools/gdisk_x64.efi<br />
}<br />
}}<br />
<br />
====== Chainloading an Arch Linux .efi file ======<br />
<br />
If you have an ''.efi'' file generated from following [[Secure Boot]] or other means, you can add it to the boot menu. For example:<br />
<br />
{{bc|1=<br />
menuentry "Arch Linux .efi" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --fs-uuid ''FILESYSTEM_UUID''<br />
chainloader /EFI/arch/vmlinuz.efi<br />
}<br />
}}<br />
<br />
===== Dual-booting =====<br />
<br />
====== GNU/Linux ======<br />
<br />
Assuming that the other distribution is on partition {{ic|sda2}}:<br />
<br />
{{bc|1=<br />
menuentry "Other Linux" {<br />
set root=(hd0,2)<br />
linux /boot/vmlinuz (add other options here as required)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
}<br />
}}<br />
<br />
Alternatively let GRUB search for the right partition by ''UUID'' or ''label'':<br />
<br />
{{bc|1=<br />
menuentry "Other Linux" {<br />
# assuming that UUID is 763A-9CB6<br />
search --no-floppy --set=root --fs-uuid 763A-9CB6<br />
<br />
# search by label OTHER_LINUX (make sure that partition label is unambiguous)<br />
#search --no-floppy --set=root --label OTHER_LINUX<br />
<br />
linux /boot/vmlinuz (add other options here as required, for example: root=UUID=763A-9CB6)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
}<br />
}}<br />
<br />
====== Windows installed in UEFI/GPT mode ======<br />
<br />
This mode determines where the Windows bootloader resides and chain-loads it after GRUB when the menu entry is selected. The main task here is finding the EFI system partition and running the bootloader from it.<br />
<br />
{{Note|This menuentry will work only in UEFI boot mode and only if the Windows bitness matches the UEFI bitness. It will not work in BIOS installed GRUB. See [[Dual boot with Windows#Windows UEFI vs BIOS limitations]] and [[Dual boot with Windows#Bootloader UEFI vs BIOS limitations]] for more information.}}<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "efi" ]; then<br />
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {<br />
insmod part_gpt<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid<br />
chainloader /EFI/Microsoft/Boot/bootmgfw.efi<br />
}<br />
fi<br />
}}<br />
<br />
where {{ic|$hints_string}} and {{ic|$fs_uuid}} are obtained with the following two commands. <br />
<br />
The {{ic|$fs_uuid}} command determines the UUID of the EFI system partition:<br />
<br />
{{hc|1=# grub-probe --target=fs_uuid ''esp''/EFI/Microsoft/Boot/bootmgfw.efi|2=<br />
1ce5-7f28<br />
}}<br />
<br />
Alternatively one can run {{ic|blkid}} (as root) and read the UUID of the EFI system partition from there.<br />
<br />
The {{ic|$hints_string}} command will determine the location of the EFI system partition, in this case harddrive 0:<br />
<br />
{{hc|1=# grub-probe --target=hints_string ''esp''/EFI/Microsoft/Boot/bootmgfw.efi|2=<br />
--hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1<br />
}}<br />
<br />
These two commands assume the ESP Windows uses is mounted at {{ic|''esp''}}. There might be case differences in the path to Windows's EFI file, what with being Windows, and all.<br />
<br />
====== Windows installed in BIOS/MBR mode ======<br />
<br />
{{Note|GRUB supports booting {{ic|bootmgr}} directly and [https://www.gnu.org/software/grub/manual/grub.html#Chain_002dloading chainloading] of partition boot sector is no longer required to boot Windows in a BIOS/MBR setup.}}<br />
<br />
{{Warning|It is the '''system partition''' that has {{ic|/bootmgr}}, not your "real" Windows partition (usually {{ic|C:}}). The system partition's [[Persistent block device naming#by-label|filesystem label]] is {{ic|System Reserved}} or {{ic|SYSTEM}} and the partition is only about 100 to 549 MiB in size. See [[Wikipedia:System partition and boot partition]] for more information.}}<br />
<br />
Throughout this section, it is assumed your Windows partition is {{ic|/dev/sda1}}. A different partition will change every instance of {{ic|hd0,msdos1}}.<br />
<br />
{{Note|These menu entries will work only in BIOS boot mode. It will not work in UEFI installed GRUB. See [[Dual boot with Windows#Windows UEFI vs BIOS limitations]] and [[Dual boot with Windows#Bootloader UEFI vs BIOS limitations]] .}}<br />
<br />
In both examples {{ic|''XXXXXXXXXXXXXXXX''}} is the filesystem UUID which can be found with command {{ic|lsblk --fs}}.<br />
<br />
For Windows Vista/7/8/8.1/10:<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "pc" ]; then<br />
menuentry "Microsoft Windows Vista/7/8/8.1/10 BIOS/MBR" {<br />
insmod part_msdos<br />
insmod ntfs<br />
insmod ntldr <br />
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ''XXXXXXXXXXXXXXXX''<br />
ntldr /bootmgr<br />
}<br />
fi<br />
}}<br />
<br />
For Windows XP:<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "pc" ]; then<br />
menuentry "Microsoft Windows XP" {<br />
insmod part_msdos<br />
insmod ntfs<br />
insmod ntldr <br />
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ''XXXXXXXXXXXXXXXX''<br />
ntldr /ntldr<br />
}<br />
fi<br />
}}<br />
<br />
{{Note|In some cases, GRUB may be installed without a clean Windows 8, in which case you cannot boot Windows without having an error with {{ic|\boot\bcd}} (error code {{ic|0xc000000f}}). You can fix it by going to Windows Recovery Console ({{ic|cmd.exe}} from install disk) and executing:<br />
<br />
X:\> bootrec.exe /fixboot<br />
X:\> bootrec.exe /RebuildBcd<br />
<br />
Do '''not''' use {{ic|bootrec.exe /Fixmbr}} because it will wipe GRUB out.<br />
Or you can use Boot Repair function in the Troubleshooting menu - it will not wipe out GRUB but will fix most errors.<br />
Also you would better keep plugged in both the target hard drive and your bootable device '''ONLY'''. Windows usually fails to repair boot information if any other devices are connected.<br />
}}<br />
<br />
== Using the command shell ==<br />
<br />
Since the MBR is too small to store all GRUB modules, only the menu and a few basic commands reside there. The majority of GRUB functionality remains in modules in {{ic|/boot/grub/}}, which are inserted as needed. In error conditions (e.g. if the partition layout changes) GRUB may fail to boot. When this happens, a command shell may appear.<br />
<br />
GRUB offers multiple shells/prompts. If there is a problem reading the menu but the bootloader is able to find the disk, you will likely be dropped to the "normal" shell:<br />
<br />
grub><br />
<br />
If there is a more serious problem (e.g. GRUB cannot find required files), you may instead be dropped to the "rescue" shell:<br />
<br />
grub rescue><br />
<br />
The rescue shell is a restricted subset of the normal shell, offering much less functionality. If dumped to the rescue shell, first try inserting the "normal" module, then starting the "normal" shell:<br />
<br />
grub rescue> set prefix=(hdX,Y)/boot/grub<br />
grub rescue> insmod (hdX,Y)/boot/grub/i386-pc/normal.mod<br />
rescue:grub> normal<br />
<br />
=== Pager support ===<br />
<br />
GRUB supports pager for reading commands that provide long output (like the {{ic|help}} command). This works only in normal shell mode and not in rescue mode. To enable pager, in GRUB command shell type:<br />
<br />
sh:grub> set pager=1<br />
<br />
=== Using the command shell environment to boot operating systems ===<br />
<br />
grub><br />
<br />
The GRUB's command shell environment can be used to boot operating systems.<br />
A common scenario may be to boot Windows / Linux stored on a drive/partition via '''chainloading'''.<br />
<br />
''Chainloading'' means to load another boot-loader from the current one, ie, chain-loading.<br />
<br />
The other bootloader may be embedded at the start of a partitioned disk (MBR), at the start of a partition or a partitionless disk (VBR), or as an EFI binary in the case of UEFI.<br />
<br />
==== Chainloading a partition's VBR ====<br />
<br />
set root=(hdX,Y)<br />
chainloader +1<br />
boot<br />
<br />
X=0,1,2...<br />
Y=1,2,3...<br />
<br />
For example to chainload Windows stored in the first partition of the first hard disk,<br />
<br />
set root=(hd0,1)<br />
chainloader +1<br />
boot<br />
<br />
Similarly GRUB installed to a partition can be chainloaded.<br />
<br />
==== Chainloading a disk's MBR or a partitionless disk's VBR ====<br />
<br />
set root=hdX<br />
chainloader +1<br />
boot<br />
<br />
==== Chainloading Windows/Linux installed in UEFI mode ====<br />
<br />
insmod fat<br />
set root=(hd0,gpt4)<br />
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi<br />
boot<br />
<br />
{{ic|insmod fat}} is used for loading the FAT file system module for accessing the Windows bootloader on the EFI system partition.<br />
{{ic|(hd0,gpt4)}} or {{ic|/dev/sda4}} is the EFI system partition in this example.<br />
The entry in the {{ic|chainloader}} line specifies the path of the ''.efi'' file to be chain-loaded.<br />
<br />
==== Normal loading ====<br />
<br />
See the examples in [[#Using the rescue console]]<br />
<br />
=== Using the rescue console ===<br />
<br />
See [[#Using the command shell]] first. If unable to activate the standard shell, one possible solution is to boot using a live CD or some other rescue disk to correct configuration errors and reinstall GRUB. However, such a boot disk is not always available (nor necessary); the rescue console is surprisingly robust.<br />
<br />
The available commands in GRUB rescue include {{ic|insmod}}, {{ic|ls}}, {{ic|set}}, and {{ic|unset}}. This example uses {{ic|set}} and {{ic|insmod}}. {{ic|set}} modifies variables and {{ic|insmod}} inserts new modules to add functionality.<br />
<br />
Before starting, the user must know the location of their {{ic|/boot}} partition (be it a separate partition, or a subdirectory under their root):<br />
<br />
grub rescue> set prefix=(hdX,Y)/boot/grub<br />
<br />
where X is the physical drive number and Y is the partition number.<br />
<br />
{{Note|With a separate boot partition, omit {{ic|/boot}} from the path (i.e. type {{ic|1=set prefix=(hdX,Y)/grub}}).}}<br />
<br />
To expand console capabilities, insert the {{ic|linux}} module:<br />
<br />
grub rescue> insmod i386-pc/linux.mod<br />
<br />
or simply<br />
<br />
grub rescue> insmod linux<br />
<br />
This introduces the {{ic|linux}} and {{ic|initrd}} commands, which should be familiar.<br />
<br />
An example, booting Arch Linux:<br />
<br />
set root=(hd0,5)<br />
linux /boot/vmlinuz-linux root=/dev/sda5<br />
initrd /boot/initramfs-linux.img<br />
boot<br />
<br />
With a separate boot partition (e.g. when using UEFI), again change the lines accordingly: <br />
<br />
{{Note|Since boot is a separate partition and not part of your root partition, you must address the boot partition manually, in the same way as for the prefix variable.}}<br />
<br />
set root=(hd0,5)<br />
linux (hdX,Y)/vmlinuz-linux root=/dev/sda6<br />
initrd (hdX,Y)/initramfs-linux.img<br />
boot<br />
<br />
{{Note|If you experienced {{ic|error: premature end of file /YOUR_KERNEL_NAME}} during execution of {{ic|linux}} command, you can try {{ic|linux16}} instead.}}<br />
<br />
After successfully booting the Arch Linux installation, users can correct {{ic|grub.cfg}} as needed and then reinstall GRUB.<br />
<br />
To reinstall GRUB and fix the problem completely, changing {{ic|/dev/sda}} if needed. See [[#Installation]] for details.<br />
<br />
== Troubleshooting ==<br />
<br />
=== F2FS and other unsupported file systems ===<br />
<br />
GRUB does not support [[F2FS]] file system. In case the root partition is on an unsupported file system, an alternative {{ic|/boot}} partition with a supported file system must be created. In some cases, the development version of GRUB {{aur|grub-git}} may have native support for the file system.<br />
<br />
If GRUB is used with an unsupported filesystem it is not able to extract the [[UUID]] of your drive so it uses classic non-persistent {{ic|/dev/''sdXx''}} names instead. In this case you might have to manually edit {{ic|/boot/grub/grub.cfg}} and replace {{ic|1=root=/dev/''sdXx''}} with {{ic|1=root=UUID=''XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX''}}. You can use the {{ic|blkid}} command to get the UUID of your device, see [[Persistent block device naming]].<br />
<br />
=== Intel BIOS not booting GPT ===<br />
<br />
Some Intel BIOS's require at least one bootable MBR partition to be present at boot, causing GPT-partitioned boot setups to be unbootable.<br />
<br />
This can be circumvented by using (for instance) fdisk to mark one of the GPT partitions (preferably the 1007 KiB partition you have created for GRUB already) bootable in the MBR. This can be achieved, using fdisk, by the following commands: Start fdisk against the disk you are installing, for instance {{ic|fdisk /dev/sda}}, then press {{ic|a}} and select the partition you wish to mark as bootable (probably #1) by pressing the corresponding number, finally press {{ic|w}} to write the changes to the MBR.<br />
<br />
{{Note|The bootable-marking must be done in {{ic|fdisk}} or similar, not in GParted or others, as they will not set the bootable flag in the MBR.}}<br />
<br />
With cfdisk, the steps are similar, just {{ic|cfdisk /dev/sda}}, choose bootable (at the left) in the desired hard disk, and quit saving.<br />
<br />
With recent version of parted, you can use {{ic|disk_toggle pmbr_boot}} option. Afterwards verify that Disk Flags show pmbr_boot.<br />
<br />
# parted /dev/sd''x'' disk_toggle pmbr_boot<br />
# parted /dev/sd''x'' print<br />
<br />
More information is available [http://www.rodsbooks.com/gdisk/bios.html here]<br />
<br />
=== Enable debug messages ===<br />
<br />
{{Note|This change is overwritten when [[#Generate the main configuration file]].}}<br />
<br />
Add:<br />
<br />
set pager=1<br />
set debug=all<br />
<br />
to {{ic|grub.cfg}}.<br />
<br />
=== "No suitable mode found" error ===<br />
<br />
If you get this error when booting any menuentry:<br />
<br />
error: no suitable mode found<br />
Booting however<br />
<br />
Then you need to initialize GRUB graphical terminal ({{ic|gfxterm}}) with proper video mode ({{ic|gfxmode}}) in GRUB. This video mode is passed by GRUB to the linux kernel via 'gfxpayload'. In case of UEFI systems, if the GRUB video mode is not initialized, no kernel boot messages will be shown in the terminal (atleast until KMS kicks in).<br />
<br />
{{Remove|''grub-install'' copies {{ic|unicode.pf2}} to {{ic|/boot/grub/fonts/}}, there is no need to do it manually.}}<br />
<br />
Copy {{ic|/usr/share/grub/unicode.pf2}} to {{ic|${GRUB_PREFIX_DIR}}} ({{ic|/boot/grub/}} in case of BIOS and UEFI systems). If GRUB UEFI was installed with {{ic|1=--boot-directory=''esp''/EFI}} set, then the directory is {{ic|''esp''/EFI/grub/}}:<br />
<br />
# cp /usr/share/grub/unicode.pf2 ${GRUB_PREFIX_DIR}<br />
<br />
If {{ic|/usr/share/grub/unicode.pf2}} does not exist, install {{Pkg|bdf-unifont}}, create the {{ic|unifont.pf2}} file and then copy it to {{ic|1=${GRUB_PREFIX_DIR}}}:<br />
<br />
# grub-mkfont -o unicode.pf2 /usr/share/fonts/misc/unifont.bdf<br />
<br />
Then, in the {{ic|grub.cfg}} file, add the following lines to enable GRUB to pass the video mode correctly to the kernel, without of which you will only get a black screen (no output) but booting (actually) proceeds successfully without any system hang.<br />
<br />
After that add the following code (common to both BIOS and UEFI):<br />
<br />
{{bc|1=<br />
loadfont "unicode"<br />
set gfxmode=auto<br />
set gfxpayload=keep<br />
insmod all_video<br />
insmod gfxterm<br />
terminal_output gfxterm<br />
}}<br />
<br />
=== msdos-style error message ===<br />
<br />
grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding will not be possible!<br />
grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.<br />
However, blocklists are UNRELIABLE and its use is discouraged.<br />
grub-setup: error: If you really want blocklists, use --force.<br />
<br />
This error may occur when you try installing GRUB in a VMware container. Read more about it [https://bbs.archlinux.org/viewtopic.php?pid=581760#p581760 here]. It happens when the first partition starts just after the MBR (block 63), without the usual space of 1 MiB (2048 blocks) before the first partition. Read [[#Master Boot Record (MBR) specific instructions]]<br />
<br />
=== UEFI ===<br />
<br />
==== Common installation errors ====<br />
<br />
* If you have a problem when running ''grub-install'' with ''sysfs'' or ''procfs'' and it says you must run {{ic|modprobe efivars}}, try [[Unified Extensible Firmware Interface#Mount efivarfs]].<br />
* Without {{ic|--target}} or {{ic|--directory}} option, grub-install cannot determine for which firmware to install. In such cases {{ic|grub-install}} will print {{ic|source_dir does not exist. Please specify --target or --directory}}.<br />
* If after running grub-install you are told your partition does not look like an EFI partition then the partition is most likely not {{ic|Fat32}}.<br />
<br />
==== Drop to rescue shell ====<br />
<br />
If GRUB loads but drops into the rescue shell with no errors, it can be due to one of these two reasons:<br />
<br />
* It may be because of a missing or misplaced {{ic|grub.cfg}}. This will happen if GRUB UEFI was installed with {{ic|--boot-directory}} and {{ic|grub.cfg}} is missing,<br />
* It also happens if the boot partition, which is hardcoded into the {{ic|grubx64.efi}} file, has changed.<br />
<br />
==== GRUB UEFI not loaded ====<br />
<br />
An example of a working UEFI:<br />
<br />
{{hc|# efibootmgr -v|<br />
BootCurrent: 0000<br />
Timeout: 3 seconds<br />
BootOrder: 0000,0001,0002<br />
Boot0000* GRUB HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\EFI\GRUB\grubx64.efi)<br />
Boot0001* Shell HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\shellx64.efi)<br />
Boot0002* Festplatte BIOS(2,0,00)P0: SAMSUNG HD204UI<br />
}}<br />
<br />
If the screen only goes black for a second and the next boot option is tried afterwards, according to [https://bbs.archlinux.org/viewtopic.php?pid=981560#p981560 this post], moving GRUB to the partition root can help. The boot option has to be deleted and recreated afterwards. The entry for GRUB should look like this then:<br />
<br />
Boot0000* GRUB HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\grubx64.efi)<br />
<br />
==== Default/fallback boot path ====<br />
<br />
Some UEFI firmwares require a bootable file at a known location before they will show UEFI NVRAM boot entries. If this is the case, {{ic|grub-install}} will claim {{ic|efibootmgr}} has added an entry to boot GRUB, however the entry will not show up in the VisualBIOS boot order selector. The solution is to install GRUB at the default/fallback boot path:<br />
<br />
# grub-install --target=x86_64-efi --efi-directory=''esp'' '''--removable'''<br />
<br />
Alternatively you can move an already installed GRUB EFI executable to the default/fallback path:<br />
<br />
# mv ''esp''/EFI/grub ''esp''/EFI/BOOT<br />
# mv ''esp''/EFI/BOOT/grubx64.efi ''esp''/EFI/BOOT/BOOTX64.EFI<br />
<br />
=== Invalid signature ===<br />
<br />
If trying to boot Windows results in an "invalid signature" error, e.g. after reconfiguring partitions or adding additional hard drives, (re)move GRUB's device configuration and let it reconfigure:<br />
<br />
# mv /boot/grub/device.map /boot/grub/device.map-old<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
{{ic|grub-mkconfig}} should now mention all found boot options, including Windows. If it works, remove {{ic|/boot/grub/device.map-old}}.<br />
<br />
=== Boot freezes ===<br />
<br />
If booting gets stuck without any error message after GRUB loading the kernel and the initial ramdisk, try removing the {{ic|add_efi_memmap}} kernel parameter.<br />
<br />
=== Arch not found from other OS ===<br />
<br />
Some have reported that other distributions may have trouble finding Arch Linux automatically with {{ic|os-prober}}. If this problem arises, it has been reported that detection can be improved with the presence of {{ic|/etc/lsb-release}}. This file and updating tool is available with the package {{Pkg|lsb-release}}.<br />
<br />
=== Warning when installing in chroot ===<br />
<br />
When installing GRUB on a LVM system in a chroot environment (e.g. during system installation), you may receive warnings like<br />
<br />
/run/lvm/lvmetad.socket: connect failed: No such file or directory<br />
<br />
or<br />
<br />
WARNING: failed to connect to lvmetad: No such file or directory. Falling back to internal scanning.<br />
<br />
This is because {{ic|/run}} is not available inside the chroot. These warnings will not prevent the system from booting, provided that everything has been done correctly, so you may continue with the installation.<br />
<br />
=== GRUB loads slowly ===<br />
<br />
GRUB can take a long time to load when disk space is low. Check if you have sufficient free disk space on your {{ic|/boot}} or {{ic|/}} partition when you are having problems.<br />
<br />
=== error: unknown filesystem ===<br />
<br />
GRUB may output {{ic|error: unknown filesystem}} and refuse to boot for a few reasons. If you are certain that all [[UUID]]s are correct and all filesystems are valid and supported, it may be because your [[#GUID Partition Table (GPT) specific instructions|BIOS Boot Partition]] is located outside the first 2 TiB of the drive [https://bbs.archlinux.org/viewtopic.php?id=195948]. Use a partitioning tool of your choice to ensure this partition is located fully within the first 2 TiB, then reinstall and reconfigure GRUB.<br />
<br />
=== grub-reboot not resetting ===<br />
<br />
GRUB seems to be unable to write to root BTRFS partitions [https://bbs.archlinux.org/viewtopic.php?id=166131]. If you use grub-reboot to boot into another entry it will therefore be unable to update its on-disk environment. Either run grub-reboot from the other entry (for example when switching between various distributions) or consider a different file system. You can reset a "sticky" entry by executing {{ic|grub-editenv create}} and setting {{ic|1=GRUB_DEFAULT=0}} in your {{ic|/etc/default/grub}} (do not forget {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}).<br />
<br />
=== Old BTRFS prevents installation ===<br />
<br />
If a drive is formatted with BTRFS without creating a partition table (eg. /dev/sdx), then later has partition table written to, there are parts of the BTRFS format that persist. Most utilities and OS's do not see this, but GRUB will refuse to install, even with --force<br />
<br />
# grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..<br />
# grub-install: error: filesystem `btrfs' does not support blocklists.<br />
<br />
You can zero the drive, but the easy solution that leaves your data alone is to erase the BTRFS superblock with {{ic|wipefs -o 0x10040 /dev/sdx}}<br />
<br />
=== Windows 8/10 not found ===<br />
<br />
A setting in Windows 8/10 called "Hiberboot", "Hybrid Boot" or "Fast Boot" can prevent the Windows partition from being mounted, so {{ic|grub-mkconfig}} will not find a Windows install. Disabling Hiberboot in Windows will allow it to be added to the GRUB menu.<br />
<br />
=== VirtualBox EFI mode ===<br />
<br />
Install GRUB to the [[#Default/fallback boot path|default/fallback boot path]].<br />
<br />
See also [[VirtualBox#Installation in EFI mode]].<br />
<br />
=== Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds ===<br />
<br />
If grub-mkconfig hangs and gives error: {{ic|WARNING: Device /dev/''xxx'' not initialized in udev database even after waiting 10000000 microseconds}}.<br />
<br />
You may need to provide {{ic|/run/lvm/}} access to the chroot environment using:<br />
<br />
# mkdir /mnt/hostlvm<br />
# mount --bind /run/lvm /mnt/hostlvm<br />
# arch-chroot /mnt<br />
# ln -s /hostlvm /run/lvm<br />
<br />
See {{Bug|61040}} and [https://bbs.archlinux.org/viewtopic.php?pid=1820949#p1820949 workaround].<br />
<br />
<br />
=== GRUB configuration file not updating with ALPM hook when grub boot directory not set to /boot ===<br />
<br />
If your GRUB installation not using ''/boot'' as boot directory (e.g. you put it to efi partition) it is possible, that [[pacman#Hooks|ALPM hook]] will not update ''grub.cfg'' when it will be requested by pacman (e.g. when installing new kernel or updating initramfs). Reason: update-grub only updates files in ''/boot'' directory.<br />
<br />
To solve this problem you may create '''symlink''' in ''/boot'' to directory, that contains ''grub.cfg'' file. For example, if you gave --boot-directory=/boot/efi/EFI/grub argument to grub-install, then you need to execute this:<br />
{{bc|<nowiki># ln -s /boot/efi/EFI/grub /boot/grub</nowiki>}}<br />
<br />
<br />
Or you may alter ''99-grub.hook'' [[pacman#Hooks|ALPM hook]]:<br />
<br />
Open it with nano editor:<br />
{{bc|<nowiki># nano /usr/share/libalpm/hooks/99-grub.hook</nowiki>}}<br />
<br />
It originally looks like this:<br />
{{bc|<nowiki>[Trigger]<br />
Type = File<br />
Operation = Install<br />
Operation = Upgrade<br />
Operation = Remove<br />
Target = boot/vmlinuz-*<br />
<br />
[Action]<br />
Description = Updating Grub-Bootmenu<br />
When = PostTransaction<br />
Exec = update-grub</nowiki>}}<br />
<br />
You need to change '''Exec''' parameter in '''Action''' section to this:<br />
<br />
{{bc|<nowiki>Exec = grub-mkconfig -o <path_to_your_grub_directory></nowiki>}}<br />
<br />
== See also ==<br />
<br />
* [[Wikipedia:GNU GRUB]]<br />
* [https://www.gnu.org/software/grub/manual/grub.html Official GRUB Manual]<br />
* [https://help.ubuntu.com/community/Grub2 Ubuntu wiki page for GRUB]<br />
* [https://help.ubuntu.com/community/UEFIBooting GRUB wiki page describing steps to compile for UEFI systems]<br />
* [[Wikipedia:BIOS Boot partition]]<br />
* [http://web.archive.org/web/20160424042444/http://members.iinet.net/~herman546/p20/GRUB2%20Configuration%20File%20Commands.html#Editing_etcgrub.d05_debian_theme How to configure GRUB]<br />
* [http://www.linuxjournal.com/article/4622 Boot with GRUB]</div>Niasarhttps://wiki.archlinux.org/index.php?title=GRUB&diff=569018GRUB2019-03-17T20:03:47Z<p>Niasar: Added info about issue when grub-update, launched by pacman hook, when updating initramfs or installing new kernel, not updating grub.cfg if grub is not configured to use /boot for grub directory.</p>
<hr />
<div>[[Category:Boot loaders]]<br />
[[Category:GNU]]<br />
[[ar:GRUB]]<br />
[[cs:GRUB]]<br />
[[de:GRUB]]<br />
[[el:GRUB]]<br />
[[es:GRUB]]<br />
[[fa:گراب]]<br />
[[fr:GRUB]]<br />
[[he:GRUB]]<br />
[[id:GRUB]]<br />
[[it:GRUB]]<br />
[[ja:GRUB]]<br />
[[nl:GRUB]]<br />
[[pt:GRUB]]<br />
[[ru:GRUB]]<br />
[[zh-hans:GRUB]]<br />
[[zh-hant:GRUB]]<br />
{{Related articles start}}<br />
{{Related|Arch boot process}}<br />
{{Related|Master Boot Record}}<br />
{{Related|GUID Partition Table}}<br />
{{Related|Unified Extensible Firmware Interface}}<br />
{{Related|GRUB Legacy}}<br />
{{Related|GRUB/EFI examples}}<br />
{{Related|GRUB/Tips and tricks}}<br />
{{Related|Multiboot USB drive}}<br />
{{Related articles end}}<br />
[https://www.gnu.org/software/grub/ GRUB] (GRand Unified Bootloader) is a [[Boot loader|multi-boot loader]]. It is derived from [http://www.nongnu.org/pupa/ PUPA] which was a research project to develop the replacement of what is now known as [[GRUB Legacy]]. The latter had become too difficult to maintain and GRUB was rewritten from scratch with the aim to provide modularity and portability [https://www.gnu.org/software/grub/grub-faq.html#q1]. The current GRUB is also referred to as GRUB 2 while GRUB Legacy corresponds to versions 0.9x.<br />
<br />
{{Note|In the entire article {{ic|''esp''}} denotes the mountpoint of the [[EFI system partition]] aka ESP.}}<br />
<br />
== BIOS systems ==<br />
<br />
=== GUID Partition Table (GPT) specific instructions ===<br />
<br />
On a BIOS/[[GPT]] configuration, a [https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html#BIOS-installation BIOS boot partition] is required. GRUB embeds its {{ic|core.img}} into this partition.<br />
<br />
{{Note|<br />
* Before attempting this method keep in mind that not all systems will be able to support this partitioning scheme. Read more on [[Partitioning#GUID Partition Table]].<br />
* The BIOS boot partition is only needed by GRUB on a BIOS/GPT setup. On a BIOS/MBR setup, GRUB uses the post-MBR gap for the embedding the {{ic|core.img}}. On GPT, however, there is no guaranteed unused space before the first partition.<br />
* For [[UEFI]] systems this extra partition is not required, since no embedding of boot sectors takes place in that case. However, UEFI systems still require an [[EFI system partition]].<br />
}}<br />
<br />
Create a mebibyte partition ({{ic|1=+1M}} with ''fdisk'' or ''gdisk'') on the disk with no file system and with partition type GUID {{ic|21686148-6449-6E6F-744E-656564454649}}.<br />
<br />
* Select partition type {{ic|BIOS boot}} for [[fdisk]].<br />
* Select partition type code {{ic|ef02}} for [[gdisk]].<br />
* For [[parted]] set/activate the flag {{ic|bios_grub}} on the partition.<br />
<br />
This partition can be in any position order but has to be on the first 2 TiB of the disk. This partition needs to be created before GRUB installation. When the partition is ready, install the bootloader as per the instructions below.<br />
<br />
The space before the first partition can also be used as the BIOS boot partition though it will be out of GPT alignment specification. Since the partition will not be regularly accessed performance issues can be disregarded, though some disk utilities will display a warning about it. In ''fdisk'' or ''gdisk'' create a new partition starting at sector 34 and spanning to 2047 and set the type. To have the viewable partitions begin at the base consider adding this partition last.<br />
<br />
=== Master Boot Record (MBR) specific instructions ===<br />
<br />
Usually the post-MBR gap (after the 512 byte [[MBR]] region and before the start of the first partition) in many MBR partitioned systems is 31 KiB when DOS compatibility cylinder alignment issues are satisfied in the partition table. However a post-MBR gap of about 1 to 2 MiB is recommended to provide sufficient room for embedding GRUB's {{ic|core.img}} ({{Bug|24103}}). It is advisable to use a partitioning tool that supports 1 MiB [[Partitioning#Partition alignment|partition alignment]] to obtain this space as well as to satisfy other non-512-byte-sector issues (which are unrelated to embedding of {{ic|core.img}}).<br />
<br />
=== Installation ===<br />
<br />
[[Install]] the {{Pkg|grub}} package. (It will replace {{AUR|grub-legacy}} if that is already installed.) Then do:<br />
<br />
# grub-install --target=i386-pc /dev/sd'''X'''<br />
<br />
where {{ic|/dev/sd'''X'''}} is the disk where GRUB is to be installed (for example, disk {{ic|/dev/sda}} and '''not''' partition {{ic|/dev/sda1}}).<br />
<br />
Now you must [[#Generate the main configuration file]].<br />
<br />
If you use [[LVM]] for your {{ic|/boot}}, you can install GRUB on multiple physical disks.<br />
<br />
{{Tip|See [[GRUB/Tips and tricks#Alternative installation methods]] for other ways to install GRUB, such as to a USB stick.}}<br />
<br />
See {{man|8|grub-install}} and [https://www.gnu.org/software/grub/manual/grub/html_node/BIOS-installation.html#BIOS-installation GRUB Manual] for more details on the ''grub-install'' command.<br />
<br />
== UEFI systems ==<br />
<br />
{{Note|<br />
* It is recommended to read and understand the [[Unified Extensible Firmware Interface]], [[Partitioning#GUID Partition Table]] and [[Arch boot process#Under UEFI]] pages.<br />
* When installing to use UEFI it is important to boot the installation media in UEFI mode, otherwise ''efibootmgr'' will not be able to add the GRUB UEFI boot entry. Installing to the [[#Default/fallback boot path|fallback boot path]] will still work even in BIOS mode since it does not touch the NVRAM.<br />
* To boot from a disk using UEFI, an EFI system partition is required. Follow [[EFI system partition#Check for an existing partition]] to find out if you have one already, otherwise you need to create it.<br />
}}<br />
<br />
=== Installation ===<br />
<br />
{{Note|<br />
* UEFI firmwares are not implemented consistently across manufacturers. The procedure described below is intended to work on a wide range of UEFI systems but those experiencing problems despite applying this method are encouraged to share detailed information, and if possible the turnarounds found, for their hardware-specific case. A [[GRUB/EFI examples]] article has been provided for such cases.<br />
* The section assumes you are installing GRUB for x86_64 systems. For IA32 (32-bit) UEFI systems (not to be confused with 32-bit CPUs), replace {{ic|x86_64-efi}} with {{ic|i386-efi}} where appropriate.<br />
}}<br />
<br />
First, [[install]] the packages {{Pkg|grub}} and {{Pkg|efibootmgr}}: ''GRUB'' is the bootloader while ''efibootmgr'' is used by the GRUB installation script to write boot entries to NVRAM.<br />
<br />
Then follow the below steps to install GRUB:<br />
<br />
# [[EFI system partition#Mount the partition|Mount the EFI system partition]] and in the remainder of this section, substitute {{ic|''esp''}} with its mount point.<br />
# Choose a bootloader identifier, here named {{ic|GRUB}}. A directory of that name will be created in {{ic|''esp''/EFI/}} to store the EFI binary and this is the name that will appear in the UEFI boot menu to identify the GRUB boot entry.<br />
# Execute the following command to install the GRUB EFI application {{ic|grubx64.efi}} to {{ic|''esp''/EFI/GRUB/}} and install its modules to {{ic|/boot/grub/x86_64-efi/}}.<br />
<br />
# grub-install --target=x86_64-efi --efi-directory=''esp'' --bootloader-id=GRUB<br />
<br />
After the above install completed the main GRUB directory is located at {{ic|/boot/grub/}}. Note that {{ic|grub-install}} also tries to [[GRUB/Tips and tricks#Create a GRUB entry in the firmware boot manager|create an entry in the firmware boot manager]], named {{ic|GRUB}} in the above example.<br />
<br />
Remember to [[#Generate the main configuration file]] after finalizing the configuration.<br />
<br />
{{Tip|If you use the option {{ic|--removable}} then GRUB will be installed to {{ic|''esp''/EFI/BOOT/BOOTX64.EFI}} (or {{ic|''esp''/EFI/BOOT/BOOTIA32.EFI}} for the {{ic|i386-efi}} target) and you will have the additional ability of being able to boot from the drive in case EFI variables are reset or you move the drive to another computer. Usually you can do this by selecting the drive itself similar to how you would using BIOS. If dual booting with Windows, be aware Windows usually places an EFI executable there, but its only purpose is to recreate the UEFI boot entry for Windows.}}<br />
<br />
{{Note|<br />
* {{ic|--efi-directory}} and {{ic|--bootloader-id}} are specific to GRUB UEFI, {{ic|--efi-directory}} replaces {{ic|--root-directory}} which is deprecated. <br />
* You might note the absence of a ''device_path'' option (e.g.: {{ic|/dev/sda}}) in the {{ic|grub-install}} command. In fact any ''device_path'' provided will be ignored by the GRUB UEFI install script. Indeed, UEFI bootloaders do not use a MBR bootcode or partition boot sector at all.<br />
}}<br />
<br />
See [[#UEFI|UEFI troubleshooting]] in case of problems. Additionally see [[GRUB/Tips and tricks#UEFI further reading]].<br />
<br />
== Configuration ==<br />
<br />
On an installed system, GRUB loads the {{ic|/boot/grub/grub.cfg}} configuration file each boot. You can follow [[#Generated grub.cfg]] for using a tool, or [[#Custom grub.cfg]] for a manual creation.<br />
<br />
=== Generated grub.cfg ===<br />
<br />
This section only covers editing the {{ic|/etc/default/grub}} configuration file. See [[GRUB/Tips and tricks]] for more information.<br />
<br />
Remember to always [[#Generate the main configuration file]] after making changes to {{ic|/etc/default/grub}} and/or files in {{ic|/etc/grub.d/}}.<br />
<br />
==== Generate the main configuration file ====<br />
<br />
After the installation, the main configuration file {{ic|/boot/grub/grub.cfg}} needs to be generated. The generation process can be influenced by a variety of options in {{ic|/etc/default/grub}} and scripts in {{ic|/etc/grub.d/}}. <br />
<br />
If you have not done additional configuration, the automatic generation will determine the root filesystem of the system to boot for the configuration file. For that to succeed it is important that the system is either booted or chrooted into. <br />
<br />
{{Note|<br />
* Remember that {{ic|/boot/grub/grub.cfg}} has to be re-generated after any change to {{ic|/etc/default/grub}} or files in {{ic|/etc/grub.d/}}.<br />
* The default file path is {{ic|/boot/grub/grub.cfg}}, not {{ic|/boot/grub/i386-pc/grub.cfg}}.<br />
* If you are trying to run ''grub-mkconfig'' in a chroot or ''systemd-nspawn'' container, you might notice that it does not work, complaining that ''grub-probe'' cannot get the "canonical path of /dev/sdaX". In this case, try using ''arch-chroot'' as described in the [https://bbs.archlinux.org/viewtopic.php?pid&#61;1225067#p1225067 BBS post].<br />
* If you are installing GRUB in chroot environment using LVM and the {{ic|grub-mkconfig}} hangs indefinitely, see [[#Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds]].<br />
}}<br />
<br />
Use the ''grub-mkconfig'' tool to generate {{ic|/boot/grub/grub.cfg}}:<br />
<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
By default the generation scripts automatically add menu entries for all installed Arch Linux [[kernel]]s to the generated configuration.<br />
<br />
{{Tip|<br />
* After installing or removing a [[kernel]], you just need to re-run the above ''grub-mkconfig'' command.<br />
* For tips on managing multiple GRUB entries, for example when using both {{Pkg|linux}} and {{Pkg|linux-lts}} kernels, see [[GRUB/Tips and tricks#Multiple entries]].<br />
}}<br />
<br />
To automatically add entries for other installed operating systems, see [[#Detecting other operating systems]]. <br />
<br />
You can add additional custom menu entries by editing {{ic|/etc/grub.d/40_custom}} and re-generating {{ic|/boot/grub/grub.cfg}}. Or you can create {{ic|/boot/grub/custom.cfg}} and add them there. Changes to {{ic|/boot/grub/custom.cfg}} do not require re-running ''grub-mkconfig'', since {{ic|/etc/grub.d/40_custom}} adds the necessary {{ic|source}} statement to the generated configuration file.<br />
<br />
{{Tip|{{ic|/etc/grub.d/40_custom}} can be used as a template to create {{ic|/etc/grub.d/''nn''_custom}}, where {{ic|''nn''}} defines the precedence, indicating the order the script is executed. The order scripts are executed determine the placement in the GRUB boot menu. {{ic|''nn''}} should be greater than {{ic|06}} to ensure necessary scripts are executed first.}}<br />
<br />
See [[#Boot menu entry examples]] for custom menu entry examples.<br />
<br />
==== Detecting other operating systems ====<br />
<br />
To have ''grub-mkconfig'' search for other installed systems and automatically add them to the menu, [[install]] the {{Pkg|os-prober}} package and [[mount]] the partitions that contain the other systems. Then re-run ''grub-mkconfig''.<br />
<br />
===== MS Windows =====<br />
<br />
Often, partitions containing Windows will be automatically discovered by {{Pkg|os-prober}}. However, NTFS partitions may not always be detected when mounted with the default Linux drivers. If GRUB is not detecting it, try installing {{Pkg|ntfs-3g}} and remounting.<br />
<br />
Encrypted Windows partitions may need to be decrypted before mounting. For BitLocker, this can be done with {{AUR|dislocker}}. This should be sufficient for {{Pkg|os-prober}} to add the correct entry.<br />
<br />
==== Additional arguments ====<br />
<br />
To pass custom additional arguments to the Linux image, you can set the {{ic|GRUB_CMDLINE_LINUX}} + {{ic|GRUB_CMDLINE_LINUX_DEFAULT}} variables in {{ic|/etc/default/grub}}. The two are appended to each other and passed to kernel when generating regular boot entries. For the ''recovery'' boot entry, only {{ic|GRUB_CMDLINE_LINUX}} is used in the generation.<br />
<br />
It is not necessary to use both, but can be useful. For example, you could use {{ic|1=GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=''uuid-of-swap-partition'' quiet"}} where {{ic|''uuid-of-swap-partition''}} is the [[UUID]] of your swap partition to enable resume after [[hibernation]]. This would generate a recovery boot entry without the resume and without {{ic|quiet}} suppressing kernel messages during a boot from that menu entry. Though, the other (regular) menu entries would have them as options.<br />
<br />
By default ''grub-mkconfig'' determines the [[UUID]] of the root filesystem for the configuration. To disable this, uncomment {{ic|1=GRUB_DISABLE_LINUX_UUID=true}}. <br />
<br />
For generating the GRUB recovery entry you have to ensure that {{ic|GRUB_DISABLE_RECOVERY}} is not set to {{ic|true}} in {{ic|/etc/default/grub}}.<br />
<br />
See [[Kernel parameters]] for more info.<br />
<br />
==== LVM ====<br />
<br />
{{Merge|#Installation|grub-mkconfig is capable of detecting that it needs the {{ic|lvm}} module, specifying it in {{ic|GRUB_PRELOAD_MODULES}} is not required. Move warning to [[#Installation]] & [[#Installation_2]] or create a [[Help:Style#"Known issues" section|Known issues section]] and document it there.}}<br />
<br />
{{Warning|GRUB does not support thin-provisioned logical volumes.}}<br />
<br />
If you use [[LVM]] for your {{ic|/boot}} or {{ic|/}} root partition, make sure that the {{ic|lvm}} module is preloaded:<br />
<br />
{{hc|/etc/default/grub|2=<br />
GRUB_PRELOAD_MODULES="... lvm"<br />
}}<br />
<br />
==== RAID ====<br />
<br />
{{Merge|#Installation|grub-mkconfig is capable of detecting that it needs the {{ic|mdraid09}} and/or {{ic|mdraid1x}} modules, specifying them in {{ic|GRUB_PRELOAD_MODULES}} is not required. Summarize the double grub-install in a note and move it to [[#Installation]]; move {{ic|set root}} stuff to [[#Custom grub.cfg]].}}<br />
<br />
GRUB provides convenient handling of [[RAID]] volumes. You need to load GRUB modules {{ic|mdraid09}} or {{ic|mdraid1x}} to allow you to address the volume natively:<br />
<br />
{{hc|/etc/default/grub|2=<br />
GRUB_PRELOAD_MODULES="... mdraid09 mdraid1x"<br />
}}<br />
<br />
For example, {{ic|/dev/md0}} becomes:<br />
<br />
set root=(md/0)<br />
<br />
whereas a partitioned RAID volume (e.g. {{ic|/dev/md0p1}}) becomes:<br />
<br />
set root=(md/0,1)<br />
<br />
To install grub when using RAID1 as the {{ic|/boot}} partition (or using {{ic|/boot}} housed on a RAID1 root partition), on BIOS systems, simply run ''grub-install'' on both of the drives, such as:<br />
<br />
# grub-install --target=i386-pc --debug /dev/sda<br />
# grub-install --target=i386-pc --debug /dev/sdb<br />
<br />
Where the RAID 1 array housing {{ic|/boot}} is housed on {{ic|/dev/sda}} and {{ic|/dev/sdb}}.<br />
<br />
{{Note|GRUB supports booting from [[Btrfs]] RAID 0/1/10, but ''not'' RAID 5/6. You may use [[mdadm]] for RAID 5/6, which is supported by GRUB.}}<br />
<br />
==== Encrypted /boot ====<br />
<br />
GRUB also has special support for booting with an encrypted {{ic|/boot}}. This is done by unlocking a [[LUKS]] blockdevice in order to read its configuration and load any [[initramfs]] and [[kernel]] from it. This option tries to solve the issue of having an [[dm-crypt/Specialties#Securing the unencrypted_boot partition|unencrypted boot partition]].<br />
<br />
{{Note|{{ic|/boot}} is '''not''' required to be kept in a separate partition; it may also stay under the system's root {{ic|/}} directory tree.}}<br />
<br />
{{Warning|GRUB does not support LUKS2 headers; see [https://savannah.gnu.org/bugs/?55093 GRUB bug #55093]. Make sure to specify {{ic|1=--type luks1}} when creating the encrypted partition using {{ic|cryptsetup luksFormat}}.}}<br />
<br />
To enable this feature encrypt the partition with {{ic|/boot}} residing on it using [[LUKS]] as normal. Then add the following option to {{ic|/etc/default/grub}}:<br />
<br />
{{hc|/etc/default/grub|output=<br />
GRUB_ENABLE_CRYPTODISK=y<br />
}}<br />
<br />
This option is used by grub-install to generate the grub {{ic|core.img}}, so make sure to [[#Installation|install grub]] after modifying this option.<br />
<br />
Without further changes you will be prompted twice for a passhrase: the first for GRUB to unlock the {{ic|/boot}} mount point in early boot, the second to unlock the root filesystem itself as implemented by the initramfs. You can use a [[Dm-crypt/Device encryption#With a keyfile embedded in the initramfs|keyfile]] to avoid this.<br />
<br />
{{Warning|<br />
* If you want to [[#Generate the main configuration file|generate the main configuration file]], make sure that {{ic|/boot}} is mounted.<br />
* In order to perform system updates involving the {{ic|/boot}} mount point, ensure that the encrypted {{ic|/boot}} is unlocked and mounted before performing an update. With a separate {{ic|/boot}} partition, this may be accomplished automatically on boot by using [[crypttab]] with a [[Dm-crypt/Device encryption#With a keyfile embedded in the initramfs|keyfile]].<br />
}}<br />
<br />
{{Note|<br />
* If you use a special keymap, a default GRUB installation will not know it. This is relevant for how to enter the passphrase to unlock the LUKS blockdevice.<br />
* If you experience issues getting the prompt for a password to display (errors regarding cryptouuid, cryptodisk, or "device not found"), try reinstalling GRUB and appending {{ic|1=--modules="part_gpt part_msdos"}} to the end of your {{ic|grub-install}} command.<br />
}}<br />
<br />
{{Tip|1=You can use [https://bbs.archlinux.org/viewtopic.php?id=234607 pacman hooks]to automount your {{ic|/boot}} when upgrades need to access related files.}}<br />
<br />
=== Custom grub.cfg ===<br />
<br />
{{Expansion|Add instructions on how to write a custom {{ic|/boot/grub/grub.cfg}}. See [[User:Eschwartz/Grub]] for a proposed draft.|section=Manually generate grub.cfg}}<br />
<br />
This section describes the manual creation of GRUB boot entries in {{ic|/boot/grub/grub.cfg}} instead of relying on ''grub-mkconfig''.<br />
<br />
A basic GRUB config file uses the following options:<br />
<br />
* {{ic|(hd''X'',''Y'')}} is the partition ''Y'' on disk ''X'', partition numbers starting at 1, disk numbers starting at 0<br />
* {{ic|1=set default=''N''}} is the default boot entry that is chosen after timeout for user action<br />
* {{ic|1=set timeout=''M''}} is the time ''M'' to wait in seconds for a user selection before default is booted<br />
* {{ic|<nowiki>menuentry "title" {entry options}</nowiki>}} is a boot entry titled {{ic|title}}<br />
* {{ic|1=set root=(hd''X'',''Y'')}} sets the boot partition, where the kernel and GRUB modules are stored (boot need not be a separate partition, and may simply be a directory under the "root" partition ({{ic|/}})<br />
<br />
==== Boot menu entry examples ====<br />
<br />
{{Tip|These boot entries can also be used when using a {{ic|/boot/grub/grub.cfg}} generated by ''grub-mkconfig''. Add them to {{ic|/etc/grub.d/40_custom}} and [[#Generate the main configuration file|re-generate the main configuration file]] or add them to {{ic|/boot/grub/custom.cfg}}.}}<br />
<br />
For tips on managing multiple GRUB entries, for example when using both {{Pkg|linux}} and {{Pkg|linux-lts}} kernels, see [[GRUB/Tips and tricks#Multiple entries]].<br />
<br />
For [[Archiso]] and [[Archboot]] boot menu entries see [[Multiboot USB drive#Boot entries]].<br />
<br />
===== GRUB commands =====<br />
<br />
====== "Shutdown" menu entry ======<br />
<br />
{{bc|<br />
menuentry "System shutdown" {<br />
echo "System shutting down..."<br />
halt<br />
}<br />
}}<br />
<br />
====== "Restart" menu entry ======<br />
<br />
{{bc|<br />
menuentry "System restart" {<br />
echo "System rebooting..."<br />
reboot<br />
}<br />
}}<br />
<br />
====== "Firmware setup" menu entry (UEFI only) ======<br />
<br />
{{bc|1=<br />
if [ ${grub_platform} == "efi" ]; then<br />
menuentry "Firmware setup" {<br />
fwsetup<br />
}<br />
fi<br />
}}<br />
<br />
===== EFI binaries =====<br />
<br />
When launched in UEFI mode, GRUB can chainload other EFI binaries.<br />
<br />
{{Tip|1=To show these menu entries only when GRUB is launched in UEFI mode, enclose them in the following {{ic|if}} statement:<br />
<br />
{{bc|1=<br />
if [ ${grub_platform} == "efi" ]; then<br />
''place UEFI-only menu entries here''<br />
fi<br />
}}<br />
<br />
}}<br />
<br />
====== UEFI Shell ======<br />
<br />
You can launch [[Unified Extensible Firmware Interface#UEFI Shell|UEFI Shell]] by using placing it in the root of the [[EFI system partition]] and adding this menu entry:<br />
<br />
{{bc|1=<br />
menuentry "UEFI Shell" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --file /shellx64.efi<br />
chainloader /shellx64.efi<br />
}<br />
}}<br />
<br />
====== gdisk ======<br />
<br />
Download the [[gdisk#gdisk EFI application|gdisk EFI application]] and copy {{ic|gdisk_x64.efi}} to {{ic|''esp''/EFI/tools/}}.<br />
<br />
{{bc|1=<br />
menuentry "gdisk" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --file /EFI/tools/gdisk_x64.efi<br />
chainloader /EFI/tools/gdisk_x64.efi<br />
}<br />
}}<br />
<br />
====== Chainloading an Arch Linux .efi file ======<br />
<br />
If you have an ''.efi'' file generated from following [[Secure Boot]] or other means, you can add it to the boot menu. For example:<br />
<br />
{{bc|1=<br />
menuentry "Arch Linux .efi" {<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --set=root --fs-uuid ''FILESYSTEM_UUID''<br />
chainloader /EFI/arch/vmlinuz.efi<br />
}<br />
}}<br />
<br />
===== Dual-booting =====<br />
<br />
====== GNU/Linux ======<br />
<br />
Assuming that the other distribution is on partition {{ic|sda2}}:<br />
<br />
{{bc|1=<br />
menuentry "Other Linux" {<br />
set root=(hd0,2)<br />
linux /boot/vmlinuz (add other options here as required)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
}<br />
}}<br />
<br />
Alternatively let GRUB search for the right partition by ''UUID'' or ''label'':<br />
<br />
{{bc|1=<br />
menuentry "Other Linux" {<br />
# assuming that UUID is 763A-9CB6<br />
search --no-floppy --set=root --fs-uuid 763A-9CB6<br />
<br />
# search by label OTHER_LINUX (make sure that partition label is unambiguous)<br />
#search --no-floppy --set=root --label OTHER_LINUX<br />
<br />
linux /boot/vmlinuz (add other options here as required, for example: root=UUID=763A-9CB6)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
}<br />
}}<br />
<br />
====== Windows installed in UEFI/GPT mode ======<br />
<br />
This mode determines where the Windows bootloader resides and chain-loads it after GRUB when the menu entry is selected. The main task here is finding the EFI system partition and running the bootloader from it.<br />
<br />
{{Note|This menuentry will work only in UEFI boot mode and only if the Windows bitness matches the UEFI bitness. It will not work in BIOS installed GRUB. See [[Dual boot with Windows#Windows UEFI vs BIOS limitations]] and [[Dual boot with Windows#Bootloader UEFI vs BIOS limitations]] for more information.}}<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "efi" ]; then<br />
menuentry "Microsoft Windows Vista/7/8/8.1 UEFI/GPT" {<br />
insmod part_gpt<br />
insmod fat<br />
insmod chain<br />
search --no-floppy --fs-uuid --set=root $hints_string $fs_uuid<br />
chainloader /EFI/Microsoft/Boot/bootmgfw.efi<br />
}<br />
fi<br />
}}<br />
<br />
where {{ic|$hints_string}} and {{ic|$fs_uuid}} are obtained with the following two commands. <br />
<br />
The {{ic|$fs_uuid}} command determines the UUID of the EFI system partition:<br />
<br />
{{hc|1=# grub-probe --target=fs_uuid ''esp''/EFI/Microsoft/Boot/bootmgfw.efi|2=<br />
1ce5-7f28<br />
}}<br />
<br />
Alternatively one can run {{ic|blkid}} (as root) and read the UUID of the EFI system partition from there.<br />
<br />
The {{ic|$hints_string}} command will determine the location of the EFI system partition, in this case harddrive 0:<br />
<br />
{{hc|1=# grub-probe --target=hints_string ''esp''/EFI/Microsoft/Boot/bootmgfw.efi|2=<br />
--hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1<br />
}}<br />
<br />
These two commands assume the ESP Windows uses is mounted at {{ic|''esp''}}. There might be case differences in the path to Windows's EFI file, what with being Windows, and all.<br />
<br />
====== Windows installed in BIOS/MBR mode ======<br />
<br />
{{Note|GRUB supports booting {{ic|bootmgr}} directly and [https://www.gnu.org/software/grub/manual/grub.html#Chain_002dloading chainloading] of partition boot sector is no longer required to boot Windows in a BIOS/MBR setup.}}<br />
<br />
{{Warning|It is the '''system partition''' that has {{ic|/bootmgr}}, not your "real" Windows partition (usually {{ic|C:}}). The system partition's [[Persistent block device naming#by-label|filesystem label]] is {{ic|System Reserved}} or {{ic|SYSTEM}} and the partition is only about 100 to 549 MiB in size. See [[Wikipedia:System partition and boot partition]] for more information.}}<br />
<br />
Throughout this section, it is assumed your Windows partition is {{ic|/dev/sda1}}. A different partition will change every instance of {{ic|hd0,msdos1}}.<br />
<br />
{{Note|These menu entries will work only in BIOS boot mode. It will not work in UEFI installed GRUB. See [[Dual boot with Windows#Windows UEFI vs BIOS limitations]] and [[Dual boot with Windows#Bootloader UEFI vs BIOS limitations]] .}}<br />
<br />
In both examples {{ic|''XXXXXXXXXXXXXXXX''}} is the filesystem UUID which can be found with command {{ic|lsblk --fs}}.<br />
<br />
For Windows Vista/7/8/8.1/10:<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "pc" ]; then<br />
menuentry "Microsoft Windows Vista/7/8/8.1/10 BIOS/MBR" {<br />
insmod part_msdos<br />
insmod ntfs<br />
insmod ntldr <br />
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ''XXXXXXXXXXXXXXXX''<br />
ntldr /bootmgr<br />
}<br />
fi<br />
}}<br />
<br />
For Windows XP:<br />
<br />
{{bc|1=<br />
if [ "${grub_platform}" == "pc" ]; then<br />
menuentry "Microsoft Windows XP" {<br />
insmod part_msdos<br />
insmod ntfs<br />
insmod ntldr <br />
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 ''XXXXXXXXXXXXXXXX''<br />
ntldr /ntldr<br />
}<br />
fi<br />
}}<br />
<br />
{{Note|In some cases, GRUB may be installed without a clean Windows 8, in which case you cannot boot Windows without having an error with {{ic|\boot\bcd}} (error code {{ic|0xc000000f}}). You can fix it by going to Windows Recovery Console ({{ic|cmd.exe}} from install disk) and executing:<br />
<br />
X:\> bootrec.exe /fixboot<br />
X:\> bootrec.exe /RebuildBcd<br />
<br />
Do '''not''' use {{ic|bootrec.exe /Fixmbr}} because it will wipe GRUB out.<br />
Or you can use Boot Repair function in the Troubleshooting menu - it will not wipe out GRUB but will fix most errors.<br />
Also you would better keep plugged in both the target hard drive and your bootable device '''ONLY'''. Windows usually fails to repair boot information if any other devices are connected.<br />
}}<br />
<br />
== Using the command shell ==<br />
<br />
Since the MBR is too small to store all GRUB modules, only the menu and a few basic commands reside there. The majority of GRUB functionality remains in modules in {{ic|/boot/grub/}}, which are inserted as needed. In error conditions (e.g. if the partition layout changes) GRUB may fail to boot. When this happens, a command shell may appear.<br />
<br />
GRUB offers multiple shells/prompts. If there is a problem reading the menu but the bootloader is able to find the disk, you will likely be dropped to the "normal" shell:<br />
<br />
grub><br />
<br />
If there is a more serious problem (e.g. GRUB cannot find required files), you may instead be dropped to the "rescue" shell:<br />
<br />
grub rescue><br />
<br />
The rescue shell is a restricted subset of the normal shell, offering much less functionality. If dumped to the rescue shell, first try inserting the "normal" module, then starting the "normal" shell:<br />
<br />
grub rescue> set prefix=(hdX,Y)/boot/grub<br />
grub rescue> insmod (hdX,Y)/boot/grub/i386-pc/normal.mod<br />
rescue:grub> normal<br />
<br />
=== Pager support ===<br />
<br />
GRUB supports pager for reading commands that provide long output (like the {{ic|help}} command). This works only in normal shell mode and not in rescue mode. To enable pager, in GRUB command shell type:<br />
<br />
sh:grub> set pager=1<br />
<br />
=== Using the command shell environment to boot operating systems ===<br />
<br />
grub><br />
<br />
The GRUB's command shell environment can be used to boot operating systems.<br />
A common scenario may be to boot Windows / Linux stored on a drive/partition via '''chainloading'''.<br />
<br />
''Chainloading'' means to load another boot-loader from the current one, ie, chain-loading.<br />
<br />
The other bootloader may be embedded at the start of a partitioned disk (MBR), at the start of a partition or a partitionless disk (VBR), or as an EFI binary in the case of UEFI.<br />
<br />
==== Chainloading a partition's VBR ====<br />
<br />
set root=(hdX,Y)<br />
chainloader +1<br />
boot<br />
<br />
X=0,1,2...<br />
Y=1,2,3...<br />
<br />
For example to chainload Windows stored in the first partition of the first hard disk,<br />
<br />
set root=(hd0,1)<br />
chainloader +1<br />
boot<br />
<br />
Similarly GRUB installed to a partition can be chainloaded.<br />
<br />
==== Chainloading a disk's MBR or a partitionless disk's VBR ====<br />
<br />
set root=hdX<br />
chainloader +1<br />
boot<br />
<br />
==== Chainloading Windows/Linux installed in UEFI mode ====<br />
<br />
insmod fat<br />
set root=(hd0,gpt4)<br />
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi<br />
boot<br />
<br />
{{ic|insmod fat}} is used for loading the FAT file system module for accessing the Windows bootloader on the EFI system partition.<br />
{{ic|(hd0,gpt4)}} or {{ic|/dev/sda4}} is the EFI system partition in this example.<br />
The entry in the {{ic|chainloader}} line specifies the path of the ''.efi'' file to be chain-loaded.<br />
<br />
==== Normal loading ====<br />
<br />
See the examples in [[#Using the rescue console]]<br />
<br />
=== Using the rescue console ===<br />
<br />
See [[#Using the command shell]] first. If unable to activate the standard shell, one possible solution is to boot using a live CD or some other rescue disk to correct configuration errors and reinstall GRUB. However, such a boot disk is not always available (nor necessary); the rescue console is surprisingly robust.<br />
<br />
The available commands in GRUB rescue include {{ic|insmod}}, {{ic|ls}}, {{ic|set}}, and {{ic|unset}}. This example uses {{ic|set}} and {{ic|insmod}}. {{ic|set}} modifies variables and {{ic|insmod}} inserts new modules to add functionality.<br />
<br />
Before starting, the user must know the location of their {{ic|/boot}} partition (be it a separate partition, or a subdirectory under their root):<br />
<br />
grub rescue> set prefix=(hdX,Y)/boot/grub<br />
<br />
where X is the physical drive number and Y is the partition number.<br />
<br />
{{Note|With a separate boot partition, omit {{ic|/boot}} from the path (i.e. type {{ic|1=set prefix=(hdX,Y)/grub}}).}}<br />
<br />
To expand console capabilities, insert the {{ic|linux}} module:<br />
<br />
grub rescue> insmod i386-pc/linux.mod<br />
<br />
or simply<br />
<br />
grub rescue> insmod linux<br />
<br />
This introduces the {{ic|linux}} and {{ic|initrd}} commands, which should be familiar.<br />
<br />
An example, booting Arch Linux:<br />
<br />
set root=(hd0,5)<br />
linux /boot/vmlinuz-linux root=/dev/sda5<br />
initrd /boot/initramfs-linux.img<br />
boot<br />
<br />
With a separate boot partition (e.g. when using UEFI), again change the lines accordingly: <br />
<br />
{{Note|Since boot is a separate partition and not part of your root partition, you must address the boot partition manually, in the same way as for the prefix variable.}}<br />
<br />
set root=(hd0,5)<br />
linux (hdX,Y)/vmlinuz-linux root=/dev/sda6<br />
initrd (hdX,Y)/initramfs-linux.img<br />
boot<br />
<br />
{{Note|If you experienced {{ic|error: premature end of file /YOUR_KERNEL_NAME}} during execution of {{ic|linux}} command, you can try {{ic|linux16}} instead.}}<br />
<br />
After successfully booting the Arch Linux installation, users can correct {{ic|grub.cfg}} as needed and then reinstall GRUB.<br />
<br />
To reinstall GRUB and fix the problem completely, changing {{ic|/dev/sda}} if needed. See [[#Installation]] for details.<br />
<br />
== Troubleshooting ==<br />
<br />
=== F2FS and other unsupported file systems ===<br />
<br />
GRUB does not support [[F2FS]] file system. In case the root partition is on an unsupported file system, an alternative {{ic|/boot}} partition with a supported file system must be created. In some cases, the development version of GRUB {{aur|grub-git}} may have native support for the file system.<br />
<br />
If GRUB is used with an unsupported filesystem it is not able to extract the [[UUID]] of your drive so it uses classic non-persistent {{ic|/dev/''sdXx''}} names instead. In this case you might have to manually edit {{ic|/boot/grub/grub.cfg}} and replace {{ic|1=root=/dev/''sdXx''}} with {{ic|1=root=UUID=''XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX''}}. You can use the {{ic|blkid}} command to get the UUID of your device, see [[Persistent block device naming]].<br />
<br />
=== Intel BIOS not booting GPT ===<br />
<br />
Some Intel BIOS's require at least one bootable MBR partition to be present at boot, causing GPT-partitioned boot setups to be unbootable.<br />
<br />
This can be circumvented by using (for instance) fdisk to mark one of the GPT partitions (preferably the 1007 KiB partition you have created for GRUB already) bootable in the MBR. This can be achieved, using fdisk, by the following commands: Start fdisk against the disk you are installing, for instance {{ic|fdisk /dev/sda}}, then press {{ic|a}} and select the partition you wish to mark as bootable (probably #1) by pressing the corresponding number, finally press {{ic|w}} to write the changes to the MBR.<br />
<br />
{{Note|The bootable-marking must be done in {{ic|fdisk}} or similar, not in GParted or others, as they will not set the bootable flag in the MBR.}}<br />
<br />
With cfdisk, the steps are similar, just {{ic|cfdisk /dev/sda}}, choose bootable (at the left) in the desired hard disk, and quit saving.<br />
<br />
With recent version of parted, you can use {{ic|disk_toggle pmbr_boot}} option. Afterwards verify that Disk Flags show pmbr_boot.<br />
<br />
# parted /dev/sd''x'' disk_toggle pmbr_boot<br />
# parted /dev/sd''x'' print<br />
<br />
More information is available [http://www.rodsbooks.com/gdisk/bios.html here]<br />
<br />
=== Enable debug messages ===<br />
<br />
{{Note|This change is overwritten when [[#Generate the main configuration file]].}}<br />
<br />
Add:<br />
<br />
set pager=1<br />
set debug=all<br />
<br />
to {{ic|grub.cfg}}.<br />
<br />
=== "No suitable mode found" error ===<br />
<br />
If you get this error when booting any menuentry:<br />
<br />
error: no suitable mode found<br />
Booting however<br />
<br />
Then you need to initialize GRUB graphical terminal ({{ic|gfxterm}}) with proper video mode ({{ic|gfxmode}}) in GRUB. This video mode is passed by GRUB to the linux kernel via 'gfxpayload'. In case of UEFI systems, if the GRUB video mode is not initialized, no kernel boot messages will be shown in the terminal (atleast until KMS kicks in).<br />
<br />
{{Remove|''grub-install'' copies {{ic|unicode.pf2}} to {{ic|/boot/grub/fonts/}}, there is no need to do it manually.}}<br />
<br />
Copy {{ic|/usr/share/grub/unicode.pf2}} to {{ic|${GRUB_PREFIX_DIR}}} ({{ic|/boot/grub/}} in case of BIOS and UEFI systems). If GRUB UEFI was installed with {{ic|1=--boot-directory=''esp''/EFI}} set, then the directory is {{ic|''esp''/EFI/grub/}}:<br />
<br />
# cp /usr/share/grub/unicode.pf2 ${GRUB_PREFIX_DIR}<br />
<br />
If {{ic|/usr/share/grub/unicode.pf2}} does not exist, install {{Pkg|bdf-unifont}}, create the {{ic|unifont.pf2}} file and then copy it to {{ic|1=${GRUB_PREFIX_DIR}}}:<br />
<br />
# grub-mkfont -o unicode.pf2 /usr/share/fonts/misc/unifont.bdf<br />
<br />
Then, in the {{ic|grub.cfg}} file, add the following lines to enable GRUB to pass the video mode correctly to the kernel, without of which you will only get a black screen (no output) but booting (actually) proceeds successfully without any system hang.<br />
<br />
After that add the following code (common to both BIOS and UEFI):<br />
<br />
{{bc|1=<br />
loadfont "unicode"<br />
set gfxmode=auto<br />
set gfxpayload=keep<br />
insmod all_video<br />
insmod gfxterm<br />
terminal_output gfxterm<br />
}}<br />
<br />
=== msdos-style error message ===<br />
<br />
grub-setup: warn: This msdos-style partition label has no post-MBR gap; embedding will not be possible!<br />
grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists.<br />
However, blocklists are UNRELIABLE and its use is discouraged.<br />
grub-setup: error: If you really want blocklists, use --force.<br />
<br />
This error may occur when you try installing GRUB in a VMware container. Read more about it [https://bbs.archlinux.org/viewtopic.php?pid=581760#p581760 here]. It happens when the first partition starts just after the MBR (block 63), without the usual space of 1 MiB (2048 blocks) before the first partition. Read [[#Master Boot Record (MBR) specific instructions]]<br />
<br />
=== UEFI ===<br />
<br />
==== Common installation errors ====<br />
<br />
* If you have a problem when running ''grub-install'' with ''sysfs'' or ''procfs'' and it says you must run {{ic|modprobe efivars}}, try [[Unified Extensible Firmware Interface#Mount efivarfs]].<br />
* Without {{ic|--target}} or {{ic|--directory}} option, grub-install cannot determine for which firmware to install. In such cases {{ic|grub-install}} will print {{ic|source_dir does not exist. Please specify --target or --directory}}.<br />
* If after running grub-install you are told your partition does not look like an EFI partition then the partition is most likely not {{ic|Fat32}}.<br />
<br />
==== Drop to rescue shell ====<br />
<br />
If GRUB loads but drops into the rescue shell with no errors, it can be due to one of these two reasons:<br />
<br />
* It may be because of a missing or misplaced {{ic|grub.cfg}}. This will happen if GRUB UEFI was installed with {{ic|--boot-directory}} and {{ic|grub.cfg}} is missing,<br />
* It also happens if the boot partition, which is hardcoded into the {{ic|grubx64.efi}} file, has changed.<br />
<br />
==== GRUB UEFI not loaded ====<br />
<br />
An example of a working UEFI:<br />
<br />
{{hc|# efibootmgr -v|<br />
BootCurrent: 0000<br />
Timeout: 3 seconds<br />
BootOrder: 0000,0001,0002<br />
Boot0000* GRUB HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\EFI\GRUB\grubx64.efi)<br />
Boot0001* Shell HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\shellx64.efi)<br />
Boot0002* Festplatte BIOS(2,0,00)P0: SAMSUNG HD204UI<br />
}}<br />
<br />
If the screen only goes black for a second and the next boot option is tried afterwards, according to [https://bbs.archlinux.org/viewtopic.php?pid=981560#p981560 this post], moving GRUB to the partition root can help. The boot option has to be deleted and recreated afterwards. The entry for GRUB should look like this then:<br />
<br />
Boot0000* GRUB HD(1,800,32000,23532fbb-1bfa-4e46-851a-b494bfe9478c)File(\grubx64.efi)<br />
<br />
==== Default/fallback boot path ====<br />
<br />
Some UEFI firmwares require a bootable file at a known location before they will show UEFI NVRAM boot entries. If this is the case, {{ic|grub-install}} will claim {{ic|efibootmgr}} has added an entry to boot GRUB, however the entry will not show up in the VisualBIOS boot order selector. The solution is to install GRUB at the default/fallback boot path:<br />
<br />
# grub-install --target=x86_64-efi --efi-directory=''esp'' '''--removable'''<br />
<br />
Alternatively you can move an already installed GRUB EFI executable to the default/fallback path:<br />
<br />
# mv ''esp''/EFI/grub ''esp''/EFI/BOOT<br />
# mv ''esp''/EFI/BOOT/grubx64.efi ''esp''/EFI/BOOT/BOOTX64.EFI<br />
<br />
=== Invalid signature ===<br />
<br />
If trying to boot Windows results in an "invalid signature" error, e.g. after reconfiguring partitions or adding additional hard drives, (re)move GRUB's device configuration and let it reconfigure:<br />
<br />
# mv /boot/grub/device.map /boot/grub/device.map-old<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
{{ic|grub-mkconfig}} should now mention all found boot options, including Windows. If it works, remove {{ic|/boot/grub/device.map-old}}.<br />
<br />
=== Boot freezes ===<br />
<br />
If booting gets stuck without any error message after GRUB loading the kernel and the initial ramdisk, try removing the {{ic|add_efi_memmap}} kernel parameter.<br />
<br />
=== Arch not found from other OS ===<br />
<br />
Some have reported that other distributions may have trouble finding Arch Linux automatically with {{ic|os-prober}}. If this problem arises, it has been reported that detection can be improved with the presence of {{ic|/etc/lsb-release}}. This file and updating tool is available with the package {{Pkg|lsb-release}}.<br />
<br />
=== Warning when installing in chroot ===<br />
<br />
When installing GRUB on a LVM system in a chroot environment (e.g. during system installation), you may receive warnings like<br />
<br />
/run/lvm/lvmetad.socket: connect failed: No such file or directory<br />
<br />
or<br />
<br />
WARNING: failed to connect to lvmetad: No such file or directory. Falling back to internal scanning.<br />
<br />
This is because {{ic|/run}} is not available inside the chroot. These warnings will not prevent the system from booting, provided that everything has been done correctly, so you may continue with the installation.<br />
<br />
=== GRUB loads slowly ===<br />
<br />
GRUB can take a long time to load when disk space is low. Check if you have sufficient free disk space on your {{ic|/boot}} or {{ic|/}} partition when you are having problems.<br />
<br />
=== error: unknown filesystem ===<br />
<br />
GRUB may output {{ic|error: unknown filesystem}} and refuse to boot for a few reasons. If you are certain that all [[UUID]]s are correct and all filesystems are valid and supported, it may be because your [[#GUID Partition Table (GPT) specific instructions|BIOS Boot Partition]] is located outside the first 2 TiB of the drive [https://bbs.archlinux.org/viewtopic.php?id=195948]. Use a partitioning tool of your choice to ensure this partition is located fully within the first 2 TiB, then reinstall and reconfigure GRUB.<br />
<br />
=== grub-reboot not resetting ===<br />
<br />
GRUB seems to be unable to write to root BTRFS partitions [https://bbs.archlinux.org/viewtopic.php?id=166131]. If you use grub-reboot to boot into another entry it will therefore be unable to update its on-disk environment. Either run grub-reboot from the other entry (for example when switching between various distributions) or consider a different file system. You can reset a "sticky" entry by executing {{ic|grub-editenv create}} and setting {{ic|1=GRUB_DEFAULT=0}} in your {{ic|/etc/default/grub}} (do not forget {{ic|grub-mkconfig -o /boot/grub/grub.cfg}}).<br />
<br />
=== Old BTRFS prevents installation ===<br />
<br />
If a drive is formatted with BTRFS without creating a partition table (eg. /dev/sdx), then later has partition table written to, there are parts of the BTRFS format that persist. Most utilities and OS's do not see this, but GRUB will refuse to install, even with --force<br />
<br />
# grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..<br />
# grub-install: error: filesystem `btrfs' does not support blocklists.<br />
<br />
You can zero the drive, but the easy solution that leaves your data alone is to erase the BTRFS superblock with {{ic|wipefs -o 0x10040 /dev/sdx}}<br />
<br />
=== Windows 8/10 not found ===<br />
<br />
A setting in Windows 8/10 called "Hiberboot", "Hybrid Boot" or "Fast Boot" can prevent the Windows partition from being mounted, so {{ic|grub-mkconfig}} will not find a Windows install. Disabling Hiberboot in Windows will allow it to be added to the GRUB menu.<br />
<br />
=== VirtualBox EFI mode ===<br />
<br />
Install GRUB to the [[#Default/fallback boot path|default/fallback boot path]].<br />
<br />
See also [[VirtualBox#Installation in EFI mode]].<br />
<br />
=== Device /dev/xxx not initialized in udev database even after waiting 10000000 microseconds ===<br />
<br />
If grub-mkconfig hangs and gives error: {{ic|WARNING: Device /dev/''xxx'' not initialized in udev database even after waiting 10000000 microseconds}}.<br />
<br />
You may need to provide {{ic|/run/lvm/}} access to the chroot environment using:<br />
<br />
# mkdir /mnt/hostlvm<br />
# mount --bind /run/lvm /mnt/hostlvm<br />
# arch-chroot /mnt<br />
# ln -s /hostlvm /run/lvm<br />
<br />
See {{Bug|61040}} and [https://bbs.archlinux.org/viewtopic.php?pid=1820949#p1820949 workaround].<br />
<br />
<br />
=== GRUB configuration file not updating with ALPM hook when grub boot directory not set to /boot ===<br />
<br />
If your GRUB installation not using ''/boot'' as boot directory (e.g. you put it to efi partition) it is possible, that [[pacman#Hooks|ALPM hook]] will not update ''grub.cfg'' when it will be requested by pacman (e.g. when installing new kernel or updating initramfs). Reason: update-grub only updates files in ''/boot'' directory.<br />
<br />
To solve this problem you may create '''symlink''' in ''/boot'' to directory, that contains ''grub.cfg'' file. For example, if you gave --boot-directory=/boot/efi/EFI/grub argument to grub-install, then you need to execute this:<br />
{{bc|<nowiki># ln -s /boot/efi/EFI/grub /boot/grub</nowiki>}}<br />
<br />
<br />
Or you may create simple shell script, that move ''grub.cfg'' to your custom directory, and alter ALPM hook.<br />
<br />
For example create shell script file with this lines: <br />
{{bc|<nowiki>#!/bin/env /bin/bash<br />
update-grub && mv -f /boot/grub/grub.cfg /boot/efi/EFI/grub/grub.cfg</nowiki>}}<br />
<br />
Then make it executable:<br />
{{bc|<nowiki># chmod +x <script_file_name></nowiki>}}<br />
<br />
Finally you need to alter [[pacman#Hooks|ALPM hook]] ''99-grub.hook'':<br />
Open it with nano editor:<br />
{{bc|<nowiki># nano /usr/share/libalpm/hooks/99-grub.hook</nowiki>}}<br />
<br />
It originally looks like this:<br />
{{bc|<nowiki>[Trigger]<br />
Type = File<br />
Operation = Install<br />
Operation = Upgrade<br />
Operation = Remove<br />
Target = boot/vmlinuz-*<br />
<br />
[Action]<br />
Description = Updating Grub-Bootmenu<br />
When = PostTransaction<br />
Exec = update-grub</nowiki>}}<br />
<br />
You need to change '''Exec''' parameter in '''Action''' section to your script location:<br />
<br />
{{bc|<nowiki>Exec = <path_to_your_srcipt></nowiki>}}<br />
<br />
== See also ==<br />
<br />
* [[Wikipedia:GNU GRUB]]<br />
* [https://www.gnu.org/software/grub/manual/grub.html Official GRUB Manual]<br />
* [https://help.ubuntu.com/community/Grub2 Ubuntu wiki page for GRUB]<br />
* [https://help.ubuntu.com/community/UEFIBooting GRUB wiki page describing steps to compile for UEFI systems]<br />
* [[Wikipedia:BIOS Boot partition]]<br />
* [http://web.archive.org/web/20160424042444/http://members.iinet.net/~herman546/p20/GRUB2%20Configuration%20File%20Commands.html#Editing_etcgrub.d05_debian_theme How to configure GRUB]<br />
* [http://www.linuxjournal.com/article/4622 Boot with GRUB]</div>Niasarhttps://wiki.archlinux.org/index.php?title=NVIDIA_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)&diff=421317NVIDIA (Русский)2016-02-19T00:35:37Z<p>Niasar: Changed pkg name to nvidia-settings according to recent changes in repositories</p>
<hr />
<div>[[Category:Graphics (Русский)]]<br />
[[Category:X server (Русский)]]<br />
[[Category:Русский]]<br />
[[cs:NVIDIA]]<br />
[[de:Nvidia]]<br />
[[en:NVIDIA]]<br />
[[es:NVIDIA]]<br />
[[fa:اِنویدیا]]<br />
[[fr:Nvidia]]<br />
[[it:NVIDIA]]<br />
[[ja:NVIDIA]]<br />
[[nl:NVIDIA]]<br />
[[tr:Nvidia]]<br />
[[zh-cn:NVIDIA]]<br />
{{Related articles start (Русский)}}<br />
{{Related|Nouveau (Русский)}}<br />
{{Related|Bumblebee (Русский)}}<br />
{{Related|NVIDIA Optimus}}<br />
{{Related|Xorg (Русский)}}<br />
{{Related articles end}}<br />
{{Unmaintained (Русский)}}<br />
<br />
Данная статья описывает процесс установки и настройки проприетарного драйвера графических карт [http://www.nvidia.com NVIDIA]. Для получения информации о драйверах с открытым исходным кодом обратитесь к статье [[Nouveau (Русский)]]. Также есть отдельная статья для обладателей ноутбуков с технологиями на базе [[NVIDIA Optimus]].<br />
<br />
== Установка ==<br />
<br />
Данная инструкция предназначена для предоставляемых в дистрибутиве пакетов ядра {{Pkg|linux}} или {{Pkg|linux-lts}}. Для пользователей ядра, собранного самостоятельно, следует обратится к [[#Альтернативная установка: собственное ядро|следующему]] подразделу.<br />
<br />
{{Warning (Русский)|Избегайте установки пакета драйвера NVIDIA, предоставляемого веб-сайтом NVIDIA. Установка через [[pacman]], позволяет обновлять драйвер вместе с остальной системой.}}<br />
<br />
1. Если вы не знаете модель графической карты, установленной у вас, для поиска используйте данный запрос:<br />
:{{bc|<nowiki>$ lspci -k | grep -A 2 -E "(VGA|3D)"</nowiki>}}<br />
<br />
2. Есть несколько вариантов определения необходимой для вас версии драйвера:<br />
:* поиск по кодовому имени (т.к. NV50, NVC0, и др.) на [http://nouveau.freedesktop.org/wiki/CodeNames странице с кодовыми именами nouveau]<br />
:* просмотр модели в [http://www.nvidia.com/object/IO_32667.html списке устаревших графических карт] NVIDIA: если вашей карты нет в списке, используйте драйвер для нового оборудования<br />
:* также можно посетить [http://www.nvidia.com/Download/index.aspx страницу загрузки драйвера с сайта] NVIDIA <br />
<br />
3. Установите подходящий драйвер для своей карты:<br />
:* Для карт GeForce 400 series и более новых [NVCx и новее], установите (см. [[install]]) пакет {{Pkg|nvidia}} или пакет {{Pkg|nvidia-lts}} вместе с пакетом {{Pkg|nvidia-libgl}}.<br />
:* Для карт GeForce 8000/9000 и 100-300 series [NV5x, NV8x, NV9x и NVAx] года производства 2006-2010, установите (см. [[install]]) пакет {{Pkg|nvidia-340xx}} или пакет {{Pkg|nvidia-340xx-lts}} вместе с пакетом {{Pkg|nvidia-340xx-libgl}}.<br />
:* Для карт GeForce 6000/7000 series [NV4x и NV6x] года производства 2004-2006, установите (см. [[install]]) пакет {{Pkg|nvidia-304xx}} или пакет {{Pkg|nvidia-304xx-lts}} вместе с пакетом {{Pkg|nvidia-304xx-libgl}}.<br />
<br />
:* Для более старых моделей, обратитесь к подразделу [[#Неподдерживаемые драйвера]].<br />
:* Для очень новых моделей графических ускорителей может потребоваться установка (см. [[install]]) пакета {{AUR|nvidia-beta}}, т.к. стабильная версия драйвера может не поддерживать новые функции, добавленные в эти карты.<br />
<br />
4. Если у вас разрядность ОС 64-бит и вам необходима поддержка OpenGL 32-бит,то необходимо установить соответствующие пакеты ''lib32'' с репозитория [[multilib]] (т.к. {{Pkg|lib32-nvidia-libgl}}, {{Pkg|lib32-nvidia-340xx-libgl}} или {{Pkg|lib32-nvidia-304xx-libgl}}).<br />
<br />
5. Перезагрузите систему. Пакет {{Pkg|nvidia}} содержит файл с чёрным списком для модуля ''nouveau'', поэтому перезагрузка необходима.<br />
<br />
После того, как драйвер будет установлен, можно перейти к разделу [[#Настройка]].<br />
<br />
=== Неподдерживаемые драйвера ===<br />
<br />
Если вы имеете карту GeForce 5 FX series или старее, Nvidia не поддерживает больше драйвера для вашей карты. Это означает, что эти драйвера [http://nvidia.custhelp.com/app/answers/detail/a_id/3142/ не поддерживают текущую версию Xorg]. В вашем случае, проще использовать драйвер [[nouveau]], который поддерживает старые карты в текущей версии Xorg.<br />
<br />
Однако, старые драйвера Nvidia пока ещё доступны и могут прдоставлять лучшую 3D производительность/стабильность если вы откатите версию Xorg:<br />
<br />
* Для карт GeForce 5 FX series [NV30-NV36], установите пакет {{AUR|nvidia-173xx-dkms}}. Последняя поддерживаемая версия Xorg 1.15.<br />
* Для карт GeForce 2/3/4 MX/Ti series [NV11, NV17-NV28], установите пакет {{AUR|nvidia-96xx-dkms}}. Последняя поддерживаемая версия Xorg 1.12.<br />
<br />
{{Tip (Русский)| Устаревшие драйвера nvidia-96xx-dkms и nvidia-173xx-dkms также можно установить с неофициального [http://pkgbuild.com/~bgyorgy/city.html <nowiki>репозитория [city]</nowiki>]. (Настоятельно рекомендуется использовать данный способ, который поможет избежать любых проблем с зависимостями после установки.)}}<br />
<br />
=== Альтернативная установка: собственное ядро ===<br />
<br />
Прежде всего, очень хорошо понимать, как работает система ABS, путём прочтения некоторых статей об этом:<br />
<br />
* Основная статья о [[ABS]]<br />
* Статья о [[makepkg]]<br />
* Статья о [[Creating packages]]<br />
<br />
Следующее небольшое руководство описывает процесс создания собственного пакета драйвера NVIDIA, используя [[ABS]]:<br />
<br />
Установите (см. [[Install]]) пакет {{Pkg|abs}} и сгенерируйте дерево:<br />
# abs<br />
Как обычный пользователь, сделайте временный каталог для создания нового пакета:<br />
$ mkdir -p ~/abs<br />
Сделайте копию каталога пакета {{ic|nvidia}}:<br />
$ cp -r /var/abs/extra/nvidia/ ~/abs/<br />
Зайдите в временный каталог сборки {{ic|nvidia}}:<br />
$ cd ~/abs/nvidia<br />
Теперь необходимо отредактировать файлы {{ic|nvidia.install}} и {{ic|PKGBUILD}}, они должны содержать правильные переменные версии ядра.<br />
<br />
Когда запущено собственное ядро, узнайте версию и имя ядра:<br />
$ uname -r<br />
# В nvidia.install, замените переменную {{ic|EXTRAMODULES<nowiki>=</nowiki>'extramodules-3.4-ARCH'}} собственной версией ядра, например {{ic|EXTRAMODULES<nowiki>=</nowiki>'extramodules-3.4.4'}} или {{ic|EXTRAMODULES<nowiki>=</nowiki>'extramodules-3.4.4-custom'}} в зависимости от названия и версии вашего ядра. Сделайте эти изменения для всех найденых совпадений в этом файле.<br />
# В PKGBUILD, измените переменную {{ic|_extramodules<nowiki>=</nowiki>extramodules-3.4-ARCH}} на совпадающую с вашей версией ядра, как описано выше.<br />
# Если вы установили параллельно несколько ядер (например собственное ядро и ядро -ARCH, предоставляемое по умолчанию), измените название в PKGBUILD {{ic|pkgname<nowiki>=</nowiki>nvidia}} на уникальное, такое как nvidia-344 или nvidia-custom. Это позволяет ядрам использовать разные модули nvidia, собственный модуль nvidia будет иметь другое название пакета и не будет переписан оригинальным. Вам также понадобится закоментировать строку в {{ic|package()}}, которая добавляет в чёрный список модуль nouveau в {{ic|/usr/lib/modprobe.d/nvidia.conf}} (нет необходимости делать это снова).<br />
<br />
Теперь выполните:<br />
$ makepkg -ci<br />
Ключ {{ic|-c}} говорит makepkg очистить оставшиеся файлы после сборки пакета, ключ {{ic|-i}} указывает makepkg автоматически выполнить запуск pacman для установки собранного пакета.<br />
<br />
==== Автоматическая пересборка модуля NVIDIA при обновлении ядра ====<br />
<br />
Это возможно благодаря пакету {{AUR|nvidia-hook}} с [[AUR]]. Вам необходимо установить пакет с исходным кодом модуля: {{Pkg|nvidia-dkms}}. В ''nvidia-hook'', автоматическая пересборка выполняется хуком {{ic|nvidia}} в [[mkinitcpio]] принудительно, при обновлении пакета {{Pkg|linux-headers}}. Вам необходимо добавить {{ic|nvidia}} в раздел HOOKS файла {{ic|/etc/mkinitcpio.conf}}.<br />
<br />
Хук будет вызывать команду ''dkms'' для обновления модуля NVIDIA при обновлении версии вашего ядра.<br />
<br />
{{Note (Русский)|<br />
* Если вы используете данную функциональность '''необходимо''' наблюдать процесс установки пакета {{Pkg|linux}} (или другого ядра). Хук nvidia будет сообщать вам, если что-то пойдет не так.<br />
* Если вы хотите это делать вручную, обратитесь к статье [[Dynamic_Kernel_Module_Support_(Русский)#Использование]].<br />
}}<br />
<br />
== Настройка ==<br />
<br />
Вполне возможно, что после установки драйвера, вам будет не нужно создавать конфигурационные файлы для сервера Xorg. Вы можете запустить [[Xorg#Running|тест]] для проверки корректной работы сервера Xorg без файла конфигурации. Однако, может потребоваться создание конфигурационного файла (предпочтительно {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}} поверх {{ic|/etc/X11/xorg.conf}}) для дополнительной настройки. Это конфигурация может быть сгенерирована инструментом конфигурации NVIDIA Xorg или можно создать её вручную. Если создается вручную, это может быть минимальной конфигурацией (в том смысле, что она будет содержать базовые настройки сервера [[Xorg]]), либо она может включать в себя ряд настроек, которые могут обоходить автоматически обнаруженные настройки Xorg или предварительно заданные настройки.<br />
{{Note (Русский)|Начиная с версии 1.8.x, Xorg использует разделение конфигурационных файлов в {{ic|/etc/X11/xorg.conf.d/}} - проверьте раздел [[#Advanced: 20-nvidia.conf|advanced configuration]].}}<br />
<br />
=== Минимальная настройка ===<br />
<br />
Базовый блок конфигурации в {{ic|20-nvidia.conf}} (или устаревший блок в {{ic|xorg.conf}}) должен выглядеть так:<br />
<br />
{{hc|/etc/X11/xorg.conf.d/20-nvidia.conf|<br />
Section "Device"<br />
Identifier "Nvidia Card"<br />
Driver "nvidia"<br />
VendorName "NVIDIA Corporation"<br />
Option "NoLogo" "true"<br />
#Option "UseEDID" "false"<br />
#Option "ConnectedMonitor" "DFP"<br />
# ...<br />
EndSection<br />
}}<br />
<br />
{{Tip (Русский)| Если вы перешли с драйвера nouveau, удостоверьтесь, в том что вы удалили "{{ic|nouveau}}" из {{ic|/etc/mkinitcpio.conf}}. Дополнительно смотрите [[#Switching between NVIDIA and nouveau drivers|Switching between NVIDIA and nouveau drivers]], если вы часто переключаетесь между открытым и закрытым драйвером.}}<br />
<br />
=== Автоматическая настройка ===<br />
<br />
Пакет NVIDIA, включает в себя автоматический инструмент для создания файла конфигурации сервера Xorg ({{ic|xorg.conf}}) и может быть запущен путем выполнения:<br />
# nvidia-xconfig<br />
<br />
Данная команда автоматически обнаруживает и создает (или изменяет, если было уже создано) конфигурацию {{ic|/etc/X11/xorg.conf}}, в соответствии с текущим аппаратным обеспечением.<br />
<br />
Если есть строка с указанием загрузки DRI, убедитесь, что она закомментирована:<br />
# Load "dri"<br />
Проверьте ещё раз {{ic|/etc/X11/xorg.conf}}, убедитесь, что глубина по умолчанию, горизонтальная синхронизация, частота кадров и разрешение допустимы.<br />
<br />
{{Warning (Русский)|Это может не работать корректно с сервером Xorg версии 1.8}}<br />
<br />
=== Несколько мониторов ===<br />
<br />
:''Смотрите [[Multihead]] для получения основной информации''<br />
<br />
==== Использование NVIDIA Settings ====<br />
<br />
Вы можете использовать инструмент {{Pkg|nvidia-settings}} для настройки много-мониторной конфигурации. Этот метод использует закрытое програмнное обеспечение NVIDIA поставляемое с драйверами. Просто запустите {{ic|nvidia-settings}} как root, затем настройте как вам надо и сохраните конфигурацию в {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}}.<br />
<br />
==== ConnectedMonitor ====<br />
<br />
Если драйвер не определил второй монитор, вы можете принудительно указать его с помощью опции ConnectedMonitor <br />
<br />
{{hc|/etc/X11/xorg.conf|<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
VendorName "Panasonic"<br />
ModelName "Panasonic MICRON 2100Ex"<br />
HorizSync 30.0 - 121.0 # this monitor has incorrect EDID, hence Option "UseEDIDFreqs" "false"<br />
VertRefresh 50.0 - 160.0<br />
Option "DPMS"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor2"<br />
VendorName "Gateway"<br />
ModelName "GatewayVX1120"<br />
HorizSync 30.0 - 121.0<br />
VertRefresh 50.0 - 160.0<br />
Option "DPMS"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Device1"<br />
Driver "nvidia"<br />
Option "NoLogo"<br />
Option "UseEDIDFreqs" "false"<br />
Option "ConnectedMonitor" "CRT,CRT"<br />
VendorName "NVIDIA Corporation"<br />
BoardName "GeForce 6200 LE"<br />
BusID "PCI:3:0:0"<br />
Screen 0<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Device2"<br />
Driver "nvidia"<br />
Option "NoLogo"<br />
Option "UseEDIDFreqs" "false"<br />
Option "ConnectedMonitor" "CRT,CRT"<br />
VendorName "NVIDIA Corporation"<br />
BoardName "GeForce 6200 LE"<br />
BusID "PCI:3:0:0"<br />
Screen 1<br />
EndSection<br />
<br />
}}<br />
<br />
Дублирование устройств с опцией {{ic|Screen}} описывает использование сервером Xorg двух мониторов на одной карте без технологии {{ic|TwinView}}. Учтите, что {{ic|nvidia-settings}} будет вырезать любое упоминание опции {{ic|ConnectedMonitor}}.<br />
<br />
==== TwinView ====<br />
<br />
Вы хотите только один большой экран вместо двух. Установите значение опции {{ic|TwinView}} в {{ic|1}}. Эта опция должна использоваться если вы хотите композитинга. Технология TwinView работает только на базе одной карты, когда все мониторы подключены к одной карте. <br />
Option "TwinView" "1"<br />
<br />
Пример конфигурцаии:<br />
{{hc|/etc/X11/xorg.conf.d/10-monitor.conf|<br />
Section "ServerLayout"<br />
Identifier "TwinLayout"<br />
Screen 0 "metaScreen" 0 0<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Monitor1"<br />
Option "Enable" "true"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Card0"<br />
Driver "nvidia"<br />
VendorName "NVIDIA Corporation"<br />
<br />
#refer to the link below for more information on each of the following options.<br />
Option "HorizSync" "DFP-0: 28-33; DFP-1 28-33"<br />
Option "VertRefresh" "DFP-0: 43-73; DFP-1 43-73"<br />
Option "MetaModes" "1920x1080, 1920x1080"<br />
Option "ConnectedMonitor" "DFP-0, DFP-1"<br />
Option "MetaModeOrientation" "DFP-1 LeftOf DFP-0"<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "metaScreen"<br />
Device "Card0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
Option "TwinView" "True"<br />
SubSection "Display"<br />
Modes "1920x1080"<br />
EndSubSection<br />
EndSection<br />
}}<br />
<br />
[ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/configtwinview.html Дополнительная информация о технологии TwinView (англ.)].<br />
<br />
Если вы имеете несколько карт, которые совместимы с технологией SLI, вы можете использовать несколько мониторов присоединённых к разным картам (пример: две карты в режиме SLI с подключением монитора на каждой карте). Опция "MetaModes" совместно с режимом SLI Mosaic позволяет это. Ниже указана конфигурация, которая работает для вышеупомянутого примера и безупречно запускает [[GNOME]].<br />
{{hc|/etc/X11/xorg.conf.d/10-monitor.conf|<br />
Section "Device"<br />
Identifier "Card A"<br />
Driver "nvidia"<br />
BusID "PCI:1:00:0"<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Card B"<br />
Driver "nvidia"<br />
BusID "PCI:2:00:0"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Right Monitor"<br />
EndSection<br />
<br />
Section "Monitor"<br />
Identifier "Left Monitor"<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Right Screen"<br />
Device "Card A"<br />
Monitor "Right Monitor"<br />
DefaultDepth 24<br />
Option "SLI" "Mosaic"<br />
Option "Stereo" "0"<br />
Option "BaseMosaic" "True"<br />
Option "MetaModes" "GPU-0.DFP-0: 1920x1200+4480+0, GPU-1.DFP-0:1920x1200+0+0"<br />
SubSection "Display"<br />
Depth 24<br />
EndSubSection<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Left Screen"<br />
Device "Card B"<br />
Monitor "Left Monitor"<br />
DefaultDepth 24<br />
Option "SLI" "Mosaic"<br />
Option "Stereo" "0"<br />
Option "BaseMosaic" "True"<br />
Option "MetaModes" "GPU-0.DFP-0: 1920x1200+4480+0, GPU-1.DFP-0:1920x1200+0+0"<br />
SubSection "Display"<br />
Depth 24<br />
EndSubSection<br />
EndSection<br />
<br />
Section "ServerLayout"<br />
Identifier "Default"<br />
Screen 0 "Right Screen" 0 0<br />
Option "Xinerama" "0"<br />
EndSection}}<br />
<br />
===== Ручная конфигурация из командной строки с использованием xrandr =====<br />
{{Accuracy (Русский)|Данные команды устанавливают мониторы в режим ''TwinView''?}}<br />
<br />
Если вышеуказанные решения не сработали, вы можете использовать ''автозапуск'' вашего менеджера окон совместно с пакетом {{Pkg|xorg-xrandr}}.<br />
<br />
Некоторые примеры работы с командой {{ic|xrandr}}:<br />
<br />
xrandr --output DVI-I-0 --auto --primary --left-of DVI-I-1<br />
<br />
или:<br />
<br />
xrandr --output DVI-I-1 --pos 1440x0 --mode 1440x900 --rate 75.0<br />
<br />
Где:<br />
<br />
* {{ic|--output}} используется для указания "монитора", к которому применяются опции.<br />
* {{ic|DVI-I-1}} имя второго монитора.<br />
* {{ic|--pos}} позиция второго монитора относительно первого.<br />
* {{ic|--mode}} разрешение второго монитора.<br />
* {{ic|--rate}} частота обновления (в Гц).<br />
<br />
==== Режим Mosaic ====<br />
<br />
Режим Mosaic единственный способ использовать более чем два монитора через несколько видеокарт с использованием композитинга. Ваш оконный менджер может распознать, а может и не распознать различия между мониторами.<br />
<br />
===== Base Mosaic =====<br />
<br />
Режим Base Mosaic работает с картами Geforce 8000 series или выше. Его нельзя включить через графический интерфейс nvidia-setting. Вы должны использовать команду {{ic|nvidia-xconfig}}, либо отредактировать {{ic|xorg.conf}} самостоятельно. Опция Metamodes должна быть указана. Следующий пример для четырёх DFP мониторов в конфигурации 2х2, каждый запущен в разрешении 1920x1024, по два подключенных DFP монитора на две карты:<br />
$ nvidia-xconfig --base-mosaic --metamodes="GPU-0.DFP-0: 1920x1024+0+0, GPU-0.DFP-1: 1920x1024+1920+0, GPU-1.DFP-0: 1920x1024+0+1024, GPU-1.DFP-1: 1920x1024+1920+1024"<br />
<br />
{{Note (Русский)|Хотя в документации и указано конфигурация мониторов 2х2, Nvidia уменьшила данную возможность до трех мониторов в режиме Base Mosaic в 304 версии драйвера. Большее количество мониторов доступно в картах серии Quadro, а в обычных картах ограничение в три монитора. Как объяснение данного уменьшения озвучивается как "Паритетное свойство драйвера Windows". С сентября 2014, Windows не имеет ограничение на количество мониторов с той же самой версией драйвера. Это не ошибка, так задумано по дизайну архитектуры.}}<br />
<br />
===== SLI Mosaic =====<br />
<br />
Если вы имеете конфигурацию SLI и все графические ускорители серии Quadro FX 5800, Quadro Fermi или новее, тогда вы можете использовать режим SLI Mosaic. он можеть быть включен из графического интерфейса nvidia-settings или из командной строки:<br />
$ nvidia-xconfig --sli=Mosaic --metamodes="GPU-0.DFP-0: 1920x1024+0+0, GPU-0.DFP-1: 1920x1024+1920+0, GPU-1.DFP-0: 1920x1024+0+1024, GPU-1.DFP-1: 1920x1024+1920+1024"<br />
<br />
=== Драйвер Persistence ===<br />
<br />
Начиная с версии 319, Nvidia изменила порядок работы драйвера persistence, теперь он запускается как демон при загрузке. Смотрите раздел [http://docs.nvidia.com/deploy/driver-persistence/index.html драйвер Persistence (англ.)] документации Nvidia, для получения детальной информации.<br />
<br />
Для запуска демона persistence [[enable|разрешите]] {{ic|nvidia-persistenced.service}}. Для использования вручную смотрите [http://docs.nvidia.com/deploy/driver-persistence/index.html#usage документацию разработчика].<br />
<br />
== Тонкая настройка ==<br />
<br />
=== Графический интерфейс: nvidia-settings ===<br />
<br />
Пакет NVIDIA включает в себя программу {{ic|nvidia-settings}}, которая позволяет настраивать различные параметры. <br />
<br />
Для загрузки настроек при входе, запустите эту команду из терминала:<br />
$ nvidia-settings --load-config-only<br />
<br />
Метод автозапуска среды рабочего стола 'может' не сработать при загрузке nvidia-settings (KDE). Чтобы удостовериться, что настройки реально загружены, поместите команду в файл ~/.xinitrc (создайте сами, если его нет)<br />
<br />
{{Tip (Русский)|Иногда {{ic|~/.nvidia-settings-rc}} может повреждаться. Если это произошло, сервер Xorg может не загрузится и нужно удалить файл для решения проблемы загрузки.}}<br />
<br />
=== Дополнительно: 20-nvidia.conf ===<br />
<br />
Отредактируйте {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}} и добавьте опции в нужные секции. Сервер Xorg необходимо перегрузить для применения любых изменений.<br />
<br />
Смотрите [ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/README.txt NVIDIA Accelerated Linux Graphics Driver README и Руководство по установке (англ.)] для получения дополнительной информации и опций.<br />
<br />
==== Запрет логотипа при загрузке ====<br />
<br />
Добавьте опцию {{ic|"NoLogo"}} внутри секции {{ic|Device}}:<br />
Option "NoLogo" "1"<br />
<br />
==== Переопределение обнаружения монитора ====<br />
<br />
Опция {{ic|"ConnectedMonitor"}} в секции {{ic|Device}} позволяет переопределить обнаружение монитора при запуске X, что позволяет сэкономить время при загрузке. Доступные опции: {{ic|"CRT"}} для аналоговых мониторов, {{ic|"DFP"}} для цифровых мониторов и {{ic|"TV"}} для телевизоров.<br />
<br />
Следующая строка принуждает драйвер NVIDIA в обход проверки и определения использовать монитор как DFP:<br />
Option "ConnectedMonitor" "DFP"<br />
{{Note (Русский)| Используйте "CRT" для все аналоговых соединений типа VGA 15-пин, даже если монитор тонкий. "DFP" предназначен только для цифровых подключений такие как DVI, HDMI и DisplayPort.}}<br />
<br />
==== Включение контроля яркости ====<br />
<br />
Добавьте в секцию {{ic|Device}} строку:<br />
Option "RegistryDwords" "EnableBrightnessControl=1"<br />
<br />
Если контроль яркости не заработает после применения данной опции, попробуйте установить {{AUR|nvidia-bl}} или {{AUR|nvidiabl}}.<br />
<br />
==== Включение SLI ====<br />
<br />
{{Warning (Русский)|По состоянию на Май 7, 2011, вы можете испытывать проблемы с производительностью видео в GNOME 3, после включения SLI.}}<br />
<br />
Выдержка из [ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/xconfigoptions.html README] драйвера NVIDIA Приложение B: ''Данная опция контролирует рендеринг SLI в поддерживаемых конфигурациях.'' Другими словами, в "поддерживаемых конфигурациях" обозначены компьютеры оборудованные материнской платой c сертифицированной поддержкой SLI и 2 или 3 графических процессора GeForce, также с сертифицированной поддержкой SLI.<br />
Смотрите [http://www.slizone.com/page/home.html Зона SLI (англ.)] для получения подробной информации.<br />
<br />
Найдем первый PCI Bus ID графического процессора, используя {{ic|lspci}}:<br />
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<br />
03:00.0 VGA compatible controller: nVidia Corporation G92 [GeForce 8800 GTS 512] (rev a2)<br />
05:00.0 VGA compatible controller: nVidia Corporation G92 [GeForce 8800 GTS 512] (rev a2)<br />
}}<br />
<br />
Добавим BusID (3 в нашем случае) в секцию {{ic|Device}}:<br />
BusID "PCI:3:0:0"<br />
<br />
{{Note (Русский)|Формат написания очень важен. Значение BusID должно быть указано в таком формате {{ic|"PCI:<BusID>:0:0"}}}}<br />
<br />
Добавьте желаемое значение режима рендеринга SLI в секцию {{ic|Screen}}:<br />
Option "SLI" "AA"<br />
<br />
Следущая таблица описывает доступные режимы рендеринга.<br />
<br />
{| class="wikitable"<br />
! Значение !! Описание<br />
|-<br />
| 0, no, off, false, Single || Использовать только один графический процессор для рендеринга.<br />
|-<br />
| 1, yes, on, true, Auto || Включить SLI и позволить драйверу автоматически выбрать режим рендеринга.<br />
|-<br />
| AFR || Включить SLI и использовать режим поочередного рендеринга кадров.<br />
|-<br />
| SFR || Включить SLI и использовать режим разделённого рендеринга кадров.<br />
|-<br />
| AA || Включить SLI и использовать сглаживание SLI. Используйте в сочетании с полным сглаживанием сцены, для улучшения качества визуализации.<br />
|}<br />
<br />
Другой вариант, вы можете использовать утилиту {{ic|nvidia-xconfig}} для вставки изменений в {{ic|xorg.conf}} одной командой:<br />
# nvidia-xconfig --busid=PCI:3:0:0 --sli=AA<br />
<br />
Для проверки работы режима SLI в консольном режиме:<br />
{{hc|<nowiki>$ nvidia-settings -q all | grep SLIMode</nowiki>|<br />
Attribute 'SLIMode' (arch:0.0): AA <br />
'SLIMode' is a string attribute.<br />
'SLIMode' is a read-only attribute.<br />
'SLIMode' can use the following target types: X Screen.<br />
}}<br />
<br />
{{Warning (Русский)| После включения SLI ваша система может зависать/не отвечать после запуска Xorg. Желательно отключить менеджер входа до перезагрузки.}}<br />
<br />
==== Включение разгона ====<br />
<br />
{{Warning (Русский)|Помните, что разгон может привести к повреждению оборудования и авторы этой страницы снимают с себя любую ответственность за повреждение оборудования, вся информация, в том числе и возможность разгона, указывается изготовителем в спецификации к оборудованию.}}<br />
<br />
Разгон контролируется через опцию ''Coolbits'' в секции {{ic|Device}}, позволяя использовать различные неподдерживаемые свойства:<br />
Option "Coolbits" "''value''"<br />
<br />
{{Tip (Русский)|Опция ''Coolbits'' легко контролируется через ''nvidia-xconfig'', которая может управлять файлами конфигурации Xorg: {{bc|1=# nvidia-xconfig --cool-bits=''value''}}}}<br />
<br />
Значение ''Coolbits'' - сумма его составляющих битов в двоичной системе исчисления. Типы битов:<br />
<br />
* {{ic|1}} (bit 0) - Включает возможность разгона для старых (до архитектуры Fermi) ядер, вкладка ''Clock Frequencies'' в ''nvidia-settings''.<br />
* {{ic|2}} (bit 1) - Когда бит установлен, драйвер "будет пытаться инициализировать режим SLI, когда используются два графических процессора с разным количеством видеопамяти".<br />
* {{ic|4}} (bit 2) - Включает ручное управление охлаждением графического процессора вкладка ''Thermal Monitor'' в ''nvidia-settings''.<br />
* {{ic|8}} (bit 3) - Включает возможность разгона на вкладке ''PowerMizer'' в ''nvidia-settings''. Доступна с версии 337.12 для архитектур Fermi и новее. [http://www.phoronix.com/scan.php?px=MTY1OTM&page=news_item]<br />
* {{ic|16}} (bit 4) - Включает возможность повышения напряжения через параметры командной строки ''nvidia-settings''. Доступна с версии 337.12 для архитектур Fermi и новее.[http://www.phoronix.com/scan.php?page=news_item&px=MTg0MDI]<br />
<br />
Чтобы включить несколько свойств, сложите значения ''Coolbits''. Например, чтобы включить возможности разгона и повышения напряжения для архитектуры Fermi, установите значение {{ic|Option "Coolbits" "24"}}.<br />
<br />
Документация по ''Coolbits'' находится в {{ic|/usr/share/doc/nvidia/html/xconfigoptions.html}}. Последния онлайн-версия документации по ''Coolbits'' (версия драйвера 355.11) находится [ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/xconfigoptions.html тут (англ.)].<br />
<br />
{{Note (Русский)|Также, возможно отредактировать и переписать BIOS графического процессора, используя DOS (предпочтительнее) или с использованием Win32 окружения с помощью [http://www.mvktech.net/component/option,com_remository/Itemid,26/func,select/id,127/orderby,2/page,1/ nvflash]{{Dead link (Русский)|2013|05|25}} и [http://www.mvktech.net/component/option,com_remository/Itemid,26/func,select/id,135/orderby,2/page,1/ NiBiTor 6.0]{{Dead link (Русский)|2013|05|25}}. Преимущество данного способа в том, что вы можете поднять не только напряжение, но и повысить стабильность программных методов разгона, такие как Coolbits. [http://ivanvojtko.blogspot.sk/2014/03/how-to-overclock-geforce-460gtx-fermi.html Руководство по модификации BIOS архитектуры Fermi (англ.)]}}<br />
<br />
===== Настройка статического 2D/3D разгона =====<br />
<br />
Установите следующую строку в секции {{ic|Device}} для включения PowerMizer на максимальную производительность (VSync не будет работать без этой строки):<br />
Option "RegistryDwords" "PerfLevelSrc=0x2222"<br />
<br />
== Советы и подсказки ==<br />
<br />
=== Исправление разрешения терминала ===<br />
Переход с драйвера nouveau будет сопровождаться низким разрешением экрана терминала при загрузке. Для загрузчика GRUB, обратитесь к [[GRUB/Tips and tricks#Setting the framebuffer resolution]], чтобы увеличить разрешение.<br />
<br />
=== Включение Pure Video HD (VDPAU/VAAPI) ===<br />
<br />
{{Merge (Русский)|VDPAU|Оставить только специфику и объединить с общей информаций в основной статье.}}<br />
<br />
'''Аппаратные требования:''' <br />
<br />
Как миниум, видеокарта с вторым поколением PureVideo HD [http://en.wikipedia.org/wiki/Nvidia_PureVideo#Table_of_PureVideo_.28HD.29_GPUs].<br />
<br />
'''Программные требования:'''<br />
<br />
Видеокарты Nvidia с установленым проприетарным драйвером будут предоставлять декодирование видео, совместимое с интерфейсом VDPAU в различных вариантах, в зависимости от поколения PureVideo.<br />
<br />
Вы можете также добавить поддержку интерфейса VA-API с помощью {{Pkg|libva-vdpau-driver}}.<br />
<br />
Проверка подержки VA-API:<br />
$ vainfo<br />
<br />
Для получения всех преимуществ апаратного декодирования вашей видеокарты, вам необходим медиаплеер с поддержкой VDPAU или VA-API.<br />
<br />
Для включения аппаратного ускорения в [[MPlayer]] добавьте в {{ic|~/.mplayer/config}}<br />
<br />
vo=vdpau<br />
vc=ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,ffh264vdpau,ffodivxvdpau,<br />
<br />
{{Warning (Русский)|Кодек {{ic|ffodivxvdpau}} поддерживается только в последних сериях видеокарт NVIDIA. Данный пример рассматривается, без учета специфики вашего оборудования.}}<br />
<br />
Для включения аппаратного ускорения в [[VLC]] перейдите:<br />
<br />
{{ic|Инструменты > Настройки > Ввод/кодеки}}, теперь выберите {{ic|VDPAU}} в меню {{ic|'''Декодирование с аппаратным ускорением'''}}<br />
<br />
Для включения аппаратного ускорения в '''smplayer''' перейдите:<br />
<br />
{{ic|Настройки > Настройки > Основные > вкладка Видео}}, теперь выберите {{ic|vdpau}} в меню {{ic|'''Устройство вывода'''}}<br />
<br />
Для включения аппаратного ускорения в '''gnome-mplayer''' перейдите:<br />
<br />
{{ic|Правка > Параметры}}, теперь выберите в меню {{ic|'''Вывод видео'''}} значение {{ic|vdpau}}<br />
<br />
'''Просмотр HD видео на картах с малым количеством памяти:'''<br />
<br />
Если ваша видеокарта имеет мало памяти (>512MB?), вы можете столкнуться с глюками при просмотре видео в разрешениях 1080p или 720p.<br />
Чтобы этого избежать, запускайте простые менеджеры окон типа TWM или MWM.<br />
<br />
Также может помочь увеличение размера кэша MPlayer в {{ic|~/.mplayer/config}}, когда ваш жёсткий диск останавливается при просмотре HD видео.<br />
<br />
=== Избежание разрывов изображения (тьюринга) в KDE (KWin) ===<br />
<br />
{{hc|/etc/profile.d/kwin.sh|<nowiki><br />
export __GL_YIELD="USLEEP"<br />
</nowiki>}}<br />
<br />
Если вышеуказанная строка не поможет, попробуйте заменить на это:<br />
{{hc|/etc/profile.d/kwin.sh|<nowiki><br />
export KWIN_TRIPLE_BUFFER=1<br />
</nowiki>}}<br />
<br />
<br />
Не включайте обе вышеуказанные опции одновременно.<br />
Также, если вы включили тройную буферизацию, убедитесь что включена опция TripleBuffering в самом драйвере.<br />
Источник: https://bugs.kde.org/show_bug.cgi?id=322060<br />
<br />
=== Аппартное ускорение декодирования видео с помощью XvMC ===<br />
<br />
Ускорение декодирования видео MPEG-1 и MPEG-2 через [[XvMC]] поддерживается на сериях видеокарт GeForce4, GeForce 5 FX, GeForce 6 и GeForce 7. Чтобы использовать его, создайте новый файл {{ic|/etc/X11/XvMCConfig}} с следующим содержимым:<br />
libXvMCNVIDIA_dynamic.so.1<br />
<br />
Смотрите примеры конфигураций [[XvMC#Supported software|поддерживаемого програмного обеспечения]].<br />
<br />
=== Использование ТВ-выхода ===<br />
<br />
Хорошая статья об этом есть [http://en.wikibooks.org/wiki/NVidia/TV-OUT тут].<br />
<br />
=== X на ТВ (DFP) как основной экран ===<br />
<br />
Сервер X откатывается к CRT-0, если нет автоматически определённого монитора. Это может стать проблемой при использовании подключения ТВ через DVI как основной монитор, и сервер X был запущен при выключенном ТВ или он был не подключен.<br />
<br />
Для принудительного использования DFP драйвером NVIDIA, сохраните копию EDID в файловой системе там, где его сможет прочитать сервер X, вместо чтения EDID с ТВ/DFP.<br />
<br />
Для получения EDID запустите nvidia-settings. Появится различная информация в древовидном формате, игнорируя все настройки выберите графический процессор (соответствующее поле должно называться "GPU-0" или быть похожим на него), щелкните по {{ic|DFP}} секции (также возможно {{ic|DFP-0}} или что-то похожее), нажмите на кнопку {{ic|Acquire Edid}} и сохраните куда-нибудь, например в {{ic|/etc/X11/dfp0.edid}}.<br />
<br />
Если у вас не подключена мышь и клавиатура, EDID может быть получен из командной строки. Запустите сервер X с нужным логированием для вывода блока EDID:<br />
$ startx -- -logverbose 6<br />
После окончания иницализации сервера X закройте его, ваш лог файл сохранится в {{ic|/var/log/Xorg.0.log}}. Извлеките блок EDID используя nvidia-xconfig:<br />
$ nvidia-xconfig --extract-edids-from-file=/var/log/Xorg.0.log --extract-edids-output-file=/etc/X11/dfp0.bin<br />
<br />
Отредактируйте {{ic|xorg.conf}} добавив в секцию {{ic|Device}} строки:<br />
Option "ConnectedMonitor" "DFP"<br />
Option "CustomEDID" "DFP-0:/etc/X11/dfp0.edid"<br />
Опция {{ic|ConnectedMonitor}} принуждает драйвер распознавать DFP так, как буд-то он подключен. {{ic|CustomEDID}} предоставляет данные EDID для устройства и говорит, что при загрузке ТВ/DFP как бы был подключен во время процесса запуска X.<br />
<br />
Таким образом, можно автоматически запускать менеджер экрана при загрузке, иметь рабочий и настроенный экран для X до включения питания ТВ.<br />
<br />
Если вышеуказанные изменения не работают, в {{ic|xorg.conf}} в секции {{ic|Device}} вы можете попробовать удалить строку {{ic|Option "ConnectedMonitor" "DFP"}} и добавить следующие строки:<br />
Option "ModeValidation" "NoDFPNativeResolutionCheck"<br />
Option "ConnectedMonitor" "DFP-0"<br />
<br />
Опция драйвера NVIDIA {{ic|NoDFPNativeResolutionCheck}} предотвращает отключение всех режимов, которые не подходят к основному разрешению. <br />
<br />
=== Проверка источника питания ===<br />
<br />
Драйвер NVIDIA может также использовать графический процессор для определения источника питания. Чтобы увидеть текущий источник питания, проверьте параметр 'GPUPowerSource' (0 - сеть, 1 - батарея):<br />
<br />
{{hc|$ nvidia-settings -q GPUPowerSource -t|1}}<br />
<br />
{{Accuracy (Русский)|Остальная часть статьи не имеет смысла - нужен acpid или нет, советы противоречат друг другу.|Talk:NVIDIA#Check power source (acpid)}}<br />
<br />
Если вы видите сообщение об ошибке похожее на то что указано ниже, тогда вам необходимо или установить [[acpid]] или запустить systemd сервис {{ic|systemctl start acpid.service}} если он уже установлен<br />
ACPI: failed to connect to the ACPI event daemon; the daemon<br />
may not be running or the "AcpidSocketPath" X<br />
configuration option may not be set correctly. When the<br />
ACPI event daemon is available, the NVIDIA X driver will<br />
try to use it to receive ACPI event notifications. For<br />
details, please see the "ConnectToAcpid" and<br />
"AcpidSocketPath" X configuration options in Appendix B: X<br />
Config Options in the README.<br />
(Если вы не видите этой ошибки, вам нет необходимости ставить/запускать acpid. Источник питания должен определяться даже если не установлен acpid.)<br />
<br />
=== Отображение температуры графического процессора в оболочке ===<br />
<br />
==== Метод 1 - nvidia-settings ====<br />
<br />
{{Note (Русский)|Данный метод требует наличия сервера X. Используйте второй или третий метод если X сервер вам не нужен. Также, третий метод не работает с новыми картами NVIDIA, такими как GeForce 200 series, и с интегрированными графическими решениями, такими как Zotac IONITX's 8800GS.}}<br />
<br />
Для отображения температуры графического ядра в оболочке используйте {{ic|nvidia-settings}} как указано ниже:<br />
$ nvidia-settings -q gpucoretemp<br />
<br />
Вывод должен быть примерно такой:<br />
Attribute 'GPUCoreTemp' (hostname:0.0): 41.<br />
'GPUCoreTemp' is an integer attribute.<br />
'GPUCoreTemp' is a read-only attribute.<br />
'GPUCoreTemp' can use the following target types: X Screen, GPU.<br />
<br />
Температура графического процессора этой платы 41 °C.<br />
<br />
Пример того, как получить значение температуры для использования в утилитах {{ic|rrdtool}} или {{ic|conky}} и др.:<br />
{{hc|$ nvidia-settings -q gpucoretemp -t|41}}<br />
<br />
==== Метод 2 - nvidia-smi ====<br />
<br />
{{ic|nvidia-smi}} может читать температуру прямо с графического процессора без использования сервера X. Это важно для небольшой группы пользователей, которые не имеют запущенного сервера X, те, кто используют ОС для серверных приложений.<br />
Отображение температуры графического процессора с использованием nvidia-smi:<br />
<br />
$ nvidia-smi<br />
<br />
Пример вывода результата работы программы:<br />
{{hc|$ nvidia-smi|<nowiki><br />
Fri Jan 6 18:53:54 2012 <br />
+------------------------------------------------------+ <br />
| NVIDIA-SMI 2.290.10 Driver Version: 290.10 | <br />
|-------------------------------+----------------------+----------------------+<br />
| Nb. Name | Bus Id Disp. | Volatile ECC SB / DB |<br />
| Fan Temp Power Usage /Cap | Memory Usage | GPU Util. Compute M. |<br />
|===============================+======================+======================|<br />
| 0. GeForce 8500 GT | 0000:01:00.0 N/A | N/A N/A |<br />
| 30% 62 C N/A N/A / N/A | 17% 42MB / 255MB | N/A Default |<br />
|-------------------------------+----------------------+----------------------|<br />
| Compute processes: GPU Memory |<br />
| GPU PID Process name Usage |<br />
|=============================================================================|<br />
| 0. ERROR: Not Supported |<br />
+-----------------------------------------------------------------------------+<br />
</nowiki>}}<br />
<br />
Только температура:<br />
{{hc|$ nvidia-smi -q -d TEMPERATURE|<nowiki><br />
<br />
==============NVSMI LOG==============<br />
<br />
Timestamp : Sun Apr 12 08:49:10 2015<br />
Driver Version : 346.59<br />
<br />
Attached GPUs : 1<br />
GPU 0000:01:00.0<br />
Temperature<br />
GPU Current Temp : 52 C<br />
GPU Shutdown Temp : N/A<br />
GPU Slowdown Temp : N/A<br />
<br />
</nowiki>}}<br />
<br />
Пример того, как получить значение температуры для использования в утилитах {{ic|rrdtool}} или {{ic|conky}} и др.:<br />
<br />
{{hc|<nowiki>$ nvidia-smi -q -d TEMPERATURE | awk '/GPU Current Temp/ {print $5}'</nowiki>|52}}<br />
<br />
Ссылка на руководство: http://www.question-defense.com/2010/03/22/gpu-linux-shell-temp-get-nvidia-gpu-temperatures-via-linux-cli.<br />
<br />
==== Метод 3 - nvclock ====<br />
<br />
Используйте {{AUR|nvclock}}, который доступен в [[AUR]].<br />
{{Note (Русский)|{{ic|nvclock}} не может получить доступ к тепловому сенсору на картах NVIDIA новее Geforce 200 series.}}<br />
<br />
Могут быть расхождения значений температуры между nvclock и nvidia-settings/nv-control. В соответствии с [http://sourceforge.net/projects/nvclock/forums/forum/67426/topic/1906899 этим сообщением] от автора (thunderbird) nvclock, значения выдаваемые nvclock более точные.<br />
<br />
=== Утсановка скорости вентилятора при входе ===<br />
<br />
{{Poor writing (Русский)|Ссылка [[#Включение разгона]] для описания всех опций ''Coolbits''.}}<br />
<br />
Вы можете выставить скорость вентилятора вашей графической карты с помощью консольного интерфейса ''nvidia-settings''. Сначала убедитесь в том, что в вашем конфигурационом файле Xorg значения опции Coolbits установлены в {{ic|4}}, {{ic|5}} или {{ic|12}} для архитектуры Ферми и выше в секции {{ic|Device}} для включения управления скоростью вентилятора.<br />
<br />
Option "Coolbits" "4"<br />
<br />
{{Note (Русский)|Для карт GeForce 400/500 series, на текущий момент, этот метод при входе не устанавливает скорость вентилятора. Также, этот метод только позволяет настраивать скорость вентилятора только для текущей сессии X через nvidia-settings.}}<br />
<br />
Поместите следующую строку в ваш файл [[xinitrc]] для управления вентилятором при запуске Xorg. Замените {{ic|''n''}} на значение скорости вентилятора нужное вам в процентах.<br />
<br />
nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUCurrentFanSpeed=''n''"<br />
<br />
Также вы можете указать и второй графический процессор, путем увеличения счетчика графического процесора и вентилятора.<br />
<br />
nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUCurrentFanSpeed=''n''" \<br />
-a "[gpu:1]/GPUFanControlState=1" -a [fan:1]/GPUCurrentFanSpeed=''n''" &<br />
<br />
Если вы ипользуете менеджер входа такой как GDM или KDM, вы можете создать файл настроек. Создайте {{ic|~/.config/autostart/nvidia-fan-speed.desktop}} и вставьте следующий текст.Снова измените {{ic|''n''}} на значение скорости вентилятора нужное вам в процентах.<br />
<br />
[Desktop Entry]<br />
Type=Application<br />
Exec=nvidia-settings -a "[gpu:0]/GPUFanControlState=1" -a "[fan:0]/GPUCurrentFanSpeed=''n''"<br />
X-GNOME-Autostart-enabled=true<br />
Name=nvidia-fan-speed<br />
<br />
{{Note (Русский)|С версии драйвера 349.16, опция {{ic|GPUCurrentFanSpeed}} заменена на {{ic|GPUTargetFanSpeed}}. [https://devtalk.nvidia.com/default/topic/821563/linux/can-t-control-fan-speed-with-beta-driver-349-12/post/4526208/#4526208]}}<br />
<br />
=== Порядок установки/удаления при смене драйвера ===<br />
<br />
{{Expansion (Русский)|Не понятно, что эти шаги дают, нужны уточнения.}}<br />
<br />
Здесь указаны старый драйвер как nvidiaO и новый драйвер как nvidiaN.<br />
<br />
*удаляем nvidiaO<br />
*устанавливаем nvidia-libglN<br />
*устанавливаем nvidiaN<br />
*устанавливаем lib32-nvidia-libgl-N (если требуется)<br />
<br />
=== Переключение между драйверами NVIDIA и nouveau ===<br />
<br />
Если вам необходимо переключение между драйверами, вы можете использовать следующий скрипт, запуская его от root (для всех подтверждений, отвечайте да):<br />
<br />
{{bc|1=<nowiki><br />
#!/bin/bash<br />
BRANCH= # Enter a branch if needed, i.e. -340xx or -304xx<br />
NVIDIA=nvidia${BRANCH} # If no branch entered above this would be "nvidia"<br />
NOUVEAU=xf86-video-nouveau<br />
<br />
# Replace -R with -Rs to if you want to remove the unneeded dependencies<br />
if [ $(pacman -Qqs ^mesa-libgl$) ]; then<br />
pacman -S $NVIDIA ${NVIDIA}-libgl # Add lib32-${NVIDIA}-libgl and ${NVIDIA}-lts if needed<br />
# pacman -R $NOUVEAU<br />
elif [ $(pacman -Qqs ^${NVIDIA}$) ]; then<br />
pacman -S --needed $NOUVEAU mesa-libgl # Add lib32-mesa-libgl if needed<br />
pacman -R $NVIDIA # Add ${NVIDIA}-lts if needed<br />
fi<br />
</nowiki>}}<br />
<br />
=== Как избежать разрывов/тьюринга на картах GeForce 500/600/700/900 series === <br />
<br />
Разрывов можно избежать принудительным включением цепочки полного композитинга, независимо от используего вами композитора. Для проверки работоспособности опции, выполните<br />
nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"<br />
Вам будет сообщено, что производительность некоторых приложений OpenGL может быть снижена.<br />
<br />
Для постоянного использования сделанных изменений, вам необходимо добавить следующую строку в секцию {{ic|"Screen"}} вашего конфигурационного файла Xorg, например {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}}:<br />
Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"<br />
<br />
Если у вас нет конфигурационного файла Xorg, вы можете создать его для текущей видеокарты исполльзуя {{ic|nvidia-xconfig}} (смотрите [[#Автоматическая настройка]]) и переместить его из {{ic|/etc/X11/xorg.conf}} в более удобное место {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}}.<br />
<br />
== Возможные проблемы ==<br />
<br />
=== Игры при использовании TwinView ===<br />
<br />
В случае, если вы хотите играть в игры в полноэкранном режиме используя TwinView, вы должны учитывать, что игры распознают два экрана как один большой. С технической точки зрения это утверждение корректно (виртуальный размер экрана X из комбинации ваших экранов), скорее всего вы не захотите играть на двух экранах одновременно.<br />
<br />
Для исправления данного поведния для SDL, попробуйте:<br />
export SDL_VIDEO_FULLSCREEN_HEAD=1<br />
<br />
Для OpenGL, добавьте подходящие режимы в ваш файл xorg.conf в секцию {{ic|Device}} и перезапустите сервер X:<br />
Option "Metamodes" "1680x1050,1680x1050; 1280x1024,1280x1024; 1680x1050,NULL; 1280x1024,NULL;"<br />
<br />
Есть ещё другой способ который, может работать как отдельно, так и в сочетании с вышеупомянутым способом, это [[Gaming#Starting_games_in_a_separate_X_server|запуск игр в разделеных серверах X]].<br />
<br />
=== Вертикальная синхронизация при использовании TwinView ===<br />
<br />
Если вы используете TwinView и вертикальную синхронизацию (опция "Sync to VBlank" в '''nvidia-settings'''), вы заметите, что только один экран снихронизируется должным образом, если у вас два одинаковых монитора. Несмотря на то, что '''nvidia-settings''' даёт возможность изменять какой экран должен быть синхронизирован (опция "Sync to this display device"), это не всегда работает. Как решение, добавьте следующие переменные окружения при загрузке, на пример в файл {{ic|/etc/profile}}:<br />
<br />
export __GL_SYNC_TO_VBLANK=1<br />
export __GL_SYNC_DISPLAY_DEVICE=DFP-0<br />
export __VDPAU_NVIDIA_SYNC_DISPLAY_DEVICE=DFP-0<br />
<br />
Вы можете изменить {{ic|DFP-0}} на нужный вам тип экрана ({{ic|DFP-0}} это DVI порт и {{ic|CRT-0}} это VGA порт).Вы можете найти идентификатор вашего монитора в '''nvidia-settings''', секция "X Server XVideoSettings".<br />
<br />
=== Wayland (gdm) рушится после установки nvidia-libgl ===<br />
<br />
В некоторых процессорах Intel устаревший микрокод может привести к нестабильности работы с Wayland когда установлен драйвер nvidia, вызывая крах gdm.<br />
<br />
[[Microcode#Updating Microcode|Обновление микрокода]] должно решить проблему.<br />
<br />
=== Старые настройки Xorg ===<br />
<br />
При обновлении с предыдущей установки, пожалуйста удалите старые пути {{ic|/usr/X11R6/}}, т.к. это может привести к проблемам при установки.<br />
<br />
=== Поврежденный экран: проблема "Шести экранов" ===<br />
<br />
Некоторые пользователи, использующие GeForce GT 100M, могут столкнуться с повреждением экрана при запуске X, разделенным на 6 секций с ограниченным разрешением в 640x480. Похожая проблема недавно была замечена с Quadro 2000 и мониторами высокого разрешения.<br />
<br />
Для решения проблемы, укажите значение {{ic|NoTotalSizeCheck}} режима проверки в разделе {{ic|Device}}:<br />
Section "Device"<br />
...<br />
Option "ModeValidation" "NoTotalSizeCheck"<br />
...<br />
EndSection<br />
<br />
=== '/dev/nvidia0' input/output error ===<br />
<br />
{{Accuracy|Verify that the BIOS related suggestions work and are not coincidentally set while troubleshooting.|section='/dev/nvidia0' Input/Output error... suggested fixes}}<br />
This error can occur for several different reasons, and the most common solution given for this error is to check for group/file permissions, which in almost every case is ''not'' the problem. The NVIDIA documentation does not talk in detail on what you should<br />
do to correct this problem but there are a few things that have worked for some people. The problem can be a IRQ conflict with another device or bad routing by either the kernel or your BIOS.<br />
<br />
First thing to try is to remove other video devices such as video capture cards and see if the problem goes away. If there are too many video processors on the same system it can lead into the kernel being unable to start them because of memory allocation problems with the video controller. In particular on systems with low video memory this can occur even if there is only one video processor. In such case you should find out the amount of your system's video memory (e.g. with {{ic|lspci -v}}) and pass allocation parameters to the kernel, e.g. for a 32-bit kernel:<br />
vmalloc=384M<br />
<br />
If running a 64bit kernel, a driver defect can cause the NVIDIA module to fail initializing when IOMMU is on. Turning it off in the BIOS has been confirmed to work for some users. [http://www.nvnews.net/vbulletin/showthread.php?s=68bb2fabadcb53b10b286aa42d13c5bc&t=159335][[User:Clickthem#nvidia module]]<br />
<br />
Another thing to try is to change your BIOS IRQ routing from {{ic|Operating system controlled}} to {{ic|BIOS controlled}} or the other way around. The first one can be passed as a kernel parameter:<br />
PCI=biosirq<br />
<br />
The {{ic|noacpi}} kernel parameter has also been suggested as a solution but since it disables ACPI completely it should be used with caution. Some hardware are easily damaged by overheating.<br />
<br />
{{Note|The kernel parameters can be passed either through the kernel command line or the bootloader configuration file. See your bootloader Wiki page for more information.}}<br />
<br />
=== Ошибки '/dev/nvidiactl' ===<br />
<br />
При запуске OpenGL приложений может возникнуть ошибка:<br />
Error: Could not open /dev/nvidiactl because the permissions are too<br />
restrictive. Please see the {{ic|FREQUENTLY ASKED QUESTIONS}} <br />
section of {{ic|/usr/share/doc/NVIDIA_GLX-1.0/README}} <br />
for steps to correct.<br />
<br />
Решением, будет добавление нужного пользователя в группу {{ic|video}}, после этот нужно перезайти:<br />
# gpasswd -a username video<br />
<br />
=== Не запускаются 32-битные приложения ===<br />
<br />
В 64-битных системах, установка пакета {{ic|lib32-nvidia-libgl}}, который имеет ту же версию, что и установленный 64-битный драйвер решит проблему.<br />
<br />
=== Ошибки после обновления ядра ===<br />
<br />
Если вы используете самосборный модуль NVIDIA вместо пакета из репозитория ''extra'', то требуется пересборка пакета каждый раз после обновления ядра. Рекомендуется перезагрузка после обновления ядра и графических драйверов.<br />
<br />
=== Crashing in general ===<br />
<br />
* Try disabling {{ic|RenderAccel}} in xorg.conf.<br />
* If Xorg outputs an error about "conflicting memory type" or "failed to allocate primary buffer: out of memory", add {{ic|nopat}} at the end of the {{ic|kernel}} line in {{ic|/boot/grub/menu.lst}}.<br />
* If the NVIDIA compiler complains about different versions of GCC between the current one and the one used for compiling the kernel, add in {{ic|/etc/profile}}:<br />
export IGNORE_CC_MISMATCH=1<br />
* If Xorg is crashing with a "Signal 11" while using nvidia-96xx drivers, try disabling PAT. Pass the argument {{ic|nopat}} to [[kernel parameters]].<br />
More information about troubleshooting the driver can be found in the [https://forums.geforce.com/ NVIDIA forums.]<br />
<br />
=== Bad performance after installing a new driver version ===<br />
<br />
If FPS have dropped in comparison with older drivers, first check if direct rendering is turned on (glxinfo is included in {{Pkg|mesa-demos}}):<br />
$ glxinfo | grep direct<br />
If the command prints:<br />
direct rendering: No<br />
then that could be an indication for the sudden FPS drop.<br />
<br />
A possible solution could be to regress to the previously installed driver version and rebooting afterwards.<br />
<br />
=== CPU spikes with 400 series cards ===<br />
<br />
If you are experiencing intermittent CPU spikes with a 400 series card, it may be caused by PowerMizer constantly changing the GPU's clock frequency. Switching PowerMizer's setting from Adaptive to Performance, add the following to the {{ic|Device}} section of your Xorg configuration:<br />
<br />
Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x3322; PowerMizerDefaultAC=0x1"<br />
<br />
=== Laptops: X hangs on login/out, worked around with Ctrl+Alt+Backspace ===<br />
<br />
If, while using the legacy NVIDIA drivers, Xorg hangs on login and logout (particularly with an odd screen split into two black and white/gray pieces), but logging in is still possible via {{ic|Ctrl+Alt+Backspace}} (or whatever the new "kill X" key binding is), try adding this in {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
options nvidia NVreg_Mobile=1<br />
<br />
One user had luck with this instead, but it makes performance drop significantly for others:<br />
options nvidia NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=33 NVreg_DeviceFileMode=0660 NVreg_SoftEDIDs=0 NVreg_Mobile=1<br />
<br />
Note that {{ic|NVreg_Mobile}} needs to be changed according to the laptop:<br />
* 1 for Dell laptops.<br />
* 2 for non-Compal Toshiba laptops.<br />
* 3 for other laptops.<br />
* 4 for Compal Toshiba laptops.<br />
* 5 for Gateway laptops.<br />
<br />
See [ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/README.txt NVIDIA Driver's README: Appendix K] for more information.<br />
<br />
=== No screens found on a laptop/NVIDIA Optimus ===<br />
<br />
On a laptop, if the NVIDIA driver cannot find any screens, you may have an NVIDIA Optimus setup : an Intel chipset connected to the screen and the video outputs, and a NVIDIA card that does all the hard work and writes to the chipset's video memory.<br />
<br />
Check if {{ic|<nowiki>$ lspci | grep VGA</nowiki>}}<br />
outputs something similar to:<br />
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)<br />
01:00.0 VGA compatible controller: nVidia Corporation Device 0df4 (rev a1)<br />
<br />
NVIDIA drivers now offer Optimus support since 319.12 Beta [[http://www.nvidia.com/object/linux-display-amd64-319.12-driver.html]] with kernels above and including 3.9.<br />
<br />
Another solution is to install the [[Intel]] driver to handle the screens, then if you want 3D software you should run them through [[Bumblebee]] to tell them to use the NVIDIA card.<br />
<br />
==== Possible Workaround ====<br />
<br />
Enter the BIOS and changed the default graphics setting from 'Optimus' to 'Discrete' and the install NVIDIA drivers (295.20-1 at time of writing) recognized the screens.<br />
<br />
Steps:<br />
# Enter BIOS.<br />
# Find Graphics Settings (should be in tab ''Config > Display'').<br />
# Change 'Graphics Device' to 'Discrete Graphics' (Disables Intel integrated graphics).<br />
# Change OS Detection for Nvidia Optimus to "Disabled".<br />
# Save and exit.<br />
<br />
Tested on a Lenovo W520 with a Quadro 1000M and Nvidia Optimus<br />
<br />
=== Screen(s) found, but none have a usable configuration ===<br />
<br />
Sometimes NVIDIA and X have trouble finding the active screen. If your graphics card has multiple outputs try plugging your monitor into the other ones. On a laptop it may be because your graphics card has vga/tv outs. Xorg.0.log will provide more info.<br />
<br />
Another thing to try is adding invalid {{ic|"ConnectedMonitor" Option}} to {{ic|Section "Device"}}<br />
to force Xorg throws error and shows you how correct it.<br />
[ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/xconfigoptions.html Here]<br />
more about ConnectedMonitor setting.<br />
<br />
After re-run X see Xorg.0.log to get valid CRT-x,DFP-x,TV-x values.<br />
<br />
{{ic|nvidia-xconfig --query-gpu-info}} could be helpful.<br />
<br />
=== Blackscreen at X startup with new driver ===<br />
<br />
If you have installed an update of Nvidia and you screen stay black after launching Xorg. You have to use the {{ic|<nowiki>rcutree.rcu_idle_gp_delay=1</nowiki>}} [[kernel parameter]].<br />
<br />
You can also try to add the {{ic|nvidia}} module directly to your [[mkinitcpio]] config file.<br />
<br />
If the screen still stays black with '''both''' the {{ic|<nowiki>rcutree.rcu_idle_gp_delay=1</nowiki>}} [[kernel parameter]] and the {{ic|nvidia}} module directly in the [[mkinitcpio]] config file, try re-installing {{Pkg|nvidia}} and {{Pkg|nvidia-libgl}} in that order, and finally reload the driver:<br />
<br />
# modprobe nvidia<br />
<br />
=== Backlight is not turning off in some occasions ===<br />
<br />
By default, DPMS should turn off backlight with the timeouts set or by running xset. However, probably due to a bug in the proprietary Nvidia drivers the result is a blank screen with no powersaving whatsoever. To workaround it, until the bug has been fixed you can use the {{ic|vbetool}} as root.<br />
<br />
Install the {{Pkg|vbetool}} package.<br />
<br />
Turn off your screen on demand and then by pressing a random key backlight turns on again:<br />
<br />
vbetool dpms off && read -n1; vbetool dpms on<br />
<br />
Alternatively, xrandr is able to disable and re-enable monitor outputs without requiring root.<br />
<br />
xrandr --output DP-1 --off; read -n1; xrandr --output DP-1 --auto<br />
<br />
=== Blue tint on videos with Flash ===<br />
<br />
A problem with {{Pkg|flashplugin}} versions 11.2.202.228-1 and 11.2.202.233-1 causes it to send the U/V panes in the incorrect order resulting in a blue tint on certain videos. There are a few potential fixes for this bug:<br />
<br />
# Install the latest {{Pkg|libvdpau}}.<br />
# Patch {{ic|vdpau_trace.so}} with [https://bbs.archlinux.org/viewtopic.php?pid=1078368#p1078368 this makepkg].<br />
# Right click on a video, select "Settings..." and uncheck "Enable hardware acceleration". Reload the page for it to take affect. Note that this disables GPU acceleration.<br />
# [[Downgrade]] the {{Pkg|flashplugin}} package to version 11.1.102.63-1 at most.<br />
# Use {{AUR|google-chrome}} with the new Pepper API {{AUR|chromium-pepper-flash}}.<br />
# Try one of the few Flash alternatives.<br />
<br />
The merits of each are discussed in [https://bbs.archlinux.org/viewtopic.php?id=137877 this thread].<br />
<br />
=== Bleeding overlay with Flash ===<br />
<br />
This bug is due to the incorrect colour key being used by the {{Pkg|flashplugin}} version 11.2.202.228-1 and causes the flash content to "leak" into other pages or solid black backgrounds. To avoid this problem simply install the latest {{Pkg|libvdpau}} or export {{ic|1=VDPAU_NVIDIA_NO_OVERLAY=1}} within either your shell profile (E.g. {{ic|~/.bash_profile}} or {{ic|~/.zprofile}}) or {{ic|~/.xinitrc}}<br />
<br />
=== Full system freeze using Flash ===<br />
<br />
If you experience occasional full system freezes (only the mouse is moving) using flashplugin<br />
and get:<br />
<br />
{{hc|/var/log/errors.log|<br />
NVRM: Xid (0000:01:00): 31, Ch 00000007, engmask 00000120, intr 10000000<br />
}}<br />
<br />
A possible workaround is to switch off Hardware Acceleration in Flash, setting<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
EnableLinuxHWVideoDecode=0<br />
}}<br />
<br />
Or, if you want to keep Hardware acceleration enabled, you may try to::<br />
export VDPAU_NVIDIA_NO_OVERLAY=1<br />
<br />
...before starting the browser.<br />
Note that this may introduce tearing.<br />
<br />
=== Xorg fails to load or Red Screen of Death ===<br />
<br />
If you get a red screen and use GRUB disable the GRUB framebuffer by editing {{ic|/etc/default/grub}} and uncomment GRUB_TERMINAL_OUTPUT. For more information see [[GRUB#Disable_framebuffer|GRUB]].<br />
<br />
=== Black screen on systems with Intel integrated GPU ===<br />
<br />
If you have an Intel CPU with an integrated GPU (e.g. Intel HD 4000) and have installed the {{Pkg|nvidia}} package, you may experience a black screen on boot, when changing virtual terminal, or when exiting an X session. This may be caused by a conflict between the graphics modules. This is solved by blacklisting the Intel GPU modules. Create the file {{ic|/etc/modprobe.d/blacklist.conf}} and prevent the ''i915'' and ''intel_agp'' modules from loading on boot:<br />
<br />
{{hc|/etc/modprobe.d/blacklist.conf|<br />
install i915 /usr/bin/false<br />
install intel_agp /usr/bin/false<br />
}}<br />
<br />
=== Black screen on systems with VIA integrated GPU ===<br />
<br />
As above, blacklisting the ''viafb'' module may resolve conflicts with NVIDIA drivers:<br />
<br />
{{hc|/etc/modprobe.d/blacklist.conf|<br />
install viafb /usr/bin/false<br />
}}<br />
<br />
=== X fails with "no screens found" with Intel iGPU ===<br />
<br />
Like above, if you have an Intel CPU with an integrated GPU and X fails to start with <br />
<br />
[ 76.633] (EE) No devices detected.<br />
[ 76.633] Fatal server error:<br />
[ 76.633] no screens found<br />
<br />
then you need to add your discrete card's BusID to your X configuration. Find it:<br />
<br />
{{hc|<nowiki># lspci | grep VGA</nowiki>|<br />
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09)<br />
01:00.0 VGA compatible controller: NVIDIA Corporation GK107 [GeForce GTX 650] (rev a1)<br />
}}<br />
<br />
then you fix it by adding it to the card's Device section in your X configuration. In my case:<br />
<br />
{{hc|/etc/X11/xorg.conf.d/10-nvidia.conf|<br />
Section "Device"<br />
Identifier "Device0"<br />
Driver "nvidia"<br />
VendorName "NVIDIA Corporation"<br />
BusID "PCI:1:0:0"<br />
EndSection<br />
}}<br />
<br />
Note how {{ic|01:00.0}} is written as {{ic|1:0:0}}.<br />
<br />
=== Xorg fails during boot, but otherwise starts fine ===<br />
<br />
On very fast booting systems, systemd may attempt to start the display manager before the NVIDIA driver has fully initialized. You will see a message like the following in your logs only when Xorg runs during boot.<br />
{{hc|/var/log/Xorg.0.log|output=<br />
[ 1.807] (EE) NVIDIA(0): Failed to initialize the NVIDIA kernel module. Please see the<br />
[ 1.807] (EE) NVIDIA(0): system's kernel log for additional error messages and<br />
[ 1.808] (EE) NVIDIA(0): consult the NVIDIA README for details.<br />
[ 1.808] (EE) NVIDIA(0): *** Aborting ***<br />
}}<br />
In this case you will need to establish an ordering dependency from the display manager to the DRI device. First create device units for DRI devices by creating a new udev rules file.<br />
{{hc|/etc/udev/rules.d/99-systemd-dri-devices.rules|output=<br />
ACTION=="add", KERNEL=="card*", SUBSYSTEM=="drm", TAG+="systemd"<br />
}}<br />
Then create dependencies from the display manager to the device(s).<br />
{{hc|/etc/systemd/system/display-manager.service.d/10-wait-for-dri-devices.conf|output=<br />
[Unit]<br />
Wants=dev-dri-card0.device<br />
After=dev-dri-card0.device<br />
}}<br />
If you have additional cards needed for the desktop then list them in Wants and After seperated by spaces.<br />
<br />
=== Flash video players crashes ===<br />
<br />
If you are getting frequent crashes of Flash video players, try to switch off Hardware Acceleration:<br />
<br />
{{hc|/etc/adobe/mms.cfg|2=<br />
EnableLinuxHWVideoDecode=0<br />
}}<br />
<br />
(This problem appeared after installing the proprietary nvidia driver, and was fixed by changing this setting.)<br />
<br />
=== Override EDID ===<br />
<br />
If your monitor is providing wrong EDID information, the nvidia-driver will pick a very small solution.<br />
Nvidia's driver options change, this guide refers to nvidia 346.47-11.<br />
<br />
Aside from manually setting modelines in the xorg config, you have to allow non-edid modes and disable edid in the device section:<br />
<br />
{{hc|/etc/X11/xorg.conf.d/10-monitor.conf|2=<br />
Section "Monitor"<br />
Identifier "Monitor0"<br />
VendorName "Unknown"<br />
ModelName "Unknown"<br />
HorizSync 30-94<br />
VertRefresh 56-76<br />
DisplaySize 518.4 324.0<br />
Option "DPMS"<br />
# 1920x1200 59.95 Hz (CVT 2.30MA-R) hsync: 74.04 kHz; pclk: 154.00 MHz<br />
Modeline "1920x1200R" 154.00 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync<br />
EndSection<br />
<br />
Section "Device"<br />
Identifier "Device0"<br />
Driver "nvidia"<br />
VendorName "NVIDIA Corporation"<br />
Option "UseEdidFreqs" "FALSE"<br />
Option "UseEDID" "FALSE"<br />
Option "ModeValidation" "AllowNonEdidModes"<br />
EndSection<br />
<br />
Section "Screen"<br />
Identifier "Screen0"<br />
Device "Device0"<br />
Monitor "Monitor0"<br />
DefaultDepth 24<br />
SubSection "Display"<br />
Depth 24<br />
Modes "1920x1200R"<br />
EndSubSection<br />
EndSection<br />
}}<br />
<br />
=== Fix rendering lag (firefox, gedit, vim, tmux …) ===<br />
nvidia-settings -a InitialPixmapPlacement=0<br />
<br />
https://bugzilla.gnome.org/show_bug.cgi?id=728464<br />
<br />
=== Screen Tearing with Multiple Monitor Orientations ===<br />
<br />
When running multiple monitors in different orientations (through [[Xrandr]] settings) such as portrait and landscape simultaneously, you may notice screen tearing in one of the orientations/monitors. Unfortunately, this issue is fixed by setting all monitors to the same orientation via [[Xrandr]] settings<br />
<br />
== See also ==<br />
<br />
* [https://forums.geforce.com/ NVIDIA User forums]<br />
* [ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/README.txt Official README for NVIDIA drivers, all on one text page. Most Recent Driver Version as of September 7, 2015: 355.11.]<br />
* [ftp://download.nvidia.com/XFree86/Linux-x86/355.11/README/xconfigoptions.html README Appendix B. X Config Options, 355.11 (direct link)]</div>Niasar