Sql-server – mssql suddenly cannot access physical file

linuxsql serversql-server-2019

SQL server 2019 on Centos 7 x86_64. It was running fine for quite long time, then got broken.
I was not doing anything special, neither update or restart or whatever. At some point the database went offline, and in errorlog I see these lines every time when I try to bring db online:

FCB::Open failed: Could not open file /var/opt/mssql/data/base.mdf for file number 1. OS error: 5(Access is denied.).
Unable to open the physical file "/var/opt/mssql/data/base.mdf". Operating system error 5: "5(Access is denied.)".

I tried to su into mssql user. All files and paths were accessible. selinux is disabled on that machine.

I then tried to run sql service as root. Still same problem (root cannot get access to files?)

Tried to make all files 777. Tried to reboot in case someone is holding some lock or whatever. No luck. At this point I think that it is some weird bug in mssql and it just blames OS.

Dropped the base and restored from backup with same name and same file locations. Worked without any warning, and works ever since.

I would appreciate if anyone could share some wisdom as of what could be happening there, because even though the problem was easily solved, I really don't like to deal with haunted servers.

Best Answer

This is definitely interesting. Normally, Access is denied error is due to changed/missing permission on the file. Did you see any related errors in journalctl?

If it happens again, I'd raise a ticket with Microsoft.