Author Topic: installing FreeBSD in a VM  (Read 4723 times)

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
installing FreeBSD in a VM
« on: 2010 August 25 21:46:58 »

Well it's been about 7 years since I did a FreeBSD install so I was a little rusty but I have it somewhat running now. For some reason the Fedora .iso download is a mere trickle so I don't have that up and running yet. Will try to set up a compilation environment. Oh lovely, an install of Xorg failed. Looks like I won't be running X and therefore not testing PI natively on FreeBSD. I suppose I can install the MingX server on my windows box and display it here. The joy.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: installing FreeBSD in a VM
« Reply #1 on: 2010 August 26 00:06:57 »
Hi Sander,

You're going to love BSD :)

Some facts and recommendations:

- You must use VMware. VirtualBox does not support FreeBSD (it may seem the contrary when you just install it, but that isn't true at all).

- Install PC-BSD 8.1 for AMD64 (there's no 32-bit version of PI for FreeBSD) instead of FreeBSD. It's really easy, easier than installing Linux, and IMHO the best desktop operating system. With PC-BSD you get a working OS with X and KDE perfectly configured out of the box. It just *works*. Of course FreeBSD gives you full control, but setting it up correctly is complicated. I'll post a step-by-step guide later to install FreeBSD RELEASE-8.1.

- This is necessary: you cannot compile anything of PixInsight with the default 4.2 version of GCC that comes with FreeBSD. Due to absurd (IMO) restrictions imposed by GNU (as a result of GPL V3), FreeBSD cannot include a version higher than 4.2 in its distribution. Unfortunately, this compiler is incompatible with PixInsight/PCL, so you have to compile and install GCC 4.4 by yourself. Sounds bad but it is easy. Fortunately a full version of GCC 4.4 is included in FreeBSD's ports tree and you can just build it. After installing PC-BSD 8.1, do the following:

* Open a terminal window (Konsole) and enter this command:

init 3

Now you have terminated the X server so you have FreeBSD running in command line.

* Log in as root and run these commands.

cd /usr/ports/lang/gcc44
make
make install


This takes some time. Be patient. At the end of the process you'll have GCC 4.4 built and installed on your FreeBSD machine, and you'll be able to build PCL-based modules without problems.

* To reboot your machine:

reboot now

- I'll publish a new version of the MakefileGenerator script later, which you should use to generate your makefiles. I just have to polish it a bit more. The current version doesn't work correctly for FreeBSD.

Regarding Linux, installing Fedora 13 should give you a working system out of the box. What's causing problems?

Good luck. Remember that you can always send me your code if you want to get it compiled immediately. in case you get stuck.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: installing FreeBSD in a VM
« Reply #2 on: 2010 August 26 05:58:48 »
Hi Juan,

are you sure VB doesn't support FreeBSD? When I typed the name of the VB (FreeBSD) it automatically detected the OS type, correctly. Since I work for EMC perhaps I can get a real VMWare license for home use. Otherwise I'll have to give the free version a try. Thanks for the tip on which version to use, I'll start over with that one.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: installing FreeBSD in a VM
« Reply #3 on: 2010 August 26 16:49:18 »
I was able to install PCBSD on VirtualBox. It seems to work fine except my screen is restricted to 800x600 which is of course rather dumb. Lots of people run into this and the fix isn't that obvious. I already crippled a Fedora install by messing with the xorg config file so I'll leave this alone for now. The problem with Fedora was that some of the critical dialogs were taller than 600 pixels so I could not use them. Not so great.

I'll try to get gcc installed now.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: installing FreeBSD in a VM
« Reply #4 on: 2010 August 26 18:17:30 »
So I spent considerable time building and installing gcc 4.4 when gcc -v still says 4.2.1 after a reboot. Nice :) So it turns out that this installs an executable gcc44 rather than replacing gcc. Oy vay!
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: installing FreeBSD in a VM
« Reply #5 on: 2010 August 26 21:21:58 »
I actually got PCBSD running at native monitor resolution. What a frackin' pain.

http://wiki.freebsd.org/VirtualBox

Don't bother trying to run Xorg -configure. It won't work while Xorg is running and you can't kill it. So edit the /etc/X11/xorg.conf file by hand and do a 'killall Xorg' to kill and restart Xorg. I haven't yet tried to make the shared folders work. That would help with compiling my modules under PCBSD. Oh and I haven't installed PCL yet.

Init 3 doesn't work on PCBSD. 3 isn't a valid runlevel. In fact I haven't yet been able to run PCBSD in a fully loaded multiuser level without X.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: installing FreeBSD in a VM
« Reply #6 on: 2010 August 27 02:15:26 »
Hi Sander,

Quote
Init 3 doesn't work on PCBSD. 3 isn't a valid runlevel. In fact I haven't yet been able to run PCBSD in a fully loaded multiuser level without X.

You're right. Only levels 0, 1 and 6 are legal but none of them is useful to exit the X server. Sorry I was temporarily abducted by my GNU/Linux background :)

Actually, it seems you don't need to kill X in order to build gcc; you can build it as root from a Konsole session. On FreeBSD it gave me problems when I tried to compile it from Konsole (it crashed and caused some filesystem corruption), but went perfectly fine when I built it after a clean reboot without running startx.

Just for your information, you can get PC-BSD running without X by modifying your /etc/ttys configuration file:

su
cd /etc
cp ttys ttys.old
ee ttys


comment out the following line:

ttyv8 "/usr/PCBSD/bin/pdm" xterm on secure

by inserting a # character and a space in front of it. Press Esc and use the menu to save and exit.

Now reboot your virtual machine from KDE's Kickoff menu. It should reboot in standard tty mode. To undo the above, just copy the ttys.old backup file to ttys and reboot.

Quote
I actually got PCBSD running at native monitor resolution. What a frackin' pain.

It works perfectly on VMware, with guest additions and all :) I had to create/edit xorg.conf too, to fine tune things. This is standard practice on all unices/X systems.

Quote
So I spent considerable time building and installing gcc 4.4 when gcc -v still says 4.2.1 after a reboot. Nice smile So it turns out that this installs an executable gcc44 rather than replacing gcc. Oy vay!

This is perfectly normal, and it is logical: you cannot replace the system's distribution compiler.  After building gcc 4.4, enter this:

gcc44 -dumpversion

and you'll see 4.4.x (it's 4.4.5 on my PC-BSD vm). The new C compiler is available as 'gcc44' and the new C++ compiler is 'g++44'. The latest version 1.55 of the MakefileGenerator script knows this and will generate your makefiles accordingly.

You can also use the GCC 4.4 compiler by default if you have to build a third-party library for example. Just set the appropriate environment variables for the console session where you want to compile:

export CC=gcc44
export CXX=g++44
export CPP=cpp44


and run the configure script (or equivalent) for the library in question. Then make or gmake, etc.

Quote
I haven't yet tried to make the shared folders work. That would help with compiling my modules under PCBSD.

You actually don't need shared folders. I never use them because they are not secure, and are an added layer of complexity that isn't necessary. You can communicate with the virtual machine via SSH. This is how I work on all of my development machines, both virtual and physical. On Windows, you'll have to install a good SSH client application. I strongly recommend WinSCP, which is what I use. It works like a charm.

Quote
Oh and I haven't installed PCL yet.

You cannot, actually :) I'll upload a PCL-pxi.a file and the corresponding include/pcl folder for FreeBSD in a while.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: installing FreeBSD in a VM
« Reply #7 on: 2010 August 27 07:07:55 »
Hi Juan,

I have a question in with one of our VMWare guys what I should use to run VMWare like VB i.e. run VMs under a Windows guest OS. All I've used so far is ESX and with a Linux host OS. Those aren't options for me right now. As I work for EMC I should be able to get the stuff I need. If not then I've at least made VB work.

Yes, I'm familiar with ssh and use WinSCP every day. I just don't like copying files back and forth. It's error prone. Last time I played with this I was able to mount my CVS root using NFS on Fedora in a VB.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity