QIDITECH / QIDI_Q1_Pro

GNU Affero General Public License v3.0
26 stars 3 forks source link

KIAUH Installation error #19

Open leadustin opened 2 months ago

leadustin commented 2 months ago

Has Qidi modified anything on KIAUH? As soon as you switch to the installation screen, this error appears. A semicolon is inserted at the end of the kiauh.ini and keeps coming back. Screenshot 2024-04-30 231126

File creation date: Tue 30 Apr 2024 09:33:48 PM CEST

=================================================

KIAUH - Klipper Installation And Update Helper

https://github.com/dw-0/kiauh

DO NOT edit this file!

=================================================

KIAUH v4.0.0

application_updates_available= backup_before_update=false logupload_accepted=false custom_klipper_repo= custom_klipper_repo_branch= mainsail_install_unstable=false fluidd_install_unstable=false multi_instance_names= fluidd_port=10088;

CChen616 commented 2 months ago

It seems .kiauh.ini is using CRLF file format instead of LF format which is suitable for Linux system. Try running:

# cd to where the file is 
dos2unix .kiauh.ini

We didn’t make any modifications to Kiauh, and it does seem odd that there’s a semicolon at the end, so you can just remove it.

queeph commented 2 months ago

Changing to the other format did not help.

CChen616 commented 2 months ago

Changing to the other format did not help.

Yes, I‘ve confirmed that simply removing the semicolon at the end allows it to run correctly. Normally, the generated ini file should not include this semicolon.

queeph commented 2 months ago

No, not at all. As soon as the semicolon is removed and kiauh is started, the kiau.ini is adjusted again and the semicolon is included again. That's why leadustin had already asked if you had changed anything in kiauh.

CChen616 commented 2 months ago

I've pinpointed the source of the issue.

In Kiauh's script, there is a function used to initialize the kiauh.ini file each time it starts:

function fetch_webui_ports() {
  local port interfaces=("mainsail" "fluidd" "octoprint")

  ### read ports from possible installed interfaces and write them to ~/.kiauh.ini
  for interface in "${interfaces[@]}"; do
    if [[ -f "/etc/nginx/sites-available/${interface}" ]]; then
      port=$(grep -E "listen" "/etc/nginx/sites-available/${interface}" | head -1 | sed 's/^\s*//' | sed 's/;$//' | cut -d" " -f2)
      if ! grep -Eq "${interface}_port" "${INI_FILE}"; then
        sed -i '$a'"${interface}_port=${port}" "${INI_FILE}"
      else
        sed -i "/^${interface}_port/d" "${INI_FILE}"
        sed -i '$a'"${interface}_port=${port}" "${INI_FILE}"
      fi
    else
        sed -i "/^${interface}_port/d" "${INI_FILE}"
    fi
  done
}

This function reads the /etc/nginx/sites-available/fluidd configuration file to get the port currently being listened to. The file is currently in CRLF format, which causes the sed 's/;$//' command meant to remove the trailing semicolon to fail due to the unexpected presence of \r, leading to the deletion not being executed correctly. While the CRLF format does not affect Nginx's functionality, it does cause issues with the script's execution.

Setting the /etc/nginx/sites-available/fluidd file to LF format resolves the issue. We will fix this problem in the next release.

IAmSHOCK commented 1 month ago

@leadustin Have you managed to use the newest klipper version in the Q1 Pro?

leadustin commented 1 month ago

@leadustin Have you managed to use the newest klipper version in the Q1 Pro?

No, I haven't, as I don't currently own the printer

dewi-ny-je commented 1 month ago

We will fix this problem in the next release.

But, to be clear, we are not supposed to use KIAUH to update anything, to avoid bricking the printer, correct?

leadustin commented 1 month ago

But, to be clear, we are not supposed to use KIAUH to update anything, to avoid bricking the printer, correct?

If you solve the problem with KIAUH, you should update Moonraker so that an update from Fluidd or Mainsail works. Instructions are available in the official Github of Qidi