fuzziebrain / docker-oracle-xe

Docker build for Oracle Database 18c Express Edition (XE). This project is now archived with the release of version 21c.
MIT License
272 stars 127 forks source link

su - cannot open session #15

Open ratcashdev opened 6 years ago

ratcashdev commented 6 years ago

Building fails:

Running transaction
  Installing : file-5.11-33.el7.x86_64                                      1/2 
su: cannot open session: Permission denied
[SEVERE] The su command is not configured properly or the oracle user does not have the required privileges to install the Oracle database. If you are running in a Docker environment, ensure to set the environment variable ORACLE_DOCKER_INSTALL=true and try again.
error: %pre(oracle-database-xe-18c-1.0-1.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package oracle-database-xe-18c-1.0-1.x86_64

the fact that the ORACLE_DOCKER_INSTALL is already set does not help :(

fuzziebrain commented 6 years ago

@ratcashdev Thanks for your feedback. What OS are you running Docker on? What was the full Docker command that you used to build the image?

ratcashdev commented 6 years ago

OS: elementary OS 5.0 (Juno), built on Ubuntu 18.04. docker-ce 18.0.1 installed as a SNAP package build command: sudo docker build -t oracle-xe:18c . - since the current user is not in the appropriate group for docker.

hg-smart commented 6 years ago

@fuzziebrain : I experience exactly the same issue on a new ubuntu machine (18.04 bionic, Linux xxx 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux) with installed docker from ubuntu install using the command : docker build -t oracle-xe:18c .

running transaction
  Installing : file-5.11-33.el7.x86_64                                      1/2
su: cannot open session: Permission denied
[SEVERE] The su command is not configured properly or the oracle user does not have the required privileges to install the Oracle database. If you are running in a Docker environment, ensure to set the environment variable ORACLE_DOCKER_INSTALL=true and try again.
error: %pre(oracle-database-xe-18c-1.0-1.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package oracle-database-xe-18c-1.0-1.x86_64
  Verifying  : file-5.11-33.el7.x86_64                                      1/2
  Verifying  : oracle-database-xe-18c-1.0-1.x86_64                          2/2

Dependency Installed:
  file.x86_64 0:5.11-33.el7

Failed:
  oracle-database-xe-18c.x86_64 0:1.0-1

Complete!
The command '/bin/sh -c yum install -y oracle-database-preinstall-18c &&   yum install -y /tmp/${ORACLE_XE_RPM} &&   rm -rf /tmp/${ORACLE_XE_RPM}' returned a non-zero code: 1
tensau commented 6 years ago

Had the same problem on Ubuntu 18.04 with the snap package. Tried it with the "docker.io" package supplied via apt-get, and it works.

fuzziebrain commented 6 years ago

Thanks everyone for the feedback. @tensau good point about which version or where you installed Docker from. I'm on Ubuntu 18.04 as well and had nothing but successes. I did install the latest engine from Docker using the these instructions. The user I use does belong to the docker group, so I don't use sudo to do the build or run the container. @martindsouza of course, does everything on a Mac and he hasn't had problems either.

This is probably an issue/diferences with how we obtain or use Docker and not necesarily problems with the image or RPMs from Oracle. If everyone's agreeable, the only "fix" I can think of is to provide some text in the README that suggest users do the same as I did and what are the potential issues with other approaches.

tensau commented 6 years ago

With the docker.io apt package, the group problem existed, too. But if I ran the commands with sudo, it worked perfectly.

hg-smart commented 6 years ago

@tensau thx a lot, it is really related to the docker installation.

this helped me 👍 sudo snap remove docker , but take care this removes all docker images and containers...

fuzziebrain commented 6 years ago

Thanks all. We'll look into adding some notes in the documentation on this issue.

ratcashdev commented 6 years ago

Indeed, after remove the docker snap package and installing it using apt, it worked.

gerbil commented 5 years ago

Ubuntu 14.04 - the same error. I don't have any 'snap' install on my ubuntu.

[SEVERE] The su command is not configured properly or the oracle user does not have the required privileges to install the Oracle database. If you are running in a Docker environment, ensure to set the environment variable ORACLE_DOCKER_INSTALL=true and try again. error: %pre(oracle-database-xe-18c-1.0-1.x86_64) scriptlet failed, exit status 1 Error in PREIN scriptlet in rpm package oracle-database-xe-18c-1.0-1.x86_64

Since it's a build process i can't use 'priveleged' flag there..

Arsis247 commented 5 years ago

Before installing oracle, you need to comment session include system-auth line in /etc/pam.d/su file of your linux image.

devalru commented 5 years ago

There is no /etc/pam.d/su in oraclelinux

h00s commented 5 years ago

I had the same problem running on RHEL 8.0 host with Docker 19.03.2. I've solved the problem with comment @Arsis247 suggested. I have edited Dockerfile: switched to oraclelinux and removed mentioned line from /etc/pam.d/su line. No problems after that, image successfully built and container is happily running.

This are the changes I made to Dockerfile: -FROM oraclelinux:7-slim +FROM oraclelinux

-RUN yum install -y oracle-database-preinstall-18c && \ +RUN yum install -y oracle-database-preinstall-18c && sed -i '12d' /etc/pam.d/su && \

KowKiller commented 5 years ago

There is no /etc/pam.d/su in oraclelinux

It's not in the base image but it's added once you run yum install -y oracle-database-preinstall-18c

Similarly to @h00s , I used this command to remove the line pointed by @Arsis247 sed -i -r '/session\s+include\s+system-auth/d' /etc/pam.d/su

difr commented 4 years ago

it's not only about "su", "runuser" also has the same problem: runuser: cannot open session: Permission denied i've localized it, "pam_limits.so" is a reason (OL 7.7) so, my workaround (in "Dokerfile"):

    ... oracle-database-preinstall-18c && \
    sed -i -r 's/^(session\s+required\s+pam_limits.so)/#\1/' /etc/pam.d/* && \
    ...

big thanks to @Arsis247 (!), @h00s and @KowKiller

qwertycody commented 4 years ago
sed -i -r 's/^(session\s+required\s+pam_limits.so)/#\1/' /etc/pam.d/* && \

hey @difr, wanted to tell you that I just used this and it worked for me on a COMPLETELY separate issue I was having but same concept, su and runuser not working on Dockerfile based on oracle linux.

Thanks for doing the work on this.

pazfernando commented 3 years ago

it's not only about "su", "runuser" also has the same problem: runuser: cannot open session: Permission denied i've localized it, "pam_limits.so" is a reason (OL 7.7) so, my workaround (in "Dokerfile"):

    ... oracle-database-preinstall-18c && \
    sed -i -r 's/^(session\s+required\s+pam_limits.so)/#\1/' /etc/pam.d/* && \
    ...

big thanks to @Arsis247 (!), @h00s and @KowKiller

Thanks I confirm your workaround works for me, the issue is present with the last version of 18.4.0 XE at this time.