Upgrading from 2022 (16.x) to 2025 (17.x)
This is a true in-place upgrade. The data directory stays at /var/opt/mssql
and nothing needs to be detached, exported or reattached. Following Arch
practice the package does not start, stop or restart mssql-server, so
installing it converts nothing on its own.
The conversion happens the next time you start the engine. It rewrites every
database (master, msdb, model and all user databases) from on-disk version 957
to 998, and that is one-way: 16.x can no longer open those files afterwards and
aborts with a fatal error. There is no downgrade path and no side-by-side
operation, because /opt/mssql and /var/opt/mssql are fixed locations.
Database compatibility levels are preserved, so existing databases keep the behaviour they had and logins in master survive. Only the physical file format moves. You can raise the compatibility level later, separately, if you want to.
If the engine is running when you upgrade, it carries on unaffected: it holds the previous version's binaries open on disk and keeps using them until you restart it. That gives you a window to take a rollback point while the data can still be read by the old engine.
sudo systemctl stop mssql-server
sudo tar -C /var/opt --zstd -cf ~/mssql-pre-upgrade.tar.zst mssql
sudo systemctl start mssql-server
sudo journalctl -u mssql-server -f
Restoring that archive over /var/opt/mssql is a verified way back to 16.x.
Note that an enabled unit will also convert at the next boot, so do not rely on
the service simply being stopped as a safeguard.
Troubleshooting: "Unable to set persistent hive root"
If the engine fails to start with Unable to set persistent hive root and
Last errno: 13 / Permission denied, something has left files in the SQLPAL
registry hive owned by a user other than mssql. Check with:
sudo find /var/opt/mssql \! -user mssql
The usual cause is running /opt/mssql/bin/sqlservr by hand as your own user
while being a member of the mssql group. The engine initialises its registry
hive during startup, before it parses arguments, so even sqlservr --help is
enough to rewrite /var/opt/mssql/.system/system/*.hiv as you. Fix with:
sudo chown -R mssql:mssql /var/opt/mssql
The older advice to create /var/opt/mssql/hk no longer applies. The 2025
engine never references that path; the hive lives in /var/opt/mssql/.system
and is created automatically.
Pinned Comments
too commented on 2026-09-13 09:21 (UTC) (edited on 2026-09-13 09:33 (UTC) by too)
Upgrading from 2022 (16.x) to 2025 (17.x)
This is a true in-place upgrade. The data directory stays at
/var/opt/mssqland nothing needs to be detached, exported or reattached. Following Arch practice the package does not start, stop or restartmssql-server, so installing it converts nothing on its own.The conversion happens the next time you start the engine. It rewrites every database (master, msdb, model and all user databases) from on-disk version 957 to 998, and that is one-way: 16.x can no longer open those files afterwards and aborts with a fatal error. There is no downgrade path and no side-by-side operation, because
/opt/mssqland/var/opt/mssqlare fixed locations.Database compatibility levels are preserved, so existing databases keep the behaviour they had and logins in master survive. Only the physical file format moves. You can raise the compatibility level later, separately, if you want to.
If the engine is running when you upgrade, it carries on unaffected: it holds the previous version's binaries open on disk and keeps using them until you restart it. That gives you a window to take a rollback point while the data can still be read by the old engine.
Restoring that archive over
/var/opt/mssqlis a verified way back to 16.x. Note that an enabled unit will also convert at the next boot, so do not rely on the service simply being stopped as a safeguard.Troubleshooting: "Unable to set persistent hive root"
If the engine fails to start with
Unable to set persistent hive rootandLast errno: 13 / Permission denied, something has left files in the SQLPAL registry hive owned by a user other thanmssql. Check with:The usual cause is running
/opt/mssql/bin/sqlservrby hand as your own user while being a member of themssqlgroup. The engine initialises its registry hive during startup, before it parses arguments, so evensqlservr --helpis enough to rewrite/var/opt/mssql/.system/system/*.hivas you. Fix with:The older advice to create
/var/opt/mssql/hkno longer applies. The 2025 engine never references that path; the hive lives in/var/opt/mssql/.systemand is created automatically.