Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-364

Odd SG Installation errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.5.0
    • Fix Version/s: 2.6.0
    • Component/s: SyncGateway
    • Security Level: Public
    • Labels:
      None
    • Sprint:
      CBG Sprint 22, CBG Sprint 23, CBG Sprint 24, CBG Sprint 25
    • Story Points:
      5

      Description

      I think this is a build/packaging issue but I'm having a very hard time tracking it down.

       

      For context, I maintain our automated demo environments through RightScale which in turn launches instances in AWS.  I recently upgraded these scripts to SG 2.5 and am now running into an issue when trying to install it.  The weirdest part so far is that the installation only fails when the server first starts up and works fine a little later.

       

      I'm working on finding a workaround for myself, but thought you might have an idea of where the issue is and/or that it might be affecting others:

      yum -y install couchbase-sync-gateway-enterprise_2.5.0_x86_64.rpm 
      Error in PREIN scriptlet in rpm package couchbase-sync-gateway-2.5.0-271.x86_64
      Loaded plugins: fastestmirror 
      Examining couchbase-sync-gateway-enterprise_2.5.0_x86_64.rpm: couchbase-sync-gateway-2.5.0-271.x86_64 
      Marking couchbase-sync-gateway-enterprise_2.5.0_x86_64.rpm to be installed 
      Resolving Dependencies
       --> Running transaction check
       ---> Package couchbase-sync-gateway.x86_64 0:2.5.0-271 will be installed
       --> Finished 
      Dependency Resolution
       Dependencies Resolved ================================================================================ 
      Package Arch Version Repository Size ================================================================================ 
      Installing: couchbase-sync-gateway x86_64 2.5.0-271 /couchbase-sync-gateway-enterprise_2.5.0_x86_64 31 M Transaction Summary ================================================================================ 
      Install 1 Package 
      Total size: 31 M 
      Installed size: 31 M 
      Downloading packages: 
      Running transaction check 
      Running transaction test 
      Transaction test succeeded 
      Running transaction 
      useradd: cannot create directory /opt/couchbase-sync-gateway error: %pre(couchbase-sync-gateway-2.5.0-271.x86_64) scriptlet failed, exit status 1 
      Verifying : couchbase-sync-gateway-2.5.0-271.x86_64 1/1 
      Failed: couchbase-sync-gateway.x86_64 0:2.5.0-271 
      Complete!
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          perry Perry Krug added a comment -

          FWIW, I put a sleep and retry after the first failure and now SG installs in my automated script...but I can see that it's still failing this way and I don't know why.

          Show
          perry Perry Krug added a comment - FWIW, I put a sleep and retry after the first failure and now SG installs in my automated script...but I can see that it's still failing this way and I don't know why.
          Hide
          adamf Adam Fraser added a comment -

          This feels like it would be related to the fix for https://github.com/couchbase/sync_gateway/issues/3826.  

          Show
          adamf Adam Fraser added a comment - This feels like it would be related to the fix for  https://github.com/couchbase/sync_gateway/issues/3826 .  
          Hide
          ben.brooks Ben Brooks added a comment -

          Perry Krug I suspect this is due to SELinux preventing the home directory from being created when adding the user, but I'm still working on the repro to be sure.

          Adam Fraser is right in that this was introduced above linked issue/PR in 2.5, I'm trying to piece together how the rpm script managed to create the home directory before this change went in - that might shed some light on a possible fix.

          For now, you can disable SELinux during installation with sudo setenforce 0 and then re-enable with sudo setenforce 1 and see if that fixes your installation problem.

          Show
          ben.brooks Ben Brooks added a comment - Perry Krug I suspect this is due to SELinux preventing the home directory from being created when adding the user, but I'm still working on the repro to be sure. Adam Fraser is right in that this was introduced above linked issue/PR in 2.5, I'm trying to piece together how the rpm script managed to create the home directory before this change went in - that might shed some light on a possible fix. For now, you can disable SELinux during installation with sudo setenforce 0 and then re-enable with sudo setenforce 1 and see if that fixes your installation problem.
          Hide
          perry Perry Krug added a comment -

          Thanks Ben, I will double-check but I'm fairly sure that SELinux is disabled entirely for these systems already.

          Show
          perry Perry Krug added a comment - Thanks Ben, I will double-check but I'm fairly sure that SELinux is disabled entirely for these systems already.
          Hide
          ben.brooks Ben Brooks added a comment -

          Perry Krug just to help with my efforts to reproduce - can you let me know which distro and version you're running?

          Are the scripts to set up this environment in a Git repo anywhere? It might be helpful to take a look at.

          Show
          ben.brooks Ben Brooks added a comment - Perry Krug just to help with my efforts to reproduce - can you let me know which distro and version you're running? Are the scripts to set up this environment in a Git repo anywhere? It might be helpful to take a look at.
          Hide
          ben.brooks Ben Brooks added a comment - - edited

          I've reproduced on a default Centos7 install - it does seem to be SELinux preventing the first attempt at creating /opt/couchbase-sync-gateway. Subsequent attempts to install are allowed through.

          I think I might be able to make it play ball by using mkdir to create the directory before useradd is called to create the user - I will experiment with it in this environment I have set up.

          Show
          ben.brooks Ben Brooks added a comment - - edited I've reproduced on a default Centos7 install - it does seem to be SELinux preventing the first attempt at creating /opt/couchbase-sync-gateway . Subsequent attempts to install are allowed through. I think I might be able to make it play ball by using mkdir to create the directory before useradd is called to create the user - I will experiment with it in this environment I have set up.
          Hide
          perry Perry Krug added a comment -

          Thanks Ben, my apologies as I just checked and see that SELinux is enabled on my servers.  However, I think there's something else going on here because on some identically configured systems, I am able to install sync gateway when SELinux is still enabled (the first time).  I can certainly see your analysis shows that it's interacting with SELinux...but it's also not clear to me why this behavior has changed since it was working fine on previous SG versions.

           

          Thanks

          Show
          perry Perry Krug added a comment - Thanks Ben, my apologies as I just checked and see that SELinux is enabled on my servers.  However, I think there's something else going on here because on some identically configured systems, I am able to install sync gateway when SELinux is still enabled (the first time).  I can certainly see your analysis shows that it's interacting with SELinux...but it's also not clear to me why this behavior has changed since it was working fine on previous SG versions.   Thanks
          Hide
          build-team Couchbase Build Team added a comment -

          Build sync_gateway-2.6.0-107 contains sync_gateway commit 75cdceb with commit message:
          CBG-364 - Remove --create-home from useradd (#4174)

          Show
          build-team Couchbase Build Team added a comment - Build sync_gateway-2.6.0-107 contains sync_gateway commit 75cdceb with commit message: CBG-364 - Remove --create-home from useradd (#4174)

            People

            • Assignee:
              ben.brooks Ben Brooks
              Reporter:
              perry Perry Krug
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.