SQL Server Docker container fails on start up when run in a VM with Ubuntu 24.04

I’m able to run the Docker image mcr.microsoft.com/mssql/server:2019-CU25-ubuntu-20.04 perfectly fine on Debian 12 & Windows 10. However, when running the same image on a VM with Ubuntu 24.04, the following error occurs on container start-up:

sqlserver2019  | This program has encountered a fatal error and cannot continue running at Thu Jun 20 01:53:15 2024
sqlserver2019  | The following diagnostic information is available:
sqlserver2019  | 
sqlserver2019  |          Reason: 0x00000001
sqlserver2019  |          Signal: SIGABRT - Aborted (6)
sqlserver2019  |           Stack:
sqlserver2019  |                  IP               Function
sqlserver2019  |                  ---------------- --------------------------------------
sqlserver2019  |                  000064d890f8e2fc <unknown>
sqlserver2019  |                  000064d890f8dd42 <unknown>
sqlserver2019  |                  000064d890f8d351 <unknown>
sqlserver2019  |                  00007449027e3090 killpg+0x40
sqlserver2019  |                  00007449027e300b gsignal+0xcb
sqlserver2019  |                  00007449027c2859 abort+0x12b
sqlserver2019  |                  000064d890f143d2 <unknown>
sqlserver2019  |         Process: 9 - sqlservr
sqlserver2019  |          Thread: 128 (application thread 0x1f8)
sqlserver2019  |     Instance Id: 765a7d6c-ba67-4b16-bd6c-0bb87d617e75
sqlserver2019  |        Crash Id: b52af073-1db9-4ed7-a9c6-21ba1505f57b
sqlserver2019  |     Build stamp: e149a9e980d9936d4f4a616b06112de0e7b2f4e45c2cd3a0884ae319ad3d13b7
sqlserver2019  |    Distribution: Ubuntu 20.04.6 LTS
sqlserver2019  |      Processors: 4
sqlserver2019  |    Total Memory: 8327204864 bytes
sqlserver2019  |       Timestamp: Thu Jun 20 01:53:15 2024
sqlserver2019  |      Last errno: 2
sqlserver2019  | Last errno text: No such file or directory
Capturing a dump of 9
sqlserver2019  | Successfully captured dump: /var/opt/mssql/log/core.sqlservr.6_20_2024_1_53_15.9
sqlserver2019  | Executing: /opt/mssql/bin/handle-crash.sh with parameters
sqlserver2019  |      handle-crash.sh
sqlserver2019  |      /opt/mssql/bin/sqlservr
sqlserver2019  |      9
sqlserver2019  |      /opt/mssql/bin
sqlserver2019  |      /var/opt/mssql/log/
sqlserver2019  |      
sqlserver2019  |      765a7d6c-ba67-4b16-bd6c-0bb87d617e75
sqlserver2019  |      b52af073-1db9-4ed7-a9c6-21ba1505f57b
sqlserver2019  |      
sqlserver2019  |      /var/opt/mssql/log/core.sqlservr.6_20_2024_1_53_15.9
sqlserver2019  | 
sqlserver2019  | Ubuntu 20.04.6 LTS
sqlserver2019  | Capturing core dump and information to /var/opt/mssql/log...
sqlserver2019  | dmesg: read kernel buffer failed: Operation not permitted
sqlserver2019  | /usr/bin/timeout: failed to run command '/bin/journalctl': No such file or directory
sqlserver2019  | /usr/bin/timeout: failed to run command '/bin/journalctl': No such file or directory
sqlserver2019  | Thu Jun 20 01:53:31 UTC 2024 Capturing program information
sqlserver2019  | Dump already generated: /var/opt/mssql/log/core.sqlservr.6_20_2024_1_53_15.9, moving to /var/opt/mssql/log/core.sqlservr.9.temp/core.sqlservr.9.gdmp
sqlserver2019  | Moving logs to /var/opt/mssql/log/core.sqlservr.9.temp/log/paldumper-debug.log
sqlserver2019  | Thu Jun 20 01:53:31 UTC 2024 Capturing program binaries
sqlserver2019  | Thu Jun 20 01:53:32 UTC 2024 Not compressing the dump files, moving instead to: /var/opt/mssql/log/core.sqlservr.06_20_2024_01_53_29.9.d

The issue first arose from a colleague who was using a VM with Ubuntu 24.04 and I was able to replicate it with a fresh VM on virtual box (both VM’s are hosted on a native Windows OS). My colleague also stated that it works fine on a VM of his running Ubuntu 20.04, so the problem seems to be either with Ubuntu 24.04 specifically or a newer version than 20.04. Of course, it may be something VM related in combination with the OS version.

I cannot find a record of anyone else encountering the same problem. My colleague is testing to see how it performs on a native Ubuntu 24.04 installation (that work hasn’t been completed at this time).

Hello!

I’m suffering the same issue with Debian 12 (Proxmox VE 8) as Docker host and the latest MS SQL server 2017 image (with Ubuntu 18.04.6 LTS as base image). There isn’t any clue about the nonexistent file or directory neither in logs or dumps files generated by the sqlserver process.

The same Docker image works fine with Fedora 39 as Docker host.

Thanks in advance for any help.

Trying to reproduce the issue, I’ve redeployed the Docker container with volume mounted as:

docker volume create dbdata
docker run -d -p 1433:1433 --name sql --mount source=dbdata,target=/var/opt/mssql --memory-reservation='4g' --restart=always -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Testing!' -e atach_dbs="[{'dbName': 'master', 'dbFiles': ['/var/opt/mssql/data/master.mdf', '/var/opt/mssql/data/mastlog.ldf']}, {'dbName': 'tempdb', 'dbFiles': ['/var/opt/mssql/data/tempdb.mdf', '/var/opt/mssql/data/templog.ldf']}, {'dbName': 'model', 'dbFiles': ['/var/opt/mssql/data/model.mdf', '/var/opt/mssql/data/modellog.ldf']}, {'dbName': 'msdb', 'dbFiles': ['/var/opt/mssql/data/MSDBData.mdf', '/var/opt/mssql/data/MSDBLog.ldf']}]" -e 'MSSQL_PID=Express' mcr.microsoft.com/mssql/server:2017-latest

Then an error with the datafiles was shown in /var/lib/docker/volumes/dbdata/_data/log/errorlog log file:

2024-07-23 16:06:42.41 Server      Microsoft SQL Server 2017 (RTM-CU31-GDR) (KB5029376) - 14.0.3465.1 (X64) 
	Jul 30 2023 15:31:58 
	Copyright (C) 2017 Microsoft Corporation
	Express Edition (64-bit) on Linux (Ubuntu 18.04.6 LTS)
. . .
2024-07-23 16:06:43.99 spid5s      Starting up database 'msdb'.
2024-07-23 16:06:44.00 spid11s     The resource database build version is 14.00.3465. This is an informational message only. No user action is required.
2024-07-23 16:06:44.02 spid5s      Error: 17204, Severity: 16, State: 1.
2024-07-23 16:06:44.02 spid5s      FCB::Open failed: Could not open file D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).
2024-07-23 16:06:44.02 spid11s     Starting up database 'model'.
2024-07-23 16:06:44.03 spid5s      Error: 5120, Severity: 16, State: 101.
2024-07-23 16:06:44.03 spid5s      Unable to open the physical file "D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2024-07-23 16:06:44.05 spid11s     Error: 17204, Severity: 16, State: 1.
2024-07-23 16:06:44.05 spid11s     FCB::Open failed: Could not open file D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).
2024-07-23 16:06:44.06 spid11s     Error: 5120, Severity: 16, State: 101.
2024-07-23 16:06:44.06 spid11s     Unable to open the physical file "D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2024-07-23 16:06:44.07 spid5s      Error: 17207, Severity: 16, State: 1.
2024-07-23 16:06:44.07 spid5s      FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.
2024-07-23 16:06:44.08 spid11s     Error: 17207, Severity: 16, State: 1.
2024-07-23 16:06:44.08 spid11s     FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.
2024-07-23 16:06:44.08 spid5s      File activation failure. The physical file name "D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf" may be incorrect.
2024-07-23 16:06:44.09 spid11s     File activation failure. The physical file name "D:\dbs\sh\nd3b\0730_151756\cmd\i\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf" may be incorrect.
2024-07-23 16:06:44.10 spid11s     Error: 945, Severity: 14, State: 2.
2024-07-23 16:06:44.10 spid11s     Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details.
2024-07-23 16:06:44.11 spid11s     SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

Here is a link explaining the how issue could be resolved. From an SQL client session:

SELECT name, physical_name, state_desc FROM  sys.master_files ORDER BY  database_id;
go

ALTER DATABASE  model MODIFY  FILE ( NAME  = modeldev, FILENAME = '/var/opt/mssql/data/model.mdf');
ALTER DATABASE  model MODIFY  FILE ( NAME  = modellog, FILENAME = '/var/opt/mssql/data/modellog.ldf');
ALTER DATABASE  msdb MODIFY  FILE ( NAME  = MSDBData, FILENAME = '/var/opt/mssql/data/MSDBData.mdf');
ALTER DATABASE  msdb MODIFY  FILE ( NAME  = MSDBLog, FILENAME = '/var/opt/mssql/data/MSDBLog.ldf');
ALTER DATABASE  tempdb MODIFY  FILE ( NAME  = tempdev, FILENAME = '/var/opt/mssql/data/temp.mdf');
ALTER DATABASE  tempdb MODIFY  FILE ( NAME  = templog, FILENAME = '/var/opt/mssql/data/temp.ldf');
go

Or you can use the default MS SQL server default flavour, that is, the Developer one:

docker pull mcr.microsoft.com/mssql/server:2017-latest
docker volume create dbdata
docker run -d -p 1433:1433 --name sql --mount source=dbdata,target=/var/opt/mssql --memory-reservation='4g' --restart=always -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Testing!' -e atach_dbs="[{'dbName': 'master', 'dbFiles': ['/var/opt/mssql/data/master.mdf', '/var/opt/mssql/data/mastlog.ldf']}, {'dbName': 'tempdb', 'dbFiles': ['/var/opt/mssql/data/tempdb.mdf', '/var/opt/mssql/data/templog.ldf']}, {'dbName': 'model', 'dbFiles': ['/var/opt/mssql/data/model.mdf', '/var/opt/mssql/data/modellog.ldf']}, {'dbName': 'msdb', 'dbFiles': ['/var/opt/mssql/data/MSDBData.mdf', '/var/opt/mssql/data/MSDBLog.ldf']}]" mcr.microsoft.com/mssql/server:2017-latest

I hope this can help anyone else facing this issue.

1 Like

use image:mcr.microsoft.com/mssql/server:2022-latest
or
switch linux kernel:6.6.51
both to normal working…but I want to use linux kernel.

That is not possible. Linux containers need Linux kernels, Windows containers need Windows kernels. The reason is because a container is a process on the host, but the kernel doesn’t allow it to see everything on the host.

UPDATE:

On second thought, I’m not sure about your goal. I realized this topic is about SQL Server on Linux. That could be what you need if that still exists. What is your issue? Is it related to this specific topic?

I didn’t read carefully before. My previous solution was to switch the Linux kernel to 6.6.51. After taking a closer look, I found that it works fine with the latest kernel as well. The issue is resolved.

1 Like