Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Install from script doesn't work. Problem with password and file permissions #625

Closed
2 tasks done
icemanch opened this issue Aug 26, 2022 · 10 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@icemanch
Copy link

icemanch commented Aug 26, 2022

When Submitting please remove every thing above this line

πŸ› Bug Report

  • πŸ“ I've Included a ZIP file containing my librephotos log files
  • [ X] ❌ I have looked for similar issues (including closed ones)
  • 🎬 (If applicable) I've provided pictures or links to videos that clearly demonstrate the issue

πŸ“ Description of issue:

Started with a completely fresh and fully updated Debian install. I followed the instructions for the local Install. Once install is done the web page is accessible but I can't get past the login screen.

Here is what I have done to try and fix it. I've narrowed down two issues.

  1. Only the front end service is running. The backend service is down because the worker service is down. The worker service is down because it can't run librephotos-worker. Looking at the file and the permissions are wrong. CHMOD ugo+x fixes the problem and all of the services can be started and run

I still can't get past the login screen. Mostly because I don't know the username and password. Trying to run librephotos-cli reveals problem number 2.

  1. librephotos-cli crashes and has Django complaining about not having the environment variable "secretkey". I have no clue where that is supposed to be set. The instructions also do not explain where/when/how to set

πŸ” How can we reproduce it:

Fresh install of Debian and than follow the instructions for local Install. I've done it three times with the same results. I may have missed something in the instructions but I have followed them fairly closely.

Please provide additional information:

  • πŸ’» Operating system: Debian
  • βš™ Architecture (x86 or ARM): x86
  • πŸ”’ Librephotos version: latest? I used the install script based on the instructions for ocal install.
  • πŸ“Έ Librephotos installation method (Docker, Kubernetes, .deb, etc.): Local
    • πŸ‹ If Docker or Kubernets, provide docker-compose image tag:
  • πŸ“ How is you picture library mounted (Local file system (Type), NFS, SMB, etc.): NFS
  • ☁ If you are virtualizing librephotos, Virtualization platform (Proxmox, Xen, HyperV, etc.): Proxmox
@icemanch icemanch added the bug Something isn't working label Aug 26, 2022
@icemanch
Copy link
Author

icemanch commented Sep 6, 2022

Found a few of the issues.

  1. need to add "SECERET_KEY=" in the librephotos-backend.env
  2. need to create a user for postgres with privileges for the librephots database. This is not in the instructions but, I guess it's obvious? Will need to add the user information to the librephotos-backend.env

Still not up and running as it's giving an error for invalid e-mail address but, it's a step closer.

@icemanch
Copy link
Author

icemanch commented Sep 6, 2022

Workaround is to use the CLI.

sudo librephotos-cli createadmin USERNAME USER-EMAIL
sudo librephotos-cli changepassword USERNAME

@EnfantDup
Copy link

I got the exact same issue. Still not managed to get it working on a fresh ubuntu 20.04.

@derneuere
Copy link
Member

On the first startup, you should see a "First Time Setup" page where you can create your admin user. The backend probably crashed, because your system hasn't the right requirements. It works fine in the singleton docker image.

The second issue is already fixed.

@mkdugi
Copy link

mkdugi commented Oct 1, 2022

Hi,
I've just made fresh install in fresh system.
I have 2 problems:

  1. librephotos-backend.env contains DB_USER=docker, but there is no such user in PGSQL. There is "librephotos"
    I had to change DB_USER in librephotos-backend.env and set password for this user.
  2. "librephotos" DB is empty..... so, there is no "First Time Setup", just login page, but nothing works....

@mkdugi
Copy link

mkdugi commented Oct 3, 2022

Hi.
Problems I'v found in librephotos local installation proces and workaround.

  1. In the /etc/librephotos/librephotos-backend.env file is wrong DB user and password,
    1a. there is: DB_USER=docker, but instalation script creates "librephotos" user
    1b. there is: DB_PASS=AaAa1234, but there should be something elese.
    Instalation script creates random password during instalation. You can find it in terminal. Search for DB_PASS.
    I have (hidden password ;-) line:
  • sed -i 's|DB_PASS=password|DB_PASS=XxXxXxXxXxXx|g' /etc/librephotos/librephotos-backend.env
    And posgresql DB grants acces with user librephotos and XxXxXxXxXxXx password.
  1. I'v found part creating database in install-librephotos.sh, but I didn't foind part where this database is filled by structure.
  2. /usr/lib/librephotos/bin/librephotos-worker have wrong permissions

Workaround:

  1. Install LibrePhotos somewhere else in other way (eg. Docker version).
  2. After install make a database dump
  3. Edit this SQL backup file: change all "docker" to "librephotos" with your favorire file editor (vi? :-)
    I have such SQL file. I can put it here, if @derneuere will allow me to.
  4. install LibrePhotos Local
  5. find DB password in terminal history
  6. upload corrected SQL file to DB with user: librephotos, password XxXxXxXxXxXx, db: librephotos, host: localhost
    psql -h localhost -U librephotos librephotos <librephotos-corrected.sql
  7. correct DB_USER and DB_PASS in /etc/librephotos/librephotos-backend.env
  8. Correct /usr/lib/librephotos/bin/librephotos-worker file permissions.
    chmod 755 /usr/lib/librephotos/bin/librephotos-worker
    or librephotos-worker.service won't start.
  9. restart librephotos services, or whole machine.
  10. check if all librephotos services works
  11. try to log in, you should get first login page.

Good luck! :-)

@techie2000
Copy link

Workaround is to use the CLI.

sudo librephotos-cli createadmin USERNAME USER-EMAIL

running this (minus the sudo) inside the container generates the blow error

Traceback (most recent call last):
  File "/usr/lib/librephotos/backend/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/librephotos/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/lib/librephotos/.local/lib/python3.10/site-packages/django/core/management/__init__.py", line 345, in execute
    settings.INSTALLED_APPS
  File "/usr/lib/librephotos/.local/lib/python3.10/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/usr/lib/librephotos/.local/lib/python3.10/site-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/librephotos/.local/lib/python3.10/site-packages/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/librephotos/backend/ownphotos/settings.py", line 26, in <module>
    raise NameError("Environment variable not set :" + envvar)
NameError: Environment variable not set :SECRET_KEY

@cahaya42
Copy link

cahaya42 commented Feb 9, 2023

To resolve:
NameError: Environment variable not set :SECRET_KEY
I edited /etc/librephotos/librephotos-backend.env
to add the line:
SECRET_KEY=/var/log/librephotos/secret.key

@sickelap
Copy link
Contributor

With this, you are essentially setting the secret key value to /var/log/librephotos/secret.key, not the contents of the given file. Not saying that's wrong or bad, just keep that in mind.

@eerison
Copy link

eerison commented Oct 1, 2023

SECRET_KEY=/var/log/librephotos/secret.key

it does not work in my side :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants