# FreeBSD hosting FreeBSD in Virtualbox



## max21 (Dec 9, 2014)

I have been running *FreeBSD as host* for Windows for quite a while. I have not gotten into jails yet other than reading about it (it is my ultimate goal), but for now, a few days ago I decided installed FreeBSD 10.1 inside VirtualBox as a place to start. Now I understand why users need to upload the boot-only ISO to install FreeBSD on Vultr KVM. I’m so glad I read this last month because for a minute I didn't know what VirtualBox' problem was. I even went back to FreeBSD 8.2 trying to make it work, then it hit me like a ton of bricks.

https://forums.freebsd.org/threads/freebsd-hosting-shared-vps-etc.21472/page-4

Anyway, when trying to mount USB I get this error "block device required". So I `/dev; ls -l` and there are no block devices at all under /dev inside this FreeBSD virtual OS. What command can I use to mount USB inside this virtual system or what do I need to do to make this happen?

I got a feeling that this is not possible, and if this is true maybe it’s not such a big deal anyway for a server. On the hosting side it just add an extra layer of security. I kind of better understand the use of VirtualBox, KVM and other virtualization where FreeBSD would be the guest. Jails would not have these problems but cloud hosting is dominated by KVM and openVZ. On my first try I will know what to expect. Other than the power of the KVM administrator _and that’s a maybe_, I bet a FreeBSD jail could be so deep Beastie couldn’t find it. I’m just wondering...

Anyway, I have files under the FreeBSD host system that I want to copy inside this virtual FreeBSD space. How do I connect to the host and/or other machine to upload and download files into my new virtual OS similar to what freebsd-update(8) just did, or whatever is best that you networking people do.

I’m not asking for a full course in networking. I got a decent understanding from reading threads and links from here but I never did anything but wonder about it, now I am force to learn use it

All I need is a few commands and hints to get me started. Just one more thing. What command would I use to learn the IP address of this FreeBSD inside VirtualBox, and how could I make it static so to take that control away from VirtualBox?

Thanks in advance.


----------



## Oko (Dec 9, 2014)

max21 said:


> Anyway, when trying to mount USB I get this error *block device required *.  So I */dev; ls -l* and there are no block devices at all under */dev* inside this FreeBSD virtual OS.  What command can I use to mount USB inside this virtual system or what do I need to do to make this happen?


IIRC VirutalBox distributes USB device drivers separately in the form of binary blobs (extension packages). I am not sure those are available for FreeBSD as no official builds are available for FreeBSD.


----------



## J65nko (Dec 9, 2014)

You can find out the IP address with `$ ifconfig`. If the FreeBSD host has sshd(8) running, you should be able to use scp(1) to copy files from the host into the guest.

Or read the DATA TRANSFER section from nc(1) to do it without configuring SSH.

See https://www.virtualbox.org/manual/ch06.html for the different types of networking. I use bridged networking and have configured the guests to get an IP address from a DHCP server on my local network.


----------



## spanglefox (Dec 9, 2014)

On a slightly separate note I found sysutils/ezjail IMMENSELY useful for setting up jails. Like you I initially read about jails but found that it fried my brain a little.

Using sysutils/ezjail was an absolute cinch in comparison.


----------



## vermaden (Dec 9, 2014)

Oko said:


> IIRC VirutalBox distributes USB device drivers separately in the form of binary blobs (extension packages). I am not sure those are available for FreeBSD as no official builds are available for FreeBSD.


When there was Virtualbox 4.0/4.2 on FreeBSD, the USB 2.0 devices just worked as USB 1.1 devices, but as Virtualbox 4.3 has been introduced to FreeBSD the USB pass through does not work any more, at any speed.

Strange.


----------



## max21 (Dec 11, 2014)

> IIRC VirtualBox distributes USB device drivers separately in the form of binary blobs (extension packages). I am not sure those are available for FreeBSD as no official builds are available for FreeBSD.


My searches came up empty but that’s ok.  At least I know what has to be done.  For me it’s all about practicing on my own box before purchasing VPS’s.  Using USB would have been a quick way to grab needed files on my own box. At lease there’re other ways and I’m ready to try. Thank you Oko.



> On a slightly separate note I found sysutils/ezjail IMMENSELY useful for setting up jails. Like you I initially read about jails but found that it fried my brain a little.



There’s two kinds of people in this world.  Those who think to learn and those who learn to think.  Just like you spanglefox, I go deep, spending lots of time to learn to think which is best and why. After all my research ezjail just finally won! Ezjail will be included in my set-up so to test which VPS instance will allow it (once I figure out how to), other than that I would need partners to handle payment to colocation where we know for sure FreeBSD runs the entire show.
http://lowendtalk.com/discussion/7024/backuping-freebsd-jails-instances-to-lebs

vermaden, even more peculiar; FreeBSD hosting Windows under these newer Virtualboxes, my UTC time is still living seven hours ahead when inside Windows, since 9.1. Over all these years, same effect on over five machines using many new ISOs. Other than that, Windows has a happy home, now it’s all about FreeBSD hosting jails and Virtualbox with FreeBSD.

J65nko, I can’t get SCP to work. I did tons of searching. I tried with and without the internet cable connect. I turn off the pf firewall under the host. I even did the Allow Root Access thing in the both configuration files.  Now I’m all worn out. It feel like working with first FreeBSD or Redhat disk back in the nineties. I never got anywhere with either.


```
# ifconfig
Inet …..
Lo0:
Inet6 ….
```


maxx.host.local
Check if sshd is running.

```
ps -aux | grep ssh
Root 2358 0.0 0.0 18744 2156 1 S+ 7:79PM 0:00.00 grep ssh
```


bootonly.guest.local
Both are but compare time and other differences

```
ps -aux | grep ssh
Root 1324 0.0 2.7 61204 6488 - Is 5:40PM 0:00.00 /usr/sbin/sshd
```


maxx.host.local
But date is fine!

```
# date
Tue Dec 9 19:58:57 UTC 2014
```


bootonly.guest.local
Same here!

```
# date
Tue Dec 9 19:58:45 UTC 2014
```


maxx.host.local
I’m trying to copy a file from the guest.

```
# scp root@bootonly.guest.local:myfile1.txt /var/tmp
ssh: could not resolve hostname bootonly.guest.local : hostname nor servname provided or not known, lost connection
```

bootonly.guest.local
I’m trying to copy a file from the host.

```
# scp root@ maxx.host.local:myfile2.txt /var/tmp
ssh: could not resolve hostname bootonly.guest.local : hostname nor servname provided or not known, lost connection
```

I tried many difference kinds of SCP examples I could find. They all fail and for all of them the error message was this which is slightly difference than above.

```
ssh: could not resolve hostname bootonly.guest.local : hostname nor servname provided or not known
```

Then I remember the ping way of checking.

maxx.host.local


```
# ping www.yahoo.com
PING fd-fp3.wg1.b.yahoo.com (98.139.183.24): 56 data bytes
64 bytes from …
64 bytes from …
```


bootonly.guest.local


```
# ping www.yahoo.com
PING fd-fp3.wg1.b.yahoo.com (98.139.183.24): 56 data bytes
```

Ping from the virtual FreeBSD fails. But the modem light was flashing, indicating that something was happening. I enter the keyboard command [ctl]z and the light stops flashing. I bet the pings are coming but the console is not moving up to displaying them. Right now I am doing a `portsnap fetch` and it working!

What am I’m doing wrong with my SCP commands? How can I make the console display the pings? What command can I use to connect to the host _and_ from the host? Do the boot-only install really works or are there issues already discussed?

Thank you all.


----------



## gqgunhed (Dec 11, 2014)

Hi max21,

There are a fews points you have to correct as far as I can see. Some examples or ideas for solutions follow below:



> maxx.host.local
> I’m trying to copy a file from the guest.
> 
> ```
> ...



As the error messages states, your client is not able to get find an IP address for the given hostname "bootonly.guest.local". Try to connect to the IP address of the host instead. Maybe check your /etc/resolv.conf in the VM to see which DNS host is used to resolve the names to IPs.

Depending on the type of network adapter/network setting you chose for your virtual machine in VirtualBox you will (e.g. Bridged Network) or will not (NAT) be able to connect _to_ your client from your host or network. Connecting from your virtual client to the outside network and the services like sshd on your host should work.



> bootonly.guest.local
> 
> 
> ```
> ...



Hitting Ctrl-Z will suspend and background the running process. `fg` will return it to the "foreground" so you will see the output again.

For all these points to be addressed you should read the Networking sections of the FreeBSD Handbook and get a good understanding of routing, DNS, IP addresses and subnets and so on. Otherwise you will not find much joy when playing around with virtualization of any kind 

I hope this gives some hints on where to go.

gqgunhed


----------



## max21 (Dec 11, 2014)

> I hope this gives some hints on where to go.


I got lots of reading to do but without these types of suggestions I know already I would miss too many important points.  It's exactly what I needed. It’s the guiding light for learners like myself.

About the [ctl]z command, I been doing that since day one thinking I kill the process, hahaha. I’ll be back to brag about my networking experience in a few days or two. Thanks a ton gqgunhed, and Thanks again J65nko for the crash course. I will read the link you posted in its entirety this time. I've been a one-page Charlie too long.  *Wow!*


----------

