https://wiki.archlinux.org/api.php?action=feedcontributions&user=Hirion&feedformat=atomArchWiki - User contributions [en]2024-03-29T05:31:19ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=KVM&diff=177345KVM2012-01-07T18:37:58Z<p>Hirion: </p>
<hr />
<div>[[Category:Virtualization]]<br />
{{i18n|KVM}}<br />
<br />
'''KVM''', Kernel-based Virtual Machine, is a hypervisor built right into the 2.6 (and 3.X) Linux kernel for kernels newer than 2.6.20. It is similar to [[Xen]] in purpose but much simpler to get running. To start using the hypervisor, just load the appropriate {{Ic|kvm}} kernel modules and the hypervisor is up. As with Xen's full virtualization, in order for KVM to work, you must have a processor that supports Intel's VT-x extensions or AMD's AMD-V extensions.<br />
<br />
Using KVM, one can run multiple virtual machines running unmodified GNU/Linux, Windows, or any other operating system. (See [http://www.linux-kvm.org/page/Guest_Support_Status Guest Support Status]). Each virtual machine has private virtualized hardware: a network card, disk, graphics adapter, etc. See [http://www.linux-kvm.org/page/HOWTO KVM Howto]<br />
<br />
Differences among KVM, Xen, VMware, and QEMU can be found at the [http://www.linux-kvm.org/page/FAQ#General_KVM_information KVM FAQ].<br />
<br />
=== Get the packages ===<br />
<br />
Arch Linux kernels >= 2.6.22 provide the appropriate [[Kernel_modules|kernel modules]] to support KVM.<br />
You can check if your kernel supports KVM with the following command:<br />
modprobe -l 'kvm*'<br />
<br />
KVM requires that the virtual machine host's processor has virtualization support. You can check whether your processor supports hardware virtualization with the following command:<br />
grep -E "(vmx|svm)" --color=always /proc/cpuinfo<br />
If nothing is displayed after running that command, then your processor does ''not'' support hardware virtualization, and you will ''not'' be able to use QEMU-KVM.<br />
<br />
KVM also requires a modified QEMU to launch and manage virtual machines. You can choose one of the following according to your needs:<br />
<br />
1. The {{Package Official|qemu-kvm}} package is available in the [[Official Repositories|official repositories]] ''(recommended)''.<br />
<br />
2. If you also need to use QEMU, you can choose to install {{Package Official|qemu}} >= 0.9.0 instead, which conflicts with the {{Package Official|qemu-kvm}} package. However, {{Package Official|qemu}} now provides a {{Ic|qemu-kvm}} executable ({{Ic|qemu -enable-kvm}}) that takes advantage of this technology.<br />
<br />
=== Setup kernel modules ===<br />
<br />
First, you need to add your user account into the {{Ic|kvm}} group to use the {{Filename|/dev/kvm}} device.<br />
gpasswd -a <Your_Login_Name> kvm<br />
<br />
Secondly, you have to choose one of the following depending on the manufacturer of your CPU.<br />
<br />
1. If you have Intel's VT-x extensions, modprobe the {{Ic|kvm}} and {{Ic|kvm-intel}} modules.<br />
modprobe kvm<br />
modprobe kvm-intel<br />
<br />
2. If you have AMD's AMD-V (code name "Pacifica") extensions, modprobe the {{Ic|kvm}} and {{Ic|kvm-amd}} modules.<br />
modprobe kvm<br />
modprobe kvm-amd<br />
<br />
If modprobing {{Ic|kvm}} succeeds, but modprobing {{Ic|kvm-intel}} or {{Ic|kvm-amd}} fails (but {{Filename|/proc/cpuinfo}} claims that hardware acceleration is supported), check your BIOS settings. Some vendors (especially laptop vendors) disable these processor extensions by default.<br />
<br />
If you want these modules to persist, add them to {{Filename|/etc/rc.conf}} or {{Filename|/etc/mkinitcpio.conf}}.<br />
<br />
=== How to use KVM ===<br />
<br />
# Create a guest OS image: {{bc|$ qemu-img create -f qcow2 <Image_Name> <size> }}<br />
# Install the guest OS:<br>A CD/DVD image (ISO file) can be used for the installation. {{bc|$ qemu-kvm -hda <Image_Name> -m 512 -cdrom /path/to/the/ISO/image -boot d -vga std }}<br />
# Running the system: {{bc|$ qemu-kvm -hda <Image_Name> -m 512 -vga std}}<br />
<br />
{{Note|The default amount of main memory assigned to KVM guests is 128 MB. If that is not sufficient, add the {{Ic|-m}} argument and the desired amount of main memory specified in megabytes (e.g. {{Ic|-m 1024}}). Also note that recent Windows operating systems (tested with Windows Vista and Windows 7) require the {{Ic|qcow2}} disk image format. Other disk image formats may give a 0x80070057 error during the installation.}}<br />
<br />
See '''[[QEMU]]''' for more information, and the ''[[QEMU#Using_the_Kernel-based_Virtual_Machine|Using the Kernel-based Virtual Machine]]'' section.<br />
<br />
=== Paravirtualized guests (virtio) ===<br />
<br />
KVM offers guests the ability to use paravirtualized block and network devices, which leads to better performance and lower overhead.<br />
Linux has had this ability with its virtio-modules since kernel 2.6.25.<br />
For Windows, a paravirtualized network driver can be obtained here: [http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers]<br />
<br />
A virtio block device requires the option {{Ic|-drive}} instead of the simple {{Ic|-hd*}} plus {{Ic|<nowiki>if=virtio</nowiki>}}:<br />
$ qemu-kvm -drive file=drive.img,if=virtio,boot=on<br />
(ps: {{Ic|<nowiki>boot=on</nowiki>}} is absolutely required when you want to boot from it. There is no auto-detection as with {{Ic|-hd*}} ...)<br />
<br />
Almost the same goes for the network:<br />
$ qemu-kvm -net nic,model=virtio<br />
<br />
==== Preparing an (Arch) Linux guest ====<br />
<br />
To use virtio devices after an Arch Linux guest has been installed, the following modules can be loaded in the guest: {{Ic|virtio}}, {{Ic|virtio_pci}}, {{Ic|virtio_blk}}, {{Ic|virtio_net}}, and {{Ic|virtio_ring}} (for 32-bit guests, the specific "virtio" module is not necessary).<br />
<br />
If you want to boot from a virtio disk, the initial ramdisk must be [[mkinitcpio|rebuilt]]. Add the appropriate modules in {{Filename|/etc/mkinitcpio.conf}} like this:<br />
MODULES="virtio_blk virtio_pci virtio_net"<br />
and rebuild the initial ramdisk:<br />
# mkinitcpio -p linux<br />
<br />
Virtio disks are recognized with the prefix '''''v''''' (e.g. ''v''da, ''v''db, etc.); therefore, changes must be made in at least {{Filename|/etc/fstab}} and {{Filename|/boot/grub/menu.lst}} when booting from a virtio disk. When using grub-pc which references disks by [[Persistent_block_device_naming#By-uuid|UUID's]], nothing has to be done.<br />
<br />
Edit or create {{Filename|/boot/grub/device.map}}:<br />
(hd0) /dev/vda<br />
<br />
{{Note|The following may be outdated since a new official installation ISO has been released (2011.08.19).}}<br />
To enable virtio at Arch Linux installation time, manual GRUB installation is required (for arch-release-media 2010.05)<br />
Though AIF correctly detects the virtio disks and sets up the right prefixes, the {{Filename|/boot/grub/device.map}} file must be created before configuring the bootloader.<br />
<br />
So when installing Arch Linux, you can install GRUB by switching to another virtual terminal ({{Keypress|Ctrl+Alt+F2}}) and running the following commands.<br />
# grub<br />
> device (hd0) /dev/vda<br />
> root (hd0,0)<br />
> setup (hd0)<br />
> quit<br />
<br />
{{Note|(hd0,0) numbering may change depending on your configuration. Reference: http://lists.mandriva.com/bugs/2009-08/msg03424.php}}<br />
<br />
Once you have installed GRUB, switch back to the main terminal with {{Keypress|Ctrl+Alt+F1}}.<br />
<br />
Further information on paravirtualization with KVM can be found here:<br />
[http://www.linux-kvm.org/page/Boot_from_virtio_block_device]<br />
section in the German qemu-book: [http://qemu-buch.de/de/index.php/QEMU-KVM-Buch/_Virtuelle_Hardware/_Paravirtualisierte_Ger%C3%A4tetreiber]<br />
<br />
==== Preparing a Windows guest ====<br />
<br />
Preparing a Windows guest for running with a virtio disk driver is a bit tricky.<br />
<br />
In your KVM host (running Arch Linux), download the virtio disk driver from the [http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers Fedora repository].<br />
<br />
Now you need to create a new disk image, which fill force Windows to search for the driver. To do it, stop the virtual machine if its running and issue the following command:<br />
qemu-img create -f qcow2 fake.img 1G<br />
Run the original Windows guest (still in the IDE mode). Add the fake disk and a CD-ROM with the driver.<br />
qemu-kvm -drive file=windows.img,if=ide,boot=on -m 512 -drive file=fake.img,if=virtio -cdrom virtio-win-0.1-15.iso -vga std<br />
<br />
Windows will detect the fake disk and try to find a driver for it. If it fails, go to Device Manager, locate the SCSI drive with an exclamation mark icon (should be open), click "Update driver" and browse for the proper directory on the virtual CD-ROM.<br />
<br />
When the installation is successful, you can turn off the virtual machine and launch it again, now with the {{Ic|virtio}} driver.<br />
<br />
qemu-kvm -drive file=windows.img,if=virtio,boot=on -m 512 -vga std<br />
<br />
{{Note|If you encounter the Blue Screen of Death, make sure you did not forget the {{Ic|-m}} parameter.}}<br />
<br />
=== Resizing the image ===<br />
<br />
It is possible to increase the size of a qcow2 image later, at least with ext3. Convert it to a raw image, expand its size with dd, convert it back to qcow2, replace the partition with a larger one, do a {{Ic|fsck}} and resize the filesystem.<br />
<br />
$ qemu-img convert -O raw image.qcow2 image.img<br />
$ dd if=/dev/zero of=image.img bs=1G count=0 seek=[NUMBER_OF_GB]<br />
$ qemu-img convert -O qcow2 -o cluster_size=64K image.img imageplus.qcow2<br />
$ qemu-kvm -hda imageplus.qcow2 -m 512 -cdrom </Path/to/the/ISO/Image> -boot d -vga std<br />
$ fdisk /dev/sda [delete the partition, create new one occupying whole disk]<br />
$ e2fsck -f /dev/sda1<br />
$ resize2fs /dev/sda1<br />
<br />
=== Enabling KSM ===<br />
Kernel Samepage Merging (KSM) is a feature of the Linux kernel introduced in the 2.6.32 kernel. KSM allows for an application to register with the kernel to have its pages merged with other processes that also register to have their pages merged. For KVM, the KSM mechanism allows for guest virtual machines to share pages with each other. In an environment where many of the guest operating systems are similar, this can result in significant memory savings.<br />
<br />
To enable KSM, first ensure that you have installed {{Package Official|qemu-kvm}} >= 0.12.0.<br />
# pacman -Qi qemu-kvm | grep Version<br />
Version : 0.15.0-2<br />
Also ensure that your kernel is at least version 2.6.32.<br />
# uname -r<br />
3.0-ARCH<br />
If this is the case there should be a {{Filename|/sys/kernel/mm/ksm/}} directory containing several files. You can turn KSM on or off by echoing a 1 or 0 to {{Filename|/sys/kernel/mm/ksm/run}}.<br />
# echo 1 > /sys/kernel/mm/ksm/run<br />
If KSM is running, and there are pages to be merged (i.e. more than one similar VM is running), then {{Filename|/sys/kernel/mm/ksm/pages_shared}} should be non-zero. From the kernel documentation in {{Filename|Documentation/vm/ksm.txt}}:<br />
The effectiveness of KSM and MADV_MERGEABLE is shown in /sys/kernel/mm/ksm/:<br />
<br />
pages_shared - how many shared unswappable kernel pages KSM is using<br />
pages_sharing - how many more sites are sharing them i.e. how much saved<br />
pages_unshared - how many pages unique but repeatedly checked for merging<br />
pages_volatile - how many pages changing too fast to be placed in a tree<br />
full_scans - how many times all mergeable areas have been scanned<br />
<br />
A high ratio of pages_sharing to pages_shared indicates good sharing, but<br />
a high ratio of pages_unshared to pages_sharing indicates wasted effort.<br />
pages_volatile embraces several different kinds of activity, but a high<br />
proportion there would also indicate poor use of madvise MADV_MERGEABLE.<br />
<br />
An easy way to see how well KSM is performing is to simply print the contents of all the files in that directory.<br />
<br />
# for ii in /sys/kernel/mm/ksm/* ; do echo -n "$ii: " ; cat $ii ; done<br />
/sys/kernel/mm/ksm/full_scans: 151<br />
/sys/kernel/mm/ksm/max_kernel_pages: 246793<br />
/sys/kernel/mm/ksm/pages_shared: 92112<br />
/sys/kernel/mm/ksm/pages_sharing: 131355<br />
/sys/kernel/mm/ksm/pages_to_scan: 100<br />
/sys/kernel/mm/ksm/pages_unshared: 123942<br />
/sys/kernel/mm/ksm/pages_volatile: 1182<br />
/sys/kernel/mm/ksm/run: 1<br />
/sys/kernel/mm/ksm/sleep_millisecs: 20<br />
<br />
=== Easy to Use for New User ===<br />
If the {{Package Official|qemu}} package has been installed, you can use a GUI tool, such as {{Package Official|qtemu}} for simple use or {{Package Official|qemu-launcher}} for particle control, to manage your virtual machine.<br />
<br />
You need to change {{Ic|qemu}} in the configure item "QEMU start command" to {{Ic|qemu-kvm}} or leave the "QEMU start command" as {{Ic|qemu}} and append {{Ic|-enable-kvm}} to the additional start options. With newer versions of {{Package Official|qemu}}, it might not be necessary to append {{Ic|-enable-kvm}} as the {{Ic|qemu}} executable will detect that KVM is running and start in the correct mode.<br />
<br />
If you start your VM with a GUI tool and installation is '''very slow''', you should check for proper KVM support, as QEMU may be falling back to pure software emulation.<br />
<br />
=== Bridged Networking ===<br />
<br />
See also [[QEMU#Tap_Networking_with_QEMU]] and [[QEMU#Networking_with_VDE2]].<br />
<br />
First, install the {{Package Official|bridge-utils}} package.<br />
<br />
Save this script in {{Filename|/etc/qemu-ifup}}:<br />
<br />
#!/bin/bash<br />
if [ ! $1 ]; then<br />
echo -e "Usage: qemu-ifup <interface>\n qemu-ifup eth0" && exit<br />
fi<br />
echo "Executing /etc/qemu-ifup"<br />
echo "Bringing up $1 for bridged mode..."<br />
sudo /sbin/ifconfig $1 0.0.0.0 promisc up<br />
echo "Adding $1 to br0..."<br />
sudo /usr/sbin/brctl addif br0 $1<br />
sleep 2<br />
<br />
{{Ic|chmod}} the script to 755:<br />
chmod 755 /etc/qemu-ifup<br />
<br />
Then use this script to start KVM. Adjust the {{Ic|ARGS}} line to suit your requirements.<br />
<br />
#!/bin/sh<br />
ARGS="-hda win2k.img -boot c -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/etc/qemu-ifup -m 256 -localtime"<br />
echo "Starting QEMU with..."<br />
echo $ARGS<br />
echo "...."<br />
exec qemu $ARGS<br />
<br />
Now the VM should get an IP address from your DHCP server and you can access it using that IP address from your LAN.<br />
<br />
If you are using {{Package Official|iptables}}, it is recommended for performance and security reasons to disable the firewall on the bridge:<br />
# cat >> /etc/sysctl.conf <<EOF<br />
net.bridge.bridge-nf-call-ip6tables = 0<br />
net.bridge.bridge-nf-call-iptables = 0<br />
net.bridge.bridge-nf-call-arptables = 0<br />
EOF<br />
# sysctl -p /etc/sysctl.conf<br />
<br />
See the [http://wiki.libvirt.org/page/Networking#Creating_network_initscripts libvirt wiki] and [https://bugzilla.redhat.com/show_bug.cgi?id=512206 Fedora bug 512206]<br />
<br />
Alternatively, you can configure {{Package Official|iptables}} to allow all traffic to be forwarded across the bridge by adding a rule like this:<br />
-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT<br />
<br />
=== Mouse integration ===<br />
To prevent the mouse from being grabbed when clicking on the guest operating system's windows, add the option {{Ic|-usbdevice tablet}}. This means QEMU is able to report the mouse position without having to grab the mouse. This also overrides PS/2 mouse emulation when activated.<br />
$ qemu-kvm -hda <Image_Name> -m 512 -vga std -usbdevice tablet<br />
<br />
=== Mounting the QEMU image ===<br />
<br />
modprobe nbd max_part=63<br />
qemu-nbd -c /dev/nbd0 [image.img]<br />
mount /dev/nbd0p1 [/mnt/qemu]<br />
<br />
=== Starting KVM virtual machines on boot up===<br />
<br />
If you use virt-manager and virsh as your VM tools then this is very simple. At the commandline to set a VM to autostart:<br />
<br />
virsh autostart <domain><br />
<br />
To disable autostarting:<br />
<br />
virsh autostart --disable <domain><br />
<br />
Virt-manager is equally easy having an autostart check box in the boot options of the VM.<br />
<br />
Note VMs started by QEMU or KVM from the command line are not then manageable by virt-manager. <br />
<br />
For an alternative check here: [[QEMU#Starting_QEMU_virtual_machines_on_boot]]<br />
<br />
=== Tips/Tricks ===<br />
==== Poor Man's Networking ====<br />
<br />
Setting up bridged networking can be a bit of a hassle sometimes. If the sole purpose of the VM is experimentation, one strategy to connect the host and the guests is to use SSH tunneling.<br />
<br />
The basic steps are as follows:<br />
* Setup an SSH server in the host OS<br />
* (optional) Create a designated user used for the tunneling (e.g. tunneluser)<br />
* Install SSH in the VM<br />
* Setup authentication<br />
<br />
See: [[SSH]] for the setup of SSH, especially [[SSH#Forwarding_Other_Ports]]<br />
<br />
When using the default user network stack, the host is reachable at address 10.0.2.2.<br />
<br />
If everything works and you can SSH into the host, simply add something like the following to your /etc/rc.local<br />
# Local SSH Server<br />
echo "Starting SSH tunnel"<br />
sudo -u vmuser ssh tunneluser@10.0.2.2 -N -R 2213:127.0.0.1:22 -f<br />
# Random remote port (e.g. from another VM)<br />
echo "Starting random tunnel"<br />
sudo -u vmuser ssh tunneluser@10.0.2.2 -N -L 2345:127.0.0.1:2345 -f<br />
<br />
In this example a tunnel is created to the SSH server of the VM and an arbitrary port of the host is pulled into the VM.<br />
<br />
This is a quite basic strategy to do networking with VMs. However, it is very robust and should be quite sufficient most of the time.</div>Hirionhttps://wiki.archlinux.org/index.php?title=GRUB_Legacy&diff=77181GRUB Legacy2009-10-04T18:57:26Z<p>Hirion: /* Alternative way to find the resolution code */</p>
<hr />
<div>[[Category:Boot process (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers various aspects of Arch Linux's default bootloader, GRand Unified Bootloader (GRUB).}}<br />
<br />
{{Article summary heading|Available in languages}}<br />
{{i18n_entry|English|GRUB}}<br />
{{i18n_entry|עברית|GRUB (עברית)}}<br />
{{i18n_entry|简体中文|GRUB(简体中文)}}<br />
{{i18n_entry|Русский|GRUB (Русский)}}<br />
{{i18n_entry|Español|GRUB (Español)}}<br />
{{i18n_entry|Français|GRUB (Français)}}<br />
{{i18n_entry|Italiano|GRUB (Italiano)}}<br />
{{i18n_entry|Nederlands|GRUB (Nederlands)}}<br />
{{Article summary heading|Related articles}}<br />
{{Article summary wiki|Reinstalling GRUB}}<br />
{{Article summary wiki|Grub configure examples}}<br />
{{Article summary wiki|Grub-gfx}}<br />
{{Article summary end}}<br />
<br />
<br />
<br />
<br />
<br />
== Installing Grub package ==<br />
<br />
First install grub with pacman<br />
<br />
pacman -Sy grub<br />
<br />
Edit the menu.lst with your settings<br />
<br />
nano /boot/grub/menu.lst<br />
<br />
''Note: Use hd[a-z] for ide and sd[a-z] for scsi and sata''<br />
<br />
Here is mine for example:<br />
<br />
# Config file for GRUB - The GNU GRand Unified Bootloader<br />
# /boot/grub/menu.lst<br />
<br />
# DEVICE NAME CONVERSIONS <br />
#<br />
# Linux Grub<br />
# -------------------------<br />
# /dev/fd0 (fd0)<br />
# /dev/hda (hd0)<br />
# /dev/hdb2 (hd1,1)<br />
# /dev/hda3 (hd0,2)<br />
#<br />
<br />
# FRAMEBUFFER RESOLUTION SETTINGS<br />
# +-------------------------------------------------+<br />
# | 640x480 800x600 1024x768 1280x1024<br />
# ----+--------------------------------------------<br />
# 256 | 0x301=769 0x303=771 0x305=773 0x307=775<br />
# 32K | 0x310=784 0x313=787 0x316=790 0x319=793<br />
# 64K | 0x311=785 0x314=788 0x317=791 0x31A=794<br />
# 16M | 0x312=786 0x315=789 0x318=792 0x31B=795<br />
# +-------------------------------------------------+<br />
<br />
# general configuration:<br />
timeout 5<br />
default 1<br />
color light-blue/black light-cyan/blue<br />
<br />
# boot sections follow<br />
# each is implicitly numbered from 1 in the order of appearance below<br />
#<br />
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.<br />
#<br />
#-*<br />
<br />
# (0) Arch Linux<br />
title Arch Linux [cpio]<br />
root (hd0,0)<br />
kernel /boot/vmlinuz26 root=/dev/sda6 ro vga=773<br />
initrd /boot/kernel26.img<br />
<br />
title Arch Linux [thinkpad]<br />
root (hd0,0)<br />
kernel /boot/vmlinuz26thinkpad root=/dev/sda6 ro video=vesafb:off acpi_sleep=s3_bios<br />
resume=swap:/dev/sda5<br />
initrd /boot/kernel26thinkpad.img<br />
<br />
Copy the mounts to mtab<br />
<br />
grep -v rootfs /proc/mounts > /etc/mtab<br />
<br />
== Installing or Restoring GRUB to the Master Boot Record ==<br />
GRUB may be installed from a live environment, or directly from a running Arch install.<br />
<br />
In either case, boot the system and run the '''grub''' command as root:<br />
# grub<br />
Grub must be told where its files are on the system, since multiple instances of it may exist. The grub files reside under /boot, which may be its own partition. If you know where /boot is, specify it with the '''root''' command like so:<br />
grub> root (hdx,x)<br />
(remember that /boot is GRUB's root)<br />
<br />
If you are unaware of the the location of /boot, use the '''find''' command to locate the GRUB files. <br />
<br />
The following example is for systems ''without'' a separate /boot partition, wherein /boot is merely a directory under / :<br />
grub> find /boot/grub/stage1<br />
The following example is for systems ''with'' a separate /boot partition:<br />
grub> find /grub/stage1<br />
<br />
Grub will find the file, and give an output showing the location of the stage1 file, (which resides under /boot). For example:<br />
(hd1,0)<br />
Use the root command, (with the output from the find command) to instruct GRUB which partition contains stage1, (and therefore, /boot):<br />
grub> root (hd1,0)<br />
Finally, (re)install GRUB to the MBR of the drive. The following example installs GRUB to the MBR of the drive containing /boot:<br />
grub> setup (hd1)<br />
Use the '''quit''' command to quit GRUB:<br />
grub> quit<br />
* Alternative, installing to a partition.<br />
You may, of course, install GRUB anywhere you need it to be.<br />
<br />
For example:<br />
<br />
grub> setup (hd1,0) <br />
will install GRUB to the second harddisk, first partition.<br />
<br />
== Boot loader configuration ==<br />
The grub configuration is done in this file:<br />
/boot/grub/menu.lst<br />
<br />
* <i>(hdn,m)</i> is the partition m on disc n, numbers starting with 0<br />
* <i>splashimage (hdn,m)/grub/Name.xpm.gz</i> is the splash-image-file<br />
* <i>default n</i> is the default boot entry, that is choosen after timout for user action<br />
* <i>timeout m</i> time m to wait in seconds for a user selection, before default is booted<br />
* <i>password -md5 str</i> encrypted boot password 'str'<br />
* <i>title str</i> title string 'str' for a boot entry<br />
* <i>root (hdn,m)</i> base partition, where the kernel is stored to<br />
* <i>kernel /path ro root=/dev/device initrd /initrd.img</i> use the root option, if the kernel not placed in /<br />
* <i>makeactive<br>chainloader +1</i> sets root active and gives booting procedure to its boot-loader (for Windows, f.e.)<br />
* <i>map (hd0) (hd1)<br>map (hd1) (hd0)</i> changes primary and secondary disc for a boot, necessary to boot Windows from a secondary disc<br />
* <i>root (hdn,m,z)<br>kernel /boot/loader</i> boots the FreeBSD-Partition x<br />
* <i>default saved</i> remembers each current boot selection and makes it the new default. Place "savedefault" at the end of each boot section, for that you want this feature shall be used.<br />
<br />
For those who like eye-candy, there is [[Graphical GRUB]].<br />
<br />
<br />
=== Dual booting===<br />
These are the two most common ways of configuring the menu.lst file. For more complex uses, click [[Grub configure examples|here]].<br />
====Dual booting with Windows====<br />
Add this at the end of your /boot/grub/menu.lst. This assumes that your Windows partition is [s/h]da2.<br />
<br />
# (2) Windows XP<br />
title Windows XP<br />
rootnoverify (hd0,1)<br />
makeactive<br />
chainloader +1<br />
<br />
Note, that although commonly believed to be the case, Windows 2000 and later versions do not need to be on the first partition to boot. If the Windows partition changes number (i.e. if you after install add a partition before the windows partition), you will need to edit the Windows boot.ini file to reflect the change (see [http://vlaurie.com/computers2/Articles/bootini.htm this article] for details on how to do that).<br />
<br />
====Dual booting with Windows on another hard disk====<br />
Add this at the end of your /boot/grub/menu.lst. This assumes that your Windows partition is [s/h]db1.<br />
<br />
# (2) Windows XP<br />
title Windows XP<br />
map (hd0) (hd1)<br />
map (hd1) (hd0)<br />
rootnoverify (hd1,0)<br />
makeactive<br />
chainloader +1<br />
<br />
The map function tricks your Windows install into thinking that a second hard drive is the primary.<br />
<br />
====Dual booting with other linux distros====<br />
This is done exactly the same way that Arch linux is loaded. Here we assume that the other distro is on partition [s/h]da3.<br />
title Other Linux<br />
root (hd0,2)<br />
kernel /boot/vmlinuz (add other options here as required)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
<br />
====Dual booting with other linux distro (Chainloading)====<br />
To avoid ''maintenance nightmare'', you might want to chainload the GRUB in the MBR to another bootloader you might have installed in the bootrecord of a partition [(hd0,2) in our example] instead of the MBR. This way the auto-magic stuff of some distro will manage the menu.lst on (hd0,2) (if it is grub) for its own distro and you will boot with all the option needed (like the correct last kernel) without the need to copy/paste some part of that menu.lst into yours.<br />
<br />
In our example, GRUB is in the MBR and some other bootloader (BL) (be it grub or lilo) is in the Boot Record of (hd0,2).<br />
-------------------------------------------------<br />
| | | | % (hd0,2) |<br />
| M | | | B % |<br />
| B | (hd0,0) | (hd0,1) | L % Other |<br />
| R | | | % Distro |<br />
| | | | % |<br />
-------------------------------------------------<br />
| ^<br />
| chainloading |<br />
-----------------------------<br />
<br />
Then, you simply use in your menu.lst:<br />
title Other Linux distro<br />
root (hd0,2)<br />
chainloader +1<br />
<br />
<br />
<br />
This, of course, also works the other way around, i.e. if your arch root is in (hd0,2)/sda2 and you chose to install Arch's GRUB there instead of the MBR, because you had installed another distro first, just put the above code in that distros menu.lst.<br />
<br />
<br />
If you want to boot GRUB from a second harddisk, when GRUB is placed in the MBR of this second HDD, your menu.lst has to be like this:<br />
title Second Hard Disk<br />
rootnoverify (hd1)<br />
chainloader +1<br />
<br />
===Tips and tricks===<br />
====Restart with named boot choice====<br />
If you realize that you need to switch to some other non-default OS, e.g. Windows, having to reboot and wait for the GRUB menu to appear is tedious. GRUB offers a simple way to record your OS choice when restarting instead of waiting for the menu, simply by designating a temporary new default which will be reset (to the 'default default') as soon as it has been used.<br />
<br />
Supposing a simple menu.lst setup like this:<br />
<br />
<pre><br />
# general configuration:<br />
timeout 10<br />
default 0<br />
color light-blue/black light-cyan/blue<br />
<br />
# (0) Arch<br />
title Arch Linux<br />
root (hd0,1)<br />
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/a29113d7-2204-49e9-be69-d94699eba466 ro<br />
initrd /boot/kernel26.img<br />
<br />
# (1) Windows<br />
title Microsoft Windows XP Pro<br />
rootnoverify (hd0,0)<br />
makeactive<br />
chainloader +1<br />
</pre><br />
<br />
Arch is the default (0). We want to restart in to Windows. Change default to saved ("default saved") - this will record the current default in a 'default' file in the grub directory whenever the 'savedefault' grub command is used. Now add the line "savedefault 0" to the bottom of the Windows entry. Whenever Windows is booted, it will reset the default to Arch, thus making changing the default to Windows temporary. <br />
<br />
Now all that is needed is a way to easily change the default 'manually'. This can be accomplsihed using the command 'grub-set-default [number of entry (starting with 0)]. So to reboot into Windows, enter the following command:<br />
<br />
sudo grub-set-default 1 && sudo shutdown -r now<br />
<br />
For ease of use, you might to wish to implement the "[[Allow users to shutdown]] fix" (including /sbin/grub-set-default amongst the commands the user is allowed to issue without supplying a password).<br />
<br />
== LiLO and GRUB interaction ==<br />
<br />
If you once had used [[lilo]] Don't forget to remove it with <br />
pacman -R lilo<br />
as some tasks (f.e. kernel compilation using <code>make all</code>) will make a lilo call, and then lilo is installed over grub.<br />
Note that this will not remove lilo from the MBR, but it will be overwritten when you install another bootloader.<br />
<br />
== Framebuffer Resolution ==<br />
<br />
One can use the resolution given in the menu.lst of [[grub]]. But you might want to use your LCD wide-screen at its full native resolution. Here is what you can do to achieve this.<br />
<br />
On [http://en.wikipedia.org/wiki/VESA_BIOS_Extensions#Linux_video_mode_numbers wikipedia], there is a list of extended framebuffer resolution (i.e beyond the ones in the VBE standard). But, for example, the one i want to use is 1440x900 and the vga=867 does not work. May be because those resolution are outside of the standard and every graphic card manufacturer use the code they like.<br />
<br />
So instead of using that table, i suggest using this method:<br />
<br />
=== How to find the correct code to use for the resolution you want to use ===<br />
# Install ''lrmi'' package from the '''[community]''' that has the ''vbetest'' tool (not available for 64bit arch, install [http://aur.archlinux.org/packages.php?ID=14977 hwinfo] '''[AUR]''' instead and run 'hwinfo --vbe').<br />
# Run ''vbetest'' as root and in a '''console''' already running on framebuffer. While ''vbetest'' will return results in a terminal in X, you will not be able to test using <tt>vbetest -m yournumberhere</tt> unless you are running a framebuffered console.<br />
# Then note the number in [ ] corresponding to your desired resolution with ''vbetest''. With ''hwinfo'' the six digits following Mode are the values you'll need.<br />
# Press 'q' to quit ''vbetest'' interactive prompt. <br />
# Add 512 to the discovered ''vbetest value'' for you monitor size and use the total as code to use in <tt>vga=</tt> kernel option in menu.lst. For ''hwinfo'' copy the six digit code to the <tt>vga=</tt> option.<br />
# reboot and voilà !<br />
<br />
{{Box Note |If you want to test the resolution you have just picked up, you can run <tt>vbetest -m yournumberhere</tt> to test the resolution. You will see a checked colored image on your console. It will return to black after some second. If the text of your console is not restored you will have to switch to another console and switch back to have your text restored. (minor glitch)}}<br />
<br />
For example ''vbetest'' on one computer:<br />
[356] 1440x900 (256 color palette)<br />
[357] 1440x900 (8:8:8)<br />
So here the number you want is 357. then, 357 + 512 = 869, so you will use '''vga=869'''. Add your vga value to the end of the kernel line in menu.lst as shown below.<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=869'''<br />
On another desktop with ''hwinfo'':<br />
Mode 0x0364: 1440x900 (+1440), 8 bits<br />
Mode 0x0365: 1440x900 (+5760), 24 bits<br />
And the kernel line:<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=0x0365'''<br />
<br />
Now, you will have a console at the full native resolution of your screen. The next step is to use another font in console at a correct size. In my case i use ''terminus'' font named ter-120b (by setting CONSOLEFONT in /etc/rc.conf)<br />
<br />
'''Note''':<br />
* (8:8:8) is for 24-bit color (or 32-bit ?)<br />
* (5:6:5) is for 16-bit color<br />
* (5:5:5) is for 15-bit color<br />
<br />
=== Alternative way to find the resolution code ===<br />
<br />
This is an easy/dirty way to find the resolution code using only grub itself.<br />
<br />
First specify a resolution code at the kernel line that is probably not recognized, e.g. 900.<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=900'''<br />
<br />
Now reboot. Grub will now - as desired - complain that the resolution code is not recognized and present a list of suitable codes to use and the option to scan for even more.<br />
You can pick the code you would like to use (don't forget it, it is needed for the next step) and boot using it.<br />
The number you have picked here is the '''hexadecimal''' number, in order to use it at the kernel line you can transform it into a '''decimal''' number.<br />
<br />
Now replace the false code in the kernel line with the correct one you have picked.<br />
<br />
E.g. the kernelline for ''[369] 1680x1050x32'' would be:<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=873'''<br />
<br />
== Troubleshooting ==<br />
<br />
===Fixing GRUB Error 17===<br />
If your partition table gets messed up, an unpleasant "GRUB error 17" message might be the only thing that greets you on your next reboot. There are a number of reasons why the partition table could get messed up. Commonly users who manipulate their partitions with [gparted] -- particularly logical drives -- can cause the order of the partitions to change. For example, you delete /dev/sda6 and resize /dev/sda7 a little bit, then finally re-create what used to be /dev/sda6 only now it goes down to the bottom of the list, /dev/sda9 for example. Although the physical order of the partitions/logical drives hasn't changed, the order in which they're recognized is messed up.<br />
<br />
Fixing the partition table is easy. Boot from your Arch CD, login as root and fix the partition table:<br />
<br />
# fdisk /dev/sda<br />
<br />
Once you're in disk, enter e[x]tra/expert mode, [f]ix the partition order, then [w]rite the table and exit. You'll do this by three keys, <br />
{{Keypress|X}}, {{Keypress|F}}, {{Keypress|W}}. Now exit fdisk. <br />
<br />
You can verify that the partition table was indeed fixed by issuing an fdisk -l. Now you just need to fix grub. See the [[http://wiki.archlinux.org/index.php/GRUB#Installing_or_Restoring_GRUB_to_the_Master_Boot_Record Installing_or_Restoring_GRUB_to_the_Master_Boot_Record]] section above.<br />
<br />
Basically you need to tell grub the correct location of your /boot then re-write grub to the MBR on the disk.<br />
<br />
Example on my system:<br />
<br />
# grub<br />
grub> root (hd0.6)<br />
grub> setup (hd0)<br />
grub> quit<br />
<br />
See [[http://stringofthoughts.wordpress.com/2009/05/24/grub-error-17-debianubuntu this page]] for a more in depth summary of this section.<br />
<br />
<br />
===Editing GRUB entries just before boot===<br />
Once you have selected some entry before booting, you can edit it using key 'e' and following on-screen instructions. Then you can boot it using key 'b'. This settings '''will not be saved'''.<br />
<br />
<br />
===Reboot pulldown menu in KDE does not have any effect===<br />
If you've opened a submenu with the list of all operating system configured in grub, selected one and upon restart you still got your default OS, then you might want to check if you have line <br />
<pre><br />
default saved<br />
</pre><br />
in file ''/boot/grub/menu.lst''.<br />
<br />
== External Resources ==<br />
* [http://www.gnu.org/software/grub/ GRUB Website]<br />
* [http://www.troubleshooters.com/linux/grub/index.htm GRUB Grotto- an excellent GRUB resource]<br />
* [http://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt List of kernel parameters that can be used at boot time ]<br />
* [http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ch09.pdf List of kernel paramaters with further explanation and grouped by like options ('Kernel Boot Command-Line Parameter Reference', ''Linux Kernel In A Nutshell'')]</div>Hirionhttps://wiki.archlinux.org/index.php?title=GRUB_Legacy&diff=77180GRUB Legacy2009-10-04T18:54:36Z<p>Hirion: </p>
<hr />
<div>[[Category:Boot process (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers various aspects of Arch Linux's default bootloader, GRand Unified Bootloader (GRUB).}}<br />
<br />
{{Article summary heading|Available in languages}}<br />
{{i18n_entry|English|GRUB}}<br />
{{i18n_entry|עברית|GRUB (עברית)}}<br />
{{i18n_entry|简体中文|GRUB(简体中文)}}<br />
{{i18n_entry|Русский|GRUB (Русский)}}<br />
{{i18n_entry|Español|GRUB (Español)}}<br />
{{i18n_entry|Français|GRUB (Français)}}<br />
{{i18n_entry|Italiano|GRUB (Italiano)}}<br />
{{i18n_entry|Nederlands|GRUB (Nederlands)}}<br />
{{Article summary heading|Related articles}}<br />
{{Article summary wiki|Reinstalling GRUB}}<br />
{{Article summary wiki|Grub configure examples}}<br />
{{Article summary wiki|Grub-gfx}}<br />
{{Article summary end}}<br />
<br />
<br />
<br />
<br />
<br />
== Installing Grub package ==<br />
<br />
First install grub with pacman<br />
<br />
pacman -Sy grub<br />
<br />
Edit the menu.lst with your settings<br />
<br />
nano /boot/grub/menu.lst<br />
<br />
''Note: Use hd[a-z] for ide and sd[a-z] for scsi and sata''<br />
<br />
Here is mine for example:<br />
<br />
# Config file for GRUB - The GNU GRand Unified Bootloader<br />
# /boot/grub/menu.lst<br />
<br />
# DEVICE NAME CONVERSIONS <br />
#<br />
# Linux Grub<br />
# -------------------------<br />
# /dev/fd0 (fd0)<br />
# /dev/hda (hd0)<br />
# /dev/hdb2 (hd1,1)<br />
# /dev/hda3 (hd0,2)<br />
#<br />
<br />
# FRAMEBUFFER RESOLUTION SETTINGS<br />
# +-------------------------------------------------+<br />
# | 640x480 800x600 1024x768 1280x1024<br />
# ----+--------------------------------------------<br />
# 256 | 0x301=769 0x303=771 0x305=773 0x307=775<br />
# 32K | 0x310=784 0x313=787 0x316=790 0x319=793<br />
# 64K | 0x311=785 0x314=788 0x317=791 0x31A=794<br />
# 16M | 0x312=786 0x315=789 0x318=792 0x31B=795<br />
# +-------------------------------------------------+<br />
<br />
# general configuration:<br />
timeout 5<br />
default 1<br />
color light-blue/black light-cyan/blue<br />
<br />
# boot sections follow<br />
# each is implicitly numbered from 1 in the order of appearance below<br />
#<br />
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.<br />
#<br />
#-*<br />
<br />
# (0) Arch Linux<br />
title Arch Linux [cpio]<br />
root (hd0,0)<br />
kernel /boot/vmlinuz26 root=/dev/sda6 ro vga=773<br />
initrd /boot/kernel26.img<br />
<br />
title Arch Linux [thinkpad]<br />
root (hd0,0)<br />
kernel /boot/vmlinuz26thinkpad root=/dev/sda6 ro video=vesafb:off acpi_sleep=s3_bios<br />
resume=swap:/dev/sda5<br />
initrd /boot/kernel26thinkpad.img<br />
<br />
Copy the mounts to mtab<br />
<br />
grep -v rootfs /proc/mounts > /etc/mtab<br />
<br />
== Installing or Restoring GRUB to the Master Boot Record ==<br />
GRUB may be installed from a live environment, or directly from a running Arch install.<br />
<br />
In either case, boot the system and run the '''grub''' command as root:<br />
# grub<br />
Grub must be told where its files are on the system, since multiple instances of it may exist. The grub files reside under /boot, which may be its own partition. If you know where /boot is, specify it with the '''root''' command like so:<br />
grub> root (hdx,x)<br />
(remember that /boot is GRUB's root)<br />
<br />
If you are unaware of the the location of /boot, use the '''find''' command to locate the GRUB files. <br />
<br />
The following example is for systems ''without'' a separate /boot partition, wherein /boot is merely a directory under / :<br />
grub> find /boot/grub/stage1<br />
The following example is for systems ''with'' a separate /boot partition:<br />
grub> find /grub/stage1<br />
<br />
Grub will find the file, and give an output showing the location of the stage1 file, (which resides under /boot). For example:<br />
(hd1,0)<br />
Use the root command, (with the output from the find command) to instruct GRUB which partition contains stage1, (and therefore, /boot):<br />
grub> root (hd1,0)<br />
Finally, (re)install GRUB to the MBR of the drive. The following example installs GRUB to the MBR of the drive containing /boot:<br />
grub> setup (hd1)<br />
Use the '''quit''' command to quit GRUB:<br />
grub> quit<br />
* Alternative, installing to a partition.<br />
You may, of course, install GRUB anywhere you need it to be.<br />
<br />
For example:<br />
<br />
grub> setup (hd1,0) <br />
will install GRUB to the second harddisk, first partition.<br />
<br />
== Boot loader configuration ==<br />
The grub configuration is done in this file:<br />
/boot/grub/menu.lst<br />
<br />
* <i>(hdn,m)</i> is the partition m on disc n, numbers starting with 0<br />
* <i>splashimage (hdn,m)/grub/Name.xpm.gz</i> is the splash-image-file<br />
* <i>default n</i> is the default boot entry, that is choosen after timout for user action<br />
* <i>timeout m</i> time m to wait in seconds for a user selection, before default is booted<br />
* <i>password -md5 str</i> encrypted boot password 'str'<br />
* <i>title str</i> title string 'str' for a boot entry<br />
* <i>root (hdn,m)</i> base partition, where the kernel is stored to<br />
* <i>kernel /path ro root=/dev/device initrd /initrd.img</i> use the root option, if the kernel not placed in /<br />
* <i>makeactive<br>chainloader +1</i> sets root active and gives booting procedure to its boot-loader (for Windows, f.e.)<br />
* <i>map (hd0) (hd1)<br>map (hd1) (hd0)</i> changes primary and secondary disc for a boot, necessary to boot Windows from a secondary disc<br />
* <i>root (hdn,m,z)<br>kernel /boot/loader</i> boots the FreeBSD-Partition x<br />
* <i>default saved</i> remembers each current boot selection and makes it the new default. Place "savedefault" at the end of each boot section, for that you want this feature shall be used.<br />
<br />
For those who like eye-candy, there is [[Graphical GRUB]].<br />
<br />
<br />
=== Dual booting===<br />
These are the two most common ways of configuring the menu.lst file. For more complex uses, click [[Grub configure examples|here]].<br />
====Dual booting with Windows====<br />
Add this at the end of your /boot/grub/menu.lst. This assumes that your Windows partition is [s/h]da2.<br />
<br />
# (2) Windows XP<br />
title Windows XP<br />
rootnoverify (hd0,1)<br />
makeactive<br />
chainloader +1<br />
<br />
Note, that although commonly believed to be the case, Windows 2000 and later versions do not need to be on the first partition to boot. If the Windows partition changes number (i.e. if you after install add a partition before the windows partition), you will need to edit the Windows boot.ini file to reflect the change (see [http://vlaurie.com/computers2/Articles/bootini.htm this article] for details on how to do that).<br />
<br />
====Dual booting with Windows on another hard disk====<br />
Add this at the end of your /boot/grub/menu.lst. This assumes that your Windows partition is [s/h]db1.<br />
<br />
# (2) Windows XP<br />
title Windows XP<br />
map (hd0) (hd1)<br />
map (hd1) (hd0)<br />
rootnoverify (hd1,0)<br />
makeactive<br />
chainloader +1<br />
<br />
The map function tricks your Windows install into thinking that a second hard drive is the primary.<br />
<br />
====Dual booting with other linux distros====<br />
This is done exactly the same way that Arch linux is loaded. Here we assume that the other distro is on partition [s/h]da3.<br />
title Other Linux<br />
root (hd0,2)<br />
kernel /boot/vmlinuz (add other options here as required)<br />
initrd /boot/initrd.img (if the other kernel uses/needs one)<br />
<br />
====Dual booting with other linux distro (Chainloading)====<br />
To avoid ''maintenance nightmare'', you might want to chainload the GRUB in the MBR to another bootloader you might have installed in the bootrecord of a partition [(hd0,2) in our example] instead of the MBR. This way the auto-magic stuff of some distro will manage the menu.lst on (hd0,2) (if it is grub) for its own distro and you will boot with all the option needed (like the correct last kernel) without the need to copy/paste some part of that menu.lst into yours.<br />
<br />
In our example, GRUB is in the MBR and some other bootloader (BL) (be it grub or lilo) is in the Boot Record of (hd0,2).<br />
-------------------------------------------------<br />
| | | | % (hd0,2) |<br />
| M | | | B % |<br />
| B | (hd0,0) | (hd0,1) | L % Other |<br />
| R | | | % Distro |<br />
| | | | % |<br />
-------------------------------------------------<br />
| ^<br />
| chainloading |<br />
-----------------------------<br />
<br />
Then, you simply use in your menu.lst:<br />
title Other Linux distro<br />
root (hd0,2)<br />
chainloader +1<br />
<br />
<br />
<br />
This, of course, also works the other way around, i.e. if your arch root is in (hd0,2)/sda2 and you chose to install Arch's GRUB there instead of the MBR, because you had installed another distro first, just put the above code in that distros menu.lst.<br />
<br />
<br />
If you want to boot GRUB from a second harddisk, when GRUB is placed in the MBR of this second HDD, your menu.lst has to be like this:<br />
title Second Hard Disk<br />
rootnoverify (hd1)<br />
chainloader +1<br />
<br />
===Tips and tricks===<br />
====Restart with named boot choice====<br />
If you realize that you need to switch to some other non-default OS, e.g. Windows, having to reboot and wait for the GRUB menu to appear is tedious. GRUB offers a simple way to record your OS choice when restarting instead of waiting for the menu, simply by designating a temporary new default which will be reset (to the 'default default') as soon as it has been used.<br />
<br />
Supposing a simple menu.lst setup like this:<br />
<br />
<pre><br />
# general configuration:<br />
timeout 10<br />
default 0<br />
color light-blue/black light-cyan/blue<br />
<br />
# (0) Arch<br />
title Arch Linux<br />
root (hd0,1)<br />
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/a29113d7-2204-49e9-be69-d94699eba466 ro<br />
initrd /boot/kernel26.img<br />
<br />
# (1) Windows<br />
title Microsoft Windows XP Pro<br />
rootnoverify (hd0,0)<br />
makeactive<br />
chainloader +1<br />
</pre><br />
<br />
Arch is the default (0). We want to restart in to Windows. Change default to saved ("default saved") - this will record the current default in a 'default' file in the grub directory whenever the 'savedefault' grub command is used. Now add the line "savedefault 0" to the bottom of the Windows entry. Whenever Windows is booted, it will reset the default to Arch, thus making changing the default to Windows temporary. <br />
<br />
Now all that is needed is a way to easily change the default 'manually'. This can be accomplsihed using the command 'grub-set-default [number of entry (starting with 0)]. So to reboot into Windows, enter the following command:<br />
<br />
sudo grub-set-default 1 && sudo shutdown -r now<br />
<br />
For ease of use, you might to wish to implement the "[[Allow users to shutdown]] fix" (including /sbin/grub-set-default amongst the commands the user is allowed to issue without supplying a password).<br />
<br />
== LiLO and GRUB interaction ==<br />
<br />
If you once had used [[lilo]] Don't forget to remove it with <br />
pacman -R lilo<br />
as some tasks (f.e. kernel compilation using <code>make all</code>) will make a lilo call, and then lilo is installed over grub.<br />
Note that this will not remove lilo from the MBR, but it will be overwritten when you install another bootloader.<br />
<br />
== Framebuffer Resolution ==<br />
<br />
One can use the resolution given in the menu.lst of [[grub]]. But you might want to use your LCD wide-screen at its full native resolution. Here is what you can do to achieve this.<br />
<br />
On [http://en.wikipedia.org/wiki/VESA_BIOS_Extensions#Linux_video_mode_numbers wikipedia], there is a list of extended framebuffer resolution (i.e beyond the ones in the VBE standard). But, for example, the one i want to use is 1440x900 and the vga=867 does not work. May be because those resolution are outside of the standard and every graphic card manufacturer use the code they like.<br />
<br />
So instead of using that table, i suggest using this method:<br />
<br />
=== How to find the correct code to use for the resolution you want to use ===<br />
# Install ''lrmi'' package from the '''[community]''' that has the ''vbetest'' tool (not available for 64bit arch, install [http://aur.archlinux.org/packages.php?ID=14977 hwinfo] '''[AUR]''' instead and run 'hwinfo --vbe').<br />
# Run ''vbetest'' as root and in a '''console''' already running on framebuffer. While ''vbetest'' will return results in a terminal in X, you will not be able to test using <tt>vbetest -m yournumberhere</tt> unless you are running a framebuffered console.<br />
# Then note the number in [ ] corresponding to your desired resolution with ''vbetest''. With ''hwinfo'' the six digits following Mode are the values you'll need.<br />
# Press 'q' to quit ''vbetest'' interactive prompt. <br />
# Add 512 to the discovered ''vbetest value'' for you monitor size and use the total as code to use in <tt>vga=</tt> kernel option in menu.lst. For ''hwinfo'' copy the six digit code to the <tt>vga=</tt> option.<br />
# reboot and voilà !<br />
<br />
{{Box Note |If you want to test the resolution you have just picked up, you can run <tt>vbetest -m yournumberhere</tt> to test the resolution. You will see a checked colored image on your console. It will return to black after some second. If the text of your console is not restored you will have to switch to another console and switch back to have your text restored. (minor glitch)}}<br />
<br />
For example ''vbetest'' on one computer:<br />
[356] 1440x900 (256 color palette)<br />
[357] 1440x900 (8:8:8)<br />
So here the number you want is 357. then, 357 + 512 = 869, so you will use '''vga=869'''. Add your vga value to the end of the kernel line in menu.lst as shown below.<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=869'''<br />
On another desktop with ''hwinfo'':<br />
Mode 0x0364: 1440x900 (+1440), 8 bits<br />
Mode 0x0365: 1440x900 (+5760), 24 bits<br />
And the kernel line:<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=0x0365'''<br />
<br />
Now, you will have a console at the full native resolution of your screen. The next step is to use another font in console at a correct size. In my case i use ''terminus'' font named ter-120b (by setting CONSOLEFONT in /etc/rc.conf)<br />
<br />
'''Note''':<br />
* (8:8:8) is for 24-bit color (or 32-bit ?)<br />
* (5:6:5) is for 16-bit color<br />
* (5:5:5) is for 15-bit color<br />
<br />
=== Alternative way to find the resolution code ===<br />
<br />
This is an easy/dirty way to find the resolution code using only grub itself.<br />
<br />
First specify a resolution code at the kernel line that is probably not recognized, e.g. 900.<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=900'''<br />
<br />
Now reboot. Grub will now - as desired - complain that the resolution code is not recognized and present a list of suitable codes to use and the option to scan for even more.<br />
You can pick the code you would like to use (don't forget it, it is needed for the next step) and boot using it.<br />
The number you have picked here is the '''hexadecimal''' number, in order to use it at the kernel line you have can transform it into a '''decimal''' number.<br />
<br />
Now replace the false code in the kernel line with the correct one you have picked.<br />
<br />
E.g. the kernelline for ''[369] 1680x1050x32'' would be:<br />
kernel /vmlinuz26 root=/dev/sda1 ro '''vga=873'''<br />
<br />
<br />
== Troubleshooting ==<br />
<br />
===Fixing GRUB Error 17===<br />
If your partition table gets messed up, an unpleasant "GRUB error 17" message might be the only thing that greets you on your next reboot. There are a number of reasons why the partition table could get messed up. Commonly users who manipulate their partitions with [gparted] -- particularly logical drives -- can cause the order of the partitions to change. For example, you delete /dev/sda6 and resize /dev/sda7 a little bit, then finally re-create what used to be /dev/sda6 only now it goes down to the bottom of the list, /dev/sda9 for example. Although the physical order of the partitions/logical drives hasn't changed, the order in which they're recognized is messed up.<br />
<br />
Fixing the partition table is easy. Boot from your Arch CD, login as root and fix the partition table:<br />
<br />
# fdisk /dev/sda<br />
<br />
Once you're in disk, enter e[x]tra/expert mode, [f]ix the partition order, then [w]rite the table and exit. You'll do this by three keys, <br />
{{Keypress|X}}, {{Keypress|F}}, {{Keypress|W}}. Now exit fdisk. <br />
<br />
You can verify that the partition table was indeed fixed by issuing an fdisk -l. Now you just need to fix grub. See the [[http://wiki.archlinux.org/index.php/GRUB#Installing_or_Restoring_GRUB_to_the_Master_Boot_Record Installing_or_Restoring_GRUB_to_the_Master_Boot_Record]] section above.<br />
<br />
Basically you need to tell grub the correct location of your /boot then re-write grub to the MBR on the disk.<br />
<br />
Example on my system:<br />
<br />
# grub<br />
grub> root (hd0.6)<br />
grub> setup (hd0)<br />
grub> quit<br />
<br />
See [[http://stringofthoughts.wordpress.com/2009/05/24/grub-error-17-debianubuntu this page]] for a more in depth summary of this section.<br />
<br />
<br />
===Editing GRUB entries just before boot===<br />
Once you have selected some entry before booting, you can edit it using key 'e' and following on-screen instructions. Then you can boot it using key 'b'. This settings '''will not be saved'''.<br />
<br />
<br />
===Reboot pulldown menu in KDE does not have any effect===<br />
If you've opened a submenu with the list of all operating system configured in grub, selected one and upon restart you still got your default OS, then you might want to check if you have line <br />
<pre><br />
default saved<br />
</pre><br />
in file ''/boot/grub/menu.lst''.<br />
<br />
== External Resources ==<br />
* [http://www.gnu.org/software/grub/ GRUB Website]<br />
* [http://www.troubleshooters.com/linux/grub/index.htm GRUB Grotto- an excellent GRUB resource]<br />
* [http://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt List of kernel parameters that can be used at boot time ]<br />
* [http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ch09.pdf List of kernel paramaters with further explanation and grouped by like options ('Kernel Boot Command-Line Parameter Reference', ''Linux Kernel In A Nutshell'')]</div>Hirionhttps://wiki.archlinux.org/index.php?title=Kile_and_TeX_Live&diff=37378Kile and TeX Live2008-02-20T13:27:40Z<p>Hirion: </p>
<hr />
<div>This article summarizes how to install the Kile LaTeX editor with TeXLive instead of TeTeX (which is no longer maintained). For additional information about how to install TeXLive on Arch Linux, visit the [[Texlive|TeXLive]] article.<br />
<br />
Step 1, install TeXLive<br />
<br />
The best way to start is installing the texlive-most package.<br />
pacman -Sy texlive-most<br />
Make sure you have enabled the community archives (in /etc/pacman.conf).<br />
If you encounter errors during the installation complaining that commands could not be found, try running "export PATH=$PATH:/opt/texlive/bin" before installing.<br />
<br />
Step 2, install KPDF, KDVI,..<br />
<br />
Those packages have been regrouped under a single packages named kdegraphics, except for gv, therefore, in order to install them, you have to type:<br />
pacman -S kdegraphics gv<br />
<br />
Step 3, install Kile<br />
<br />
Finally you have to install Kile.<br />
pacman -S kile<br />
Start Kile from you menu and check whether all dependencies are solved using "Settings > Systemcheck". Kile will ask you for the Acrobat Reader (the pacman package is called acroread) but that is optional.<br />
<br />
Note that if you installed Kile before installing the required packages (like kdvi), you can still install them and have a fully working Kile install.<br />
<br />
Step 4, pdfTeX warnings?<br />
<br />
If you get warnings such as 'pdfTeX warning: pdflatex [...] fontmap entry for [...] already exists, duplicates ignored', try to remove the map files pcr8y.map, phv8y.map, ptm8y.map from the updmap.cfg and finally run updmap.<br />
<br />
Enjoy Kile and TeXLive.</div>Hirion