2

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.

Dave
  • 410
  • 6
  • 13
  • It's a configuration setting of `sudo`. – Barmar Jun 26 '18 at 21:32
  • You need to modify `/etc/sudoers` to allow it. – Barmar Jun 26 '18 at 21:32
  • SO is for programming questions, not questions about using or configuring Linux and its applications. [SuperUser](http://superuser.com) or [unix.se] would be better places for questions like this. – Barmar Jun 26 '18 at 21:32

3 Answers3

8

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
that other guy
  • 116,971
  • 11
  • 170
  • 194
  • This worked. Thank you! In case this additional context helps anyone else: The situation you described about access to run commands but not to modify the environment, might be explained by the fact that this is a spun up Linux environment that is provided as a service by an external company. (not sure if that matters) – Dave Jun 26 '18 at 23:13
3

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.

Jordan Simba
  • 1,046
  • 7
  • 10
1

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.

Jared Forth
  • 1,577
  • 6
  • 17
  • 32