https://wiki.archlinux.org/api.php?action=feedcontributions&user=Digivampire&feedformat=atomArchWiki - User contributions [en]2024-03-29T07:35:28ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80708VirtualBox Arch Linux Guest On Physical Drive2009-10-27T21:55:21Z<p>Digivampire: /* Additional nodes */</p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through [[UUID]]s, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8..." LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D2..." LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-..." TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-..." TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-..." TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB configuration file so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to mkinitcpio.d:<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the [http://download.virtualbox.org/virtualbox/3.0.8/UserManual.pdf VirtualBox User Manual] section 9.10 we need to create a mapping for the hard drive using the VBoxManage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Substitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look at [[VirtualBox#Installing Guest Additions|Virtual Box]] page.<br />
<br />
= Additional notes =<br />
<br />
For X to work in both VM and natively (since obviously it will be using different drivers) it is best if hotplugging is enabled and there is no xorg.conf so X will pick up everything it needs on the fly. If however you really do need xorg.conf then perhaps the best way to circumvent this is to set GRUB to boot into runlevel 3 for VirtualBox entry so you end up in the console. Then you can startx with custom xorg.conf.<br />
<br />
[[Category:Emulators (English)]]<br />
[[Category:HOWTOs (English)]]</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80664VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:54:44Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through [[UUID]]s, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8..." LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D2..." LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-..." TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-..." TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-..." TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB configuration file so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to mkinitcpio.d:<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the [http://download.virtualbox.org/virtualbox/3.0.8/UserManual.pdf VirtualBox User Manual] section 9.10 we need to create a mapping for the hard drive using the VBoxManage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Substitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look at [[VirtualBox#Installing Guest Additions|Virtual Box]] page.<br />
<br />
= Additional nodes =<br />
<br />
For X to work in both VM and natively (since obviously it will be using different drivers) it is best if hotplugging is enabled and there is no xorg.conf so X will pick up everything it needs on the fly. If however you really do need xorg.conf then perhaps the best way to circumvent this is to set GRUB to boot into runlevel 3 for VirtualBox entry so you end up in the console. Then you can startx with custom xorg.conf.<br />
<br />
[[Category:Emulators (English)]]<br />
[[Category:HOWTOs (English)]]</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80657VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:53:13Z<p>Digivampire: /* Setting up VirtualBox to boot Arch Linux from the Physical Drive */</p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through [[UUID]]s, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8..." LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D2..." LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-..." TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-..." TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-..." TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB configuration file so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to mkinitcpio.d:<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the [http://download.virtualbox.org/virtualbox/3.0.8/UserManual.pdf VirtualBox User Manual] section 9.10 we need to create a mapping for the hard drive using the VBoxManage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Substitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look at [[VirtualBox#Installing Guest Additions|Virtual Box]] page.<br />
<br />
= Additional nodes =<br />
<br />
For X to work in both VM and natively (since obviously it will be using different drivers) it is best if hotplugging is enabled and there is no xorg.conf so X will pick up everything it needs on the fly. If however you really do need xorg.conf then perhaps the best way to circumvent this is to set GRUB to boot into runlevel 3 for VirtualBox entry so you end up in the console. Then you can startx with custom xorg.conf.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80648VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:51:53Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through [[UUID]]s, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8..." LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D2..." LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-..." TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-..." TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-..." TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB configuration file so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to mkinitcpio.d:<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the [http://download.virtualbox.org/virtualbox/3.0.8/UserManual.pdf|VirtualBox User Manual] section 9.10 we need to create a mapping for the hard drive using the VBoxManage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Substitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look at [[VirtualBox#Installing Guest Additions|Virtual Box]] page.<br />
<br />
= Additional nodes =<br />
<br />
For X to work in both VM and natively (since obviously it will be using different drivers) it is best if hotplugging is enabled and there is no xorg.conf so X will pick up everything it needs on the fly. If however you really do need xorg.conf then perhaps the best way to circumvent this is to set GRUB to boot into runlevel 3 for VirtualBox entry so you end up in the console. Then you can startx with custom xorg.conf.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80640VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:45:44Z<p>Digivampire: /* Enabling VirtualBox integration and Seamless mode */</p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB config so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the VirtualBox User Manual (link) section (number) we need to create a mapping for the hard drive using the vboxmanage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Susbtitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look at [[VirtualBox#Installing Guest Additions|Virtual Box]] page.<br />
<br />
= Additional nodes =<br />
<br />
For X to work in both VM and natively (since obviously it will be using different drivers) it is best if hotplugging is enabled and there is no xorg.conf so X will pick up everything it needs on the fly. If however you really do need xorg.conf then perhaps the best way to circumvent this is to set GRUB to boot into runlevel 3 for VirtualBox entry so you end up in the console. Then you can startx with custom xorg.conf.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80639VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:42:19Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB config so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the VirtualBox User Manual (link) section (number) we need to create a mapping for the hard drive using the vboxmanage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Susbtitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look VirtualBox wiki page Installing Guest Additions section.<br />
<br />
= Additional nodes =<br />
<br />
For X to work in both VM and natively (since obviously it will be using different drivers) it is best if hotplugging is enabled and there is no xorg.conf so X will pick up everything it needs on the fly. If however you really do need xorg.conf then perhaps the best way to circumvent this is to set GRUB to boot into runlevel 3 for VirtualBox entry so you end up in the console. Then you can startx with custom xorg.conf.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80636VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:35:45Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB config so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional sanity check ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the VirtualBox User Manual (link) section (number) we need to create a mapping for the hard drive using the vboxmanage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Susbtitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look VirtualBox wiki page Installing Guest Additions section.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80635VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:34:46Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
=Prerequirements=<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
=Preliminary steps in Arch Linux=<br />
<br />
==Step 1 - Addressing using UUIDs==<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB config so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
=== Optional ===<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
== Step 2 - Create new mkinitpcio image ==<br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
= Setting up VirtualBox to boot Arch Linux from the Physical Drive =<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the VirtualBox User Manual (link) section (number) we need to create a mapping for the hard drive using the vboxmanage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Susbtitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
= Enabling VirtualBox integration and Seamless mode =<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look VirtualBox wiki page Installing Guest Additions section.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80634VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:33:31Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
Prerequirements<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
Preliminary steps in Arch Linux<br />
<br />
Step 1 - Addressing using UUIDs<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB config so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
-- Optional --<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
Step 2 - Create new mkinitpcio image <br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
Step 3 - Setting up VirtualBox to boot Arch Linux from the Physical Drive<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the VirtualBox User Manual (link) section (number) we need to create a mapping for the hard drive using the vboxmanage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Susbtitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
Step 4 - Enabling VirtualBox integration and Seamless mode<br />
<br />
Finally, you may want to seamlessly integrate your Arch Linux in Windows and allow copy pasting between OSes. For a guide how to set this up look VirtualBox wiki page Installing Guest Additions section.</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80632VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:29:17Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
Prerequirements<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
Preliminary steps in Arch Linux<br />
<br />
Step 1 - Addressing using UUIDs<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Another important thing to note, is that you should NEVER allow VirtualBox to try and boot Windows partition of the host. This will create a bunch of problems, and will lead to filesystem corruption. If you have Windows set up as a default entry in GRUB, take special care when you are booting VirtualBox and tell it to boot Arch Linux VirtualBox entry. Give yourself enough timeout in the GRUB config so you can do this comfortably and don't risk booting Windows host in the VM. 5 seconds works for me.<br />
<br />
-- Optional --<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
Step 2 - Create new mkinitpcio image <br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
Step 3 - Setting up VirtualBox to boot Arch Linux from the Physical Drive<br />
<br />
Now we need to setup VirtualBox with a new VM one that uses the physical drive. Before we can do that, we need to create a mapping for the physical drive. Unfortunately, VirtualBox does not have this option in the GUI but we can do it from the console. Open prompt (if you are in Vista/Win7 open it in admin mode by typing in cmd and hitting ctrl-shift-enter). Go to your VirtualBox installation folder:<br />
cd c:\Program Files\Sun\VirtualBox\<br />
According to the VirtualBox User Manual (link) section (number) we need to create a mapping for the hard drive using the vboxmanage tool. Do the following:<br />
VBoxManage internalcommands createrawvmdk -filname /path/to/file.vmdk -rawdisk \\.\PhysicalDrive? -register<br />
Where /path/to/file.vmdk is the location and the name where you want the mapping file stored. I like to keep things neat, so I placed it where VirtualBox keeps other hard drive mapping files (you can find the location in VirtualBox's preferences). Susbtitute the question mark in "\\.\PhysicalDrive?" with the number of your physical hard drive as Windows sees it, numbered from zero. So first hard drive would be "\\.\PhysicalDrive0".<br />
You should get a confirmation the file was created successfully and now we can finally create the VM. Set the options you want for the VM and during the Virtual Hard disk screen select "Use existing hard disk" option with the mapping file you created moments ago. I'd also recommend turning on the 3D acceleration, increasing video memory to 32 or 64MB and setting the network interface to bridge mode for the best results.<br />
<br />
Step 4 - Enabling VirtualBox integration and Seamless mode</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80630VirtualBox Arch Linux Guest On Physical Drive2009-10-27T18:03:46Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
Prerequirements<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
Preliminary steps in Arch Linux<br />
<br />
Step 1 - Addressing using UUIDs<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
-- Optional --<br />
<br />
You may want to double check your /etc/fstab and GRUB configuration so they are correct and restart Arch to see that the system will still boot fine using UUIDs. It is also encouraged you create a backup of both fstab and GRUB's menu.lst should you make a mistake somewhere.<br />
<br />
Step 2 - Create new mkinitpcio image <br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf<br />
Modify the modules line to include hardware used by VirtualBox. I have found that the following works good:<br />
MODULES="piix ahci pata_acpi ata_piix"<br />
Modify the hooks line to include boot hooks that VirtualBox and your partitions will need. Keep all the filesystem, lvm and encryption hooks you may be using, but add the following (if they are not there already) "ide, sata". Hooks line that should work for a usual Arch system is:<br />
HOOKS="base udev autodetect ide sata filesystems"<br />
<br />
We are almost done with this step. All we have to do is tell mkinitcpio to generate the images:<br />
sudo mkinitcpio -p kernel26-vbox<br />
Sit back and enjoy while it finishes. This completes all the preliminary setup necessary for Arch to work both natively and in VM. Reboot and lets go to Windows.<br />
<br />
Step 3 - Setting up VirtualBox to boot Arch Linux from the Physical Drive</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80629VirtualBox Arch Linux Guest On Physical Drive2009-10-27T17:53:17Z<p>Digivampire: </p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
Prerequirements<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide is in the works for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. <br />
<br />
Finally, depending on your hard drive set up, device files for your hard drives may be different when you run Arch Linux natively and in a VM. For instance in my setup I run fake raid so my root partition is natively /dev/mapper/isw_ci...Systemp6 while under VM it is /dev/sda6 because Windows abstracts away fake raid for us. Your setup may be different but the same problem may apply. To circumvent this problem we need an addressing scheme that is persistent to both systems (e.g. doesn't change). One sure way of doing it is through UUIDs, which is how we are going to do it.<br />
<br />
To sum up, you need:<br />
* Running dual-boot ArchLinux/Windows system using Grub <br />
* Hard drive partitions mapped using UUIDs in Grub and /etc/fstab<br />
* Have installed VirtualBox in Windows<br />
<br />
So lets get started. Boot into your Arch Linux and open up a terminal.<br />
<br />
Preliminary steps in Arch Linux<br />
<br />
Step 1 - Addressing using UUIDs<br />
<br />
If you don't have this set up already we are going to switch addressing scheme in Grub and /etc/fstab to UUIDs. First step is to find out UUIDs for your partitions. Type in:<br />
blkid<br />
Your output should be something like:<br />
/dev/sda1: UUID="4AD8593BD859270B" LABEL="System Reserved" TYPE="ntfs" <br />
/dev/sda2: UUID="82D27570D27568F5" LABEL="System" TYPE="ntfs" <br />
/dev/sda3: UUID="3cbcd99c-399c-43b1-88bf-cc8a2269fd8a" TYPE="ext2" <br />
/dev/sda5: UUID="bf5adc7a-5a5c-46ca-814d-07a7db8b1f63" TYPE="swap" <br />
/dev/sda6: UUID="3ca3b8f2-4d61-4da0-9833-005d606422b3" TYPE="ext4" <br />
This tells you what is the UUID of each partition. Write it down or copy paste to the editor because we'll need it later. Next we need to update /etc/fstab so it maps partitions using UUIDs and not through device files:<br />
sudo nano /etc/fstab<br />
For all your hard drive partitions switch out their device name in the first column with the UUID given above using the following example as a guide:<br />
<br />
Before:<br />
/dev/sda6 / ext4 defaults 0 1<br />
/dev/sda2 /mnt/Win7 ntfs-3g defaults 0 0<br />
After:<br />
UUID=3ca3... / ext4 defaults 0 1<br />
UUID=82D2... /mnt/Win7 ntfs-3g defaults,<font color=red>noauto,ro</font color> 0 0<br />
<br />
Please note the ro flag marked in red. You must NOT allow ArchLinux write access to the Windows Partition where system is. Because they will be both running at the same time you are risking corruption of data due to concurrent writes. This is <font color=red>EXTREMELY DANGEROUS</font color> so you must put a read only flag here.<br />
Noauto flag is added because at boot Arch will try to mount the partition and give an error because it has been locked for mounting by the running Windows. We will get to mounting it back later.<br />
<br />
Now we need to tell grub to use UUIDs as well so we can reach mkinitcpio image and the kernel to boot properly. Lets go to grub config:<br />
cd /boot/grub<br />
sudo nano menu.lst<br />
Find your boot entry for Arch Linux and copy paste a new entry with the same config. Rename it to "Arch Linux VirtualBox" and modify the root option to use UUIDs using the following guide as example:<br />
# (5) Arch Linux VirtualBox<br />
title Arch Linux VirtualBox<br />
root<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro vga=773<br />
initrd /kernel26-vbox.img<br />
Substitute the root= device file name with the UUID of the partition you used in that place like in the example (vga flag gives us a nice framebuffer you may omit it if you don't want it). Make note of the initrd line. We are telling GRUB we want to use a new mkinitcpio image that we are about to build.<br />
<br />
Repeat the process here, for the fallback entry. Create a new GRUB entry by copy pasting default Arch Linux fallback entry, call it "Arch Linux VirtualBox Fallback" and update its kernel and initrd lines so they show:<br />
kernel /vmlinuz26 root=/dev/disk/by-uuid/3ca3b8f2-... ro<br />
initrd /kernel26-vbox-fallback.img<br />
Make note the mkinitcpio image in this case is named kernel26-vbox-fallback.img.<br />
<br />
Step 2 - Create new mkinitpcio image <br />
Next we need to generate a new mkinitcpio image that will comply with VirtualBox hardware configuration. Lets setup a new mkinitcpio image. Go to /etc/mkinitcpio.d/<br />
cd /etc/mknitcpio.d/<br />
Here mkinitpcio keeps all the presets for generating images. We want to create a new preset, stemming from the default one "kernel26". So lets make a copy and call it kernel26-vbox and open it in your favorite editor:<br />
sudo cp kernel26.preset kernel26-vbox.preset<br />
sudo nano kernel26-vbox.preset<br />
Here we need to change a few things. Change all occurrences of "kernel26" for "kernel26-vbox" except the line that is sourcing kernel26.ver file. Here are the parts that need to be changed:<br />
ALL_config="/etc/mkinitcpio-vbox.conf"<br />
...<br />
#default_config="/etc/mkinitcpio-vbox.conf"<br />
default_image="/boot/kernel26-vbox.img"<br />
#default_options=""<br />
...<br />
#fallback_config="/etc/mkinitcpio-vbox.conf"<br />
fallback_image="/boot/kernel26-vbox-fallback.img"<br />
fallback_options="-S autodetect"<br />
Now we need to create the configuration file for the preset. I keep them in /etc along with the default mkinitcpio.conf but you may want to do differently. If so, update the preset with proper paths to mkinitcpio-vbox.conf. Again we are going to use the default mkinitpcio as a guide:<br />
cd /etc/<br />
sudo cp mkinitcpio.conf mkinitcpio-vbox.conf <br />
nano /etc/mkinitcpio-vbox.conf</div>Digivampirehttps://wiki.archlinux.org/index.php?title=VirtualBox_Arch_Linux_Guest_On_Physical_Drive&diff=80628VirtualBox Arch Linux Guest On Physical Drive2009-10-27T17:01:44Z<p>Digivampire: Created page with 'Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Usin…'</p>
<hr />
<div>Lots of users run a dual boot between Arch Linux and another Operating System (Windows for instance). It can be tedious to switch back and forth if you need to work in both. Using Virtual Machines, we can install one OS in the VM and have both running. This is not always convenient, because for performance reasons we might want to be able to run both OSes natively when needed and still keep the convenience of having access to both OSes at the same time. <br />
<br />
This guide will help you set up your dual boot ArchLinux/Windows system so you can still run your native ArchLinux while in Windows and be able to boot back into the same ArchLinux natively.<br />
<br />
First, we have to establish some requirements for this setup. Naturally, you need to have both OSes installed and set up for dual boot correctly. Here we will assume you are using GRUB to boot, but I'm sure other boot managers can be set up in a similar manner. This guide is focusing on setting up the environment using VirtualBox. Similar guide exists for VMWare (link) if you are using that. Assumption is that you have downloaded and installed the latest version of VirtualBox in Windows. So to sum up:<br />
* Running dual-boot ArchLinux/Windows system using Grub<br />
* Have installed VirtualBox in Windows<br />
y</div>Digivampirehttps://wiki.archlinux.org/index.php?title=Fonts&diff=65493Fonts2009-03-22T01:13:38Z<p>Digivampire: </p>
<hr />
<div>[[Category:Fonts (English)]]<br />
[[Category:Graphics and DTP (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Eye candy (English)]]<br />
{{Article summary start}}<br />
{{Article summary text|Covers the installation and use of fonts on Arch Linux.}}<br />
{{Article summary heading|Available in languages}}<br />
{{i18n_entry|English|Fonts}}<br />
{{i18n_entry|Italiano|Fonts (Italiano)}}<br />
{{i18n_entry|繁體中文|Fonts 字型}}<br />
{{i18n_entry|Español|Fuentes}}}<br />
{{Article summary heading|Legal}}<br />
{{Article summary text|Certain font packages may impose ''some'' legal limitations.}}<br />
{{Article summary heading|Related articles}}<br />
{{Article summary wiki|MS Fonts}}<br />
{{Article summary wiki|Xorg Font Configuration}}<br />
{{Article summary end}}<br />
<br />
{{merge|Xorg Font Configuration|Talk:Xorg Font Configuration}}<br />
<br />
= Introduction =<br />
A standard Arch Linux desktop installation provides an excellent font support,<br />
with the latest stable versions of the X.org X server, freetype2 (with bytecode interpreter enabled) and fontconfig. For more information on font configuration please see: '''[[Xorg Font Configuration | Font Configuration]]<br />
'''<br />
== Different Kinds of Fonts ==<br />
There exists different kinds of fonts for Linux.<br />
<br />
* bitmap fonts (.pcf .bdf .pcf.gz .bdf.gz)<br />
<br />
* PostScript fonts (.pfa .pfb) <br>''(pfa: ascii format; pfb: binary format)''<br />
<br />
* TrueType/OpenType fonts (.ttf) <br>''(OpenType fonts with quadratic outlines have also .ttf suffix)''<br />
<br />
* PostScript flavored OpenType fonts (.otf)<br />
<br />
* TeX bitmap fonts (.pk) <br>''(usually automatically generated from the METAFONT source .mf)''<br />
<br />
* TeX virtual fonts (.vf)<br />
<br />
== Installing fonts ==<br />
<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|Adding fonts}}<br />
{{i18n_entry|简体中文|添加字体}}<br />
{{i18n_entry|Česky|Přidání fontů}}<br />
{{i18n_links_end}}<br />
<br />
Adding fonts in a modern Linux system is much easier than before. Here I try to post a few tips aiming to make it more understandable to average users.<br />
Usually, you should add fonts under the following directory:<br />
* /usr/share/fonts<br />
* /usr/X11R6/lib/X11/fonts<br />
This will make everybody on the system to be able to use them, however; it requires root privileges. Copying them into:<br />
* ~/.fonts<br />
directory is a good idea too.<br />
<br />
Some font collections have been prepackaged for use in Arch Linux; search them by:<br />
<pre>pacman -Ss fonts</pre><br />
Among the packages available you will see<br />
<pre>extra/artwiz-fonts 1.3-1<br />
This is set of (improved) artwiz fonts.<br />
extra/ttf-ms-fonts 1.3-6<br />
Un-extracted TTF fonts from Microsoft<br />
</pre><br />
Then if you want to install these two packages, do:<br />
<pre>pacman -S artwiz-fonts ttf-ms-fonts</pre><br />
This will install the fonts into <code>/usr/X11R6/lib/X11/fonts</code> dir.<br />
CJK (Chinese/Japanese/Korean) users are encouraged to install also ''ttf-arphic-uming'', ''ttf-arphic-ukai'' and ''ttf-fireflysung'' to display Asian characters properly.<br />
<br />
Another option is to use KDE Font Installer in the KDE Control Center. This seems to work flawlessly if you use KDE.<br />
<br />
You can also manually copy fonts into above three directories, but don't forget to run as root: <pre>fc-cache -vf</pre><br />
<br />
This should work in X Window with GNOME, KDE or XFCE4 desktop environments for most applications. However, some GTK1 or old applications don't support fontconfig. ''(Really? Someone should check this and then fix it)'' You have to run the following commands in your fonts directory (in the terminal of course):<br />
<pre><br />
mkfontscale<br />
mkfontdir<br />
ln -s /usr/share/fonts/encodings/encodings.dir yourfontdirectory/encodings.dir</pre><br />
ex: if you-re using KDE<br />
<pre><br />
ln -s /usr/share/fonts/encodings/encodings.dir ~/.fonts/</pre><br />
then usually you need to restart X.<br />
<br />
If you want to share such fonts or avoid repeating the above manual steps, you can make an Arch package. Save the fonts you wish to install as tar.bz2 and use a variation of the following PKGBUILD and .install to install them via ABS:<br />
<pre># PKGBUILD<br />
pkgname=fonts-extra<br />
pkgver=1.0<br />
pkgrel=1<br />
depends=('xfree86')<br />
pkgdesc=\"Fonts extra\"<br />
source=(fonts-extra.tar.bz2)<br />
install=fonts-extra.install<br />
build() {<br />
mkdir -p $startdir/pkg/usr/X11R6/lib/X11/fonts/local<br />
mv $startdir/src/*.ttf $startdir/pkg/usr/X11R6/lib/X11/fonts/local<br />
}<br />
</pre><br />
<pre># fonts-extra.install:<br />
# arg 1: the new package version<br />
post_install() {<br />
echo -n \"updating font cache... \"<br />
/usr/bin/fc-cache<br />
cd /usr/X11R6/lib/X11/fonts/local<br />
/usr/X11R6/bin/mkfontscale<br />
/usr/X11R6/bin/mkfontdir<br />
ln -s /usr/X11R6/lib/X11/fonts/encodings/encodings.dir /usr/X11R6/lib/X11/fonts/local/encodings.dir<br />
echo \"done.\"<br />
}<br />
<br />
# arg 1: the new package version<br />
# arg 2: the old package version<br />
post_upgrade() {<br />
post_install $1<br />
}<br />
<br />
# arg 1: the old package version<br />
pre_remove() {<br />
/bin/true<br />
}<br />
<br />
op=$1<br />
shift<br />
<br />
$op $*<br />
</pre><br />
<br />
= Font Packages in Arch Linux =<br />
NB: This is a selective list, but it does also include most font packages from AUR.<br />
<br />
* Latin <br />
** [http://www.archlinux.org/packages/10296/ '''font-bh-ttf'''] - X.org Luxi fonts<br />
** [http://www.archlinux.org/packages/3722 '''ttf-cheapskate'''] - font collection from ''dustimo.com''<br />
** [http://www.archlinux.org/packages/9336 '''ttf-isabella'''] - Historic ''Isabella font''<br />
** [http://www.archlinux.org/packages/9337 '''ttf-junicode'''] - Junius font containing almost complete medieval latin script glyphs<br />
** [http://www.archlinux.org/packages/961 '''ttf-ms-fonts'''] - Un-extracted Fonts from ''Microsoft''<br />
** [http://aur.archlinux.org/packages.php?do_Details=1&ID=5418 '''unsupported/ttf-ms-fonts-lic'''] - Alternative to the above<br />
<br />
* Unicode (multiscript)<br />
** [http://www.archlinux.org/packages/11883/ '''ttf-dejavu'''] - DejaVu fonts, extension of Bitstream Vera<br />
** [http://aur.archlinux.org/packages.php?ID=10860 '''ttf-liberation'''] - Collection of free fonts developed for Red Hat<br />
** [http://aur.archlinux.org/packages.php?ID=6608 '''ttf-linux-libertine'''] - Replacement for Times New Roman<br />
** [http://aur.archlinux.org/packages.php?ID=3673 '''ttf-freefont'''] - ''freefont'' (clones of Times, Helvetica and Courier with large Unicode support but unequal quality)<br />
** [http://www.archlinux.org/packages/9340/ '''ttf-mph-2b-damase'''] - Covers full plane 1 and several scripts<br />
** [http://aur.archlinux.org/packages.php?ID=3856 '''unsupported/ttf-sil-fonts'''] - Gentium, Charis, Doulos, Andika and Abyssinica from SIL<br />
<br />
* Cyrillic<br />
** See category 'Unicode' above<br />
** [http://aur.archlinux.org/packages.php?ID=6265 '''unsupported/ttf-arhangai'''] - Mongolian Cyrillic<br />
<br />
* Chinese + Japanese + Korean<br />
** [http://www.archlinux.org/packages/6831 '''ttf-arphic-ukai'''] - ''Kaiti'' (brush stroke) unicode font (enabling anti-aliasing suggested)<br />
** [http://www.archlinux.org/packages/6832 '''ttf-arphic-uming'''] - ''Mingti'' (printed) unicode font<br />
** [http://www.archlinux.org/packages/10092 '''ttf-fireflysung'''] - ''New Sung'' font<br />
** [http://aur.archlinux.org/packages.php?ID=14795 '''community/wqy-zenhei'''] - ''wqy-zenhei'' font,A Hei Ti Style (sans-serif) Chinese Outline Font.<br />
** [http://aur.archlinux.org/packages.php?ID=5303 '''community/wqy-bitmapfont'''] -"wqy-bitmapfont" font, A bitmapped Song Ti (serif) Chinese font<br />
** [http://aur.archlinux.org/packages.php?do_Details=1&ID=6792 '''unsupported/acrofont-cht'''] - Traditional Chinese font packs for Adobe Acrobat Reader 7.0.8<br />
** [http://aur.archlinux.org/packages.php?ID=6794 '''unsupported/acrofont-cjk'''] - CJK font packs for Adobe Acrobat Reader 7.0.8<br />
** [http://aur.archlinux.org/packages.php?ID=6398 '''unsupported/acroread7-chs'''] - Simplified Chinese font for Adobe Acrobat Reader 7 <br />
** [http://aur.archlinux.org/packages.php?ID=6267 '''usupported/ttf-kochi-substitute'''] - High quality Japanese TrueType fonts<br />
** [http://aur.archlinux.org/packages.php?ID=6268 '''usupported/ttf-sazanami'''] - Another set of high quality Japanese fonts<br />
** [http://aur.archlinux.org/packages.php?ID=6266 '''usupported/ttf-baekmuk'''] - collection of Korean TrueType fonts<br />
** [http://aur.archlinux.org/packages.php?ID=6264 '''unsupported/ttf-alee'''] - Set of free Hangul truetype fonts<br />
<br />
* Arabic<br />
** [http://aur.archlinux.org/packages.php?ID=4633 '''unsupported/ttf-sil-arabic'''] - two excellent Unicode Arabic fonts from SIL<br />
** [http://aur.archlinux.org/packages.php?ID=3680 '''unsupported/arabeyes-fonts'''] - collection of free Arabic fonts<br />
<br />
* Hebrew<br />
** [http://www.archlinux.org/packages/12690/ '''culmus'''] - nice collection of free Hebrew fonts<br />
<br />
* Indic <br />
** [http://www.archlinux.org/packages/6071 '''ttf-freebanglafont'''] - font for Bangla <br />
** [http://www.archlinux.org/packages/6742 '''ttf-indic-otf'''] - Indic Opentype Fonts collection (containing ttf-freebanglafont)<br />
<br />
* Thai <br />
** [http://www.archlinux.org/packages/9331 '''ttf-thai'''] - font covering glyphs for thai<br />
<br />
* Khmer <br />
** [http://www.archlinux.org/packages/9338 '''ttf-khmer'''] - font covering glyphs for khmer language<br />
<br />
* Braille <br />
** [http://www.archlinux.org/packages/9339 '''ttf-ubraille'''] - font containing symbols for ''braille'' (unicode)<br />
<br />
* Handwritten<br />
** [http://aur.archlinux.org/packages.php?ID=2055 '''unsupported/aquafont'''] - Handwritten fixed-width TrueType font<br />
<br />
* Math fonts<br />
** [http://aur.archlinux.org/packages.php?ID=6349 '''unsupported/ttf-mathematica''']<br />
** [http://aur.archlinux.org/packages.php?ID=7005 '''unsupported/ttf-mathematica4.1''']<br />
** [http://aur.archlinux.org/packages.php?ID=7006 '''unsupported/ttf-mathtype''']<br />
** [http://aur.archlinux.org/packages.php?ID=2100 '''unsupported/ttf-computer-modern-fonts''']<br />
<br />
* “Programmer's fonts” (for coding and terminal display)<br />
** [http://aur.archlinux.org/packages.php?ID=4809 '''terminus-font''']<br />
** Try also DejaVu Sans Mono (from package [http://www.archlinux.org/packages/11883/ '''ttf-dejavu''']), Lucida Typewriter (included in package [http://www.archlinux.org/packages/11383/ '''jre''']) or the beautiful [http://aur.archlinux.org/packages.php?ID=12559 '''Inconsolata'''].<br />
<br />
= Best fonts for terminal =<br />
<br />
The best font for a terminal depends on what terminal emulator you are using and what features it supports. For example, it even depends on how your fonts.dir looks, as sometimes fonts get installed incorrectly. It also depends on how you have configured your X Server, if you use freetype2 or freetype1, if you use the autohinter with the bytecode interpreter compiled into freetypeN, if you have compiled in the BI but doesn't use the autohinter, if you have not compiled in the BI and use the autohinter, if you have not compiled in the BI but uses the autohinter, etc.<br />
<br />
A top favorite of some Arch Linux users is [http://www.is-vn.bg/hamster Terminus] (in community as "terminus-font").<br />
<br />
Some other fonts to try out:<br />
<br />
*Lucida Typewriter<br />
*Andale Mono<br />
*Bitstream Vera Mono<br />
*Courier<br />
*Inconsolata<br />
*Terminal<br />
*Test<br />
*Gamov<br />
*default8x16<br />
*monospace<br />
*Liberation Mono<br />
*[http://www.proggyfonts.com/index.php?menu=download Proggy Clean]<br />
<br />
Example how to use Terminus:<br />
<pre><br />
xterm -bg black -fg gray -fn -xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-1<br />
xterm -bg black -fg gray -fn -xos4-terminus-bold-r-normal--14-140-72-72-c-80-iso8859-1<br />
</pre><br />
<br />
= Fonts in virtual console =<br />
Default font in virtual console can display only ASCII characters. If you use other characters you can change the ''CONSOLEFONT'' and ''CONSOLEMAP'' settings in your ''/etc/rc.conf'' file. Different fonts can be found in ''/usr/share/kbd/consolefonts'' directory and key maps can be found in the subdirectories of ''/usr/share/kbd/keymaps''.<br />
<br />
=== Examples ===<br />
For displaying characters like "č ć ž đ š" use lat2-16.psfu.gz font:<br />
CONSOLEFONT="lat2-16.psfu.gz"<br />
Also, don't forget to set the proper key map, in this case:<br />
CONSOLEMAP="8859-2"<br />
<br />
To use the specified font in early userspace (early in the bootup process), add the 'keymap' hook to /etc/mkinitcpio.conf and rebuild the image. See [http://wiki.archlinux.org/index.php/Mkinitcpio the Mkinitcpio article] for more information.<br />
<br />
= Fonts with LCD filter enabled =<br />
<br />
== "LCD" packages ==<br />
<br />
=== Install patched packages ===<br />
<br />
Remove the original packages:<br />
pacman -Rd libxft cairo<br />
<br />
Install the patched packages from [http://aur.archlinux.org/packages.php AUR] unsupported (ex. using [[Post_Installation_Tips#Accessing_AUR_seamlessly | yaourt]]):<br />
yaourt -S fontconfig-lcd<br />
yaourt -S cairo-lcd<br />
<br />
Install the patched packages from [community]:<br />
pacman -S libxft-lcd<br />
<br />
Reboot your system.<br />
<br />
'''Note:''' if you want, you can simply revert to the original packages entering<br />
pacman -Rd libxft-lcd cairo-lcd fontconfig-lcd<br />
pacman -S libxft cairo<br />
<br />
=== Change filter configuration ===<br />
<br />
The "fontconfig-lcd" package enables by default the "lcddefault" filter. You can edit the ''/etc/fonts/conf.avail/10-lcd-filter.conf'' file and replace it with another filter.<br />
<br />
* New filter, fontconfig-lcd default<br />
<const>lcddefault</const><br />
<br />
* None<br />
<const>lcdnone</const><br />
<br />
* Lighter filter, less aggressive<br />
<const>lcdlight</const><br />
<br />
* Legacy filter, cairo default<br />
<const>lcdlegacy</const><br />
<br />
== Alternative with "ClearType" packages ==<br />
<br />
There are more effects for fonts from Windows system, this method of beautifying fonts has been tested with GNOME/Xfce/KDE.<br />
<br />
===Remove Packages:===<br />
<br />
pacman -Rd cairo libxft freetype2<br />
<br />
===Install Packages===<br />
<br />
Install the package cairo-cleartype, libxft-cleartype, freetype2-cleartype from [http://aur.archlinux.org/packages.php AUR]<br />
<br />
Search "cairo-cleartype", "libxft-cleartype", "freetype2-cleartype" in [http://aur.archlinux.org/packages.php AUR], download all these tarballs, extract them, and compile them with makepkg, install them with<br />
<br />
pacman -U *-cleartype*.pkg.tar.gz<br />
<br />
Restart X11 (ctrl+alt+backspace)<br />
<br />
'''OR''' if you have yaourt installed:<br />
<br />
<pre>yaourt -S cairo-cleartype freetype2-cleartype libxft-cleartype</pre><br />
<br />
= Configuration =<br />
<br />
== FreeType autohinter (optional) ==<br />
You can set the FreeType autohinter. As root :<br />
ln -s /etc/fonts/conf.avail/10-autohint.conf /etc/fonts/conf.d/10-autohint.conf<br />
<br />
== Disable Unattractive Bitmap Fonts (optional) ==<br />
Edit ~/.fonts.conf with the following content:<br />
<br />
<!-- Reject bitmap fonts in favour of Truetype, Postscript, etc. --><br />
<selectfont><br />
<rejectfont><br />
<pattern><br />
<patelt name="scalable"><br />
<bool>false</bool><br />
</patelt><br />
</pattern><br />
</rejectfont><br />
</selectfont><br />
<br />
Restart X11 (ctrl+alt+backspace)<br />
<br />
At this point if you think fonts look too bold, modify the fonts configuration file: edit (or create if it doesn't exist yet) the file ~/.fonts.conf with the following content:<br />
<br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<!-- If the font is bold, turn off autohinting --><br />
<match target="font" ><br />
<test compare="more" name="weight"><br />
<const>medium</const><br />
</test><br />
<edit mode="assign" name="autohint"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
<br />
=FAQ=<br />
<br />
'''Q. My fonts are too large or too small. The resolution seems wrong. My fonts are mis-shapen.'''<br />
<br />
A(1). Read the ''Display Size/DPI'' section of [[Xorg]] for configuration sample settings and formula.<br />
<br />
A(2). Get your proper resolution from a console, by typing:<br />
<br />
xdpyinfo | grep resolution<br />
<br />
Change the value to this in the Gnome font configurator. Restart X. Sometimes, the videocard gives bogus information to X. It may be better to settle on a value between 72-78 DPI for 1024x768 displays. 96 DPI is a good value for 1280x1024, but it depends on the exact resolution. I actually prefer 75 on my home machine, and the font sizes seem to be a bit more true to their proper sizes when this is set. In most cases, if the numbers don't match, you may use the following method.<br />
<br />
You may also opt to force X to start with a forced resolution. This may produce good results in some display modes. For example, you may use:<br />
<br />
startx -- -dpi 75<br />
<br />
This will force X to start in 75x75 DPI mode. You may change your Gnome font settings (From the menu: Applications/Desktop Preferences/Font) to 75 DPI and you should get a good match.<br />
<br />
If this worked well for you, you may edit your "startx" script to always force this option on startup. Edit the file "/usr/bin/startx" as root.<br />
<br />
Change the following line:<br />
<br />
defaultserverargs=""<br />
<br />
to...<br />
<br />
defaultserverargs="-dpi 75"<br />
<br />
'''Q. How do I install fonts?'''<br />
<br />
A. An easy way to install fonts is to drop them into your "$HOME/.fonts" directory and running "fc-cache". You can also perform a system-wide font installation by copying the fonts to "/usr/share/fonts" or another font directory (as long as it is listed in your "/etc/fonts/fonts.conf" file), and then performing the "fc-cache" command as root. You may also need to run "ttmkfdir" or "mkfontdir" as well.<br />
<br />
'''Q. The fonts in GNU Emacs are displayed as squares.'''<br />
<br />
A. You need to install the xorg-fonts-75dpi or xorg-fonts-100dpi package.<br />
<br />
'''Q. The fonts in OpenOffice.org look very bad.'''<br />
<br />
A. If we have a bug/font-issue in the openoffice-base package, using the original rpm-packages from the office website will allways work. "Bad fonts are a thing of the past with the newest version (2.3.1)." (http://www.stchman.com/tweaks.html). <br />
<br />
Note that OpenOffice.org for Linux ships with an (inferior) copy of freetype2 that are built directly into the code. In the past you could force it to link to your system's, shared, freetype2 by setting the following before starting the suit. <br />
<br />
export LD_PRELOAD=/usr/lib/xorg/modules/fonts/libfreetype.so<br />
<br />
The (Jan 2008) above is reported to not work anymore but at qa.openoffice.org a patch to do this bypass is emering.<br />
<br />
'''Q. The OpenOffice.org menu font looks really bad. It doesn't use antialiasing either.'''<br />
<br />
A. This can be changed in the OpenOffice.org configurator. From the drop-down menu, select "Tools/Options/OpenOffice.org/Fonts". Check the box that says "Apply Replacement Table". Type "Andale Sans UI" in the font box (this may have to be input manually, if it doesn't appear in the drop-down menu) and choose your desired font for the "Replace With" option. Dropline users may prefer the system default, "Trebuchet MS". When selected, click the checkmark box. Then choose the "always" and "screen" options in the box below. Apply the changes, and your menu fonts should look great.<br />
<br />
'''Q. OpenOffice.org doesn't detect my TrueType fonts!'''<br />
<br />
A. Make sure that you add the appropriate entry in your /etc/X11/xorg.conf file that points your programs to the /usr/share/fonts/ directory.<br />
<br />
For example, here's a sample of an xorg.conf file<br />
<br />
Section "Files"<br />
RgbPath "/usr/share/X11/rgb"<br />
ModulePath "/usr/lib/xorg/modules"<br />
FontPath "/usr/share/fonts/misc"<br />
FontPath "/usr/share/fonts/75dpi"<br />
FontPath "/usr/share/fonts/100dpi"<br />
FontPath "/usr/share/fonts/TTF"<br />
FontPath "/usr/share/fonts/Type1"<br />
EndSection<br />
<br />
Another solution is to run the openoffice administration tool<br />
<br />
# /opt/openoffice/program/spadmin<br />
<br />
from which you can add fonts.<br />
<br />
'''Q. Mozilla and other programs can no longer access TrueType fonts on my system, and are reverting to ugly fonts instead.'''<br />
<br />
A. Make sure the "freetype" module is loaded in your /etc/X11/xorg.conf file and your /usr/share/fonts/TTF/fonts.dir lists all of the TrueType fonts you have installed.<br />
<br />
Try checking your "Files" section of your xorg.conf, and make sure that you have all (or most) of these directories listed.<br />
<br />
Section "Files"<br />
RgbPath "/usr/share/X11/rgb"<br />
ModulePath "/usr/lib/xorg/modules"<br />
FontPath "/usr/share/fonts/misc"<br />
FontPath "/usr/share/fonts/75dpi"<br />
FontPath "/usr/share/fonts/100dpi"<br />
FontPath "/usr/share/fonts/TTF"<br />
FontPath "/usr/share/fonts/Type1"<br />
EndSection<br />
<br />
Finally, go to the following font directories:<br />
<br />
/usr/share/fonts/TTF<br />
/usr/share/fonts<br />
<br />
Try deleting the "fonts.dir" and "fonts.scale" files in these directories. You may want to make backups first though. Run these commands to replace them.<br />
<br />
mkfontscale<br />
mkfontdir<br />
<br />
Make sure you restart X for the changes to come into effect.<br />
<br />
'''Q. What are some suggested font settings for Mozilla/Firefox?'''<br />
<br />
A. These are recommended for Firefox:<br />
<br />
<pre><br />
Proportional: Serif Size (pixels): 16<br />
Serif: Times New Roman<br />
Sans-serif: Arial<br />
Monospace: Courier New Size (pixels): 13<br />
Display resolution: System settings<br />
</pre><br />
<br />
*Note: Times New Roman may appear to be a non-TTF font. If this is the case, read above about how to fix this.<br />
<br />
I believe that the following are Dropline's Mozilla defaults (also recommended):<br />
<pre><br />
Proportional: Serif Size (pixels): 14<br />
Serif: Times New Roman<br />
Sans-serif: Verdana<br />
Cursive: Andale Mono<br />
Fantasy: Andale Mono<br />
Monospace: Courier New Size (pixels): 11<br />
Allow Documents to use other fonts: Enabled<br />
Display resolution: System settings<br />
</pre><br />
<br />
'''Q. Why do my Apps show squares when there should be arrows and the like?'''<br />
<br />
A. It may help to activate bitmap fonts. They are disabled by default.<br />
<br />
cd /etc/fonts/conf.d<br />
rm 10-bitmaps.conf<br />
ln -s ../conf.avail/70-yes-bitmaps.conf 10-bitmaps.conf<br />
cd -<br />
<br />
If you think your fonts look ugly now then consider to remove the following packages.<br />
<br />
pacman -Rs xorg-fonts-100dpi xorg-fonts-75dpi<br />
<br />
Read [http://bbs.archlinux.org/viewtopic.php?t=21250 here] and [http://bbs.archlinux.org/viewtopic.php?t=18425 here] for some background info.<br />
<br />
'''Q: I just upgraded via pacman -Syu and my fonts are all ugly'''<br />
<br />
<b>A: </b>There are several possible conflicting issues here. See these threads:<br />
<br />
1 - http://bbs.archlinux.org/viewtopic.php?t=866<br />
<br />
2 - http://bbs.archlinux.org/viewtopic.php?t=4975<br />
<br />
'''Q: I installed ''ttf-ms-fonts'' but on certain sites in Firefox I get ugly bold smudged fonts. What gives?'''<br />
<br />
A. Tahoma Bold is missing from ms-ttf-fonts package. Sites that use bold version of Tahoma won't show it properly and the system will create its own imitation from the regular Tahoma. To fix it, put ''tahomabd.ttf'' in your ~/.fonts/ folder and restart firefox.</div>Digivampire