Easily deploy FreeBSD, NetBSD, and OpenBSD

I put together a little script that lets you deploy FreeBSD 11.0, OpenBSD 6.0, or NetBSD 7.1 to a new Linode. It uses disk images that I've created and tested – each of them support paravirtualization. Each Linode you deploy will be brought up with the same root password: password123. But root SSH access is disabled, so you will need to log into the Manager and use Glish to change or disable your password (and possibly re-enable root SSH access).

Follow the instructions in the Github repo in order to get yourself set up. But in summary, you will need to paste your API token in ~/.linode_v3.token and you will need to install my Python3 Linode API client. Here is an example of running the script to create a new OpenBSD Linode. (This will take 5-10 minutes to complete).

$ LINODE_APIV3_KEY=$(cat ~/.linode_v3.token) python3 deploy.py openbsd-6-0 -db
Fetched all datacenters
Fetched all distributions
Fetched all plans
Created a linode
Waiting for Linode to be created
Added private IP
Created first disk
Created second disk
Waiting for disks to be created
Waiting for disks to be created
Waiting for disks to be created
Disk created
Waiting for disks to be created
Disk created
Created install config
Created normal config
Waiting for Linode to boot into install config
Waiting for Linode to boot into install config
Waiting for Linode to boot into install config
Waiting for ssh server to start
Fetched ips
Started image deploy process
spawn ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@45.33.38.61 curl ftp://192.168.143.223/openbsd-6-0.img.gz | gunzip -c | dd of=/dev/sdb
Warning: Permanently added '45.33.38.61' (ECDSA) to the list of known hosts.
root@45.33.38.61's password:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 99  447M   99  444M    0     0  1165k      0  0:06:32  0:06:30  0:00:02 29309dd: writing to ‘/dev/sdb’: No space left on device
curl: (23) Failed writing body (5712 != 16384)
35651585+0 records in
35651584+0 records out
18253611008 bytes (18 GB) copied, 391.178 s, 46.7 MB/s
Image deployed
Shutting down for cleanup
Cleaning up temporary configs and disks
Linode rebooting
Your Linode is booting into openbsd-6-0 and will be ready shortly.

Id: 2883250
IP Address: 45.33.38.61
User: root
Password: password123

Root access over SSH is disabled.

(You can ignore the part about the dd failing.)

Now you can log into the Manager and access your new Linode running OpenBSD through Glish!

Caveats include:
* This is not officially supported

  • The script uses private networking to download the disk image from my FTP host in Fremont, so your Linodes are limited to Fremont

  • The script does not grow the filesystem after it's deployed, so you'll need to do that if you want to utilize all the disk

  • The script does not accept a plan option, so you can only deploy the smallest Linode plan

  • The images are only set up to support Glish, not Weblish

Finally, here is a short blog post describing a little more of the history and motivation behind this project.

Enjoy!

Phil Eaton

Linode Developer

6 Replies

This is amazing.

hi phil,

i just tried to deploy an openbsd installation, however it was failed with message:

Started image deploy process

Oh know! An exception!

Deleting Linode

Traceback (most recent call last):

File "/usr/lib/python3.6/site-packages/linodedeployexperimental/main.py", line 166, in main

waitforssh(ip.ipaddress, tmp_password, cmd)

File "/usr/lib/python3.6/site-packages/linodedeployexperimental/main.py", line 37, in waitforssh

while subprocess.call([tcl_path, address, password, cmd]) > 0:

File "/usr/lib/python3.6/subprocess.py", line 267, in call

with Popen(*popenargs, **kwargs) as p:

File "/usr/lib/python3.6/subprocess.py", line 707, in init

restoresignals, startnew_session)

File "/usr/lib/python3.6/subprocess.py", line 1326, in executechild

raise childexceptiontype(errnonum, errmsg)

PermissionError: [Errno 13] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/bin/linodedeployexperimental", line 11, in sys.exit(main())

File "/usr/lib/python3.6/site-packages/linodedeployexperimental/main.py", line 198, in main

linode.delete(l, skip_checks=True)

TypeError: linodedelete() got an unexpected keyword argument 'skipchecks'

is there any step that i missed here?

regards,

tri ms

Could you paste the exact command that you ran that triggered this?

@peaton:

Could you paste the exact command that you ran that triggered this?

su -c "linodedeployexperimental -bd openbsd-6-0"

and thanks to tech support that point me that i already create several machines that running on my account since i run this command multi times.

however i delete them all since i already have one build manually.

thank you

Two things: you shouldn't need to run this as root and are you supplying an API token? I also just added some checks to the script today to warn you when you haven't supplied the token. So could you first reinstall the package and then try to run it again like you did?

$ pip3 install linode_deploy_experimental
$ pip3 freeze | grep linode-deploy-experimental # should be version 0.4
$ linode_deploy_experimental -bd openbsd-6-0 --api_key="YOUR_APIv3_KEY"

hi peaton,

ok, i will give another try and update you for the result

thank you :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct