cschwan/sage-on-gentoo — Issue #127: issues with init script at first start
Author: few
Created: 2012-03-09 17:56:40+00:00
State: open

I just had to setup a new sage server. It worked reasonably well, but there are some problems.

a) It should check if the directories exist before cd'ing into them.
b) The given command doesn't create the directory it searches for. The reason is that the directory parameter in the command is empty. This is caused by "directory=$(eval cd ${directory} && pwd)" in the init script, which tries to cd into a non-existent directory.

# grep -v '#' /etc/conf.d/sage-notebook
interface=""
secure="True"
require_login="True"
timeout="3600"

# /etc/init.d/sage-notebook start
* Caching service dependencies ...
/etc/init.d/sage-notebook: line 20: cd: /var/lib/sage/.sage/sage_notebook.sagenb: No such file or directory [ ok ]
/etc/init.d/sage-notebook: line 20: cd: /var/lib/sage/.sage/sage_notebook.sagenb: No such file or directory
* Did not find user database - configure Sage's Notebook first: [ !! ]

* - Configure the sage-notebook's configuration file in:
*
* /etc/conf.d/sage-notebook.conf
*
* - Switch to the superuser and run the Notebook with the options
* you specified in the configuration file. Based on your current
* settings this would be:
*
* su sage -c "sage -notebook accounts=False directory= interface= open_viewer=False port=8000 require_login=True secure=True timeout=3600 ulimit=None"
*
* Follow Sage's instructions and exit it after twistd is started
* by pressing Ctrl+C.
* - A multiuser server will require additional setup. Visit the
* following URL for details:
*
* http://sagemath.org/doc/reference/sagenb/notebook/notebook_object.html

* ERROR: sage-notebook failed to start
tina conf.d # su sage -c "sage -notebook accounts=False directory= interface= open_viewer=False port=8000 require_login=True secure=True timeout=3600 ulimit=None"
----------------------------------------------------------------------
| Sage Version 4.8, Release Date: 2012-01-20 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------

Please wait while the Sage Notebook server starts...
Setting permissions of DOT_SAGE directory so only you can read and write it.
...
notebook(accounts=False,directory=r'''''',interface=r'''''',open_viewer=False,port=8000,require_login=True,secure=True,timeout=3600,ulimit=r'''None''')
Traceback (most recent call last):
File "/usr/bin/sage-notebook-real", line 34, in
exec cmd
File "", line 1, in
File "/usr/lib/python2.7/site-packages/sagenb/notebook/notebook_object.py", line 217, in __call__
return self.notebook(*args, **kwds)
File "/usr/lib/python2.7/site-packages/sagenb/notebook/run_notebook.py", line 195, in notebook_twisted
nb = notebook.load_notebook(directory)
File "/usr/lib/python2.7/site-packages/sagenb/notebook/notebook.py", line 1800, in load_notebook
nb = Notebook(dir)
File "/usr/lib/python2.7/site-packages/sagenb/notebook/notebook.py", line 83, in __init__
S = FilesystemDatastore(dir)
File "/usr/lib/python2.7/site-packages/sagenb/storage/filesystem_storage.py", line 73, in __init__
self._makepath(os.path.join(self._path, 'home'))
File "/usr/lib/python2.7/site-packages/sagenb/storage/filesystem_storage.py", line 86, in _makepath
if not os.path.exists(p): os.makedirs(p)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/etc/conf.d/.sagenb'
tina conf.d # cd /var/lib/sage
# Running the given command again seems to work, but...
# /etc/init.d/sage-notebook start
/etc/init.d/sage-notebook: line 20: cd: /var/lib/sage/.sage/sage_notebook.sagenb: No such file or directory