Repository navigation
Troubleshooting
Solutions to common issues when running BookStorage.
- SECRET_KEY must be at least 32 bytes
- bsctl: command not found
- Readonly database error
- Port already in use
- Permission denied during PostgreSQL migration
- View detailed logs
Error:
BOOKSTORAGE_SECRET_KEY must be at least 32 bytes when BOOKSTORAGE_ENV=production
Cause: In production mode, the session secret key must be a non-default string of at least 32 characters.
Fix:
- Generate a strong key:
openssl rand -base64 48- Set it in
/opt/bookstorage/.env:
BOOKSTORAGE_SECRET_KEY=your-generated-key-here- Secure the file and restart:
chmod 600 /opt/bookstorage/.env
systemctl restart bookstorageDo not shorten the key or use a simple string. Use a password manager or the openssl command above.
Error:
sudo: bsctl: command not found
Cause: bsctl is installed under /usr/local/bin. Some sudo configurations use a restricted PATH (secure_path in /etc/sudoers) that omits /usr/local/bin.
Fix: Use the full path:
sudo /usr/local/bin/bsctl install
sudo /usr/local/bin/bsctl update mainIf you are already logged in as root, run bsctl without sudo (your shell already has the correct PATH).
Error:
attempt to write a readonly database
Fix:
bsctl fix-perms
bsctl restartThis corrects file ownership and permissions on the SQLite database and related directories.
Error:
listen tcp :5000: bind: address already in use
Fix:
- Find the process using the port:
sudo lsof -i :5000- Either stop the conflicting process or change the BookStorage port in
.env:
BOOKSTORAGE_PORT=5001- Restart:
bsctl restartError: The SQLite to PostgreSQL migration wizard fails with permission denied when trying to write BOOKSTORAGE_POSTGRES_URL to the .env file.
Cause: The process user from bookstorage.service (default: nobody) cannot write to /opt/bookstorage/.env. This happens when .env was created as root:root with mode 600.
Fix:
sudo chown nobody /opt/bookstorage/.env
sudo chmod 600 /opt/bookstorage/.env
sudo systemctl restart bookstorageReplace nobody with whatever user is configured in the User= directive of your systemd unit file. Then re-run Admin > PostgreSQL > Migrate.
New installs from deploy/install.sh set .env ownership to the service user automatically.
To see real-time application logs:
bsctl logsThis runs journalctl -u bookstorage -f under the hood.
For backup logs:
journalctl -u bookstorage-backup.serviceFor Prometheus logs:
journalctl -u bookstorage-prometheusHome — Back to the wiki home page.