Having trouble updating/upgrading

For some reason I am having trouble upgrading and updating with apt-get:

rob@linux0:~$ sudo apt-get upgrade
[sudo] password for rob: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libgl1-mesa-dri libxatracker2 linux-generic linux-generic-hwe-18.04 linux-headers-generic
  linux-headers-generic-hwe-18.04 linux-image-generic linux-image-generic-hwe-18.04 mesa-va-drivers mesa-vdpau-drivers
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
4 not fully installed or removed.
Need to get 0 B/1,926 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package python-samba (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of samba-common-bin:
 samba-common-bin depends on python-samba; however:
  Package python-samba is not configured yet.

So I tried: `sudo dpkg --configure -a`
and it returned:

dpkg: error processing package python-samba (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python-samba

So I tried `sudo apt-get remove -y python-samba`
and it returned:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python-ldb python-tdb
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  libnss-winbind python-samba samba-common-bin winbind
0 upgraded, 0 newly installed, 4 to remove and 10 not upgraded.
4 not fully installed or removed.
After this operation, 18.3 MB disk space will be freed.
(Reading database ... 255157 files and directories currently installed.)
Removing libnss-winbind:amd64 (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) ...
Removing winbind (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) ...
Removing samba-common-bin (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) ...
dpkg: error processing package python-samba (--remove):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting a removal
Errors were encountered while processing:
 python-samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

It failed but I figured I would try to install again anyhow with `sudo apt-get install -y python-samba`
and it returned:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-samba is already the newest version (2:4.7.6+dfsg~ubuntu-0ubuntu2.15).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,926 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: error processing package python-samba (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Errors were encountered while processing:
 python-samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

I then tried to force an upgrade `sudo apt-get upgrade -f`
and it returned:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libgl1-mesa-dri libxatracker2 linux-generic linux-generic-hwe-18.04 linux-headers-generic
  linux-headers-generic-hwe-18.04 linux-image-generic linux-image-generic-hwe-18.04 mesa-va-drivers mesa-vdpau-drivers
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,926 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package python-samba (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 python-samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

So I tried to force install python-samba and it gave me the same error. I am not sure what to do here.

My first thoughts:

  • You can try manually installing python-samba (without using apt ).
  • You can try installing samba differently (a different distro for python), for example apt-get install python-smb

I use apt on Ubuntu, but when I run into problems I don't waste much time with apt (I use it as a tool, not as a rule), and go for manual installation.

The questions is, where is the python-samba distro for manual installation? I searched around a bit for you and could not find it.

TBH I can't even seem to get rid of samba:

rob@linux:~$ sudo apt-get remove samba --purge
[sudo] password for rob: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  attr ibverbs-providers libcephfs2 libibverbs1 libllvm8 libnl-route-3-200 librados2 libuser1 python-dnspython
  python-libuser samba-dsdb-modules samba-vfs-modules tdb-tools
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  samba* system-config-samba*
0 upgraded, 0 newly installed, 2 to remove and 3 not upgraded.
4 not fully installed or removed.
Need to get 0 B/1,926 kB of archives.
After this operation, 15.9 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 267456 files and directories currently installed.)
Removing system-config-samba (1.2.63-0ubuntu6) ...
Removing samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) ...
dpkg: error processing package python-samba (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of samba-common-bin:
 samba-common-bin depends on python-samba; however:
  Package python-samba is not configured yet.

dpkg: error processing package samba-common-bin (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 python-samba
 samba-common-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can you try force removal of mentioned packages using dpkg ?
After that, if packages are removed, run apt-get install -f

Hopefully that will help, if not post output of those commands above.

I cannot agree with manual work on ubuntu, exceptions being stuff outside repositories (the official ones).
If you really want manual work (no package or rudimental package manager), then other distributions would be better choice.

Of course, above really depends on the context and significance of those box(es).

Regards
Peasant.

It all seems fine now:

sudo dpkg -P samba samba-common-bin samba-common smbclient

followed by:

sudo rm -f /etc/rc*.d/*samba /etc/init.d/samba

then:

rob@linux:/$ sudo apt-get install --reinstall python-samba
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  attr ibverbs-providers libcephfs2 libibverbs1 libllvm8 libnl-route-3-200 librados2 libuser1 python-dnspython
  python-libuser samba-dsdb-modules samba-vfs-modules tdb-tools
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,926 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 266034 files and directories currently installed.)
Preparing to unpack .../python-samba_2%3a4.7.6+dfsg~ubuntu-0ubuntu2.15_amd64.deb ...
Unpacking python-samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) over (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) ...
Setting up python-samba (2:4.7.6+dfsg~ubuntu-0ubuntu2.15) ...
1 Like