Can not open,/var/log/cassandra/gc.log due to Permission denied

5,360

I was facing the same issue, fixed using following commands:

sudo chown -R $USER:$GROUP /var/lib/cassandra/

sudo chown -R $USER:$GROUP /var/log/cassandra/

Share:
5,360

Related videos on Youtube

MikiBelavista
Author by

MikiBelavista

Updated on September 18, 2022

Comments

  • MikiBelavista
    MikiBelavista over 1 year

    What do /var/log files serve for?When I try to run cassandra on my Ubuntu 16.04

    OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied
    

    Later

    19:47:58,887 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - Active log file name: /var/log/cassandra/system.log
    19:47:58,887 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - File property is set to [/var/log/cassandra/system.log]
    19:47:58,889 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - openFile(/var/log/cassandra/system.log,true) call failed. java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)
        at java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)
    

    Why do I have these problems? This is my java

    java -version
    openjdk version "1.8.0_151"
    OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
    OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
    

    These are the permissions

    /var/log$ ls -la cassandra/
    total 300
    drwxr-xr-x  2 cassandra cassandra   4096 jan.  25 15:50 .
    drwxrwxr-x 14 root      syslog      4096 jan.  25 15:49 ..
    -rw-r--r--  1 cassandra cassandra 184448 jan.  25 19:50 debug.log
    -rw-r--r--  1 cassandra cassandra  59956 jan.  25 19:50 gc.log.0.current
    -rw-r--r--  1 cassandra cassandra  41363 jan.  25 19:50 system.log
    
  • daniel blythe
    daniel blythe almost 4 years
    This helped me solve cassandra nodetool : Failed to connect to '127.0.0.1:7199' issue. After following this answer(stackoverflow.com/a/52456917/830309) and the instruction link in the third paragraph of that answer, I ran the above two chown commands, ran $ cassandra on my local machine which I believe starts Cassandra. Then ran $ nodetool status again and it connected.