An in-depth look at mssql-server.service file on SQL Server on Linux

In previous blogs, we discuss how to Stop, Start, View, and Enable or Disable SQL Server Service on Linux. Here, we will be discussing mssql-server.service file and will also be talking about dumping the ELF binary file “/opt/mssql/bin/sqlservr” to see – it calls what all the sfp files.

The mssql-server.service is a configuration file. It contains information about SQL Server process that controlled and supervised by systemd. To see what the “.service” file contains, kindly follow the below steps

Read the mssql-server.service file

  • Connect the system as a root user

Syntax: sudo -i

01connectasrootuser

  • Go to the systemd file location “/lib/systemd/system” and grep SQL Server service files

Syntax: ls – l | grep mssql

01definitionfileofsystemdofsql-server

  • Let’s view the mssql-server.service file

Syntax: cat mssql-server.service

root@SQLUBUNTULINUX:/lib/systemd/system# cat mssql-server.service
[Unit]
Description=Microsoft(R) SQL Server(R) Database Engine
After=network.target auditd.service

[Service]
EnvironmentFile=-/opt/mssql/etc/default/sqlservr
ExecStart=/opt/mssql/bin/sqlservr
KillMode=process
Restart=always
TimeoutSec=30min
User=mssql
WorkingDirectory=/var/opt/mssql
LimitNPROC=infinity
LimitNOFILE=infinity
TasksMax=infinity
UMask=007

[Install]
WantedBy=multi-user.target
root@SQLUBUNTULINUX:/lib/systemd/system#

02

Dump out the sqlservr file using the strace tool

You can see that mssql-server.service configuration file calls the binary file “/opt/mssql/bin/sqlservr” to start the SQL Server service on Linux. When the SQL Service service starts on Linux, It loads “/opt/mssql/bin/sqlservr” ELF binary file and calls the following sfp binary files from the location “/opt/mssql/lib”

  • system.sfp
  • system.common.sfp
  • system.certificates.sfp
  • system.netfx.sfp system.sfp
  • sqlservr.sfp

08sqlserversfpfiles

To make sure, It is calling those sfp files. You can use a tool called “strace”, which will give you a view into your programs execution and any interactions it has with the Linux operating system. So if you launched the strace tool and provide the SQL Server binary “/opt/mssql/bin/sqlservr” as a parameter,

09stracksqlserver

You will find that the below are the sfp files which are being called by the “/opt/mssql/bin/sqlservr” ELF binary file.

03 /opt/mssql/lib/system.sfp

04

05 /opt/mssql/lib/system.certificates.sfp

06

07

Hope, you enjoyed learning internals of SQL Server on Linux!

Leave a comment

Your email address will not be published. Required fields are marked *