package python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1

Bug #1651660 reported by Cor Melse
36
This bug affects 8 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

while starting my laptop it could not find the cifs shares

ProblemType: Package
DistroRelease: Ubuntu 16.04
Package: python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1
ProcVersionSignature: Ubuntu 4.4.0-53.74-generic 4.4.30
Uname: Linux 4.4.0-53-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.4
Architecture: amd64
Date: Wed Dec 21 08:34:15 2016
ErrorMessage: subprocess new pre-removal script returned error exit status 1
InstallationDate: Installed on 2016-06-28 (175 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
RelatedPackageVersions:
 dpkg 1.18.4ubuntu1.1
 apt 1.2.15ubuntu0.2
SambaClientRegression: Yes
SourcePackage: samba
Title: package python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Cor Melse (cormelse) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Robie Basak (racb) wrote :

From log:

Preparing to unpack .../python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.3_amd64.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.3_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1

Have you messed with your /usr/bin/python symlink? What does "stat /usr/bin/python" show?

Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Since it seems likely to me that this is a local configuration problem, rather than a bug in Ubuntu, I'm marking this bug as Incomplete.

If indeed this is a local configuration problem, you can find pointers to get help for this sort of problem here: http://www.ubuntu.com/support/community

Or if you believe that this is really a bug, then you may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. We'd be grateful if you would then provide a more complete description of the problem, explain why you believe this is a bug in Ubuntu rather than a problem specific to your system, and then change the bug status back to New.

Changed in samba (Ubuntu):
status: New → Incomplete
Revision history for this message
Cor Melse (cormelse) wrote : Re: [Bug 1651660] Re: package python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1

Hi,
stat /usr/bin/python says:

melsec@LT140063:~$ stat /usr/bin/python
  File: '/usr/bin/python' -> '/etc/alternatives/python'
  Size: 24 Blocks: 0 IO Block: 4096 symbolic link
Device: 802h/2050d Inode: 3674418 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2017-02-13 09:25:56.783621704 +0100
Modify: 2017-01-20 16:13:18.632559074 +0100
Change: 2017-01-20 16:13:18.636559074 +0100
 Birth: -

As i use both python 2.7 and 3.5 (with Anaconda), i presume it has
something to do with update-alternatives?
2.7 is the default (manualy with UA)

Cheers, Cor

2017-02-13 11:35 GMT+01:00 Robie Basak <email address hidden>:

> >From log:
>
> Preparing to unpack .../python-samba_2%3a4.3.11+
> dfsg-0ubuntu0.16.04.3_amd64.deb ...
> File "/usr/bin/pyclean", line 63
> except (IOError, OSError), e:
> ^
> SyntaxError: invalid syntax
> dpkg: warning: subprocess old pre-removal script returned error exit
> status 1
> dpkg: trying script from the new package instead ...
> File "/usr/bin/pyclean", line 63
> except (IOError, OSError), e:
> ^
> SyntaxError: invalid syntax
> dpkg: error processing archive /var/cache/apt/archives/
> python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.3_amd64.deb (--unpack):
> subprocess new pre-removal script returned error exit status 1
>
> Have you messed with your /usr/bin/python symlink? What does "stat
> /usr/bin/python" show?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1651660
>
> Title:
> package python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1 failed to
> install/upgrade: subprocess new pre-removal script returned error exit
> status 1
>
> Status in samba package in Ubuntu:
> Incomplete
>
> Bug description:
> while starting my laptop it could not find the cifs shares
>
> ProblemType: Package
> DistroRelease: Ubuntu 16.04
> Package: python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1
> ProcVersionSignature: Ubuntu 4.4.0-53.74-generic 4.4.30
> Uname: Linux 4.4.0-53-generic x86_64
> ApportVersion: 2.20.1-0ubuntu2.4
> Architecture: amd64
> Date: Wed Dec 21 08:34:15 2016
> ErrorMessage: subprocess new pre-removal script returned error exit
> status 1
> InstallationDate: Installed on 2016-06-28 (175 days ago)
> InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Release amd64
> (20160420.1)
> RelatedPackageVersions:
> dpkg 1.18.4ubuntu1.1
> apt 1.2.15ubuntu0.2
> SambaClientRegression: Yes
> SourcePackage: samba
> Title: package python-samba 2:4.3.11+dfsg-0ubuntu0.16.04.1 failed to
> install/upgrade: subprocess new pre-removal script returned error exit
> status 1
> UpgradeStatus: No upgrade log present (probably fresh install)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/samba/+bug/
> 1651660/+subscriptions
>

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

[Expired for samba (Ubuntu) because there has been no activity for 60 days.]

Changed in samba (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Geokimbo (kfrankcombe) wrote :

I received the same error but do not have any cifs links in fstab nor was I accessing an SMB remote drive at the time. Iturned my laptop on, the software updater prompt came up and I allowed it to update whilst getting mail . In case it is of use here is my stat report

kim@Inspiron-15:~$ stat /usr/bin/python
  File: '/usr/bin/python' -> 'python2.7'
  Size: 9 Blocks: 0 IO Block: 4096 symbolic link
Device: 802h/2050d Inode: 1051875 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-09-05 07:07:43.156621090 +0800
Modify: 2017-11-24 08:52:21.000000000 +0800
Change: 2018-02-27 20:06:53.751452602 +0800
 Birth: -

I have python 2.7, 3 and 3.5

I'm at the airport so have no SMB shares to test if things are still working.

Cheers
Kim

Revision history for this message
Geokimbo (kfrankcombe) wrote :

I've just got back to the office and updated the desktop with apt from a terminal and get the same thing.

Here is a copy of the traceback

Preparing to unpack .../python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.16_amd64.deb ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 24, in <module>
    import logging
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Traceback (most recent call last):
  File "/usr/bin/pyclean", line 24, in <module>
    import logging
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
dpkg: error processing archive /var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.16_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 26, in <module>
    import logging
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1

The desktop does have a bunch of cifs shares but given that the laptop doesn't I think that is a red herring. The cifs shares are all still working.

For what its worth here's the output of stat
kim@Portos:~$ stat /usr/bin/python
  File: '/usr/bin/python' -> 'python2.7'
  Size: 9 Blocks: 0 IO Block: 4096 symbolic link
Device: fc00h/64512d Inode: 41292233 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-09-06 13:53:39.657278583 +0800
Modify: 2017-11-24 08:52:21.000000000 +0800
Change: 2018-02-27 09:36:31.297425618 +0800
 Birth: -

Looks like a undeclared variable or mismatch in code versions.

Cheers
Kim

Revision history for this message
Geokimbo (kfrankcombe) wrote :

OK I have this same issue on my work desktop, home desktop and laptop all of which have python 2.7, 3 and 3.5. Today I also updated one of my file servers which only has python 2.7 and it did the job happily. All are running 16.04. So the issue is to do with python version bindings. Although this Bug is marked as expired it seems pointless to create a new one and loose all the history so I'll persist on this number in the hope that it gets added to all the others requesting support for python 3 and now perhaps 3.5.

Cheers
Kim

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

One needs to be careful with installing other python versions on a system and making them available system-wide. Upstream samba doesn't yet fully support python3, and the samba version shipped in ubuntu 16.04 most definitely does not support it either.

What's failing for you guys is this bit in postinst:

# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
        pycompile -p python-samba
fi

Can you run pycompile? In a new xenial container where I installed python-samba, I can:

root@xenial-samba-python-backtrace:~# pycompile -p python-samba
root@xenial-samba-python-backtrace:~#

Changed in samba (Ubuntu):
status: Expired → Incomplete
Revision history for this message
Geokimbo (kfrankcombe) wrote :

Andreas

When you say Can you run pycompile? Are you asking me (Geokimbo) or the Samba/Ubuntu team?

If me then I guess I can, I haven't used python but I have been writing code for >40 years so can obviously build executables in other languages. I have plenty of virtual machine experience but no container time but I'm guessing that as the container is the same OS as the host it is straight forward. However I presume that your container exercise was a proof of concept rather than part if a fix.

With some clear instructions as to what I'm compiling and where I'd find it I'm sure I could recompile and test.

I've stayed away from fad languages but it annoys me that coders are not thinking ahead and allowing for backward and forward compatibility when they write code. With millions of lines of working code I wouldn't live long enough to fix things if I had to go back and change hundreds of subroutines because the I/O files had changed format which they do on an all too regular basis. Wrappers and generic subroutine calls should be part of what they build in from the start.

Cheers
Kim

Revision history for this message
Geokimbo (kfrankcombe) wrote :

OK so this is what I did to resolve the problem (I hope) Crude but it appears to work.

1/ go to /usr/lib/pytho2.7 and rename weakref.py to weakref-org.py
2/ copy weakref.py from /usr/lib/python3.5 to usr/lib python2.7
3/ sudo apt-get -f install and edit until it runs
4/ rename the weakref-org.py back to weakref.py

I've attached my edited version if you trust me. If you don't there were no great tricks, comment out a couple of bits that were causing grief and replace unsupported syntax with the corresponding lines from the original weakref.py

Hope that's fixed it until the next update and this is the end of the problem.

Cheers
Kim

Revision history for this message
Geokimbo (kfrankcombe) wrote :

Looks like I can't edit that post but just in case anyone is wondering there is a / missing from /usr/lib/pytho2.7 in step 2.

Cheers
Kim

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

Hi Kim,

sorry for being unclear. I meant for people affected by this bug to try to run this command, which is what the package does in its post installation procedure:

pycompile -p python-samba

On a clean xenial install, that does not fail. If it fails for someone, it means a non-standard python version is somehow being invoked.

Revision history for this message
Geokimbo (kfrankcombe) wrote :

Nope

kim@T610:/usr/lib/python2.7$ pycompile -p python-samba
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 26, in <module>
    import logging
  File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref, collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref

This is after I copied back the original version of weakref.py as in step 4 above.

However my fix above appears to work so I'm happy for the moment.

Cheers
Kim

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

[Expired for samba (Ubuntu) because there has been no activity for 60 days.]

Changed in samba (Ubuntu):
status: Incomplete → Expired
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.