Parallels

From ArchWiki
Revision as of 12:58, 9 January 2011 by Belka (Talk | contribs) (Created page with "Category:Emulators (English) Category:HOWTOs (English) This article is about running Arch as guest operation system on Parallels. ==Overview== Parallels is a software, ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This article is about running Arch as guest operation system on Parallels.

Overview

Parallels is a software, which allows you to setup virtual machines and run different operation systems without need to reboot your computer. A more complete description on virtualisation can be found on Wikipedia. At the moment of writing Parallels is released in version 6. The current kernel version is 2.6.36 and 2.6.37 is considered stable.

Installation of Arch as guest.

Parallels supports Linux guests out of the box. For Arch you can chose „other linux - kernel 2.6“. There is not much to say on installation - the steps are the same, as if you would install Arch on a real machine.

Parallels Tools

Overview

To improve the interoperability between the host and the guest operation systems, Parallels provides you a package with kernel modules and userspace tools called „Parallels Tools“. Here is the list of features.

Installation

Choose „install Parallels Tools“ from the „Virtual Machine“ menu. Parallels Tools are located on a cd-image, which was connected to you virtual machine. You have to mount it first:

$ mount /dev/sr0 /mnt/cdrom

The installation-script expects to find your init-scripts in /etc/init.d/. The installation will fail, if the directory is not present. To fix it you either create /etc/init.d/ or define def_sysconfdir environment variable by doing the following (thanks AlandyS for this post in Parallels-forum):

$ export def_sysconfdir=/etc/rc.d

The installation-script expects to find /etc/X11/xorg.conf too. Your xorg configuration will be fixed to work with Parallels Tools. The installation will fail, if xorg.conf is not present. Create it:

$ touch /etc/X11/xorg.conf

After the installation you can move xorg.conf to /etc/X11/xorg.conf.d/ and call it something like 10-parallels.conf if you want. It is be probably a more appropriate location, but you don't have to - it will work as it is now too.

Then you can run the installer-script and follow the instructions:

$ cd /mnt/cdrom
$ ./install

At the moment of writing Paralles Tools fails to compile agains kernel 2.6.36 / 2.6.37 due to some changes in the kernel api. You will need to patch Paralles Tools to fix the problem. Copy everything from /mnt/cdrom to a writeable directory:

$ cp -r /mnt/cdrom/* ~/parallels_tools/

extract the source code of the kernel modules:

$ mkdir ~/kmods_src/
$ cd ~/kmods_src/
$ tar xzf ~/parallels_tools/kmods/prl_mod.tar.gz

save the following patch to a file named prl_tools-2.6.37.patch:

diff -cr prl_mod/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c prl_mod_patched/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
*** prl_mod/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c	2010-12-20 20:53:25.000000000 +0100
--- prl_mod_patched/prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c	2011-01-09 00:35:59.084213064 +0100
***************
*** 368,374 ****
  	init_buffer_descriptor(&bd, &pattr, PATTR_STRUCT_SIZE, 0, 0);
  	ret = host_request_attr(sb, p, buflen, &bd);
  	if (ret == 0)
! 		ret = inode_setattr(dentry->d_inode, attr);
  	dentry->d_time = 0;
  	PRLFS_STD_INODE_TAIL
  }
--- 368,378 ----
  	init_buffer_descriptor(&bd, &pattr, PATTR_STRUCT_SIZE, 0, 0);
  	ret = host_request_attr(sb, p, buflen, &bd);
  	if (ret == 0)
! 	{
! 		setattr_copy(dentry->d_inode, attr);
! 		mark_inode_dirty(dentry->d_inode);
! 		ret = 0;
! 	}
  	dentry->d_time = 0;
  	PRLFS_STD_INODE_TAIL
  }
diff -cr prl_mod/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c prl_mod_patched/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c
*** prl_mod/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c	2010-12-20 20:53:35.000000000 +0100
--- prl_mod_patched/prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c	2011-01-09 00:22:17.200882662 +0100
***************
*** 959,978 ****
  	goto out;
  }
  
- #ifdef HAVE_UNLOCKED_IOCTL
  static long prl_vtg_unlocked_ioctl(struct file *filp,
  			unsigned int cmd, unsigned long arg)
  {
  	return prl_vtg_ioctl(NULL, filp, cmd, arg);
  }
- #endif
  
  static struct file_operations prl_vtg_fops = {
  	.write		= prl_tg_write,
! 	.ioctl		= prl_vtg_ioctl,
! #ifdef HAVE_UNLOCKED_IOCTL
  	.unlocked_ioctl	= prl_vtg_unlocked_ioctl,
- #endif
  	.open		= prl_vtg_open,
  	.release	= prl_vtg_release,
  };
--- 959,974 ----
  	goto out;
  }
  
  static long prl_vtg_unlocked_ioctl(struct file *filp,
  			unsigned int cmd, unsigned long arg)
  {
  	return prl_vtg_ioctl(NULL, filp, cmd, arg);
  }
  
  static struct file_operations prl_vtg_fops = {
  	.write		= prl_tg_write,
! //	.ioctl		= prl_vtg_ioctl,
  	.unlocked_ioctl	= prl_vtg_unlocked_ioctl,
  	.open		= prl_vtg_open,
  	.release	= prl_vtg_release,
  };

Apply the patch to your copy of Parallels Tools:

$ cd ~/kmods_src
$ cat ~/prl_tools-2.6.37.patch | patch -p1

if you see the following output you need to install the patch tool first (pacman -S patch)

$ bash: patch not found

if the soruce was patched successfully you should see following output:

$ patching file prl_fs/SharedFolders/Guest/Linux/prl_fs/inode.c
$ patching file prl_tg/Toolgate/Guest/Linux/prl_tg/prltg.c

create a archive with the patched version of Parallels Tools and replace the original:

$ cd ~/kmods_src
$ tar czf ../prl_mod.tar.gz *
$ rm ~/parallels_tools/kmods/prl_mod.tar.gz
$ mv ../prl_mod.tar.gz ~/parallels_tools/kmods

After patching run the installation-script again:

$ cd ~/parallels_tools/
$ ./install

configuration

open /etc/rc.conf and change the MODULES=() to the following:

$ MODULES=(prl_fs prl_pv prl_fs_freeze prl_tg prl_eth)

Appendix A: alternatives to Parallels

Parallels is a popular virtualization solution for the mac platform, but it is not the only one. There is a competitive product from VMware called VMware Fusion and of course the free and awesome VirtualBox from Oracle (former Sun Microsystems). For Windwos VMware provides a free product called VMware Player, which lets you run (but not create, as far as i know) virtual machines.