Pages: Welcome | Projects

Random notes on a hacky evening

2020/3/24
Tags: [ bsd ] [ Hacking ] [ raspberry ]

No, I'm not dead quite yet.

Due to a recent change of job, among other things, I've neglected my blog for almost four months now. But it's time to get back into the habit of writing interesting technical stuff, at least for a couple of months more, while I'm still able to write.

In these days I'm working on two personal projects:

This blog entry is about the second project.

I don't have a specific goal in my mind. I really just want to experiment a bit with *BSD, to gain knowledge on this family of classic UNIX systems. Possibly self-host some useful service.

As the title tells, these are random notes taken from a long time GNU/Linux user, not necessarily coherent, or even correct. Also they might span many blog entries.

Hardware setup

A Raspberry in my home network. Later on I plan to attach it to the Open Internets, as soon as I've learned something about firewalls.

I installed FreeBSD since it is very convenient to do so. I can experiment on OpenBSD too, thanks to the friendly tilde.institute fellows.

How much RAM do I have?

# sysctl hw.physmem
# vmstat

Not wearing my drive off

As the raspberry platform uses a micro-SD memory, care should be taken to avoid wearing it off.

mount --rbind /etc/pkg /var/db/pkg

As mentioned in the strategies page of the afore mentioned article, in order to use pkg(1) to install software, we need the database in /var/db/pkg to be accessible even when /var/ is mounted in ram.

Installing ports would still need to mount / in read-write mode, but the database would be consistent across reboots.

The article suggests to change the /etc/rc.d/var script and add a soft-link between /var/db/pkg -> /etc/pkg, but I thought that it would be more proper to solve this with a --rbind mount.

The closest thing I can get is mount_nullfs(8). In short, let's add this line to /etc/fstab:

/etc/pkg /var/db/pkg nullfs rw,late 0 0