|How To...||Why not..?||Scripts|
Last modified: 2018-08-27
In this post I show you an easy way to provide urandom(4) for your Nextcloud instance running on OpenBSD. This provides high quality random numbers to Nextcloud and silences the error message that the device is not accessible.
I assume that you have installed Nextcloud from the package that is
available for OpenBSD. Further I assume that you either use httpd(8)
as your webserver or that you have a chroot(2)
configuration for your webserver that locks it into
If you don’t have changed it manually your
/var partition is mounted
with the option
nodev. This means that the directory
must reside on a dedicated partition which you can mount without the
nodev option. Allocating one from the SSD is a waste of space and
letter in the disklabel(5).
The memory file system mfs (mount_mfs(8))
is here to help. You can create a tiny mfs disk and mount it to
$ doas mount_mfs -s 1M /dev/sd0b /var/www/dev
You can use MAKEDEV(8) to
create the device file
$ cd /var/www/dev $ doas /dev/MAKEDEV urandom
This will not only create the device file but also the symlink
which points to
The contents of mfs are losting when power is lost to the system. I use rc.local(8) to create the device automatically during the system boot. My script looks like this:
#!/bin/ksh # # $Header$ echo -n "Create /var/www/dev/urandom: " ddr=/var/www/dev [[ ! -d $ddr ]] && mkdir $ddr mount_mfs -s 1M /dev/sd0b $ddr cwd=$(pwd) cd $ddr /dev/MAKEDEV urandom cd $cwd echo "."