Unable to connect Microsoft SQL-Server and Visual Studio code - sql-server

I just installed MSSQL 2017 for linux and Visual Studio code for linux on my Ubuntu 18.10 machine.
Both the installation succeeded, but I cannot connect from visual studio to the DB.
I have the following running drivers:
$ odbcinst -j
unixODBC 2.3.7
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /home/neo4j/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
but, when I try to install
$ sudo apt-get install mssql-tools unixodbc-dev
I receive the following error:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
Depends: msodbcsql17 (< 17.4.0.0) but it is not going to be installed
unixodbc-dev : Depends: unixodbc (= 2.3.7)
E: Unable to correct problems, you have held broken packages.
after a lot of googling, i found a lot of suggestions, but they doesn't run, like try to remove msodbcsql and unixodbc
$ sudo apt-get remove msodbcsql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'msodbcsql' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
At this point I'm locked and not able to go ahead.
Has anyone some running solution?

You only need unixodbc-dev if you plan on doing unixodbc-dev development (not required for database connectivity). I'm guessing you can leave it out to avoid confusion here.
And msodbcsql and msodbcsql17 are different packages. msodbcsql (MS ODBC Driver 13 for SQL Server) isn't even available on Ubuntu 18.10.
The key in your problem is the error message:
E: Unable to correct problems, you have held broken packages.
You need to remove the hold on the broken package. First, I'd try specifically installing msodbcsql17:
sudo apt-get install msodbcsql17
If you still get an error, there are other steps you can take to try to fix the problem of held packages:
https://askubuntu.com/a/223267

Related

Nothing provides python needed by mssql-server-is

I'm trying to install SQL Server Integration Services on RHEL 8. I have SQL Server 2019 (version v15) installed and running successfully, but when I try and follow this:
https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ssis?view=sql-server-ver15#RHEL
The RHEL 8 repo doesn't have the mssql-server-is package in it, and using the RHEL 7 repo throws this error:
Error: Problem: conflicting requests
- nothing provides python needed by mssql-server-is-15.0.2000.5-4.x86_64 (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
I have both Python2 and Python 3 installed, and when I run this:
alternatives --config python
I see that /usr/bin/python2 is selected
Any ideas how I can get SSIS installed for RHEL 8 and SQL Server 2019?
I could install it by downloading the rpm and then installing it using --nodeps option as below:
sudo yum download mssql-server-is
sudo rpm -Uvh --nodeps mssql-server-is*rpm
Worked pretty smooth for me.

Install msodbcsql17_17.4.2.1-1.deb driver for django SQL Server connection?

I am trying to connect django with SQL Server database using pip3 install django-pyodbc-azure. But when I install driver msodbcsql17_17.4.2.1-1.deb it produce following error:
Selecting previously unselected package msodbcsql17.
(Reading database ... 340765 files and directories currently installed.)
Preparing to unpack msodbcsql17_17.4.2.1-1.deb ...
Unpacking msodbcsql17 (17.4.2.1-1) ...
dpkg: dependency problems prevent configuration of msodbcsql17:
msodbcsql17 depends on unixodbc (>= 2.3.1); however:
Package unixodbc is not installed.
dpkg: error processing package msodbcsql17 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
msodbcsql17
Any possiblity to connect django with SQL Server?

I screwed up my Steam installation, how do I fix my broken packages?

I have Ubuntu 18.04, not installed directly but upgraded from 16.10, I haven't used Steam in a while on this computer (maybe since before the 18.04 upgrade, don't remember) which led to problems, and after a while of trawling the Internet for possible solutions, I had to admit defeat.
I tried the sudo apt-get autoremove/update/upgrade/dist-upgrade series, and it didn't do anything.
EDIT: I have also done sudo apt-get clean, and sudo apt-get install -f.
I also tried a full uninstall via deleting .steam/ and .local/share/Steam/ .
I am aware of the method of simply manually installing the packages, but that isn't working for me, either. Observe:
$ sudo apt install steam
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
steam:i386 : Depends: libgl1-mesa-dri:i386 (>= 17.3) but it is not going to be installed or
libtxc-dxtn0:i386
Depends: libgl1-mesa-dri:i386 but it is not going to be installed
Depends: libgl1-mesa-glx:i386 but it is not going to be installed
Recommends: nvidia-driver-libs-i386:i386 but it is not installable
E: Unable to correct problems, you have held broken packages.
From this, I tried to run the following commands:
$ sudo apt install libgl1-mesa-dri:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgl1-mesa-dri:i386 : Depends: libllvm8:i386 (>= 1:8~svn298832-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libgl1-mesa-dri:i386 libllvm8:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libllvm8:i386 : Depends: libatomic1:i386 (>= 4.8) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libgl1-mesa-dri:i386 libllvm8:i386 libatomic1:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
debhelper : Depends: dh-autoreconf (>= 17~) but it is not going to be installed
libatomic1:i386 : Depends: gcc-8-base:i386 (= 8.3.0-6ubuntu1~18.04.1) but 8.3.0-16ubuntu3~16.04 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
At this point, I don't really know what to do. Especially in response to the line "but 8.3.0-16ubuntu3~16.04 is to be installed". I have Ubuntu 18.04. Why is something from 16.04 going to be installed?
One more try for completion's sake:
$ sudo apt install libgl1-mesa-dri:i386 libllvm8:i386 libatomic1:i386 dh-autoreconf gcc-8-base:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc-8-base:i386 is already the newest version (8.3.0-16ubuntu3~16.04).
gcc-8-base:i386 set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
dh-autoreconf : Depends: libtool (>= 2.4.2) but it is not going to be installed
libatomic1:i386 : Depends: gcc-8-base:i386 (= 8.3.0-6ubuntu1~18.04.1) but 8.3.0-16ubuntu3~16.04 is to be installed
E: Unable to correct problems, you have held broken packages.
And including gcc-8-base:i386 does nothing.
How did I break my install of Ubuntu?
Tried all top Google solutions. None of them worked for me.
Came across this answer that described how we can reset broken packages.
Take a backup of the file /var/lib/dpkg/status first. Then erase all the contents of that file.
Then run sudo apt install steam. It may prompt you if there are files that already exist and will be overwritten. Best that you check for the differences in the file's contents. In my case, I decided to use the one from the package maintainers itself instead of my own.
Steam installed smoothly. Did not get any unmet dependencies error.
When I tried to start steam, I got an error about glxchoosevisual failed. For this, I then had to install libnvidia-gl-450:i386 library. Note that in my case, my nvidia driver version was 450 so used that. You need to use your version here. That's it! Steam then launched fine.
Sharing it here in case it helps somebody.
Check if you have enabled restricted and universe repositories.
You can also run:
This cleans the local repo from packages so they are going to be downloaded again
apt-get clean
This is reinstalling broken packages
apt-get -f install

Install Microsoft ODBC Driver for SQL Server on Ubuntu 18.04

The goal is to install Microsoft Driver for SQL Server on Ubuntu 18.04 to write scripts using python package pyodbc.
I make steps according this article. The problem is when I run command sudo ACCEPT_EULA=Y apt-get install msodbcsql17 then I recieve next error message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
msodbcsql17 : Depends: unixodbc (>= 2.3.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
Only relevant discussion of this problem is here. But I have already tried all recomendations:
Remove all relevant packages
Use clean system
Build unixodbc manually
Nothing helped me. Does anyone met same problem or have guide how to install this driver on clean Ubuntu 18.04 server system?

apache2 installation on linux:Unable to correct problems, you have held broken packages

i'm trying to install Apache on my Linux via terminal. used commands like
"sudo apt-get update && sudo apt-get upgrade"
and
"sudo apt-get install apache2"
i'm getting the error
"Unable to correct problems, you have held broken packages."
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
apache2 : Depends: apache2-bin (= 2.4.18-2ubuntu3.8) but it is not going to be installed
Depends: apache2-utils (>= 2.4)
E: Unable to correct problems, you have held broken packages.

Resources