lsb_release crashed with SIGABRT in Py_FatalError()

Bug #938869 reported by tolostoi
542
This bug affects 74 people
Affects Status Importance Assigned to Milestone
lsb (Ubuntu)
Fix Released
High
Barry Warsaw
Precise
Fix Released
High
Barry Warsaw
Quantal
Fix Released
High
Barry Warsaw
Raring
Fix Released
High
Barry Warsaw

Bug Description

= SRU =

All Python system scripts should use -Es to ignore $PYTHON* envars and to ignore the user's site directory. This is a general recommendation.

[Test Case]
$ PYTHONHOME=/does/not/exist lsb_release
-> crashes without the fix
-> works correctly with the fix

[Regression Potential]
None expected.

= Details =

During the installation process of either VMware Player major version 4 or 5 you will receive a crash report regarding lsb-release as VMware ships a version of python 2 with the installer and the installation process calls lsb-release which uses python 3.

I'm just login, and the message to some application crashed pops up.

ProblemType: Crash
DistroRelease: Ubuntu 12.04
Package: lsb-release 4.0-0ubuntu19
ProcVersionSignature: Ubuntu 3.2.0-17.26-generic 3.2.6
Uname: Linux 3.2.0-17-generic i686
ApportVersion: 1.92-0ubuntu1
Architecture: i386
Date: Wed Feb 22 13:45:24 2012
ExecutablePath: /usr/bin/lsb_release
InterpreterPath: /usr/bin/python3.2mu
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/bin/lsb_release -sd
Signal: 6
SourcePackage: lsb
StacktraceTop:
 raise () from /lib/i386-linux-gnu/libc.so.6
 abort () from /lib/i386-linux-gnu/libc.so.6
 Py_FatalError ()
 ?? ()
 Py_InitializeEx ()
Title: lsb_release crashed with SIGABRT in raise()
UpgradeStatus: Upgraded to precise on 2012-02-17 (5 days ago)
UserGroups:

Revision history for this message
tolostoi (tolostoi) wrote :
Revision history for this message
Apport retracing service (apport) wrote :

StacktraceTop:
 Py_FatalError ()
 initfsencoding ()
 Py_InitializeEx ()
 Py_Initialize ()
 Py_Main ()

Revision history for this message
Apport retracing service (apport) wrote : Stacktrace.txt
Revision history for this message
Apport retracing service (apport) wrote : ThreadStacktrace.txt
Changed in lsb (Ubuntu):
importance: Undecided → Medium
summary: - lsb_release crashed with SIGABRT in raise()
+ lsb_release crashed with SIGABRT in Py_FatalError()
tags: removed: need-i386-retrace
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in lsb (Ubuntu):
status: New → Confirmed
tags: added: quantal
visibility: private → public
Changed in lsb (Ubuntu):
importance: Medium → High
Steve Langasek (vorlon)
affects: lsb (Ubuntu) → python3.2 (Ubuntu)
Changed in python3.2 (Ubuntu):
assignee: nobody → Matthias Klose (doko)
Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Evan Broder wrote in

https://bugs.launchpad.net/ubuntu/+source/python3.2/+bug/917088:

-------------------------------------------------------------------------------------------------------

I ran into this error while installing VMware Player on Precise. I believe I've tracked it down to the environment that the VMware installer sets.

/usr/lib/vmware-installer/2.0/python/init.sh:

if [ -z "$_VMIS_INIT_PYTHON" ]; then
    export PYTHON_ROOT="$VMWARE_INSTALLER"/python

    . "$PYTHON_ROOT"/pygtk/init.sh

    export PYTHONHOME=`dirname "$PYTHON_ROOT"`
    export PYTHONPATH="$PYTHON_ROOT/lib:$PYTHON_ROOT/lib/lib-dynload:$PYTHONPATH"
    export LD_LIBRARY_PATH="$PYTHON_ROOT/lib/libsqlite3:$LD_LIBRARY_PATH"

    PYTHON="$PYTHON_ROOT/python"

    export PYTHON
    export _VMIS_INIT_PYTHON=1
fi

Setting PYTHONHOME as init.sh sets it is enough to get python3.2mu to abort:

evan@evan-precise-amd64:~$ PYTHONHOME=/usr/lib/vmware-installer/2.0/python /usr/bin/python3.2mu /usr/bin/lsb_release -sd
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: no codec search functions registered: can't find encoding
Aborted (core dumped)

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Stacktrace Top from bug original generated to Ubuntu11.10 Oneric

https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/831731:

--------------------------------------------------------------

StacktraceTop:
 Py_FatalError (msg=<optimized out>) at ../Python/pythonrun.c:2142
 initfsencoding (interp=<optimized out>) at ../Python/pythonrun.c:749
 Py_InitializeEx (install_sigs=1) at ../Python/pythonrun.c:297
 Py_Main (argc=3, argv=0x284c010) at ../Modules/main.c:597
 main (argc=3, argv=0x7fff07b603d8) at ../Modules/python.c:59

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

malus wrote on

https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/831731:

-----------------------------------------

happened upon boot of installed system

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

File Kolodny wrote on

https://bugs.launchpad.net/ubuntu/+source/lsb/+bug/831731:

---------------------------------------------
Also happened while installing Vmware Workstation.

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Happen to myself on direct hardware installation (HP655 laptop), during figuring arround with mounted tar.gz archives (archive mount). -> Why ever; may correlated by accident.

tags: added: oneiric
tags: added: amd64
tags: added: qa-manual-testing
Revision history for this message
Sasa Paporovic (melchiaros) wrote :

qa-manual-testing is imported from

https://bugs.launchpad.net/ubuntu/+source/python3.2/+bug/917088

The procedure is given by:"Crashed during installation of vmplayer 4.01 on amd64"

May be actual versions make sense.

Revision history for this message
Matthias Klose (doko) wrote :

the segfault is fixed in quantal.
couldn't reproduce this with vmware player 5.0 on precise.

Changed in python3.2 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
monomakh (monomakh) wrote :

This problem still occuries while installing VMWare Workstation 9 in quantal.

Revision history for this message
Brian Murray (brian-murray) wrote :

New duplicates of this bug can be found in bug 1045726. It doesn't seem like it has been fixed.

Changed in python3.2 (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Brian Murray (brian-murray) wrote :

I was able to recreate this when installing vmware-player version VMware-Player-4.0.4-744019.x86_64.bundle and by following the steps indicated in comment #6.

Revision history for this message
Matthias Klose (doko) wrote :

looks like the vmware installer uses a partial python2.x environment, and then calling everything else with this environment. when lsb_release is called, then they try to run a python3 with a partial python2.x library, which is ... interesting.

not seen on other distros, because lsb_release isn't implemented there in python. not seen in precise (at least in the final release), because lsb_release uses python2.x there, and they don't break it as bad as in quantal.

Revision history for this message
Rob Adams (readams) wrote :

I tried replacing the /usr/bin/lsb_release file with a hard-coded bash script but the vmware install still fails in roughly the same place.

Revision history for this message
Barry Warsaw (barry) wrote :

The most boiled down example that provides Python 3 to fatally exit is:

$ PYTHONHOME=/does/not/exist /usr/bin/python3

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named encodings
Aborted (core dumped)

That's to be expected I suppose; it's not a bug in Python in the sense that it is purposefully aborting itself when it cannot find the encodings module during start up. I'm not sure what else Python could do in that case (and neither is upstream, hence the self-abort).

It's not at all clear to me what we can do here, short of reporting the problem to VMware and having them not break the Python environment when they invoke lsb_release.

Revision history for this message
Rob Adams (readams) wrote :

The problem here is presumably that there's no correct way to set PYTHONHOME in this case. They need the python2.4 that they ship in the installer and to point it to their PYTHONHOME. But if from that environment you ever call any other python program then it will abort since PYTHONHOME is set incorrectly. What presumably needs to happen is that python 3 would ignore PYTHONHOME and instread use another variable PYTHON3HOME (and related) so that there is a correct way to have both versions of python work.

Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 938869] Re: lsb_release crashed with SIGABRT in Py_FatalError()

On Oct 02, 2012, at 08:35 PM, Rob Adams wrote:

>The problem here is presumably that there's no correct way to set
>PYTHONHOME in this case. They need the python2.4 that they ship in the
>installer and to point it to their PYTHONHOME. But if from that
>environment you ever call any other python program then it will abort
>since PYTHONHOME is set incorrectly. What presumably needs to happen is
>that python 3 would ignore PYTHONHOME and instread use another variable
>PYTHON3HOME (and related) so that there is a correct way to have both
>versions of python work.

Well, strictly speaking that's not even correct. They're just getting lucky
that setting PYTHONHOME in their script to get their custom Python 2.4
environment doesn't break the system Python 2.7, let alone Python 3.2. IOW,
they're already skating on thin ice, but they only broke through in this case.

Revision history for this message
Rob Adams (readams) wrote :

Here is a workaround for installing vmware workstation:

Create a file called python3.2mu with the following contents:
------------------ start after this line
#!/bin/bash

unset PYTHONHOME
unset PYTHONPATH

exec /usr/bin/python3.2mu-real "$@"
------------------ end before this line

Then run sudo mv /usr/bin/python3.2mu /usr/bin/python3.2mu-real
Then mv your python3.2mu to /usr/bin
then chmod 755 /usr/bin/python3.2mu

This will allow the workstation installer to run.

Then move the wrapper out of the way and restore the real python3.2

Revision history for this message
Karma Dorje (taaroa) wrote :

got a couple of errors during the installation of vmware player.

description: updated
Revision history for this message
Barry Warsaw (barry) wrote :

I am reminded of the -E switch to python3 which ignores environment variables. lsb_release should use this.

affects: python3.2 (Ubuntu) → lsb (Ubuntu)
Changed in lsb (Ubuntu):
milestone: none → quantal-updates
Changed in lsb (Ubuntu Raring):
milestone: quantal-updates → ubuntu-13.04
Changed in lsb (Ubuntu Quantal):
milestone: none → quantal-updates
status: New → Triaged
importance: Undecided → High
Revision history for this message
Christian Heimes (heimes) wrote :

All system command should have "-E -s" in the shebang line to isolate them from the user's env vars and local site-packages directory.

-E : ignore PYTHON* environment variables (such as PYTHONPATH)
-s : don't add user site directory to sys.path

None of Ubuntu's Python scripts in /usr/bin and /usr/sbin are using -E or -s.

$ for F in /usr/bin/* /usr/sbin/*; do head -n1 $F | grep -q python && echo $F; done

Revision history for this message
Barry Warsaw (barry) wrote :

-s may also be neede:

quoting from python-dev:

- -E : ignore PYTHON* environment variables (such as PYTHONPATH)
- -s : don't add user site directory to sys.path

- -E -s are useful for system commands and mandatory for suid commands.

Revision history for this message
Celso Providelo (cprov) wrote :

Thanks Barry and Christian!

Modifying '/usr/bin/lsb_release' shebang to use -E python3 switch does the trick for installing VMPlayer 5.0.0 (x86) on 12.10.

Barry Warsaw (barry)
Changed in lsb (Ubuntu Raring):
assignee: Matthias Klose (doko) → Barry Warsaw (barry)
Changed in lsb (Ubuntu Quantal):
assignee: nobody → Barry Warsaw (barry)
Revision history for this message
Barry Warsaw (barry) wrote :

Just to be clear, the shebang line needs to use -Es

#!/usr/bin/python3 -Es

Barry Warsaw (barry)
Changed in lsb (Ubuntu Quantal):
status: Triaged → In Progress
Changed in lsb (Ubuntu Raring):
status: Triaged → In Progress
Barry Warsaw (barry)
description: updated
Barry Warsaw (barry)
Changed in lsb (Ubuntu Precise):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Barry Warsaw (barry)
milestone: none → precise-updates
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lsb - 4.0-0ubuntu27

---------------
lsb (4.0-0ubuntu27) raring; urgency=low

  * lsb_release: Add -Es to #! line for Python so that it will ignore
    the $PYTHON* environment variables, and not add the user's site
    directory to sys.path. Both of these are general recommendations that
    should apply to all system scripts, but in this case fixes LP: #938869
 -- Barry Warsaw <email address hidden> Tue, 23 Oct 2012 18:48:21 -0400

Changed in lsb (Ubuntu Raring):
status: In Progress → Fix Released
Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello tolostoi, or anyone else affected,

Accepted lsb into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lsb/4.0-0ubuntu26.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in lsb (Ubuntu Quantal):
status: In Progress → Fix Committed
tags: added: verification-needed
Changed in lsb (Ubuntu Precise):
status: In Progress → Fix Committed
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello tolostoi, or anyone else affected,

Accepted lsb into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lsb/4.0-0ubuntu20.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Karma Dorje (taaroa) wrote :

No more errors. Tested using vmware player 5.0.0.812388.

verification-done

tags: added: verification-done
removed: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

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

This bug was fixed in the package lsb - 4.0-0ubuntu20.2

---------------
lsb (4.0-0ubuntu20.2) precise-proposed; urgency=low

  * lsb_release: Add -Es to #! line for Python so that it will ignore
    the $PYTHON* environment variables, and not add the user's site
    directory to sys.path. Both of these are general recommendations that
    should apply to all system scripts, but in this case fixes LP: #938869
 -- Barry Warsaw <email address hidden> Tue, 23 Oct 2012 20:20:42 -0400

Changed in lsb (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lsb - 4.0-0ubuntu26.1

---------------
lsb (4.0-0ubuntu26.1) quantal-proposed; urgency=low

  * lsb_release: Add -Es to #! line for Python so that it will ignore
    the $PYTHON* environment variables, and not add the user's site
    directory to sys.path. Both of these are general recommendations that
    should apply to all system scripts, but in this case fixes LP: #938869
 -- Barry Warsaw <email address hidden> Tue, 23 Oct 2012 18:52:45 -0400

Changed in lsb (Ubuntu Quantal):
status: Fix Committed → Fix Released
Revision history for this message
peshte (peshte) wrote :

Hi everyone.
I'm a bit newbie in linux systems.

How can I use/install the lsb-4.0 package?
I've updated my kubuntu 12.1, installed the lsb packages from muon package manager, lsb-core, lsb-base, but my VMplayer 5.0 won't start any virtual machine. When I press "Play virtual machine", the VMplayer exit.

I've downloaded the lsb_4.0-0ubuntu20.2.tar.gz package and I don't know what to do next.
Please help.
Thanks.

Revision history for this message
Karma Dorje (taaroa) wrote :

peshte, do not hijack this bug, start a new bug. I dont' want to be rude, but this isn't a support forum.
If you need support you can open the new bug or ask help in https://answers.launchpad.net/. It may be that there is already an answer to your question.

To post a comment you must log in.