Support Questions

Find answers, ask questions, and share your expertise

IOError: [Errno 2] No such file or directory: '/etc/ambari-server/conf/log4j.properties'

avatar
Explorer

I typed the following commands in the terminal of sandbox-hdp terminal :

1. ambari-server status
2. ambari-server setup
3. ambari-server restart

However, after hitting enter on typing the above commands, I keep getting the same type of error :

Traceback (most recent call last):                                                                                                                   
  File "/usr/sbin/ambari-server.py", line 36, in <module>                                                                                            
    from ambari_server.dbConfiguration import DATABASE_NAMES, LINUX_DBMS_KEYS_LIST                                                                   
  File "/usr/lib/python2.6/site-packages/ambari_server/dbConfiguration.py", line 28, in <module>                                                     
    from ambari_server.serverConfiguration import decrypt_password_for_alias, get_ambari_properties, get_is_secure, \                                
  File "/usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py", line 593, in <module>                                                
    configDefaults = ServerConfigDefaults()                                                                                                          
  File "/usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py", line 503, in __init__                                                
    super(ServerConfigDefaultsLinux, self).__init__()                                                                                                
  File "/usr/lib/python2.6/site-packages/ambari_server/serverConfiguration.py", line 363, in __init__                                                
    self.OUT_DIR = parse_log4j_file(get_conf_dir() + "/log4j.properties")['ambari.log.dir'].replace("//", "/")                                       
  File "/usr/lib/python2.6/site-packages/ambari_commons/os_utils.py", line 194, in parse_log4j_file                                                  
    with open(filename, "rb") as fp:                                                                                                                 
IOError: [Errno 2] No such file or directory: '/etc/ambari-server/conf/log4j.properties'               

I'm unable to figure it out. Can someone please help me to sort out the IOError ?

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Amogh Suman

IOError:[Errno2]No such file or directory:'/etc/ambari-server/conf/log4j.properties'

The error indicates that somehow the file "/etc/ambari-server/conf/log4j.properties" is missing in the mentioned location.

So can you please try checking if this file exist in that location or mistakenly someone deleted it.

If the file is missing then try to get that file from ambari git repo and then place it in the same location before starting ambari server.

https://raw.githubusercontent.com/apache/ambari/trunk/ambari-server/conf/unix/log4j.properties

.

It may also be a permission related issue. So please check if the user who is starting the ambari server process has access to read that log4j.properties file or not?

# ls -l /etc/ambari-server/conf/log4j.properties
-rwxr-xr-x. 1 root root 5443 Oct  9 15:37 /etc/ambari-server/conf/log4j.properties

.

View solution in original post

4 REPLIES 4

avatar
Master Mentor

@Amogh Suman

IOError:[Errno2]No such file or directory:'/etc/ambari-server/conf/log4j.properties'

The error indicates that somehow the file "/etc/ambari-server/conf/log4j.properties" is missing in the mentioned location.

So can you please try checking if this file exist in that location or mistakenly someone deleted it.

If the file is missing then try to get that file from ambari git repo and then place it in the same location before starting ambari server.

https://raw.githubusercontent.com/apache/ambari/trunk/ambari-server/conf/unix/log4j.properties

.

It may also be a permission related issue. So please check if the user who is starting the ambari server process has access to read that log4j.properties file or not?

# ls -l /etc/ambari-server/conf/log4j.properties
-rwxr-xr-x. 1 root root 5443 Oct  9 15:37 /etc/ambari-server/conf/log4j.properties

.

avatar
Explorer

there is no diectory or file named as etc. What to do ?

avatar
Master Mentor

@Amogh Suman

Do you mean to say there is no "/etc" directory?

# ls -l /etc
# ls -l /etc/ambari-server/conf/

.

If the "/etc" directory is missing then it indicates Sandbox VM corruption. Please use a new Sandbox Image.

And if the "/etc/ambari-server/conf/" is missing then it indicates Ambari installation corruption. So in that case either reinstall ambari server Or better to use a new Sandbox Image.

avatar
Explorer

Sorry, I was wrong. I sorted it out. in the /etc/ambari-server/conf/ the log4j.properties file was missing. So I put up this file into that folder through the link that you had posted. Thanks a ton 🙂 🙂