Thursday, January 6, 2022

SQL Server on Ubuntu 20.04: System has not been booted with systemd as init system (PID 1). Can't operate.

I'm a Windows person. I know this because for two reasons; I've used Windows for a long, long time and am very comfortable with it but also when I venture to different worlds like Linux and encounter errors I literally have no clue what I'm looking at, at least with Windows I might have some sort of idea of where to start!

Earlier I was trying to install SQL Server on Ubuntu 20.04 on my Windows 10 laptop which is using Windows Subsystem for Linux 2.0 following this quickstart guide from Microsoft. 

I'm not going to go through the steps itself but the fun and games started when I got to this command: sudo /opt/mssql/bin/mssql-conf setup

Things originally went fine, and I got the following options for the edition of SQL Server I wanted to install, which I love because it saves having lots of installation media hanging around:


I chose the Developer edition, set my sa password then this happened:

ForceFlush is enabled for this instance.

ForceFlush feature is enabled for log durability.

System has not been booted with systemd as init system (PID 1). Can't operate.

Failed to connect to bus: Host is down

Attempting to start the Microsoft SQL Server service failed.

I'm going to cut a long story short because I'm not a Linux person and thankfully via this post on Github I found this excellent post which fully explained this issue (no support for systemd) and had a rather helpful resolution too which the author describes as a (dirty) trick!

That said, I still wasn't able to start SQL Server with sudo service mssql-server start ( as expected and instead used the following command:

sudo -u mssql /opt/mssql/bin/sqlservr -c -d/var/opt/mssql/data/master.mdf -l/var/opt/mssql/data/mastlog.ldf -e/var/opt/mssql/log/errorlog -x

Voila! SQL Server is now up and running and the solution has been saved to memory (well, the favourites section of my web browser).

No comments:

Post a Comment

Breaking up with SQL Server

I was inspired to write this after reading a post from Dave Mason regarding breaking up with Big Tech companies. Yet again I haven't wr...