Author: BSD

Use Bind 9 as local recursive DNS on Ubuntu, linux mint and Debian

Here is a quick guide on how to change the default dnsmasq dns client into a fully working uncensored bind 9 recursive server – client setup on localhost.

First of all, we need to “disable” the dnsmasq in


by uncommenting the


Next we need to make a change in the order of how nsswitch do the lookup of .local domains, so edit


and change the line from

hosts: files mdns4_minimal [NOTFOUND=return] dns


hosts: files dns mdns4_minimal [NOTFOUND=return]

Next ensure bind9 is installed by apt install -y bind9 dnsutils

When that’s done edit


and ensure you have a line with the following value within the options values

listen-on port 53 { any; }
recursion yes;

Now restart the bind9 by sudo systemsctl restart bind9

You should now be up and running with your own dns server/client to avoid any governmental censorship like in undemocratic Denmark

Last you need to ensure that your messedup NetWorkmanager pointing to your local DNS server.

Posted on

Computer Audio File Formats

Whether you’re ripping your own CD library or acquiring downloads from online music sites such as HDtracks ( or iTunes, choosing the best music file format and import settings will play an important role in determining the ultimate quality of the playback performance. To many, digital music files have become synonymous with low bitrate and often- inferior sounding MP3 or AAC (Advanced Audio Coding) downloads. MP3 and AAC are “lossy” compression file formats that permanently throw away most of the data in the original music file- sometimes as much as 90% of the original data! Fortunately not all digital music files are created equal. It’s never really just 1’s and 0’s. iTunes is capable of supporting lossless compressed and uncompressed music files as large as 32-bit/384kHz. While 128kbps AAC files are popular at Apple’s iTunes store, MP3s and AAC files come in a variety of data rates. Higher data rates such as 192kbps or even 320kbps are also offered from a number of sources, and the result is audibly better sound. In addition, AAC or MP3 files at higher bit depths, such as 24-bit, sound far superior to typical 16-bit lossy files (examples can be found at under “podcast”). In more and more cases high-resolution digital music files with greater bit depths and higher sampling rates can be downloaded as either uncompressed files or files with lossless compression. HDtracks not only offers uncompressed 16-bit/44.1kHz downloads, it houses an ever growing collection of high resolution downloads at up to 24-bit/192kHz. In addition, artists like Radiohead and Nine Inch Nails have offered uncompressed and high-resolution downloads direct from their own websites. Uncompressed or lossless-compressed high-resolution digital music files have the potential to sound dramatically better than CDs and compressed MP3 or AAC files. So if you have a choice in your downloads, opt for the highest data rate/bit depth and the least compression you can get and your ears will thank you.

When ripping your own CDs to your library you’ll have more control. In iTunes you can choose higher bit rate MP3 and AAC (192kbps or 320kbps) for your music, or you can choose to rip and store your music using an uncompressed audio format such as AIFF or a lossless compression format such as Apple Lossless, each of which is the qualitative equivalent of the Compact Disc. As you’ll learn, metadata like song titles, album art and other convenience features can be downloaded from the Internet and directly through iTunes, J. River, and other music library management and playback suites. Metadata is a big-time enhancement to the convenience of using computer audio for music library management, but not all file formats support it. Here’s a rundown of the prevalent lossless/uncompressed file formats and their respective strengths and weaknesses:

Apple Lossless Compression. This is an Apple file format option in iTunes that employs “lossless” compression, which reduces the stored data to as little as half of the original music file’s size but restores bit-for-bit identical to the original music file on playback. The process is not unlike a zip file in which a large amount of data is “zipped” down to a smaller file size for storage and “unzipped” to its full size when opened. In spite of this being an Apple technology, iTunes running on Windows XP/Vista/7 is fully compatible with Apple Lossless with full rip and playback capabilities and Apple Lossless offers full metadata support on both platforms. Since the original music file is restored bit-for-bit Apple Lossless files offer much better  sound  than  lossy  MP3s  and  is  compatible  with  high-resolution music  files.  Interestingly,  uncompressed  music  files  such  as  WAV  or AIFF can sound better than lossless compression formats like Apple Lossless or FLAC. Perhaps this is because they don’t require the ad- ditional  step  of  being  “unzipped”  and  restored  to  their  original  PCM data package during real-time during playback. Listen and you’ll hear the difference.

FLAC (Free Lossless Audio Codec). Like Apple Lossless Compression, FLAC employs “lossless” compression, which reduces the stored music file’s size, but then restores the data package bit-for-bit identical to the original music file on playback. It supports high-resolution audio with greater bit depths and sample rates and also supports metadata tagging and will retain metadata when the files are backed up. In spite of the fact that FLAC is an extremely common and accepted format, it is not supported by iTunes. This means you can’t rip, store or play back FLAC music files using iTunes. A variety of programs are available for converting FLAC files to iTunes- compatible file formats such as Apple Lossless, AIFF, WAV, MP3 or AAC, including Max (, Fluke ( fluke), or DB Power Amp (

Be aware that FLAC files are high quality files and that converting them to MP3 or AAC will  permanently delete much of the data from the original music files. To maintain the integrity of FLAC files it is important that they are converted to a lossless or uncompressed file format such as Apple Lossless, AIFF or WAV. This is not only recommended but essential!
WAV (Waveform Audio File Format). WAV is a music file format capable of storing Linear PCM audio (the digital encoding format used on compact discs) in completely uncompressed form. Ripping a CD and storing it as an uncompressed WAV results in “bit perfect” storage; the ripped music file is identical to the original CD data package. WAV files can also store high-resolution music files at greater bit depths and sampling rates than CD’s 16-bit/44.1kHz resolution. Uncompressed WAV files can be ripped and played back in iTunes and are very high quality. However, they do take up more hard drive storage space then AAC, MP3, or Apple Lossless. WAV files have one notable limitation- they do not support attached metadata tagging. Things like album art, song titles and other convenience features that enhance music library management and playback will be lost in subsequent generations (backups).

If you have already ripped your music as WAV files you can convert them to AIFF using   iTunes. This is easy to do. Simply highlight all the WAV files you wish to convert and then use the “Advanced” drop down menu from the iTunes nav bar and select “Convert to AIFF.”  Be certain that you have enough available hard drive space as this will temporarily double the amount of storage occupied by the music files you’ve chosen to convert. Once iTunes has completed the WAV to AIFF conversion you can delete the WAV files. Note that for high-resolution files we recommend using Max or some other aftermarket file converter. iTunes will not convert high-resolution files at full sample rate. Converting outside of iTunes will lose the attached metadata for the files, but that inconvenience is outweighed by the loss of sound quality that would result in decreasing the sample rate using iTunes’ integral WAV-AIFF conversion.

AIFF (Audio Interchange File Format). AIFF is similar to WAV. This music file format is capable of storing uncompressed Linear PCM audio. Ripping a CD and storing it as uncompressed AIFF results in “bit perfect” storage with the ripped music file identical to the original data on the CD. Like WAV files, AIFF files can also store high-resolution music files at high bit depths and sampling rates. AIFF files can be created and played back in iTunes on Mac OSX and Windows XP/Vista/7 and are very high quality. But they, too, require more hard drive storage space. AIFF files support permanent metadata tagging, like album art, song titles and other convenience features that enhance music library management and playback. Backups of AIFF music files will retain all of the metadata making AIFF the best all around choice for performance and convenience.

Storing your digital music files in lossless or uncompressed form doesn’t mean you have to reduce the amount of music stored on your iPod, iPhone or mobile device. iTunes allows users to convert higher data rate music files to 128kbps AAC on the fly as the music is sync’d to the mobile device in question.  There is no need to maintain separate high- and low- bitrate libraries.

Posted on

Trac wiki on Ububtu 16.10 and Nginx

= Install Trac on Ubuntu proxied by Nginx =

How to install and run a single hosted Trac project from

This guide should apply for the following debian variations:

* Debian 9
* Ubuntu 16.04
* Ubuntu 16.10
* LinuxMint 18.1
* LinuxMint 18.2

Here is a somewhat basic copy paste #bash script for this, however, there will be some manual labor for you 😛 but a find+replace would help you a lot. Be aware you might run all of these commands with the `sudo -H`

**important** remember to replace the `` with [ latest verion]
apt-get install subversion libapache2-mod-python pypy python python-babel trac python-pip -y
pip install --upgrade pip
pip install --upgrade Babel
pip install --upgrade Trac
pip install --upgrade pillow
pip install dnspython
pip install spambayes
pip install oauth2
pip install httplib2
pip install TracTags
pip install TracSpamFilter 
pip install TracVote
easy_install --always-unzip
mkdir -p /var/www/trac/

trac-admin /var/www/trac initenv

Follow the trac-admin guide…

Now lets test the trac before we do more

tracd --port 8000 /var/www/trac
lynx localhost:8000/trac

Great it’s working, then it’s time to setup a admin user and password for the admin account. Bad luck if it doesn’t as that is beyond this wiki and you’ll need to go to find a solution 🙁

htpasswd -c /var/www/trac/.htpasswd adminusername
trac-admin /var/www/trac/ permission add adminusername TRAC_ADMIN

Replace `adminusername` with your desired username

Next we set the propper user and group permissions on the Trac folder to allow the Nginx/Apache/Trac server to access it

chown -R UserName:GroupName /var/www/trac/
chmod -R 775 /var/www/trac/

== Enable GIT source ==
To enable git source brosing we need another subfolder

mkdir -p /var/www/trac/git

== Systemd startup script == #SystemD

In your `/etc/systemd/system/` make this new file –>

nano /etc/systemd/system/tracd.service
Description=TrackD Daemon

ExecStart=/usr/local/bin/tracd -p 3050 --protocol=http --basic-auth="*,/var/www/trac/.htpasswd,Restricted" -s /var/www/trac


== Nginx configs ==
Now it’s time to do the NginX configureations 🙂

First we have to make a reverse proxy to the Trac daemon we have made in [#SystemD Systemd startup script]

In the `/etc/nginx/nginx.conf` we’ll have to add a upstream for our reverse_proxy to Trac

  upstream live_trachosts_com {

Now make the site.conf file in your preferred location, which by default would be `/etc/nginx/conf.d/` for other it would be in `/etc/nginx/sites-available` but we go whit the default
`nano /etc/nginx/conf.d/site.conf`

server {
  server_name  trac.local;
  charset utf8;
  access_log  /var/log/nginx/trac.access.log;
  error_log  /var/log/nginx/trac.debug.log;

  location / {
    proxy_pass  http://live_trachosts_com;
    proxy_set_header Host $host;
  # redirect server error pages to the static page /50x.html
  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   /usr/share/nginx/html;

  # deny access to .htaccess files, if Apache's document root
  # concurs with nginx's one
  location ~ /\.ht {
      deny  all;

== Apache ==
And since you properly anyway use apache 🙁 well here is that piece of code 🙁

a2enmod python
nano /etc/apache2/sites-available/trac.conf
 ServerName trac.local
 <Location />
 SetHandler mod_python
 PythonInterpreter main_interpreter
 PythonHandler trac.web.modpython_frontend
 PythonOption TracEnv /var/www/trac
 PythonOption TracEnvParentDir /var/www/trac
 PythonOption TracUriRoot /
 PythonOption TracEnv /var/www/trac
 # PythonOption TracEnvIndexTemplate /var/www/trac/templates/index-template.html
 PythonOption TracLocale en_US.UTF8
 PythonOption PYTHON_EGG_CACHE /tmp
 Order allow,deny
 Allow from all
 <Location /login>
 AuthType Basic
 AuthName "myproject"
 AuthUserFile /var/www/trac/.htpasswd
 Require valid-user

To enable the trac site run `a2ensite trac.conf`

== Find/Replace ==
The following paths is to be replaced with your preferences
`/var/www/trac` –> `/full/path/to/trac`
`adminusername` –> `YourUserName` to be used as the track admin
`UserName` –> The username for which trac daemon runs as ex. `Your login UserName`
`GroupName` –> The group name for which trac daemon runs as ex `www-data`
`trac.local` –> `full.domain.tld`
`live_trachosts_com` –> to what suits your needs
`` –> if you are running both NginX and Apache on port 80/443 you’ll need to set the IP, but if you only runs Nginx or Apache you can delete the ip to listen on all address

== Versions ==
In this tutorial I have used the following software versions

$ uname -a
Linux hostname 4.11.0-14-generic #20~16.04.1-Ubuntu SMP Wed Aug 9 09:06:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ tracd --version
tracd 1.2.2
$ nginx -v
nginx version: nginx/1.13.6


Posted on


Efter at have kigget med på forskellige medier om sejlads, har det ikke gået mig ubemærket forbi, hvordan landkrapper og deres ulidelige ligemænd har ødelagt det sprog der bruges til søs, som der igennem århundrede har været brugt til med et enkelt ord at kunne præcist specifisere en handling eller ting, herunder angivelse af noget så ordinærd og alligevel vigtigt som vindhastighed.

I tidernes morgen brrugte mand Beauforts skalaen, som er navngivet efter den franske admiral Francis Beaufort som sejlede under Nielson’s kommando. Skalaen var særdeles velegnet for sin tid med linieskibene, da vindstyrketabbel kunne oversættes til skibets nogenlunde fart i NM (Nautiske Mile) gennem vandet og ikke over grund (hav bunden)

Når med tilbage til trikkeren af dette indlæg, landkrabberne og boldværksmatroserne der foregiver at være sømænd vedbliver med at angive vinden i knots (knob) hvilket umidelbart var noget uden for de angivelser mine mange år som sejler har givet mig let genkendeligt kenskab til, så jeg begyndte at søge en tabel som kunne hjælpe mig med at oversætte fra bolværsmatroserne til sømands mål, da jeg fandt denne fejlbehæftede tabel fra DMI (Hvilket er skammeligt da søfartsstyrrelsen henviser deres undervisning af Yachtskippere til denne). Men her er tabellen med fejlrettelserne:

m/s Knob >km/t Mls/hr(*) Betegnelse På land På vand
12 >32,6 >63 >117 >73 Orkan Voldsomme
Luften fyldt med skum,
der forringer sigten
11 28,5-32,6 56-63 103-117 64-73 Stærk storm Talrige
Umådeligt høje bølger –
havet dækket af hvide
skumflager – sigten forringet
10 24,5-28,4 48-55 89-102 55-64 Storm Træer rives op
med rode, betyde-
lige skader på
Meget høje bølger –
næsten hvid overflade –
skumsprøjt påvirker udsigten
9 20,8-24,4 41-47 75-88 47-55 Stormende kuling Store grene knækkes –
tagsten blæser ned
Høje bølger, hvor toppen
vælter over – skumsprøjt
kan påvirke sigten
8 17,2-20,7 34-40 62-74 39-47 Hård kuling Kviste og grene
brækkes af – besværligt at
gå mod vinden
Ret høje, lange bølger
bølgekammen brydes til
7 13,9-17,1 28-33 50-61 31-39 Stiv kuling Større træer bevæger
sig – trættende at gå
mod vinden
Hvidt skum fra brydende
bølger føres i striber i
vindens retning
6 10,8-13,8 22-27 39-49 24-31 Hård vind Store grene bevæger sig Store bølger – hvide
skumtoppe overalt
5 8,0-10,7 17-21 29-38 18-24 Frisk vind Små løvtræer svajer lidt Middelstore langagtige
bølger med mange skum-
toppe, evt. skumsprøjt
4 5,5-7,9 11-16 20-28 12-18 Jævn vind Støv og papir løftes –
kviste og mindre grene
bevæger sig
Mindre bølger med
hyppige skumtoppe
3 3,4-5,4 7-10 12-19 7-12 Let vind Blade og små kviste bevæger
sig. Vimpler løftes
Småbølger, hvor toppe
brydes, glasagtigt skum
2 1,6-3,3 4-6 6-11 4-7 Svag vind Små blade bevæger sig Ganske korte små-
bølger, som ikke brydes
1 0,3-1,5 1-3 1-5 1-4 Næsten stille Røgen viser netop
vindens retning
Små krusninger
uden skum
0 0,0-0,2 <1 <1 <1 Stille Røg stiger lige op Havet er
Som du selv kan konstatere er der lige pludseligt også påsat km/t og mil/h, hvad fan***n skal det nu bruges til? TV2’s udueligehed og totalt fordummede seere der så kan prøve at lyde lige så intelligente som en reklame med deres IQ på ??
(*) Derpå kommer så spørgsmålet MIL/h øøhh engelske, indiske eller Trump Mil? På søen angives alle afstande altså i NM, bum basta. For NM har nemlig en ret vigtigt funktion…. Navigation, herunder et vældigt godt samspil med Minutter, grader og sekunder, altså et søkort, huh? ja et søkort, så du ved hvor du befinder dig og kan sejle og hvor du bestemt ikke skal sejle.
Med lidt mere søgen fandt jeg denne tabel fra En dejlig nem og overskuelig tabel i brugervenligt PDF format…. lige til klistermærke printeren
Nå men hvordan definere vi så hvem der er landkrabber og sejlere, lad mig prøve at lave en tabel på landkrabsk
Beaufort M/s Beskrivelse
0 -> 5,5 0 -> ~12  Temmeligt kedeligt, skal vi spise en madpakke?
 5,5 -> 9 ~12 -> ~24/25 Nu er der noget ved det, og nu er det vi let kan kende forskæl på dem der kan sejle og landkrabberne i havnene
 10 ~25 -> 32,6 Ok her begynder de private sejlere at søge havn, ikke fordi de ikke kan/vil sejle mere, men risikoen for dyre reperationer nærmer sig,
men stadigt det her er sjovt og bukkene er helt sikkert skilt fra fårene
11+ 32,6+ Som ovenfor, men her kommer så også et sikkerheds spørgsmål på bordet, samt det er temmeligt svært at holde kaffen i sin kop og det er noget af en bumpet tur

Konklusion: Når du hører tale om at det skulle begynde at blive “farligt” at sejle ved 30 -> 40 knob, ja så ved du det er strandvejrs bikini sejlene bolværksmatroser.

Posted on

Microsoft sendt til tælling af WannaCrypt?

Så lykkedes det endnu engang for Microsoft at være medårsag til at man skal fravælge propraitere operativ systemer ved selv at være udsatte for WannaCrypt og ikke have styr på IT sikkerheden, men allene fokusere på at høste folks privatliv og firmaers data, på fod med Google og facebook.

Konklusion: Eller som Microsoft retteligt burde have skrevet i deres “Microsoft solution available to protect additional products” Updater til et Linux eller Unix system som stadigt sætter private data og IT sikkerhed højt.

Posted on

Use FFmpeg to add an aditional subtitle to a mkv video

Running ex. on Evita from 1996

First let Examining the source file with ffprobe and grep the Stream lines with the googdies

ffprobe Evita.mkv

Then will see these stream lines

Stream #0:0(eng): Video: h264 (High), yuv420p, 1280×536, SAR 67:68 DAR 40:17, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
Stream #0:2(ita): Subtitle: subrip
Stream #0:3(eng): Subtitle: subrip
Stream #0:4(spa): Subtitle: subrip
Stream #0:5(fre): Subtitle: subrip
Stream #0:6(ger): Subtitle: subrip
Stream #0:7(dut): Subtitle: subrip
Stream #0:8(chi): Subtitle: subrip

This tells us that -map layers is:
0:0 is the video layer
0:1 is the Audio layer
0:2 is the italian subtitle layer
0:3 is the English subtitle layer
0:4 is the Spanish subtitle layer
0:5 is the Frensh subtitle layer
0:6 is the German subtitle layer
0:7 is the Dutch subtitle layer
0:8 is the Chinese subtitle layer

Now we will add the subtitle layer for the danish language, by simply copy all the source and add the contents of the file, but if you would like to have a “named” list of which subtitle layer is which you need to do some manual labor adding the -metadata:0:9 language=dan I’m afraid. Now go ahead and do as in the code below 🙂

You determine the -metadata:s:x by simply take the highest number in source file and adding +1, on this case 8+1=9 which makes the -metadata:s:9

ffmpeg -y -i Evita.mkv -f srt -i -map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 -map 0:5 -map 0:6 -map 0:7 -map 0:8 -map 1:0 -c copy -c:s srt -metadata:s:9 language=dan Evita-dan.mkv

Posted on

Use FFmpeg to add subtitles to video


ffmpeg -i input.mp4 -f srt -i -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s mov_text output.mp4


ffmpeg -i input.mp4 -f srt -i -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt  output.mkv

To understand the -map option you’ll first need to examine your source file by running the video trough ffprobe or ffmpeg

ffmprob -i video.mp4

Then you’ll see some lines named “Stream”, each stream represent a video, sound and/or subtitle. Streams starting with 0: is video or sound tracks and streams starting with a number higher than 0 is subtitle (overlays)

To add several subtitles to the same video requires you to add a -c:s mov_text or -c:s srt for each subtitle submitted

If you like to add a title to each soundtrack or subtitle you can use the -metadata:s: and -metadata:s:s


For soundtracks you’ll use for English

-metadata:s:0 language=English

For subtitle you have to use the extra s

-metadata:s:s:1 language=English \
-metadata:s:s:2 language=Dansk

Posted on

Shakira – Las de la Intuición

Creo que empiezo a entender
despacio, despacio, comienzas a caer
que nos deseabamos desde antes de nacer
te siento, te siento, desde antes de nacer
tengo el presentimiento de que empieza la accion
adentro, adentro, te vas quedando
y las mujeres somos las de la intuicion
asi, estoy dispuesta a todo amor

Posted on

Shakira – Me Enamoré (Official Lyric Video)

Official lyric video by Shakira performing “Me Enamoré.”

Full lyrics

La vida me empezó a cambiar
La noche que te conocí
Tenía poco que perder
Y la cosa siguió así

Yo con mis sostén a rayas
Y mi pelo a medio hacer
Pensé: ” Este todavía es un niño”
Pero, qué le voy a hacer?!

Es lo que andaba buscando
El doctor recomendando
Creí que estaba soñando, oh, oh
De qué me andaba quejando?
No sé qué estaba pensando
Hoy pal cielo voy pateando, oh, oh

Me enamoré, me ena-na-namoré
Lo vi solito y me lancé
Me ena-na-namoré
Me ena-na-namo…

Mira que cosa bonita
Que boca más redondita
Me gusta esa barbita

Y bailé hasta que me cansé
Hasta que me cansé bailé
Y me ena-na-namoré
Nos enamoramos

Un mojito, dos mojitos
Mira que ojitos bonitos
Me quedo otro ratito

Contigo yo tendría 10 hijos
Empecemos por un par
Solamente te lo digo
Por si quieres practicar

Lo único que estoy diciendo
Vayámonos conociendo
Es lo que está proponiendo, oh, oh

Nos vamos entusiasmando
Todo nos va resultando
Qué bien lo estamos pasando, oh, oh

Me enamoré, me ena-na-namoré
Lo vi solito y me lancé
Me ena-na-namoré
Me ena-na-namo…

Mira que cosa bonita
Que boca más redondita
Me gusta esa barbita

Y bailé hasta que me cansé
Hasta que me cansé bailé
Me ena-na-namoré
Nos enamoramos

Un mojito, dos mojitos
Mira que ojitos bonitos
Me quedo otro ratito

Nunca creí que fuera así
Cómo te fijarías en mí?
Toda una noche lo pensé
Este es pa’ mí, es pa’ más nadie
Es-es pa’ mí, es pa’ más nadie
Es-es pa’ mí, es pa’ más nadie
Es-es-es pa’ mí, es pa’ más nadie

Me enamoré, me ena-na-namoré
Lo vi solito y me lancé
Me ena-na-namoré
Me ena-na-namo…

Mira que cosa bonita
Que boca más redondita
Me gusta esa barbita

Y bailé hasta que me cansé
Hasta que me cansé bailé
Me ena-na-namoré
Nos enamoramos

Un mojito, dos mojitos
Mira que ojitos bonitos
Me quedo otro ratito

Nunca creí que fuera así
Cómo te fijarías en mí?
Toda una noche lo pensé
Este es pa’ mí, es pa’ más nadie
Es-es pa’ mí, es pa’ más nadie
Es-es pa’ mí, es pa’ más nadie

Es-es-es pa’ mí, es pa’ más nadie

Posted on

Ubuntu 16.10 Server MariaDB (MySql) open_file_limit won’t go higher than 16364

In Ubuntu 16.10 and other systemd enabled OS like Debian, CentOs and LinuxMint with MariaDB Server version 10.x+ open_file_limit won’t go higher than 16364. according to MariaDB it’s simply because the SystemD daemon prefer new ways to set limit and a few other vital modifications

systemd is an init replacement that MariaDB uses on releases since 10.1.8. Distribution packages before this version may use a different configuration so consult their documentation if required.

systemd services are packaged on RPM and Debian based Linux distributions. When systemd is used, mysqld_safe is not used and settings in the mysqld_safe section of configuration files will not be read or applied.

systemd overview

systemd service files are included in the MariaDB-server package. The service definition is installed in /usr/lib/systemd/system/mariadb.service. The service name is mariadb.service; however aliases to mysql.service and mysqld.service are included for convenience.

Unlike previous init scripts, the mysqld process is executed directly from the init script running as the mysql user. This places a couple of limitations on situations that were previously possible:

  • open-files-limit cannot be raised beyond the operating system limit (usually 1K) and hence the systemd configuration for mariadb has LimitNOFILE set to 16K by default;
  • memlock can be used from version 10.1.10; and
  • The start timeout from init scripts was quite large and special configuration may be required if there is a slow startup time (MDEV-9202).
  • A mapping of common mysqld_safe options to systemd options is provided below.

    mysqld_safe option systemd option Comments
    no option ProtectHome=false If any MariaDB files are in /home/
    no option PrivateDevices=false If any MariaDB storage references raw block devices
    no option ProtectSystem= If any MariaDB write any files to anywhere under /boot, /usr or /etc
    no option TimeoutStartSec={time} Set if the systemd reports failure to start because of timeout. 0 disables any timeout
    no option (ref MDEV-9264) OOMScoreAdjust={priority} e.g. -600 to lower priority of OOM killer for mysqld
    open_files LimitNOFILE={limit}  
    core_file_size LimitCORE={size}  
      LimitMEMLOCK={size} or unlimited When large-pages or memlock is used
    nice Nice={nice value}  
    syslog StandardOutput=syslog  
    syslog-tag SyslogIdentifier  
    flush-caches ExecStartPre=/usr/bin/sync  
      ExecStartPre=/usr/sbin/sysctl -q -w vm.drop_caches=3  
    numa-interleave ExecStart=/usr/bin/numactl –interleave=all /usr/sbin/mysqld ${MYSQLD_OPTS} ${_WSREP_NEW_CLUSTER}  

    Note: systemd.service contains the official meanings for these systemd settings.

    There are other options and the mariadb-service-convert script will attempt to convert these as accurately as possible.

    In addition to the set of options previously provided by mysqld_safe, systemd.service has considerably more options.

When all or some of these settings have been altered don’t forget to:

systemctl daemon-reload
systemctl restart mysql.service

To make the new values active

To verify your changes open a mysql instance in terminal or your preferred Mysql GUI and type

show global variables like 'open%';

If you can see the changes, your done. As exsamle I’ve set my LimitNOFILE=1024000 in /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf and the output looks like

MariaDB [(none)]> show global variables like 'open%';
| Variable_name    | Value   |
| open_files_limit | 1024000 |
1 row in set (0.00 sec)

Posted on