Cannot start as non root user

Hi, everyone, I met a problem about the user account. I installed cryosparc with root account and then I used “chown” command to change the owner of the whole folder to user1 belonging to the root group. Everything was fine as the root user but when I started cryosparc with user1 account, there was error just like this:

Starting cryoSPARC…
mongod: ERROR (spawn error)
Traceback (most recent call last):
File “”, line 1, in
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/pymongo/mongo_client.py”, line 1088, in database_names
“listDatabases”)[“databases”]]
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/pymongo/database.py”, line 478, in command
with client._socket_for_reads(read_preference) as (sock_info, slave_ok):
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/contextlib.py”, line 17, in enter
return self.gen.next()
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/pymongo/mongo_client.py”, line 798, in _socket_for_reads
with self._get_socket(read_preference) as sock_info:
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/contextlib.py”, line 17, in enter
return self.gen.next()
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/pymongo/mongo_client.py”, line 762, in _get_socket
server = self._get_topology().select_server(selector)
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/pymongo/topology.py”, line 210, in select_server
address))
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/pymongo/topology.py”, line 186, in select_servers
self._error_message(selector))
pymongo.errors.ServerSelectionTimeoutError: localhost:38001: [Errno 111] Connection refused

What is wrong with the user1 account? What is kind of user is better? Can anybody help me? Thanks a lot in advance.

Hi,

I’m not sure exactly what’s going wrong but one possibility is that when you installed as root, the installer would have configured cryoSPARC using the root user’s environment (location of dependencies etc) and perhaps there is some difference for user1. The error reported is that the database is unable to start.

CryoSPARC was designed to be installed as a non-root user (the installer does not require root access) so it would be best if you can just remove the current installation folder, and then install again as user1.

Hope that helps,
Ali

Hi, apunjani,
Thanks for your reply. This morning, I removed the program folder and installed cryosparc as user1(belonging to root group) just as you instructed. Then when I met the question below:

You are the root user. Are you sure you want to install as root?
This is not recommended.

  1. Yes
  2. No
    #?

I answered 2)No first and the installation process exited.
I repeated the installation and answered 1)Yes to the above question.

When the whole installation process completed,I tried to start cryosparc as user1 and received the error messages:

Starting cryoSPARC…
/opt/bioSoft/cryosparc-0.3/bin/cryosparc: line 426: run/register.log: Permission denied
Traceback (most recent call last):
File “/opt/cryosparc-0.3/anaconda2/bin/supervisord”, line 11, in
sys.exit(main())
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/supervisord.py”, line 365, in main
go(options)
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/supervisord.py”, line 375, in go
d.main()
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/supervisord.py”, line 78, in main
info_messages)
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/options.py”, line 1398, in make_logger
stdout = self.nodaemon,
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/loggers.py”, line 346, in getLogger
handlers.append(RotatingFileHandler(filename,‘a’,maxbytes,backups))
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/loggers.py”, line 172, in init
FileHandler.init(self, filename, mode)
File “/opt/cryosparc-0.3/anaconda2/lib/python2.7/site-packages/supervisor/loggers.py”, line 98, in init
self.stream = open(filename, mode)
IOError: [Errno 13] Permission denied: ‘/opt/cryosparc-0.3/run/supervisord.log’

As root user, it was fine.

I also tried a normal user account which does not belong to root group, the same things happened.
It seems that I can only install as root user and run as root user. What is wrong with my installation process?
Thanks again.

Hmmm… this is mysterious.
Maybe the /opt directory where you are installing doesn’t have write access from user1? (but then how were you able to install/download at all…)
Can you check the permissions of /opt, /opt/cryosparc-0.3/, /opt/cryosparc-0.3/run ?

We use supervisord to keep the cryosparc processes running in the background once cryoSPARC is started, and the log files are kept in the cryosparc/run folder.

Hi apunjani,

Thank you so much for your quick reply. This time, I added the write permission for the users in root group for /opt and erased all the old folders about cryosparc and installed again use user1.
I didn’t meet the question anymore: You are the root user. Are you sure you want to install as root?

Although I met such error:
(node-pre-gyp ERR! Tried to download: https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@6.10.1 (node-v48 ABI) (falling back to source compile with node-gyp) ), the whole installation completed and the program started successfully as user1.
I tried some data and it ran smoothly. I hope the error didn’t matter.

Thanks again for your help.

Great!
No this error is actually just a warning saying that NPM will be compiling a couple of packages from source because the precompiled binaries are not available. This is normal.

Hi apunjani and other specialists,

I also encountered similar problem as soyvia(see blow), although I run as a non root user and set the directory /opt writable. Thoughtout the installation, I didn’t encounter any problem. Am I still missing something? Thank you in advance.

Regards,
Jianhao

$ cryosparc start
Starting cryoSPARC..
mongod: ERROR (spawn error)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/site-packages/pymongo/mongo_client.py", line 1088, in database_names
    "listDatabases")["databases"]]
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/site-packages/pymongo/database.py", line 478, in command
    with client._socket_for_reads(read_preference) as (sock_info, slave_ok):
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/site-packages/pymongo/mongo_client.py", line 798, in _socket_for_reads
    with self._get_socket(read_preference) as sock_info:
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/site-packages/pymongo/mongo_client.py", line 762, in _get_socket
    server = self._get_topology().select_server(selector)
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/site-packages/pymongo/topology.py", line 210, in select_server
    address))
  File "/home/jianhaoc/s/cs/anaconda2/lib/python2.7/site-packages/pymongo/topology.py", line 186, in select_servers
    self._error_message(selector))
pymongo.errors.ServerSelectionTimeoutError: localhost:38001: [Errno 111] Connection refused
1 Like