FreeBSD: NFS automount with AutoFS

This applies only to FreeBSD 10.1 and newer. Previous FreeBSD releases must use amd.

Personally, I dislike ‘amd’. Its configuration is a bit complex. Autofs configuration is pretty simple.

I want to automount 2 folders from my ReadyNas Duo:

First, enable autofs:



Next, edit /etc/auto_master pointing to the map file with the folders to automount:


/mnt/nas        /etc/auto.nas

Take note ‘/mnt/nas’ is the point where the folders will be mounted.

Then create a file with the map:


media -intr,nfsv3
backup -intr,nfsv3

Finally start autofs:

service start automount

service start automountd

service start autounmountd

In a terminal or file browser go to /mnt/nas/media and /mnt/nas/backup to check if autofs works.

Posted in BSD, FreeBSD | Leave a comment

OpenBSD: phpMyAdmin and NGINX

We will suppose MySQL is already installed.

# pkg_add php-fpm php-mysql phpmyadmin

 In /etc/rc.conf.local:

pkg_scripts="mysqld php_fpm"
 # cp -fR /var/www/phpMyAdmin to /var/www/htdocs

Add to /etc/nginx/nginx.conf:

location / {
     root   /htdocs;
     index  index.html index.htm index.php;
location ~ \.php$ {
     try_files      $uri $uri/ =404;
     fastcgi_pass   unix:run/php-fpm.sock;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include        fastcgi_params;
location /phpmyadmin/ {
     root   /htdocs;
     index  index.html index.htm index.php;
location ~ ^/phpmyadmin/\.php$ {
     try_files      $uri $uri/ =404;
     fastcgi_pass   unix:run/php-fpm.sock;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include        fastcgi_params;

Make a file ‘/var/www/htdocs/phpinfo.php with the following lines:

php phpinfo();

Start nginx and php_fpm:

/etc/rc.d/php_fpm start
/etc/rc.d nginx start

Test the PHP installation with your browser pointing to ‘localhost/phpinfo.php’. If a page with information about your PHP installation then nginx is executing php code. If what you see is php code then nginx is serving PHP pages as plain text (review your nginx configuration).


If nginx is executing PHP code then you can try phpMyAdmin, pointing your browser to:



A good article as reference:

Posted in BSD, OpenBSD | Leave a comment

OpenBSD: connection problems with some sites in internet

I’m experiencing some problems when trying to connect, via web browser, with some sites as ebay or google. I’ve discovered that I get a better experience browsing when the MTU in the wifi interface (iwn0) is lower than 1500. So I put in /etc/hostname.iwn0:


mtu 1440 up

This is a very odd thing. MTU path discovery is permitted in my firewall configuration (icmp_types = “{ echoreq, unreach }”) and even deactivating PF the problems remain.


Posted in Uncategorized | Tagged , | Leave a comment

OpenBSD: hibernation rules!!!!

Simply great! hibernation in i386 works great!. It seems it could be there some issues but in my experience is pretty usable.

This is the first time I’m able to see hibernation working in a BSD laptop since my Thinkpads T20, T23 and T41 with their bios solution with a dedicated partition. So well done OpenBSD.


Posted in BSD, OpenBSD | Leave a comment

OpenBSD: How to avoid resolv.conf to be touched by dhclient

I prefer to provide DNS address of my choice instead those from my network provider. Usually OpenDNS servers are a good option.

So, to avoid dhclient touch ‘/etc/resolv.conf’ I configure the /etc/dhclient.conf as follows:

initial-interval 1;
send host-name “myhostname”;
#request subnet-mask, broadcast-address, routers, domain-name,
#       domain-name-servers, host-name;
#send dhcp-lease-time 3600;
supersede domain-name-servers, ;
supersede domain-name “”;
request subnet-mask, broadcast-address, routers;

And /etc/resolv.conf.tail :

lookup file bind


Posted in BSD, OpenBSD | Leave a comment

OpenBSD: Laptop cpu temperature control with APM

In OpenBSD, all versions I tested, I note a performance decrease (in such way as not smooth mouse movement, or web page scrolling) when the maching is doing any heavy reading/writing task or cpu compsuming (i.e. ziping/unziping/copying a big file), even when only one core is running this process and the other ones are running at low load.

In Marc Espie’s words (

Yes, there's something deeply fucked up somewhere in our 
scheduler/disk-handling/whatever. The issue is known.

It appears it is complicated to fix properly without replacing
it by a lot of other problems, some of which pertain to keeping
relatively old archs in working condition, or so I'm told.

A workaround to minimize this effect is running APM in automatic mode (maybe the preferred option for most people). I used to running it in Cooling mode to avoid temperature increases.

Now I use a script to control the APM working mode, automatic when the temperature is lower than a certain threshold, cooling when it increases.

The code is:



TIME=5 #seconds

while :
cpu0=`sysctl hw.sensors.cpu0.temp0 | cut -d= -f 2 | cut -d. -f 1`
gpu0=`sysctl hw.sensors.itherm0.temp4 | cut -d= -f 2 | cut -d. -f 1`
apm=`/usr/sbin/apm -P`

echo "CPU0: ${cpu0} GPU0: ${gpu0} APM: ${apm}"

if [ ${cpu0} -gt ${CPU_UP_TH} ] || [ ${gpu0} -gt ${GPU_UP_TH} ]; then
if [ ${apm} == 1 ]; then
/usr/sbin/apm -C
echo "apm -C"

if [ ${cpu0} -lt ${CPU_LOW_TH} ] || [ ${gpu0} -lt  ${GPU_LOW_TH} ]; then
if [ ${apm} == 2 ]; then
/usr/sbin/apm -A
echo "apm -A"

sleep ${TIME}


It can be grabbed from

Use it at your own risk :). Probably it needs to be modified, to adjust thresholds in other laptops.

It would be great if APM work in such way… even apmd needs to be patched in 5.4 for SMP machines (

Posted in BSD, OpenBSD | Tagged , , | Leave a comment

OpenBSD: ntfs-3g supported !!!

I can’t believe it!!!

I’m anxious for testing it … One of those things you miss when moving to OpenBSD from FreeBSD or Linux…


Posted in OpenBSD | Leave a comment