uwsgi-plugin-python3 failed to install

Bug #1616497 reported by Vitalii
62
This bug affects 23 people
Affects Status Importance Assigned to Milestone
uwsgi (Debian)
Fix Released
Unknown
uwsgi (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Won't Fix
Medium
Unassigned

Bug Description

I expected the package uwsgi-plugin-python3 will be installed with apt-get install. But instead it failed with error "/var/lib/dpkg/info/uwsgi-plugin-python3.postinst: 61: [: Illegal number:".

# apt-get install uwsgi-plugin-python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  python3-uwsgidecorators
The following NEW packages will be installed
  uwsgi-plugin-python3
0 to upgrade, 1 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/73.7 kB of archives.
After this operation, 259 kB of additional disk space will be used.
Selecting previously unselected package uwsgi-plugin-python3.
(Reading database ... 101126 files and directories currently installed.)
Preparing to unpack .../uwsgi-plugin-python3_2.0.12-5ubuntu3_amd64.deb ...
Unpacking uwsgi-plugin-python3 (2.0.12-5ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up uwsgi-plugin-python3 (2.0.12-5ubuntu3) ...
/var/lib/dpkg/info/uwsgi-plugin-python3.postinst: 61: [: Illegal number:

# lsb_release -rd
Description: Ubuntu 16.04.1 LTS
Release: 16.04

# apt-cache policy uwsgi-plugin-python3
uwsgi-plugin-python3:
  Installed: 2.0.12-5ubuntu3
  Candidate: 2.0.12-5ubuntu3
  Version table:
 *** 2.0.12-5ubuntu3 500
        500 http://gb.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        100 /var/lib/dpkg/status

Tags: bite-size
Revision history for this message
peter toneby (peter-toneby) wrote :
Download full text (4.3 KiB)

I see this as well. Seems to make the python35 plugin not loadable since I have it in the plugins line in myservice.ini-file, but python2 is used according to the log. The import site issue is related to the fact it tries to use python2.7 in a venv from python3.5. I added it in an earlier (failed) attempt to use uwsgi (but that attempt did have the python34 module working, that was on the last LTS release (whichever version that was))

# apt install --reinstall uwsgi-plugin-python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 16 not upgraded.
Need to get 0 B/73.7 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 46609 files and directories currently installed.)
Preparing to unpack .../uwsgi-plugin-python3_2.0.12-5ubuntu3_amd64.deb ...
Unpacking uwsgi-plugin-python3 (2.0.12-5ubuntu3) over (2.0.12-5ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up uwsgi-plugin-python3 (2.0.12-5ubuntu3) ...
/var/lib/dpkg/info/uwsgi-plugin-python3.postinst: 61: [: Illegal number:

# cat /var/log/uwsgi/app/service.log
Mon Sep 5 22:22:06 2016 - *** Starting uWSGI 2.0.12-debian (64bit) on [Mon Sep 5 22:22:05 2016] ***
Mon Sep 5 22:22:06 2016 - compiled with version: 5.3.1 20160412 on 13 April 2016 08:36:06
Mon Sep 5 22:22:06 2016 - os: Linux-3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016
Mon Sep 5 22:22:06 2016 - nodename: thehost
Mon Sep 5 22:22:06 2016 - machine: x86_64
Mon Sep 5 22:22:06 2016 - clock source: unix
Mon Sep 5 22:22:06 2016 - pcre jit disabled
Mon Sep 5 22:22:06 2016 - detected number of CPU cores: 1
Mon Sep 5 22:22:06 2016 - current working directory: /
Mon Sep 5 22:22:06 2016 - writing pidfile to /run/uwsgi/app/myservice/pid
Mon Sep 5 22:22:06 2016 - detected binary path: /usr/bin/uwsgi-core
Mon Sep 5 22:22:06 2016 - setgid() to 33
Mon Sep 5 22:22:06 2016 - setuid() to 33
Mon Sep 5 22:22:06 2016 - chdir() to /home/user/myservice/dist
Mon Sep 5 22:22:06 2016 - your processes number limit is 7474
Mon Sep 5 22:22:06 2016 - your memory page size is 4096 bytes
Mon Sep 5 22:22:06 2016 - detected max file descriptor number: 1024
Mon Sep 5 22:22:06 2016 - building mime-types dictionary from file /etc/mime.types...Mon Sep 5 22:22:06 2016 - 552 entry found
Mon Sep 5 22:22:06 2016 - lock engine: pthread robust mutexes
Mon Sep 5 22:22:06 2016 - thunder lock: disabled (you can enable it with --thunder-lock)
Mon Sep 5 22:22:06 2016 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/myservice/socket fd 3
Mon Sep 5 22:22:06 2016 - Python version: 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609]
Mon Sep 5 22:22:06 2016 - Set PythonHome to /home/user/myservice/
Mon Sep 5 22:22:06 2016 - Python main interpreter initialized at 0x1e92140
Mon Sep 5 22:22:06 2016 - python threads support enabled
Mon Sep 5 22:22:06 2016 - your server socket listen backlog is limited to 100 connections
Mon Sep 5 22:22:06 2016 - your mercy for graceful operations on workers is 60 seconds
Mon Sep 5 22:22:06 2016 - mapped 145536 bytes (142 KB) for...

Read more...

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in uwsgi (Ubuntu):
status: New → Confirmed
Revision history for this message
peter toneby (peter-toneby) wrote :

Looking at the postinst script it seems likely you want to compare to $? rather than $BINARY_IS_UWSGI_ALTERNATIVE. Although I'm not quite sure why you pipe through true in the last step since that will make sure 0 is always the return code. Grep returns 0 if a line was found, 1 if not and 2 if an error occured so to me it looks like you should be covered by that.

I did change the if statement on line 61 to
   if [ $? -eq 0 ]; then
And that seems to work, at least the package installed without any errors and I got the /usr/bin/uwsgi_python3 link that ultimatly points at uwsgi-core.

While checking the alternatives I realized that I had the python2-plugin installed so I uninstalled it and got python3 working.

Now I just have sort out some other uwsgi-configuration issue and I'll be all good.

Revision history for this message
Kye Russell (kye.russell-thecut) wrote :

Is this still an issue being looked into? It's suddenly started presenting itself to me.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Kye, could you elaborate on what you are seeing? I just tried a simple "apt install uwsgi-plugin-python3" on a fresh xenial container, and it worked:
root@xenial:~# apt install uwsgi-plugin-python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libjansson4 libmatheval1 libsodium18 libzmq5 uwsgi-core
Suggested packages:
  nginx-full | cherokee | libapache2-mod-proxy-uwsgi | libapache2-mod-uwsgi | libapache2-mod-ruwsgi uwsgi-plugins-all uwsgi-extra python3-uwsgidecorators
The following NEW packages will be installed:
  libjansson4 libmatheval1 libsodium18 libzmq5 uwsgi-core uwsgi-plugin-python3
0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
Need to get 73.8 kB/926 kB of archives.
After this operation, 3,295 kB of additional disk space will be used.
Do you want to continue? [Y/n]
(...)
Setting up uwsgi-core (2.0.12-5ubuntu3.2) ...
Setting up uwsgi-plugin-python3 (2.0.12-5ubuntu3.2) ...
/var/lib/dpkg/info/uwsgi-plugin-python3.postinst: 61: [: Illegal number:
Processing triggers for libc-bin (2.23-0ubuntu11) ...
root@xenial:~# echo $?
0
root@xenial:~#

The comparison in line 61 is correct to be a number, because it's counting the occurrences of /uwsgi_python3. That should always output a number, 0 or higher.

Maybe that code changed, but now it reads:
      BINARY_IS_UWSGI_ALTERNATIVE="$(\
        update-alternatives --list uwsgi 2>/dev/null \
        | grep -c '/uwsgi_python3$' | true \
      )"
      if [ "$BINARY_IS_UWSGI_ALTERNATIVE" -eq 0 ]; then <--- line 61

Changed in uwsgi (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Apologies, after reproducing #1562237 which was about the python2 module, I see what's going on here. It's the "| true" bit, which should have been "|| true". In fact, that is fixed in later versions of the package:
      BINARY_IS_UWSGI_ALTERNATIVE="$(\
        update-alternatives --list uwsgi 2>/dev/null \
        | grep -c '/uwsgi_@@plugin_alternatives_stem@@$' || true \
      )"
      if [ "$BINARY_IS_UWSGI_ALTERNATIVE" -eq 0 ]; then

This was fixed in debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818116

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Pressed enter too soon. I meant to add it's fixed in debian since 2.0.12-6

Changed in uwsgi (Ubuntu):
status: Incomplete → Triaged
importance: Undecided → Medium
Changed in uwsgi (Ubuntu Xenial):
status: New → Triaged
importance: Undecided → Medium
Changed in uwsgi (Ubuntu):
status: Triaged → Fix Released
tags: added: server-next
tags: added: bite-size
Changed in uwsgi (Debian):
status: Unknown → Fix Released
tags: removed: server-next
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Since this has been fixed since Bionic, and Xenial is no longer under standard support, I am closing this as wontfix.

Changed in uwsgi (Ubuntu Xenial):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.