2014-08-12

style fixes, see Help:Style; especially expand contractions and simplify links

← Older revision

Revision as of 12:38, 12 August 2014

Line 8:

Line 8:

{{Related articles end}}

{{Related articles end}}



This article describes how to transfer your current Arch Linux installation in or out of a virtual environment (i.e. QEMU, VirtualBox, VMware), and is heavily based on the [[Full system backup with rsync]] article. A virtual machine ("VM", for short) uses different hardware, which needs to be addressed by re-generating the initramfs image and possibly adjusting the fstab – especially if it
's
an [[SSD]].

+

This article describes how to transfer your current Arch Linux installation in or out of a virtual environment (i.e. QEMU, VirtualBox, VMware), and is heavily based on the [[Full system backup with rsync]] article. A virtual machine ("VM", for short) uses different hardware, which needs to be addressed by re-generating the initramfs image and possibly adjusting the fstab – especially if it
is
an [[SSD]].



While any Linux [[
File systems|filesystem
]] should work, it
's
recommended that you go with [[ext4]], at least at first, until you get the hang of it.

+

While any Linux [[
file system
]] should work, it
is
recommended that you go with [[ext4]], at least at first, until you get the hang of it.

== Moving out of a VM ==

== Moving out of a VM ==

Line 20:

Line 20:

Setting up a shared folder between the gust virtual machine and the host depends on the hypervisor you use. Please thus refer to their specific wiki page or manual.

Setting up a shared folder between the gust virtual machine and the host depends on the hypervisor you use. Please thus refer to their specific wiki page or manual.



If you do not already have an ext4 partition, see [[Beginners' guide#
Prepare_the_storage_drive|
Prepare the storage drive]]
from the Beginners' Guide
.

+

If you do not already have an ext4 partition, see [[Beginners' guide#Prepare the storage drive]].



If you
're
on Windows, install [http://www.ext2fsd.com/ Ext2Fsd] to be able to mount ext volumes.

+

If you
are
on Windows, install [http://www.ext2fsd.com/ Ext2Fsd] to be able to mount ext volumes.

=== Transfer the system ===

=== Transfer the system ===

Line 32:

Line 32:

=== Chroot and reinstall the bootloader ===

=== Chroot and reinstall the bootloader ===



Boot a "live" GNU/Linux distribution, mount the root partition and [[chroot]] into it. See [[Beginners' guide#
Chroot and configure the base system|
Chroot and configure the base system]]
from the Beginners' Guide
.

+

Boot a "live" GNU/Linux distribution, mount the root partition and [[chroot]] into it. See [[Beginners' guide#Chroot and configure the base system]].



Reinstall your bootloader/boot manager: either [[Syslinux]], [[GRUB]] or [[Gummiboot]],
using the
[[Beginners' guide#
Install_and_configure_a_bootloader|instructions
]]
from the Beginners' Guide
. Do not forget to update the configuration file: {{ic|syslinux.cfg}} for Syslinux, {{ic|grub.cfg}} for Grub, or the Gummiboot boot entries located in {{ic|/boot/loader/entries/}}.

+

Reinstall your bootloader/boot manager: either [[Syslinux]], [[GRUB]] or [[Gummiboot]],
following
[[Beginners' guide#
Install and configure a bootloader
]]. Do not forget to update the configuration file: {{ic|syslinux.cfg}} for Syslinux, {{ic|grub.cfg}} for Grub, or the Gummiboot boot entries located in {{ic|/boot/loader/entries/}}.

=== Adjust the fstab ===

=== Adjust the fstab ===



Since your entire root tree has been transferred to a single partition, edit the [[fstab
|{{ic
|/etc/fstab
}}
]] file to reflect the right partition(s).

+

Since your entire root tree has been transferred to a single partition, edit the [[fstab|/etc/fstab]] file to reflect the right partition(s).

Check with the {{ic|blkid}} command, since {{ic|lsblk}} is not very useful inside a chroot.

Check with the {{ic|blkid}} command, since {{ic|lsblk}} is not very useful inside a chroot.

Line 44:

Line 44:

=== Re-generate the initramfs image ===

=== Re-generate the initramfs image ===



Because the hardware has changed, while you
're
still in the chroot, re-generate the initramfs image:

+

Because the hardware has changed, while you
are
still in the chroot, re-generate the initramfs image:

# mkinitcpio -p linux

# mkinitcpio -p linux

Line 50:

Line 50:

And that is about it.

And that is about it.



You will most likely need to set up the network, since the virtual machine was probably piggybacking on the host OS's network settings. See [[Beginners' guide#
Configure_the_network|
Configure the network]]
from the Beginners' Guide
.

+

You will most likely need to set up the network, since the virtual machine was probably piggybacking on the host OS's network settings. See [[Beginners' guide#Configure the network]].

== Moving into a VM  ==

== Moving into a VM  ==

Line 76:

Line 76:

# gparted /dev/loop5

# gparted /dev/loop5



{{Tip|If you want, you can add however many partitions you want: home, boot, var, tmp, whatever floats your boat. Of course, it will add a layer of complexity, but it
's
doable. The point is that you
don't
necessarily need another container.}}

+

{{Tip|If you want, you can add however many partitions you want: home, boot, var, tmp, whatever floats your boat. Of course, it will add a layer of complexity, but it
is
doable. The point is that you
do not
necessarily need another container.}}



{{Note|If you use the command-line parted instead of gparted,
don't
forget to leave 1 or 2 megabytes of unpartitioned space at the start of the disk for GRUB's embedded partition.}}

+

{{Note|If you use the command-line parted instead of gparted,
do not
forget to leave 1 or 2 megabytes of unpartitioned space at the start of the disk for GRUB's embedded partition.}}

=== Transfer the system ===

=== Transfer the system ===

Line 83:

Line 83:

Mount the loopback device and [[Full system backup with rsync|transfer]] the system:

Mount the loopback device and [[Full system backup with rsync|transfer]] the system:



{{Note|If the container was saved somewhere other than {{ic|/mnt}} or {{ic|/media}},
don't
forget to add it to the exclude list.}}

+

{{Note|If the container was saved somewhere other than {{ic|/mnt}} or {{ic|/media}},
do not
forget to add it to the exclude list.}}

# mkdir /mnt/Virtual

# mkdir /mnt/Virtual

Line 105:

Line 105:

# arch-chroot /mnt

# arch-chroot /mnt



Reinstall either Syslinux or GRUB,
using the
[[Beginners' guide#
Install_and_configure_a_bootloader|instructions
]]
from the Beginners' Guide
.
Don't
forget to update its configuration file:

+

Reinstall either Syslinux or GRUB,
following
[[Beginners' guide#
Install and configure a bootloader
]].
Do not
forget to update its configuration file:

* For Syslinux, it should be {{ic|1=APPEND root=/dev/sda1 ro}} in {{ic|syslinux.cfg}}.

* For Syslinux, it should be {{ic|1=APPEND root=/dev/sda1 ro}} in {{ic|syslinux.cfg}}.



* For GRUB, it
's
recommended that you automatically re-generate a {{ic|grub.cfg}}.

+

* For GRUB, it
is
recommended that you automatically re-generate a {{ic|grub.cfg}}.

=== Adjust the fstab ===

=== Adjust the fstab ===

Line 121:

Line 121:

=== Disable any Xorg-related files ===

=== Disable any Xorg-related files ===



Having an {{ic|nvidia}}, {{ic|nouveau}}, {{ic|radeon}}, {{ic|intel}}, etc., entry in the {{ic|Device}} section from one of the Xorg configuration files will prevent it from starting, since you will be using ''emulated'' hardware (including the video card). So it
's
recommended that you move/rename or delete the following:

+

Having an {{ic|nvidia}}, {{ic|nouveau}}, {{ic|radeon}}, {{ic|intel}}, etc., entry in the {{ic|Device}} section from one of the Xorg configuration files will prevent it from starting, since you will be using ''emulated'' hardware (including the video card). So it
is
recommended that you move/rename or delete the following:

# mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

# mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

Line 128:

Line 128:

=== Re-generate the initramfs image ===

=== Re-generate the initramfs image ===



Because the hardware has changed, while you
're
still in the chroot, re-generate the initramfs image and do a proper shutdown:

+

Because the hardware has changed, while you
are
still in the chroot, re-generate the initramfs image and do a proper shutdown:

# mkinitcpio -p linux

# mkinitcpio -p linux

Line 135:

Line 135:

Finally, pull out the LiveCD (the ISO file) and start the virtual machine.

Finally, pull out the LiveCD (the ISO file) and start the virtual machine.



{{Note|At this point you may notice that you no longer have a wallpaper.
Don't
worry about it. It
's
most likely because it is located on a different partition mounted in {{ic|/media}} or {{ic|/mnt}}, folders which were excluded from the transfer.}}

+

{{Note|At this point you may notice that you no longer have a wallpaper.
Do not
worry about it. It
is
most likely because it is located on a different partition mounted in {{ic|/media}} or {{ic|/mnt}}, folders which were excluded from the transfer.}}

Enjoy your new virtual environment.

Enjoy your new virtual environment.

Line 167:

Line 167:

You are being dropped to a recovery shell

You are being dropped to a recovery shell

Type 'exit' to try and continue booting

Type 'exit' to try and continue booting



sh:
can't
access tty; job control turned off

+

sh:
cannot
access tty; job control turned off

[rootfs /]# _

[rootfs /]# _



It most likely means that you
didn't
run {{ic|poweroff}} like ''you were instructed to'', and closed the VM with the "close" button, which is the equivalent of a power outage. Now you need to regenerate your initramfs image. To do that, you can start the VM using the Fallback entry. If you
don't
have a Fallback entry, press {{ic|Tab}} (for Syslinux) or {{ic|e}} (for GRUB) and rename it {{ic|initramfs-linux-fallback.img}}. After it boots, open up a terminal and run:

+

It most likely means that you
did not
run {{ic|poweroff}} like ''you were instructed to'', and closed the VM with the "close" button, which is the equivalent of a power outage. Now you need to regenerate your initramfs image. To do that, you can start the VM using the Fallback entry. If you
do not
have a Fallback entry, press {{ic|Tab}} (for Syslinux) or {{ic|e}} (for GRUB) and rename it {{ic|initramfs-linux-fallback.img}}. After it boots, open up a terminal and run:

# mkinitcpio -p linux

# mkinitcpio -p linux

Line 177:

Line 177:

=== "Missing operating system. FATAL: INT18: BOOT FAILURE" ===

=== "Missing operating system. FATAL: INT18: BOOT FAILURE" ===



You will need to install (reinstall) a bootloader. See
the
[[Beginners' guide#
Install_and_configure_a_bootloader|instructions
]]
from the Beginners' Guide
.

+

You will need to install (reinstall) a bootloader. See [[Beginners' guide#
Install and configure a bootloader
]].

Also, check the boot order from the BIOS or from the VM's settings and make sure that the drive containing the bootloader is the first to boot.

Also, check the boot order from the BIOS or from the VM's settings and make sure that the drive containing the bootloader is the first to boot.

Show more