TransWikia.com

mssql server set up fail with errror on debian linux

Database Administrators Asked by LilRazi on December 17, 2021

I was trying to install SQL server on my Debian Linux. Installation part went well but when I tried to run setup file I am getting following error message. Is there any way to fix this issues. Thanks

File "/opt/mssql/bin/../lib/mssql-conf/mssql-conf.py", line 126, in <module>
exit(mssqlconfhelper.setupSqlServer())
File "/opt/mssql/lib/mssql-conf/mssqlconfhelper.py", line 441, in   setupSqlServer
ret = checkInstall()
 OSError: [Errno 2] No such file or directory

There are few other lines too but most of them are something similar to above and related to .py files.

3 Answers

I had a similar issue on a system without sudo, where I was logged in as root. I changed the location like David Leal proposed, but also removed all other uses of sudo using:

sed -i 's@sudo, "-EH", @@;s@"sudo", @@g' /opt/mssql/lib/mssql-conf/mssqlconfhelper.py
sed -i 's@sudo -EH@su@' /opt/mssql/lib/mssql-conf/invokesqlservr.sh

Side note: David Leal's solution exits with an error (at least on version 15.0.4063.15-10). I probably works, if you start and enable the service by hand afterwards.

Side note 2: The sudo variable from line 43 in mssqlconfhelper.py is used only once in line 930 with arguments, and changing it to an empty string unfortunately does not help. Why MS does not consequently use the variable is questionable, and would resort in only need to change two lines of code.

Answered by MP Felder on December 17, 2021

I was istalling it on a docker container based on the debian:buster image,and i had the following error:

root@25d7455d0dfc:/# /opt/mssql/bin/mssql-conf setup
Traceback (most recent call last):
  File "/opt/mssql/bin/../lib/mssql-conf/mssql-conf.py", line 361, in <module>
    main()
  File "/opt/mssql/bin/../lib/mssql-conf/mssql-conf.py", line 357, in main
    processCommands()
  File "/opt/mssql/bin/../lib/mssql-conf/mssql-conf.py", line 262, in processCommands
    COMMAND_TABLE[args.which]()
  File "/opt/mssql/bin/../lib/mssql-conf/mssql-conf.py", line 75, in handleSetup
    mssqlconfhelper.setupSqlServer(eulaAccepted, noprompt=args.noprompt)
  File "/opt/mssql/lib/mssql-conf/mssqlconfhelper.py", line 971, in setupSqlServer
    if not checkInstall():
  File "/opt/mssql/lib/mssql-conf/mssqlconfhelper.py", line 941, in checkInstall
    return runScript(checkInstallScript, True) == 0
  File "/opt/mssql/lib/mssql-conf/mssqlconfhelper.py", line 930, in runScript
    return subprocess.call([sudo, "-EH", pathToScript])
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

So visited the python script at line 930: vim +930 /opt/mssql/lib/mssql-conf/mssqlconfhelper.py

And I saw this if condition:

if (runAsRoot):
    if(checkSudo() == False):
        printError(_("Elevated privileges required for this action. Please run in 'sudo' mode."))
        return (errorExitCode)
    return subprocess.call([sudo, "-EH", pathToScript])
else:
    return subprocess.call([pathToScript])

Since I'm running as root and it enters the first condition 'runAsRoot' the script run the following return subprocess.call([sudo, "-EH", pathToScript])

I changed that line to: return subprocess.call([pathToScript])

After that, the setup command worked for me. /opt/mssql/bin/mssql-conf setup

Answered by David Leal on December 17, 2021

i had the same issue when i was installing mssql on docker in an Ubuntu 16.04 container. the issue is the missing sudo. for some reason, even though i installed a whole bunch of software without sudo, setting up the mssql server seems to need the command to the run only with sudo.

  1. install sudo: apt-get install -y sudo
  2. now try the command: sudo /opt/mssql/bin/mssql-conf setup

now you should be able to successfully setup the config for the mssql server

Answered by vivek86 on December 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP