I have installed Microsoft SQL-Server on my ubuntu machine. Now it works fine, but every time I shutdown the machine, shutdown halts at

A stop job is running for microsoft sql server database engine ( x/30min )

Now if you wait 30 minutes, then it shuts off, so technically, it's not a bug. However, when I have to shut off the laptop I don't have time to wait 30 minutes ... Also, I sometimes have to restart the machine, and don't want to have to wait 30 minutes to restart it...

Is there any way to block or disable this stop-job? Where are stop-jobs configured?

  • Are you sure this is not a timezone problem? I seem to remember seeing this for mysql once. -- yay for my memory: askubuntu.com/questions/892026/… :) – Rinzwind Mar 15 '19 at 8:41
  • @Rinzwind: So you're suggesting this is a service-boot-order-problem ? sudo dpkg-reconfigure tzdata – WitchCraft Mar 15 '19 at 9:29

Tried sudo dpkg-reconfigure tzdata, but that didn't help.
What helps is the following:

Open /lib/systemd/system/mssql-server.service with a text-editor
and change TimeoutSec=30min to TimeoutSec=5sec

Then run

systemctl daemon-reload

to reload the configuration.

That's it, the timeout is now 5 seconds instead of 30 minutes.

For risks and side effects, read the package leaflet and ask your doctor or pharmacist - and keep a backup handy at all times.
You should do that anyway.

For more information: RTFM / man page

As per PerlDuck's tipp, instead of directly editing /lib/systemd/system/mssql-server.service, you should sudo systemctl edit mssql-server.service to create a drop-in that does not get overwritten when mssql is updated.

The file /etc/systemd/system/mssql-server.service.d/override.conf should only contain the values it overrides, e.g.

| improve this answer | |
  • 2
    I would suggest you use 5 minutes instead of 5 seconds becuase MSSQL Server will get straight killed after 5 seconds and that could cause some nasty evil with MSSQL in the long run. – Thomas Ward Mar 19 '19 at 17:28
  • @Thomas Ward: That already happened once before - master database file gone. apt-get remove --purge and reinstall with restore db from backup helped. Seriously, MS should apply the google rule: if it takes longer than 4 seconds, it's a bug. No rule without exception. – WitchCraft Mar 19 '19 at 17:33
  • Yes, but if MSSQL doesn't want to stop in the first place, then this won't matter. – GNULinuxOnboard Mar 19 '19 at 17:33
  • @The MATE Man: Yep, agree. It will be killed either way. – WitchCraft Mar 19 '19 at 17:34
  • 1
    Honestly, I just try stay away from Microsoft software because I've had little, annoying problems like this in the past with Microsoft software running on Linux. – GNULinuxOnboard Mar 19 '19 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.