By: Manvendra Singh | Updated: 2017-09-11 | Comments | Related: More > SQL Server on Linux
In a previous tip I explained the process to install SQL Server Agent on a SUSE Linux server. In this tip, I will show how to fix an error you might face when installing the SQL Server tools or SQL Server on a SUSE Linux server.
As I discussed in my last couple of tips, SQL Server vNext does not install the sqlcmd and BCP utilities during the SQL Server installation on Linux servers, but we need the sqlcmd utility to make a database connection from Linux based servers. In this tip I will show how to install these tools to make database connections to SQL Server on SUSE Linux.
Unfortunately, while installing the SQL Server tools, I faced the below error which I fixed and was able to install the SQL Server tools successfully.
Failed to mount cd:///?devices=/dev/disk/by-id/ata-Vmware_Virtual_SATA_CDRW_Drive_01000000000000000001 on /var/adm/mount/AP_0xDGCZO0: Mounting media failed (mount: No medium found on /dev/sr1)
I will explain the method to rectify this issue and install your software successfully. This is not a SQL Server specific error so you can get it while installing any software/tool on SUSE Linux.
Fixing this Issue
Before going ahead, you need to have a SUSE Linux server with SQL Server vNext installed on that machine. Now let's start the SQL Server tools installation on SUSE Linux box.
I connected to the target SUSE Linux server using PuTTY as shown in the below screen shot. I entered the login name as manvendra followed by the password to make a successful connection.
You can see that I have made a successful connection to this SUSE Linux server where I installed SQL Server. Now let's check and verify the SQL Server installation on this machine. Run the below command to check the mssql-server service. Now I will check and validate whether SQL Server is installed on this Linux machine or not by checking this service. We can see the service status is shown as enabled and active (i.e. running) which is highlighted in green which means SQL Server is installed and running fine on this server.
#check the status of mssql-server service. systemctl status mssql-server
Next we will install the SQL Server tools on this server. Before going ahead we can verify whether the tools are installed on this machine or not. You can type sqlcmd and press enter, if you will get details about this utility that means this tool is already on the server. I did this and you can see sqlcmd is not recognized by SUSE Linux, so the next step is to install it on this machine.
The first step is to add the SQL Server repository to the zypper. This repository will be used to install the SQL Server tools on this machine. Use the command below to add the SQL Server repository to zypper:
#Add repository to Zypper. sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/prod.repo
You can see that the command has been executed successfully. Now execute the below command to refresh the keys.
sudo zypper --gpg-auto-import-keys refresh
Next check the list of repositories by running the below zypper command.
#Get the list of repositories zypper lr
Now our next step is to install the SQL Server tools with the unixODBC developer package on this box by using this zypper command.
#Install MSSQL tools sudo zypper install mssql-tools unixODBC-devel
Once execution has started, it will read the package list followed by checking the dependencies. It will display the name of target packages which will be installed along with this installation. Now it will ask you to choose yes or no to proceed with the installation. Type y to choose yes. Once you enter y and press enter the download process for all required packages should begin. Unfortunately, we received the error below after entering y as shown in the below picture.
The prompt suggests you insert the correct medium for the given repository and type y to proceed or n to cancel. I typed n to cancel this setup because the installation medium is already in the package repository as we have checked in the above steps. Once you enter no to cancel the operation you will be get the below error details.
I researched this issue and found the solution. The solution is to disable the given repository "SLES12-SP2-12.2-0". We can see its status is shown as "Enabled" in the 4th image of step 3. We need to open the software repositories window on the SUSE Linux server to get this done.
I logged into the SUSE Linux server locally in GUI mode and clicked on "Applications" as shown in the below screenshot. Once you click on the "Applications" button you will get a number of options to choose. Click on the "Terminal" option to launch the Administrator settings window.
Once you click on the "Terminal" option, it will ask you to enter the root password. Enter the root password and press the Continue button to proceed.
Once your root password is authenticated, the "Administrator Settings" window will appear on your screen as shown in the below image. You can see there is shortcut for software repositories in first row of this window. Click on this option to launch the software repositories.
Once you click on "Software Repositories", a window name "YaST2" will appear on your screen as shown in the below image. YaST is a powerful installation and configuration tool for SUSE Linux. You can see all the software devices and their details in this window.
Now click on 3rd line as shown in the above image. This is where we are getting the error about the CD. If you look at the error image it is saying to insert medium for "SLES12-SP2-12.2-0" and the error details contain the same path and device details which is highlighted in the red box below.
You can see this repository/device is marked as enabled in the above image. This has to be unchecked and disabled to fix this issue. Please uncheck the "Enabled" as shown below to proceed.
Click the OK button to apply this change and close this window. If you do not click on the OK button then you will get the below error while installing the SQL Server tools.
System management is locked by the application with pid 50217 (/usr/lib/YaST2/bin/y2base). Close this application before trying again.
Now go ahead and install the SQL Server Tools again. This time you will be able to install it successfully as shown in the below image.
Once the SQL Server Tools are installed you can validate the installation by running sqlcmd in at the command prompt. If sqlcmd displays the details for the utility that means this has been installed successfully.
#check sqlcmd utility. sqlcmd
We can see that now sqlcmd command is recognized by the SUSE Linux server and the output of this command shows that sqlcmd is installed and ready for use.
- Go ahead and make database connections on SUSE Linux server and get more exposure on this new product of SQL Server.
- Explore more knowledge on SQL Server Database Administration Tips.
- Check out all of the SQL Server on Linux Tips.
Last Updated: 2017-09-11
About the author
View all my tips