Milamber_Cubed
Jun 9, 2007, 08:30 AM
Moved from "Parallels Desktop for Mac"
This has been a bit of a work in progress - READ ALL THE WAY THROUGH TO THE END OF THE THREAD FOR MY LATEST ADDITIONS AND CHANGES
Hi All.
Got my MBP a week or so ago and I have now got this working pretty seamlessly, including automatic selection of xorg config at boot time, thanks to info from this threads on here and other places. I thought I would share my experience.
I'll detail what I did from the point where I had triple boot via EFI and windows "boot camp" booting properly in Parallels. There are plenty of guides out there on how to get to this point, so I won't try to re-invent the wheel.
Bear in mind that I am using Ubuntu Feisty and your distro might behave a bit differently. DO NOT try this if you are not reasonably familiar with your flavour of Linux and are happy being stranded at a command line. Also, a fair bit of this is from memory, so don't blindly follow my instructions... especially do not copy and paste! Look at the commands and think it through. I am not responsible if you hose your installation - back stuff up first!
Another thing to keep in mind is that I'm not using version 3.0 of parallels I'm using build 3188. If you have a different version, things might not (but really should) work out the same. I would be interested to see how well the Linux tools performed in this setup though. Unlikely to happen given all the bad stuff I've heard about 3.0 on this forum.... Anyway, on with the guide.
First I created a new VM, I think I chose Linux and Other Linux, and I gave it a dynamic hard disk of about 300MB. I then went off and downloaded Damn Small Linux ISO (only 50MB) and made it the boot CD for the new VM. I followed its instructions to do a full install (not frugal) to the virtual disc (cfdisk /dev/hda to create partition hda1) and eventually chose GRUB as its boot loader. Then reboot to make sure all worked okay. Once you're happy shut down the VM.
NOTE - for some reason, the VM never seems to shut down properly and I have to wait until I am sure all is done before forcing it.
Hopefully you have got to this point, otherwise I am going to be writing a lot of stuff that is no use to anyone!
Once shut down, you want to add a boot camp drive to the VM - i.e. your linux partition. I also added support for a few resolutions in the video setting at this point - especially 1440x900 for my MBP. Remember to edit the file in textedit and change the "Boot Camp" to "Boot Camp;disk0s3". In my case, I arranged the drives like so:
Virtual Disk (DSL) - IDE 0:0
Linux Partition (disk0s3) - IDE 0:1
DVD Drive (now empty) - IDE 1:0
This has the effect of making my Ubuntu partition (hd1,0) - make sure you know where your Linux partition is!
Now all that you need to do is boot into DSL again and edit the /boot/grub/menu.lst to load up your Linux installation. I mounted my ubuntu partition within DSL (mount /dev/hdb1 /mnt) so I could copy and paste the contents of the menu.lst from one to the other.
The orignal was
title Ubuntu 2.6.20-15-generic kernel
root (hd0,3)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
savedefault
I changed it to be
title Ubuntu for Parallels
root (hd1,0)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash vga=792
initrd /boot/initrd.img-2.6.20-15-generic
savedefault
The root drive is now hd1,0 and the vga=792 allows me to see the boot splash screen. If the vga doesnt work for you, try removing everything after "ro".
Now, I think a big part of the reason this works for me is that Ubuntu uses UUID for GRUB and fstab - meaning that even if partitions/drives move around etc Ubuntu still mounts the right ones in the right places. Your mileage may vary with other distros and you may need to make some tweaks.... or you may not.
Restart DSL after you made the changes and you should be able boot into Ubuntu - YAY!. But you'll get no X server - BOO!
From here on in you'll need root privileges to do a lot of the things required so instead of putting "sudo" at the beginning of every line, I do the following:
sudo su
and enter my user password. Other distros usually let you just use "su" and enter the root password.
Now to fix the X server... You dont want to loose your current xorg.conf settings - you need them for when you want a native boot, so make a copy of it in the /etc/X11 directory as native-xorg.conf.
cd /etc/X11
cp xorg.conf native-xorg.conf
Then I had to run "dpkg-reconfigure -phigh xserver-xorg" to select the vesa driver and correct resolutions (as added to the VM earlier). This step will vary according to distro as well.
After doing this and "/etc/init.d/gdm restart" (maybe twice) you should have a working desktop. (May have to use kdm or just run startx on other distros.)
Awesome.
Not done yet though. Open up a terminal (remember to become root) and save the current settings for later use:
cd /etc/X11
cp xorg.conf parallels-xorg.conf
Now, the final piece of the puzzle is to get the system to load up the correct xorg file on boot. I use the fact that my linux partition is a different block device in native boot (/dev/sda3) and Parallels (/dev/sdb1 - NOT /dev/hdb1 for some reason)
I have a little script that does the job for me that gets run every boot just before the X server gets loaded. First off, here's the script - it should be pretty universal at least. Bear in mind that it relies on sdb1 being mounted in parallels and NOT AT ALL in native mode:
#! /bin/bash
cd /etc/X11
mount | grep sdb1 > /dev/null
if [ $? == 0 ]
then
echo Parallels booted, selecting relevant xorg file
cp parallels-xorg.conf xorg.conf
else
echo Native boot, selecting relevant xorg file
cp native-xorg.conf xorg.conf
fi
So basically, I'm looking to see if sdb1 is mounted or not and choosing the xorg config based on that. Pretty simple right? Save that somewhere sensible. I put it at /parallels/detect-xorg - remember to chmod +x the file to make it executable.
Now the slightly trickier part - making the script run at the right time.
Ubuntu defaults to runlevel 2 whereas most distros use runlevel 5 so you need to be a bit wary of this step. Also, the location of the init scripts might be different for you - look this stuff up and adapt the insrtuctions to your own distro. Knowing that Ubuntu uses run level 2, i had a look in /etc/rc2.d/ and found that gdm is started by "S13gdm".
If you do
cd /etc/rc2.d
ls -l S12gdm
you'll see that S13gdm is just a link to a different script called simply "gdm". The reason this is done is so that the scripts can be executed in the right order. To make our script execute at run level but BEFORE gdm starts, we need to link to it in this directory with a name alphabetically before S13gdm. Here's what I did
cd /etc/rc2.d
ln -s /parallels/detect-xorg S12detect-xorg
Now every time ubuntu boots it will run our script before starting X and choose the right configuration.
And that's all folks. You now have a seamless parallels way of booting your Linux install. The DSL virtual disk takes up less than 150MB on my system - which is perfectly acceptable to me in order to get this going - but a frugal install would take up only 50, if you need the extra 100MB badly. It's also a useful thing to have to try and fix things if they go wrong on your Linux partition.
I know that the quality of my guide isnt the best and the amount of detail I go into changes a lot, but there are some pretty distro-specific things to take into account and I can't really make a one size fits all guide.
Hope it's of some help though.
Good Luck!
FUTURE CHANGES
I am going to try changing my GRUB entry from
title Ubuntu for Parallels
root (hd1,0)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash vga=792
initrd /boot/initrd.img-2.6.20-15-generic
savedefault
TO
title Ubuntu for Parallels
root (hd1,0)
kernel /vmlinuz root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash vga=792
initrd /initrd.img
savedefault
I THINK that when ubuntu installs new kernels it updates these links in the root directory to point to the latest kernel. This would save having to boot into DSL to update its menu.lst every time there is a new kernel. I'm pretty sure that you should install any such updates in native mode - just to avoid any complications. Just thougt I'd share my musings.
This has been a bit of a work in progress - READ ALL THE WAY THROUGH TO THE END OF THE THREAD FOR MY LATEST ADDITIONS AND CHANGES
Hi All.
Got my MBP a week or so ago and I have now got this working pretty seamlessly, including automatic selection of xorg config at boot time, thanks to info from this threads on here and other places. I thought I would share my experience.
I'll detail what I did from the point where I had triple boot via EFI and windows "boot camp" booting properly in Parallels. There are plenty of guides out there on how to get to this point, so I won't try to re-invent the wheel.
Bear in mind that I am using Ubuntu Feisty and your distro might behave a bit differently. DO NOT try this if you are not reasonably familiar with your flavour of Linux and are happy being stranded at a command line. Also, a fair bit of this is from memory, so don't blindly follow my instructions... especially do not copy and paste! Look at the commands and think it through. I am not responsible if you hose your installation - back stuff up first!
Another thing to keep in mind is that I'm not using version 3.0 of parallels I'm using build 3188. If you have a different version, things might not (but really should) work out the same. I would be interested to see how well the Linux tools performed in this setup though. Unlikely to happen given all the bad stuff I've heard about 3.0 on this forum.... Anyway, on with the guide.
First I created a new VM, I think I chose Linux and Other Linux, and I gave it a dynamic hard disk of about 300MB. I then went off and downloaded Damn Small Linux ISO (only 50MB) and made it the boot CD for the new VM. I followed its instructions to do a full install (not frugal) to the virtual disc (cfdisk /dev/hda to create partition hda1) and eventually chose GRUB as its boot loader. Then reboot to make sure all worked okay. Once you're happy shut down the VM.
NOTE - for some reason, the VM never seems to shut down properly and I have to wait until I am sure all is done before forcing it.
Hopefully you have got to this point, otherwise I am going to be writing a lot of stuff that is no use to anyone!
Once shut down, you want to add a boot camp drive to the VM - i.e. your linux partition. I also added support for a few resolutions in the video setting at this point - especially 1440x900 for my MBP. Remember to edit the file in textedit and change the "Boot Camp" to "Boot Camp;disk0s3". In my case, I arranged the drives like so:
Virtual Disk (DSL) - IDE 0:0
Linux Partition (disk0s3) - IDE 0:1
DVD Drive (now empty) - IDE 1:0
This has the effect of making my Ubuntu partition (hd1,0) - make sure you know where your Linux partition is!
Now all that you need to do is boot into DSL again and edit the /boot/grub/menu.lst to load up your Linux installation. I mounted my ubuntu partition within DSL (mount /dev/hdb1 /mnt) so I could copy and paste the contents of the menu.lst from one to the other.
The orignal was
title Ubuntu 2.6.20-15-generic kernel
root (hd0,3)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash
initrd /boot/initrd.img-2.6.20-15-generic
savedefault
I changed it to be
title Ubuntu for Parallels
root (hd1,0)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash vga=792
initrd /boot/initrd.img-2.6.20-15-generic
savedefault
The root drive is now hd1,0 and the vga=792 allows me to see the boot splash screen. If the vga doesnt work for you, try removing everything after "ro".
Now, I think a big part of the reason this works for me is that Ubuntu uses UUID for GRUB and fstab - meaning that even if partitions/drives move around etc Ubuntu still mounts the right ones in the right places. Your mileage may vary with other distros and you may need to make some tweaks.... or you may not.
Restart DSL after you made the changes and you should be able boot into Ubuntu - YAY!. But you'll get no X server - BOO!
From here on in you'll need root privileges to do a lot of the things required so instead of putting "sudo" at the beginning of every line, I do the following:
sudo su
and enter my user password. Other distros usually let you just use "su" and enter the root password.
Now to fix the X server... You dont want to loose your current xorg.conf settings - you need them for when you want a native boot, so make a copy of it in the /etc/X11 directory as native-xorg.conf.
cd /etc/X11
cp xorg.conf native-xorg.conf
Then I had to run "dpkg-reconfigure -phigh xserver-xorg" to select the vesa driver and correct resolutions (as added to the VM earlier). This step will vary according to distro as well.
After doing this and "/etc/init.d/gdm restart" (maybe twice) you should have a working desktop. (May have to use kdm or just run startx on other distros.)
Awesome.
Not done yet though. Open up a terminal (remember to become root) and save the current settings for later use:
cd /etc/X11
cp xorg.conf parallels-xorg.conf
Now, the final piece of the puzzle is to get the system to load up the correct xorg file on boot. I use the fact that my linux partition is a different block device in native boot (/dev/sda3) and Parallels (/dev/sdb1 - NOT /dev/hdb1 for some reason)
I have a little script that does the job for me that gets run every boot just before the X server gets loaded. First off, here's the script - it should be pretty universal at least. Bear in mind that it relies on sdb1 being mounted in parallels and NOT AT ALL in native mode:
#! /bin/bash
cd /etc/X11
mount | grep sdb1 > /dev/null
if [ $? == 0 ]
then
echo Parallels booted, selecting relevant xorg file
cp parallels-xorg.conf xorg.conf
else
echo Native boot, selecting relevant xorg file
cp native-xorg.conf xorg.conf
fi
So basically, I'm looking to see if sdb1 is mounted or not and choosing the xorg config based on that. Pretty simple right? Save that somewhere sensible. I put it at /parallels/detect-xorg - remember to chmod +x the file to make it executable.
Now the slightly trickier part - making the script run at the right time.
Ubuntu defaults to runlevel 2 whereas most distros use runlevel 5 so you need to be a bit wary of this step. Also, the location of the init scripts might be different for you - look this stuff up and adapt the insrtuctions to your own distro. Knowing that Ubuntu uses run level 2, i had a look in /etc/rc2.d/ and found that gdm is started by "S13gdm".
If you do
cd /etc/rc2.d
ls -l S12gdm
you'll see that S13gdm is just a link to a different script called simply "gdm". The reason this is done is so that the scripts can be executed in the right order. To make our script execute at run level but BEFORE gdm starts, we need to link to it in this directory with a name alphabetically before S13gdm. Here's what I did
cd /etc/rc2.d
ln -s /parallels/detect-xorg S12detect-xorg
Now every time ubuntu boots it will run our script before starting X and choose the right configuration.
And that's all folks. You now have a seamless parallels way of booting your Linux install. The DSL virtual disk takes up less than 150MB on my system - which is perfectly acceptable to me in order to get this going - but a frugal install would take up only 50, if you need the extra 100MB badly. It's also a useful thing to have to try and fix things if they go wrong on your Linux partition.
I know that the quality of my guide isnt the best and the amount of detail I go into changes a lot, but there are some pretty distro-specific things to take into account and I can't really make a one size fits all guide.
Hope it's of some help though.
Good Luck!
FUTURE CHANGES
I am going to try changing my GRUB entry from
title Ubuntu for Parallels
root (hd1,0)
kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash vga=792
initrd /boot/initrd.img-2.6.20-15-generic
savedefault
TO
title Ubuntu for Parallels
root (hd1,0)
kernel /vmlinuz root=UUID=d5d9c44a-d2e4-4a3b-a53f-00409e27fd59 ro quiet splash vga=792
initrd /initrd.img
savedefault
I THINK that when ubuntu installs new kernels it updates these links in the root directory to point to the latest kernel. This would save having to boot into DSL to update its menu.lst every time there is a new kernel. I'm pretty sure that you should install any such updates in native mode - just to avoid any complications. Just thougt I'd share my musings.