XF 2.1 Bloody "max_open_files" limit in FreeBSD.

ShikiSuen

Well-known member
I use MySQL 8. It constantly bumps me this complaint when I tried running XF2 on my new FreeBSD server.
Code:
2020-05-17T15:35:21.696905Z 0 [ERROR] [MY-000067] [Server] unknown variable 'max_open_files=59999'.
2020-05-17T15:35:21.697909Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-05-17T15:35:22.512112Z 0 [System] [MY-010910] [Server] /usr/local/libexec/mysqld: Shutdown complete (mysqld 8.0.20)  Source distribution.
2020-05-17T15:37:36.676708Z 0 [Warning] [MY-010140] [Server] Could not increase number of max_open_files to more than 28377 (request: 927680)

I searched through Google. However, all search results regarding the unchangeable "max_open_files" value are for CentOS and SystemD.
FreeBSD doesn't use SystemD, so what the bloody hell is limiting the value of max_open_files?
 
I just checked "/etc/login.conf" seeing its openfile settings has been set to unlimited by default. Weird.
Code:
default:\
        :passwd_format=sha512:\
        :copyright=/etc/COPYRIGHT:\
        :welcome=/etc/motd:\
        :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
        :path=/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin ~/bin:\
        :nologin=/var/run/nologin:\
        :cputime=unlimited:\
        :datasize=unlimited:\
        :stacksize=unlimited:\
        :memorylocked=64K:\
        :memoryuse=unlimited:\
        :filesize=unlimited:\
        :coredumpsize=unlimited:\
        :openfiles=unlimited:\
        :maxproc=unlimited:\
        :sbsize=unlimited:\
        :vmemoryuse=unlimited:\
        :swapuse=unlimited:\
        :pseudoterminals=unlimited:\
        :kqueues=unlimited:\
        :umtxp=unlimited:\
        :priority=0:\
        :ignoretime@:\
        :umask=022:
 
I found the solution:

STEP 1:
Edit /etc/sysctl.conf
add two lines (or make sure they exist):
Code:
kern.maxfiles=99999999
kern.maxfilesperproc=99999999
STEP 2: Edit /etc/login.conf
add these two lines right below the default:\, or make sure they exist:
Code:
:kern.maxfiles=99999999:\
:kern.maxfilesperproc=99999999:\

STEP 3: Finally, run:
cap_mkdb /etc/login.conf
 
Top Bottom