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

Password Required during manual install of Mainsail. #1891

Open
ankonaskiff17 opened this issue May 20, 2024 · 1 comment
Open

Password Required during manual install of Mainsail. #1891

ankonaskiff17 opened this issue May 20, 2024 · 1 comment
Labels
⚡ Type: Bug Something isn't working

Comments

@ankonaskiff17
Copy link

Mainsail Version:

2.11.0

Browser:

Other (Please tell us below)

Device:

Other (Please tell us below)

Operating System:

Other (Please tell us below)

What happened?

While working my way through a manual install of Mainsail (NOT MainsailOS) on a RasPi running current version of Pi OS installed via the Pi Imager.
When I got to what I will call the first check, prior to NGINX installation entered the command http://<printer-ip>:7125/server/info everything checked good in that I got the big block of information that was expected.
The next step, Install web server & reverse proxy (NGINX) I worked my way through the process, mostly just copy/pasting the various lines and generating files using Nano.
On the second check by entering http://<printer-ip>/server/info I got a 404 error on the web page. Went back through the whole NGINX process line by line in the event I had a typo or a Nano file didn;t get written. Everything was there and in the correct locations. The very last step sudo systemctl restart nginx I think is the problem because when I executed that restart nginx, I got this.

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to restart 'nginx.service'.
Authenticating as: ,,, (pi)
Password:

Once I entered my password, I got the below

==== AUTHENTICATION COMPLETE ====
I then entered http://<printer-ip>/server/info and got the big block of information that implies things are set up correctly.

What did you expect to happen instead?

I was not expecting a 404 error. Was hoping I got server info.

How to reproduce this bug?

I think if you just follow the process as written for a manual installation it should cause the same problem since there is no mechanism in a copy/paste process to accomodate password entry.

Instead of

mkdir ~/mainsail
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Instead

mkdir ~/mainsail
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/

And instruct user to then do single line because when I did the entire block I did not get any error or request for password

sudo systemctl restart nginx

Additional information:

I have noticed that PiOS is getting really tight with things requiring user Pi's password compared to past practice. It's been several months since I have messed with any Pi's and my memory is thinking that using sudo was good enough. In this instance I needed both sudo and my password.

@ankonaskiff17 ankonaskiff17 added the ⚡ Type: Bug Something isn't working label May 20, 2024
Copy link

dosubot bot commented May 20, 2024

To address the 404 error during the manual installation of Mainsail on your Raspberry Pi, ensure your NGINX configuration is correctly set up and handle the authentication prompt effectively.

NGINX Configuration

  1. Verify Configuration:
    Ensure your NGINX configuration file (/etc/nginx/sites-available/mainsail) is correctly set up. Here is a sample configuration:

    server {
      listen 80;
    
      location / {
        root /usr/share/nginx/html;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;
      }
    
      location /server/ {
        proxy_pass http://localhost:7125/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
      }
    
      include /etc/nginx/extra-conf.d/*.conf;
    }
    
  2. Place Mainsail Files:
    Ensure the Mainsail files are in the directory specified in the root directive (/usr/share/nginx/html).

  3. Enable Configuration:
    Create a symbolic link to enable the configuration:

    sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/

Handling Authentication Prompt

The authentication prompt when restarting NGINX is expected. Run the commands individually to handle the password prompt correctly:

  1. Create Mainsail Directory:

    mkdir ~/mainsail
  2. Remove Default NGINX Site:

    sudo rm /etc/nginx/sites-enabled/default
  3. Enable Mainsail Configuration:

    sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
  4. Restart NGINX:

    sudo systemctl restart nginx

Verify the Setup

After completing these steps, verify the Mainsail backend server is running and accessible at localhost:7125:

curl http://localhost:7125/server/info

If the server info is correctly returned, you should be able to access it via http://<printer-ip>/server/info.

Additional Considerations

  • Permissions: Ensure the user running the NGINX service has the necessary permissions to access the Mainsail files.
  • Firewall: Check if any firewall rules might be blocking access to the server.

Following these steps should resolve the 404 error and handle the authentication prompt effectively. If you encounter further issues, please provide additional details for further assistance.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

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

No branches or pull requests

1 participant