openwrt / packages

Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md
GNU General Public License v2.0
3.95k stars 3.46k forks source link

uswgi: uwsgi-cgi-luci-support broken with latest LuCI #10134

Closed jow- closed 4 years ago

jow- commented 4 years ago

Maintainer: @Ansuel Environment: -

Description: The uwsgi-cgi-luci-support package is unable to execute CGI helpers in /www/cgi-bin/, breaking firmware upload and backup download on LuCI master.

Please refer to https://github.com/openwrt/luci/issues/3140 for a reproducer.

nateevans commented 4 years ago

I did opkg install uwsgi-cgi-luci-support --force-reinstall but it didn't regenerate luci_uwsgi.conf. Is it supposed to?

Also tried

opkg remove uwsgi-cgi-luci-support --force-depends
opkg install uwsgi-cgi-luci-support

FWIW - This is on Ubiquiti ER-X. I started from http://downloads.openwrt.org/releases/19.07.0/targets/ramips/mt7621/openwrt-19.07.0-ramips-mt7621-ubnt-erx-squashfs-sysupgrade.bin

Ansuel commented 4 years ago

you need to reset nginx luci package not uwsgi....

nateevans commented 4 years ago

ah ok. Reinstalled nginx-mod-luci-ssl. Still getting 405 after restarting nginx and uwsgi.

luci_uwsgi.conf is same as above but first location is back to /cgi-bin/luci

Ansuel commented 4 years ago

mhhh... let me check something...

Ansuel commented 4 years ago

ok bad... The fixed config is not part of the 19.07 release...

For a quick fix use this file https://github.com/openwrt/packages/blob/master/net/nginx/files-luci-support/luci_uwsgi.conf

Will make a backport request

nateevans commented 4 years ago

Where does uwsgi_params need come from? 2020/01/31 22:01:19 [emerg] 1956#0: open() "/etc/nginx/uwsgi_params" failed (2: No such file or directory) in /etc/nginx/luci_uwsgi.conf:3

Ansuel commented 4 years ago

create one and put this

uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
nateevans commented 4 years ago

Sorry, a bit out of my depth here... now getting this when trying to get to the Luci GUI in general:

==> /var/log/nginx/error.log <==
2020/01/31 22:07:29 [crit] 1174#0: *8 connect() to unix:////var/run/luci-webui.socket failed (2: No such file or directory) while connecting to upstream, client: 192.168.1.144, server: localhost, 
request: "GET /cgi-bin/luci/ HTTP/1.1", upstream: "uwsgi://unix:////var/run/luci-webui.socket:", host: "192.168.1.1", referrer: "https://192.168.1.1/"
Ansuel commented 4 years ago

@nateevans sorry also uwsgi is broken. Is a problem if you wait 1 day so that the updated package can be merged ?

nateevans commented 4 years ago

no problem, thanks for the help

Ansuel commented 4 years ago

@nateevans commits got merged... can you try update the package with --force-maintainer --force-reinstall ?

nateevans commented 4 years ago

@Ansuel getting some conflicts, can I safely remove the conflicting packages?

root@OpenWrt:/etc/nginx# opkg upgrade nginx-mod-luci-ssl --force-maintainer --force-reinstall
Upgrading nginx-mod-luci-ssl on root from 1.16.1-1 to 1.17.7-2...
Downloading http://downloads.openwrt.org/releases/19.07.0/packages/mipsel_24kc/packages/nginx-mod-luci-ssl_1.17.7-2_mipsel_24kc.ipk
Installing uwsgi (2.0.18-1) to root...
Downloading http://downloads.openwrt.org/releases/19.07.0/packages/mipsel_24kc/packages/uwsgi_2.0.18-1_mipsel_24kc.ipk
Collected errors:
 * check_data_file_clashes: Package uwsgi wants to install file /etc/init.d/uwsgi
    But that file is already provided by package  * uwsgi-cgi-luci-support
 * check_data_file_clashes: Package uwsgi wants to install file /usr/sbin/uwsgi
    But that file is already provided by package  * uwsgi-cgi
Ansuel commented 4 years ago

remove uwsgi-cgi

nateevans commented 4 years ago

Excellent! That does it. 🎉

Ended up doing:

opkg remove uwsgi-cgi --force-removal-of-dependent-packages

then:

opkg install nginx-mod-luci-ssl --force-maintainer --force-reinstall

Luci GUI working properly now, Backup > Generate Archive works

Thank you for your help

Ansuel commented 4 years ago

thank you for alert me that it was broken in 19.x

peter-stadler commented 4 years ago

Should we make the upgrade more smoother by re-adding the old package as dummy installing the new ones? (I made a draft PR for this) PS: opkg remove --force-depends uwsgi-cgi uwsgi-cgi-luci-support && opkg install uwsgi-luci-support should work anytime (with and without that PR)

Ansuel commented 4 years ago

@peter-stadler i don't know... I think readd the uwsgi-cgi package would give more confusion since we will have uwsgi AND uwsgi-cgi.

This is really a specific case. New user won't have problem and users that have this problem can quickly use google and find this exact issue and how to solve this. Also also if you update to 19.x from 18.x you would never experience this issue since the package will be reset on flash of the new firmware.

peter-stadler commented 4 years ago

I see, that sounds good (closing the PR) :-)