FreeBSD on x86


#1

Here are some notes of the process I’ve used to set up FreeBSD on a START1-S instance.

During the installation a START1-M instance with 2 LSSDs is needed. The OS will be installed on the system volume and the secondary volume will contain the installation media. It’s possible to do something similar to get FreeBSD on a START1-XS, but if you are using the webinterface, then AFAIK you have to create the START1-XS first and create a snapshot of that. Then you can use that snapshot to spawn a START1-S with a 25G volume instead of 50G.


Spin up a START1-M instance running any Linux distribution (Ubuntu fx), and log in through SSH. Make sure that the instance has Enable Local Boot set to ON.

Fetch the FreeBSD installation image:

wget http://scaleway.kristensen.io/FreeBSD-12.0-RELEASE-amd64-mini-memstick.img

dd the image to the secondary volume:

dd if=FreeBSD-12.0-RELEASE-amd64-mini-memstick.img of=/dev/vdb

Then reboot.

The img file contains the default FreeBSD-12.0-RELEASE-amd64-mini-memstick image with a modified loader.conf, rc.local, dhclient.conf and Scaleway specific scripts in /usr/local/{bin,sbin}


Quickly switch over to the web console and hit ESC multiple times when you see a completely black console.

You should now be seeing the UEFI menu. If you are in the GRUB menu, then reboot and try again.

Once your are in the UEFI menu choose Boot Manager then EFI Misc Device 1

FreeBSD will boot and tell you to SSH into the instance in order to complete the installation.


SSH into the instance and run bsdinstall

  • The OS must be installed on vtbd0.

  • Nevermind the empty resolve settings, they will be filled out by DHCP on reboot.

Once you are done with bsdinstall and back in the shell, run scw-finalize.

Then reboot the instance into your shiny new installation. :beers:

Depending on what you want to do, you can now wipe the installation media from vtbd1, or create a START1-S instance and attach the OS volume to that one instead, then throw the START1-M away.

Known issues:

  • Space key doesn’t work in the console (seems to be a Chrome issue)

Installing Windows Server 2012R2 on VC VPS
FreeBSD on ARM64
#2

I’ve done this and the server keeps crashing. I’ve been able to SSH, etc but after a minute it crashes and reboots. I don’t understand why,


#3

@marcotuna sounds like the curl cronjob is not working. If the server doesn’t switch from ‘booting’ to ‘booted’ state after a minute or so, the Scaleway control plane will reboot the server and keep doing so, until something changes the state to ‘booted’.


#4

@nielsek I am having issues installing curl. I can’t add the crontab task because pkg is not installing curl.

Then server crashes again.
One question, the IP address from the cron task is from scaleway or should I replace with my vc1 ip address? Because if I do a simple http request I got no answer, does it only works inside the vc1 itself?

Thanks.


#5

@marcotuna not sure why pkg install curl is failing. Maybe the server rebooted while bootstrapping pkg the first time, bringing it to some inconsistent state?

You could use telnet instead of curl to keep the server floating, by doing something like this:

$ vi patch-request.sh 
#!/bin/sh
echo "open 169.254.42.42 80"
sleep 2
echo "PATCH /state HTTP/1.1"
echo "Host: 169.254.42.42"
echo "Content-Type: application/json"
echo "Content-Length: 26"
echo
echo '{"state_detail": "booted"}'
echo
sleep 2
$ chmod +x patch-request.sh
$ ./patch-request.sh | telnet
telnet> Trying 169.254.42.42...
Connected to 169.254.42.42.
Escape character is '^]'.
HTTP/1.1 200 OK
Server: Tengine
Date: Tue, 02 Aug 2016 17:19:06 GMT
Content-Type: text/plain
Content-Length: 20
Connection: keep-alive

STATE_DETAIL=booted
Connection closed by foreign host.
$ 

The IP address is Scaleways and only works from the VC1 instance.


#6

Thanks for this post, @nielsek.

I’ve been at this for a couple of hours but sadly no luck as yet. The console keeps freezing up at various points in the process; I got as far as manual config prior to reboot on my latest attempt, but again the console froze up, before I got chance to edit loader.conf.

The only way out of that seems to be hard reboot, which isn’t much good on an incomplete install.

I just signed up here yesterday so unsure whether this problem is specific to this install process, or a console issue in general. Did you ever encounter this problem during the install process?

Update: Must have been a Chromium issue. Install went smoothly accessing the console through Firefox.


#7

@nielsek Thanks, it solved the reboot problem.
The pkg seems to be broken. I installed it from ports and then did a pkg update and a pkg upgrade and then i’ve been able to install curl.


#8

I installed FreeBSD on KVM/QEMU hosted on an Ubuntu VC1 instance. Just another option to consider, depending on what you want to do with your FreeBSD. Only really tested running an Nginx server so far, but seems solid enough.


#9

I’ve updated the tutorial, so now the instance can be installed using the new Local Boot feature, instead of having to escape the iPXE boot process on every boot.


#10

Hi there, I was wondering if you could share your secret sauce for adapting the image to work with Local Boot? I need to run openSUSE Linux. I’ve tried installing it to a volume and booting off that like you describe in your tutorial, but EFI Misc Device 1 doesn’t load anything and it just goes back to the first UEFI screen.


#11

Hi there,

It appears that there are errors when you run scw-finalize on a new NVMe box -

root@freebsd:~ # scw-finalize
cp: /mnt/usr/local is not a directory
rm: /mnt/usr/local/sbin/scw-init: No such file or directory
rm: /mnt/usr/local/sbin/scw-finalize: No such file or directory
cp: /mnt/etc/dhclient.conf: No such file or directory
/usr/local/sbin/scw-finalize: cannot create /mnt/var/cron/tabs/root: No such file or directory
grep: /mnt/boot/loader.conf: No such file or directory
mv: rename /tmp/scw-final-loader.conf to /mnt/boot/loader.conf: No such file or directory
/usr/local/sbin/scw-finalize: cannot create /mnt/etc/ssh/sshd_config: No such file or directory
root@freebsd:~ #

The box also doesn’t boot! Appears to hang:

Hope this helps!


#12

@cellardoor which instance type are you running? I did a test using a START1-M, seems to work fine.


#13

Hi @nielsek - Thanks for replying.

I’m also on START1-M, but had another try this evening and figured out what is going wrong. In your instructions, between the ‘bsdinstall’ script completing and asking the user to run ‘scw-finalize’ - there is no instruction to mount the newly-flashed root partition in /mnt! In my case it was /dev/vtbd0p2 so I ran ‘mount /dev/vtbd0p2 /mnt’ and then scw-finalize, now it works just fine. There are no errors like there were in my last comment. You might want to add an instruction in your guide to mount the new installation :slight_smile: Many thanks.


#14

@cellardoor that’s weird. From what I’ve seen the new root partition is still mounted in /mnt after bsdinstall.
Not sure if the installer handles things differently depending on the partitioning you choose.

Are you running UFS or something?


#15

I used automatic partitioning on UFS… is that bad? Sorry, one of the reasons I’m deploying this server is because I’m new to BSD and trying to learn!


#16

UFS is fine, I just generally use ZFS and therefore havn’t tested this with UFS.

It seems like bsdinstall keeps the new root mounted when installing as ZFS, but it’s unmounted if you choose UFS.

I’ll handle it in the scw-finalize script and upload a new install image soon.

Thank you :slight_smile:


#17

Hello Nielsek

Thank you for your effort to bring Freebsd here on Scaleway.
It’s perfect for a beginner like me, having a small vps is perfect

But unfortunately, I tried your procedure as Cellardoor I get the same error
I installed with auto ZFS on a START1-M, I had to remove the option 4K sector to success the installation.
After I tried to launch the final script but I get an error on /mnt as you said

root@scw-a2d2dd:/usr/local/sbin # ./scw-finalize
New root fs is not mounted in /mnt - trying to mount something
mount: /dev/vtbd0p2: Invalid argument
Failed to mount the new root fs in /mnt. Please do it yourself and re-run this script

thank you


#18

Hey everyone — I managed to run FreeBSD on ARM64 too :slight_smile:


#19

amazing, have you tried to do lvm? to combine root + other ssds please?


#20

Awesome guide. Have any of you guys had any problems after upgrading to 11.2-RELEASE? I’m unable to enter multi user because of a page fault after upgrading from 11.1 to 11.2.