Cassandra
  1. Cassandra
  2. CASSANDRA-4058

Debian package does not create /var/lib/cassandra/data

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Not a Problem
    • Fix Version/s: None
    • Component/s: Packaging
    • Labels:
      None
    • Environment:

      Ubuntu 11.10

      Description

      I installed Cassandra using the Debian packages as described here: http://wiki.apache.org/cassandra/DebianPackaging

      When trying to start Cassandra using /etc/init.d/cassandra start I get this error: java.io.IOError: java.io.IOException: unable to mkdirs /var/lib/cassandra/data

      The directory /var/lib/cassandra exists, but the directory /var/lib/cassandra/data does not.

      I would assume the data directory should have been created with the correct permissions, but it was not.

      However, I tried creating /var/lib/cassandra/data and setting it the permissions to 666 and setting the user/group to cassandra/cassandra, and now I get this error:
      java.lang.AssertionError: Directory /var/lib/cassandra/data is not accessible.

      So what could possibly be the problem here?

        Activity

        Hide
        Brandon Williams added a comment -

        Cassandra itself will create this directory if it doesn't exist. You likely have a problem in a directory higher up in the hierarchy making it inaccessible.

        Show
        Brandon Williams added a comment - Cassandra itself will create this directory if it doesn't exist. You likely have a problem in a directory higher up in the hierarchy making it inaccessible.
        Hide
        Jacob Fenwick added a comment -

        I found a fix that works.
        If you change the ownership of the directory /var/lib/cassandra to cassandra:

        sudo chown -R cassandra:cassandra /var/lib/cassandra

        Then Cassandra will be able to create the directories.

        When installed from the Debian package, by default, /var/lib/cassandra has these permissions:
        drwxr-xr-x 5 root root

        So either the directory has to be set so users besides the owner can read and execute in the directory, or the user that cassandra uses needs to own the directory.

        /var/log/cassandra also has this issue as the output.log complains that system.log can't be created.
        That issue can be fixed by running:

        sudo chown -R cassandra:cassandra /var/log/cassandra

        Seems like it should be an easy fix in the Debian package. If you think this is the right fix and is worth fixing I can probably look at it.

        Show
        Jacob Fenwick added a comment - I found a fix that works. If you change the ownership of the directory /var/lib/cassandra to cassandra: sudo chown -R cassandra:cassandra /var/lib/cassandra Then Cassandra will be able to create the directories. When installed from the Debian package, by default, /var/lib/cassandra has these permissions: drwxr-xr-x 5 root root So either the directory has to be set so users besides the owner can read and execute in the directory, or the user that cassandra uses needs to own the directory. /var/log/cassandra also has this issue as the output.log complains that system.log can't be created. That issue can be fixed by running: sudo chown -R cassandra:cassandra /var/log/cassandra Seems like it should be an easy fix in the Debian package. If you think this is the right fix and is worth fixing I can probably look at it.
        Hide
        Brandon Williams added a comment -

        I don't think papering over a problem a user has caused is a good idea, since they are possibly doing something they don't intend to.

        Show
        Brandon Williams added a comment - I don't think papering over a problem a user has caused is a good idea, since they are possibly doing something they don't intend to.
        Hide
        Jacob Fenwick added a comment -

        If you take the position that the users are required to set up data_file_directories, commitlog_directory, and saved_caches_directory manually, then yes it is a user caused problem as they didn't follow the documentation.

        However, my observation is that a lot of packages make their default install have a basic working state that does not require additional system configuration.

        If you look at a Debian package like MySQL, which also stores its data files in /var/lib by default, they use these sorts of permissions:
        drwxr-s--- 2 mysql adm

        I don't think it's unreasonable to set up permissions like that for the user automatically, but maybe there's something subtle about cassandra that I'm missing.

        Show
        Jacob Fenwick added a comment - If you take the position that the users are required to set up data_file_directories, commitlog_directory, and saved_caches_directory manually, then yes it is a user caused problem as they didn't follow the documentation. However, my observation is that a lot of packages make their default install have a basic working state that does not require additional system configuration. If you look at a Debian package like MySQL, which also stores its data files in /var/lib by default, they use these sorts of permissions: drwxr-s--- 2 mysql adm I don't think it's unreasonable to set up permissions like that for the user automatically, but maybe there's something subtle about cassandra that I'm missing.
        Hide
        Brandon Williams added a comment -

        My point is that the 'cassandra' user's home directory is /var/lib/cassandra, so it should already own it when the package creates this user. If you ahead of time create this directory with the wrong permissions, that is your mistake to correct, not the package's to solve with brute force.

        Show
        Brandon Williams added a comment - My point is that the 'cassandra' user's home directory is /var/lib/cassandra, so it should already own it when the package creates this user. If you ahead of time create this directory with the wrong permissions, that is your mistake to correct, not the package's to solve with brute force.
        Hide
        Jacob Fenwick added a comment - - edited

        Ok, admittedly, I think I may have already created those directories the first time I ran the package.
        I tried installing the package on a different computer and it worked, setting the directories to the correct permissions.
        However... I removed the package using apt-get remove, checked to see that /var/lib/cassandra was gone (which it was), removed /var/lib/cassandra (because it was still there), then reinstalled the package.
        This time the directories had root as the owner.
        How could the behavior change like that between two installs of the package?

        Show
        Jacob Fenwick added a comment - - edited Ok, admittedly, I think I may have already created those directories the first time I ran the package. I tried installing the package on a different computer and it worked, setting the directories to the correct permissions. However... I removed the package using apt-get remove, checked to see that /var/lib/cassandra was gone (which it was), removed /var/lib/cassandra (because it was still there), then reinstalled the package. This time the directories had root as the owner. How could the behavior change like that between two installs of the package?
        Hide
        Arthur Zubarev added a comment -

        I also opted to un-install and re-install using packages from Cassandra 1.2.4 to now 1.2.5 due to previous inability to connect and getting an error on 'sudo service cassandra start':
        xss = -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms1841M -Xmx1841M -Xmn400M -XX:+HeapDumpOnOutOfMemoryError -Xss180k

        So I followed instructions from a post http://bit.ly/12QZyUH to allow more memory used, but it turned out to be red herring.
        I had the config files missing (no logging occurred), so I copied them from a non packaged distribution, then the aforementioned directories needed the security changes because I saw them Cassandra deamon not being able to access:

        sudo chown -R cassandra:cassandra /var/lib/cassandra and
        sudo chown -R cassandra:cassandra /var/log/cassandra helped to start Cassandra.

        I think my original issue was me upgrading Cassandra or even upgrading my Ubuntu 13.04 desktop.

        Show
        Arthur Zubarev added a comment - I also opted to un-install and re-install using packages from Cassandra 1.2.4 to now 1.2.5 due to previous inability to connect and getting an error on 'sudo service cassandra start': xss = -ea -javaagent:/usr/share/cassandra/lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms1841M -Xmx1841M -Xmn400M -XX:+HeapDumpOnOutOfMemoryError -Xss180k So I followed instructions from a post http://bit.ly/12QZyUH to allow more memory used, but it turned out to be red herring. I had the config files missing (no logging occurred), so I copied them from a non packaged distribution, then the aforementioned directories needed the security changes because I saw them Cassandra deamon not being able to access: sudo chown -R cassandra:cassandra /var/lib/cassandra and sudo chown -R cassandra:cassandra /var/log/cassandra helped to start Cassandra. I think my original issue was me upgrading Cassandra or even upgrading my Ubuntu 13.04 desktop.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jacob Fenwick
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development