1

[ aug ,11 : 21.20 ] hi all. while troubleshooting i created new problem. kindly refer below link

How to reinstall APT package

Result of reinstallation :

$ sudo apt install --reinstall python3-aptdaemon
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for python3-aptdaemon:amd64
ariel@ariel:~$ sudo apt install --reinstall python3-aptdaemon
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 7 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for python3-aptdaemon:amd64

another result about pkg: for update.

$ sudo apt-get update

Hit:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                           
Hit:3 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                         
Hit:4 http://ppa.launchpad.net/diesch/testing/ubuntu bionic InRelease                                  
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                            
Ign:6 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease              
Err:7 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release                 
  404  Not Found [IP: 91.189.95.83 80]
Traceback (most recent call last):                                                   
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code 

updated output of solution :

$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python3 (python3) in auto mode
ariel@ariel:/etc/apt/sources.list.d

$ sudo update-alternatives --config python3

There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/bin/python3.6
Nothing to configure.
ariel@ariel:/etc/apt/sources.list.d$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu19.1) ...
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1570
    async = reply_handler and error_handler
          ^
SyntaxError: invalid syntax

dpkg: error processing package python3-aptdaemon (--configure):
 installed python3-aptdaemon package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-aptdaemon.gtk3widgets:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19.1); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing package python3-aptdaemon.gtk3widgets (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of language-selector-gnome:
 language-selector-gnome depends on python3-aptdaemon.gtk3widgets; however:
  Package python3-aptdaemon.gtk3widgets is not configured yet.

No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: error processing package language-selector-gnome (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on language-selector-gnome; however:
  Package language-selector-gnome is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python3-aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)
ariel@ariel:/etc/apt/sources.list.d$ 

Whenever I try to install any software it gives me following error. I have tried sudo apt-get install -f but it outputs

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu19.1) ...
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1570
    async = reply_handler and error_handler
          ^
SyntaxError: invalid syntax

dpkg: error processing package python3-aptdaemon (--configure):
 installed python3-aptdaemon package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-aptdaemon.gtk3widgets:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19.1); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing package python3-aptdaemon.gtk3widgets (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of language-selector-gnome:
 language-selector-gnome depends on python3-aptdaemon.gtk3widgets; however:
  Package python3-aptdaemon.gtk3widgets is not configured yet.

dpkg: error processing package language-selector-gnome (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on language-selector-gnome; however:
  Package language-selector-gnome is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 python3-aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt clean && sudo apt autoclean && sudo apt remove && sudo apt autoremove -y && sudo apt install -f && sudo dpkg --configure -a && sudo apt update && sudo apt full-upgrade

[sudo] password for ariel: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3-aptdaemon (1.1.1+bzr982-0ubuntu19.1) ...
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1570
    async = reply_handler and error_handler
          ^
SyntaxError: invalid syntax

dpkg: error processing package python3-aptdaemon (--configure):
 installed python3-aptdaemon package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of python3-aptdaemon.gtk3widgets:
 python3-aptdaemon.gtk3widgets depends on python3-aptdaemon (= 1.1.1+bzr982-0ubuntu19.1); however:
  Package python3-aptdaemon is not configured yet.

dpkg: error processing package python3-aptdaemon.gtk3widgets (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of language-selector-gnome:
 language-selector-gnome depends on python3-aptdaemon.gtk3widgets; however:
  Package python3-aptdaemon.gtk3widgets is not configured yet.

dpkg: error processing package language-selector-gnome (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on language-selector-gnome; however:
  Package language-selector-gnome is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leavinNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                                                       No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                   No apport report written because MaxReports is reached already
                   g unconfigured
Errors were encountered while processing:
 python3-aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 ubuntu-desktop
E: Sub-process /usr/bin/dpkg returned an error code (1)

>

Ariel
  • 37

3 Answers3

3

This is because of the incompatibility of Python 3 version. You have installed Python version 3.7.3 and made it default. The default version of Python 3 in 18.04 Bionic Beaver is 3.6.8. You need to switch back to version 3.6.8. To do so, run

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --config python3

and enter 1.

Related bug reports:

Kulfy
  • 17,696
  • i have run above cmds. but output is same again.kindly check edited que – Ariel Jul 31 '19 at 12:31
  • @Ariel What is the output of python3 --version now? Also, which Ubuntu version are you using? – Kulfy Jul 31 '19 at 12:33
  • version is 18.04 – Ariel Jul 31 '19 at 12:36
  • @Ariel What about Python3 version now? – Kulfy Jul 31 '19 at 12:37
  • version Python 3.6.8 – Ariel Jul 31 '19 at 12:38
  • ok will be back after 5 min – Ariel Jul 31 '19 at 12:41
  • hi kulfy it didnt work – Ariel Jul 31 '19 at 19:29
  • still same error – Ariel Jul 31 '19 at 19:30
  • @Ariel Try reinstallation using sudo apt install --reinstall python3-aptdaemon – Kulfy Jul 31 '19 at 19:38
  • not working . new error. i have tried this earlier – Ariel Jul 31 '19 at 19:41
  • @Ariel How did you install python 3.7? – Kulfy Jul 31 '19 at 19:44
  • i have update it once earlier and i found some cmd rlated to this and it worked. – Ariel Jul 31 '19 at 19:51
  • @Ariel Any instructions you followed? – Kulfy Jul 31 '19 at 19:53
  • i hhave tried to uninstall python 2.7 once long back – Ariel Jul 31 '19 at 19:58
  • @Ariel Try sudo apt-get remove python3-apt; sudo apt-get install python3-apt and then sudo apt remove python3-aptdaemon; sudo apt install python3-aptdaemon – Kulfy Jul 31 '19 at 20:00
  • currently i am doing same let me check whether it ill work or not – Ariel Jul 31 '19 at 20:01
  • @Ariel Any update? – Kulfy Aug 04 '19 at 08:03
  • hi kulfy sorry for late replay. i have uninstalled it sucessfully but for reinstallation every time its failing. – Ariel Aug 08 '19 at 18:11
  • $ sudo apt install python3-aptdeamon E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? ariel@ariel:~$ sudo apt install python3-aptdeamon y E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it? – Ariel Aug 08 '19 at 18:11
  • how to repaire broken pakages in bionic beaver. – Ariel Aug 08 '19 at 18:12
  • can we replace it manually by copying file from one system to another or from repository – Ariel Aug 08 '19 at 18:12
  • how to update or reinstall dpkg?? i have tried various methods from ninternet but every time its same error – Ariel Aug 08 '19 at 18:14
  • @Ariel 1. You misspelled python3-aptdaemon. 2. apt is busy elsewhere. There's nothing to worry about. Either wait for sometime or run sudo rm /var/lib/dpkg/lock-frontend; sudo rm /var/lib/apt/lists/lock; sudo apt update; sudo apt install python3-aptdaemon. – Kulfy Aug 08 '19 at 18:15
  • $ sudo rm /var/lib/dpkg/lock-frontend $ sudo rm /var/lib/apt/lists/lock – Ariel Aug 08 '19 at 18:55
  • $ sudo apt update Err:1 http://in.archive.ubuntu.com/ubuntu bionic InRelease
    Could not resolve 'in.archive.ubuntu.com'
    – Ariel Aug 08 '19 at 18:56
  • Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
    Could not resolve 'security.ubuntu.com'
    – Ariel Aug 08 '19 at 18:57
  • Err:3 http://ppa.launchpad.net/diesch/testing/ubuntu bionic InRelease
    Could not resolve 'ppa.launchpad.net' Err:4 http://in.archive.ubuntu.com/ubuntu bionic-updates InRelease Could not resolve 'in.archive.ubuntu.com'
    – Ariel Aug 08 '19 at 18:57
  • @Ariel Are you connected to the internet? No need to post all Errors if they are similar – Kulfy Aug 08 '19 at 18:57
  • Err:5 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease Could not resolve 'ppa.launchpad.net' Err:6 http://in.archive.ubuntu.com/ubuntu bionic-backports InRelease Could not resolve 'in.archive.ubuntu.com' – Ariel Aug 08 '19 at 18:58
  • Reading package lists... Done Building dependency tree
    Reading state information... Done
    – Ariel Aug 08 '19 at 18:58
  • 45 packages can be upgraded. Run 'apt list --upgradable' to see them. W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not resolve 'in.archive.ubuntu.com' – Ariel Aug 08 '19 at 18:58
  • W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Could not resolve 'in.archive.ubuntu.com' W: Failed to fetch http://in.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Could not resolve 'in.archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Could not resolve 'security.ubuntu.com' – Ariel Aug 08 '19 at 18:59
  • W: Failed to fetch http://ppa.launchpad.net/diesch/testing/ubuntu/dists/bionic/InRelease Could not resolve 'ppa.launchpad.net' W: Failed to fetch http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/dists/bionic/InRelease Could not resolve 'ppa.launchpad.net' W: Some index files failed to download. They have been ignored, or old ones used instead. – Ariel Aug 08 '19 at 19:00
  • i think without internet we cn not access this – Ariel Aug 08 '19 at 19:02
  • @Ariel Yeah. That's why I asked you in my previous comment, Are you connected to the internet? No need to post all Errors if they are similar – Kulfy Aug 08 '19 at 19:23
2

I ran across this issue today. Seems like async has been added as a functional symbol between 3.6.8 and 3.6.9 (which is ridiculous - such thing should not change between patch levels).
I had to edit /usr/lib/python3/dist-packages/aptdaemon/client.py and replace each occurrence of "async" with a different variable name (I just appended a character). After this my system was able to install all the missing packages again.

So the real culprit seems to be a change in Python3 that seems out of scope of the version change.

Gryu
  • 7,559
  • 9
  • 33
  • 52
1

These following command worked for me :

sudo apt-get remove python3-apt
sudo apt-get install python3-apt
sudo apt remove python3-aptdaemon
sudo apt install python3-aptdaemon
damadam
  • 2,833
Pawel
  • 11
  • 1