Shell driver install with `ACCEPT_EULA=Y` error

9.6k Views Asked by At

As described here, I am trying to install the following driver in shell, using this code (modified from the original slightly):

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/debian/8/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17

But I get an error on the last command:

sudo: sorry, you are not allowed to set the following environment variables: ACCEPT_EULA

After searching, I can't seem to find this exact error anywhere else.

One solution is to run the last command without ACCEPT_EULA=Y as sudo apt-get install msodbcsql17. And then to enter Y at the prompt. This indeed works but I would like to run the above installation for other users without need of their input.

  • Is there a way to resolve the above error so I can use ACCEPT_EULA=Y, or
  • alternatively is there a simple way to enter the Y response for the EULA automatically so the end user never needs to take any action?

Thank you in advance.

3

There are 3 best solutions below

1
that other guy On BEST ANSWER

You appear to have access to run arbitrary commands, but not to modify the environment.

The simple workaround is to hand off environment changes to the command:

sudo env ACCEPT_EULA=Y apt-get install msodbcsql17
0
Jordan Simba On

I don't have enough rep to post a comment. But I was doing the same install for pyodbc inside a python:3 docker container. In the dockerfile the following command works:

ACCEPT_EULA=Y apt-get install -y msodbcsql17

(I was after this particular driver #17.)

Reading: https://github.com/microsoft/mssql-docker/blob/master/oss-drivers/pyodbc/Dockerfile can help see the environment set up from a base ubuntu (ubuntu:16.04) box.

Also check up on: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017 for microsoft first hand docs.

0
Frackalyzer On

The ACCEPT_EULA=Y apt-get install -y msodbcsql17 command above did the trick for me as I was trying to set up msodbcsql17 via a Dockerfile.