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

Folder/Path configuration change #516

Closed
Arksine opened this issue Oct 3, 2022 · 124 comments
Closed

Folder/Path configuration change #516

Arksine opened this issue Oct 3, 2022 · 124 comments
Labels
announcement Information from developers critical High priority

Comments

@Arksine
Copy link
Owner

Arksine commented Oct 3, 2022

UPDATE 10/15/2022:

Some users have experienced errors during the update process. For users of MainsailOS and FluiddPi with a default installation I have pushed a script that should recover Moonraker. Run the following commands via ssh:

cd ~/moonraker
git pull
./scripts/data-path-fix.sh

ORIGINAL

An upcoming addition to Moonraker will change how files and folders are configured and managed in Moonraker. All folders and files managed by Moonraker will be contained within a data path configured in the command line. Options such as config_path and log_path, secrets_path, etc. will be deprecated.

A detailed description of the changes can be found in pull request #491. The current plan is to merge #491 on Friday, October 14th. The changes to the configuration file and system service are automated for most installations, however the user's root password may be necessary if Moonraker does not have sudo access. In this scenario Moonraker will generate a Sudo Password Required announcement:

mainsail_sudo

image

The incomplete update will generate several warnings so the announcement may not be at the very top of the notification panel. The user should click through the link (the title in Mainsail, More Information in Fluidd), which will take you to Moonraker's landing page:

image

Here Moonraker will request the password for the detected user (in the example above it is pi). After submission Moonraker will finish the update and prompt the user to close the tab/window:

image

A Moonraker instance running on a non-debian distro or otherwise customized installation will likely need to perform these changes manually. It is possible to disable the automated changes in the machine configuration:

[machine]
validate_service: False
validate_config: False

Update:

Power users and developers should be aware that debug options will also be removed from the configuration. There are various debug options available through the command line, which can easily be changed by modifying moonraker.env and restarting Moonraker. Details are available in the PR.

@Arksine Arksine added announcement Information from developers critical High priority labels Oct 3, 2022
@Arksine
Copy link
Owner Author

Arksine commented Oct 3, 2022

Small update: I have pushed back the merge date by a week, it is now October 14th.

@chrisbdaemon
Copy link

Can the sudo command be run manually or do we have to do it through moonraker?

@Arksine
Copy link
Owner Author

Arksine commented Oct 4, 2022

@chrisbdaemon It will be possible to use a script to set the password via ssh:

~/moonraker/scripts/finish-upgrade.sh

Alternatively, its possible to temporarily set the sudo password in the [machine] section of moonraker.conf prior to the update. I would recommend using a secrets file if you do this. For example, create a file ~/moonraker.secrets with the following contents:

# moonraker.secrets

[sudo]
# replace "mypass" with  your password
password: mypass

Then in moonraker.conf:

# moonraker.conf
[secrets]
secrets_path: ~/moonraker.secrets

[machine]
sudo_password: {secrets.sudo.password}

Once the options have been set, restart Moonraker than update via the update manager.

After the update is complete you can remove the sudo_password option from the machine section. You will notice that the secrets_path was automatically removed and a symbolic link has been created to that file in ~/printer_data. If you desire you can delete that symbolic link and the original secrets file. Otherwise you can just remove the [sudo] section from the secrets file.

@MarcoBugo
Copy link

whenever I click the mainsail title i reach this git and not the moonracker root request why?

@Arksine
Copy link
Owner Author

Arksine commented Oct 5, 2022

The changes haven't been merged yet, you are clicking through the announcement generated by this issue. The currently plan is to merge on October 14th. At some point after that you will update, which will send the Sudo Password Required notification if necessary.

@Arksine
Copy link
Owner Author

Arksine commented Oct 6, 2022

FWIW, after testing I found an issue when attempting to use the install script to upgrade...it can't bring over the old database, so the process does not complete successfully. To provide an option for users that wish to finish the upgrade via ssh I have added a script, finish-upgrade.sh. This script will first check to make sure that Moonraker is awaiting the sudo password. If that condition is met it will prompt the user for the password and use it to finish the upgrade.

@Arksine Arksine pinned this issue Oct 13, 2022
@Eclypse3D
Copy link

Well this broke my system, it boots up, and now I have no config files, when I try to print I get file not found and the only messages I have in my notifications are the update ones, this was after entering sudo password.

@EricZimmerman
Copy link

Working on this now too. There was 7 notifications, totally gone after a restart, so I can't see what they were

@Eclypse3D
Copy link

I can see what they are they just point me to these pages, but none of these say anything about what to do after the system changes, just cryptic lines of change information. I do not even know how the printer is able to boot into klipper, I cannot view my configs unless I ssh to them, and I do not know what is changed enough to know how to point paths that are missing or changed lol....

@EricZimmerman
Copy link

once i added sudo password, things just worked and no more warnings, etc. seems like it cleaned up a lot of the stuff

i am using mailsail with klipper on an otherwise default install for a voron 2.4.

@Eclypse3D
Copy link

Eclypse3D commented Oct 14, 2022

Yeah I put in the sudo password it closed that screen and never did anything else just left me looking at the welcome to moonraker page. Now nothing. Printer boots up, I can control it via dashboard but cannot do anything with it other than change temps, look at updates that say "uptodate" etc. but cannot print, view logs, etc. I am not sure if I am supposed to move a folder, etc. Was just going to finish printing my Voron tonight, looks like thats a bust. Yeah my rig is a ender 3 s1 pro with mainsail/klipper installed from RPI Imager. I have no clue where to go from here.

@EricZimmerman
Copy link

you can check the systemd config to see where the env file is and update that for your setup. i verified mine and it looked good. things look like they did yesterday for me now, but i added the sudo password thing manually to the config vs the gui popup

@Arksine
Copy link
Owner Author

Arksine commented Oct 14, 2022

Yeah I put in the sudo password it closed that screen

Try to reload the landing page. It sounds like you didn't click the submit button and instead clicked out of the dialog box or cancel. This will close the dialog. When the update completes successfully it will present a popup letting you know.

@Eclypse3D
Copy link

How do I reload that?

@Arksine Arksine closed this as completed Oct 14, 2022
@Arksine Arksine reopened this Oct 14, 2022
@Arksine
Copy link
Owner Author

Arksine commented Oct 14, 2022

You can check your notifications to see if Sudo Password Request is still in there. Otherwise you can go to http://mainsailos.home:7125. Replace mainsailos.home with the correct domain.

@Eclypse3D
Copy link

all I have is the main page it is not asking for any sudo password now, it just shows
moonrakererror

@JDWarner
Copy link

JDWarner commented Oct 14, 2022

I don't have any page at all, Moonraker reports a bad gateway on the web interface and when trying to fix via SSH I get
image

@EricZimmerman
Copy link

mine does not have any warnings, so i guess it fixed itself

image

@JDWarner i got the same. i didnt bother with that. i did do the sudo fix and reboot one.

@Eclypse3D
Copy link

I did not skip adding the sudo password, I hit submit and it brought me to the same page from above, there are some errors on that page stating

Failed to link subfolder 'database' to '/home/pi/.moonraker_database'. Folder 'database' already exists. This conflict requires manual resolution.

GCode path received from Klipper does not match expected path: /home/pi/printer_data/gcodes

@Arksine
Copy link
Owner Author

Arksine commented Oct 14, 2022

@Eclypse3D

Try to ssh in to the Pi and run the following:

rm -rf ~/printer_data
sudo service moonraker restart

@JDWarner
Copy link

JDWarner commented Oct 14, 2022

My Moonraker continues to refuse to connect on [correct_ip_address] port 7125. Bad gateway.

I have fully implemented the secrets pw with .secrets file and added it to moonraker.conf

@Eclypse3D
Copy link

Eclypse3D commented Oct 14, 2022

This is what I got...

sudo service moonraker restart
sh: 0: getcwd() failed: No such file or directory
Job for moonraker.service failed because of unavailable resources or another system error.
See "systemctl status moonraker.service" and "journalctl -xe" for details.

moonraker.service - API Server for Klipper SV1
Loaded: loaded (/etc/systemd/system/moonraker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: resources) since Fri 2022-10-14 18:37:59 EDT; 2s ago

Oct 14 18:37:59 mainsailos02 systemd[1]: Failed to start API Server for Klipper SV1.
journalctl.txt

@JDWarner
Copy link

I think the actual failure is a little above that, here's my log - I think Moonraker is no longer finding its necessary files after the update.
image

@Eclypse3D
Copy link

Now Klipper cannot connect to moonraker at all

@Arksine
Copy link
Owner Author

Arksine commented Oct 14, 2022

@Eclypse3D Ok, we are going to have to do a manual install to fix it. The following assumes:

  • Your config path is ~/klipper_config/moonraker.conf
  • Your log path is `~/klipper_logs/moonraker.log
~/moonraker/scripts/install-moonraker.sh -c ~/klipper_config/moonraker.conf -l ~/klipper_logs/moonraker.log

After this is done moonraker will start. It will create a new database, so we need to restore the old one.

sudo service moonraker stop
cd ~/printer_data
rm -rf database
ln -s ~/.moonraker_database database
sudo service moonraker start

@Arksine
Copy link
Owner Author

Arksine commented Oct 22, 2022

Is there anything in ~/.moonraker_database? It probably shouldn't be there when multiple instances are installed. Just in case, do the following:

mv ~/.moonraker_database ~/.moonraker_database_old
sudo service moonraker-1 restart

@seanol69
Copy link

seanol69 commented Oct 22, 2022

Started up no errors! But config files are read only still and it looks like it is still loading back ups. Do you want me to try printer 2?

image

moonraker-1.log

@Arksine
Copy link
Owner Author

Arksine commented Oct 22, 2022

If you refresh the update manager that should correct itself. Timelapse was loaded previously, it is not there now.

Are you sure config files are read only? There are no errors in the log. Try refreshing those in mainsail as well then attempt to edit one.

If everything is working you can proceed to update instance 2.

~/moonraker/scripts/data-path-fix.sh -a moonraker-2 -d ~/printer_2_data -c ~/klipper_config/printer_2/moonraker.conf -l ~/klipper_logs/moonraker-2.log -m ~/.moonraker_database_2

@seanol69
Copy link

Refreshed everything and both are working! I can't tell you how much I appreciate you spending time on this, I am sure you are very busy and I know this is free.

I attached the logs just in case.

moonraker-1.log
moonraker-2.log

KwadFan added a commit to mainsail-crew/MainsailOS that referenced this issue Oct 22, 2022
Update of moonraker module according to

Arksine/moonraker#516

Signed-off-by: Stephan Wendel <[email protected]>
KwadFan added a commit to mainsail-crew/sonar that referenced this issue Oct 23, 2022
update installer to match new paths according to
Arksine/moonraker#516

Added posibility to set persistant log path at install

replaced apt with apt-get -q for installing dependencies

Signed-off-by: Stephan Wendel <[email protected]>
@CODeRUS
Copy link

CODeRUS commented Oct 27, 2022

@Arksine is it possible to use some sort of substitution inside config file to reference data path? For example {data_path} which will be expanded to /home/user/printer_data

KwadFan added a commit to mainsail-crew/MainsailOS that referenced this issue Oct 30, 2022
Update of moonraker module according to

Arksine/moonraker#516

Signed-off-by: Stephan Wendel <[email protected]>
@dsloyer74
Copy link

dsloyer74 commented Nov 1, 2022

I installed Klipper, Moonraker, Fluidd, KlipperScreen, and Obico for Klipper via KIAUH (Klipper Installation and Update Helper)

I updated OS and all apps to current. After this I received the alert that

"Folder/Path configuration change

UPDATE 10/15/2022:

Oct 3, 2022 5:35 AM
"
The link associated with that alert brought me to this page.

after running
cd ~/moonraker
git pull
./scripts/data-path-fix.sh

I am receiving the error "Klippy not connected". I have not had this error previously and my MCU config is correct.
Fluidd interface was working prior to running the script data-path-fix.sh. I cannot upload klippy.log because when I attempt to download it from Fluidd interface > I get the error "Failed - No File"

@Arksine
Copy link
Owner Author

Arksine commented Nov 1, 2022

@CODeRUS Not currently, however I'm not sure how that would be useful. There shouldn't be any more paths in moonraker.conf's configuration.

@dsloyer74 This announcement applies to legacy (pre-existing) installs. You have a new installation, it its likely that data-path-fix.sh made a change that broke your installation. You should be able to recover by reinstalling with KIAUH.

I'm going to close this announcement to avoid confusion going forward.

@Arksine Arksine closed this as completed Nov 1, 2022
@CODeRUS
Copy link

CODeRUS commented Nov 1, 2022

@Arksine kiauh is placing klipper uds inside printer_data/comms folder, so that would be useful just to have such a placeholder in config

@moccor
Copy link

moccor commented Nov 2, 2022

I just did a fresh install of Klipper and copied configs over, I logged into the notification that popped up, as well as entered the command at the top of this page. But it still doesn't show any configs. Anyone know the fix?

@CODeRUS
Copy link

CODeRUS commented Nov 2, 2022

@moccor
Copy link

moccor commented Nov 3, 2022

@moccor use https://github.com/th33xitus/kiauh

I guess I needed to shutdown and restart the Pi, thanks for the info

@Machine-Dynamics
Copy link

I just did a fresh install of Klipper, Moonraker, and Fluidd using Kiauh on Raspberry Pi OS lite. I'm getting the virtual SD card path error, but when I try to run the repair script I get the following error.
Error: unable to find config: /home/pi/klipper_config/moonraker.conf
Looking at the folder structure in WinSCP, I found moonraker.conf under home/pi/printer_data/config/moonraker.conf. Is there another version of the repair script that can fix this?

@ahmedbadran732000
Copy link

@Machine-Dynamics
Did u Try this

cd ~/moonraker
git pull
./scripts/data-path-fix.sh

@Arksine
Copy link
Owner Author

Arksine commented Nov 12, 2022

The data-path-fix.sh script should not be run on new installations. KIAUH should install things correctly, there is no need to symlink the old folders.

@Machine-Dynamics
Copy link

I'm an idiot. When I set this printer up, I copied over my previous config file that I'd already written. When I got this error, the very first thing I tried was adding the [virtual_sdcard] path suggested by the error to my config file, but I forgot to delete the previous path that already existed further down in the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
announcement Information from developers critical High priority
Projects
None yet
Development

No branches or pull requests