1

I installed Python 3.7.5 on my Ubuntu 18.04 and I updated alternatives for python and python3 to Python 3.7.5. After that I had a lot of problems.

When I use sudo apt-get update or sudo gdebi some_deb_file I get this error:

No module named apt_pkg

I updated the alternatives for python to Python 2.7 (Ubuntu 18.04 default) but this did not work.

I searched and found this solution:

cd /usr/lib/python3/dist-packages/
sudo ln -s apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg

and now, when I use sudo gdebi some_deb_file, I get this error:

Traceback (most recent call last):
  File "/usr/bin/gdebi", line 38, in <module>
    from GDebi.GDebiCli import GDebiCli
  File "/usr/share/gdebi/GDebi/GDebiCli.py", line 36, in <module>
    from .DebPackage import DebPackage, DscSrcPackage
  File "/usr/share/gdebi/GDebi/DebPackage.py", line 24, in <module>
    import apt.debfile
  File "/usr/lib/python3/dist-packages/apt/debfile.py", line 23, in <module>
    import apt_inst
ModuleNotFoundError: No module named 'apt_inst'

When I use sudo apt-get update I get this:

Hit:1 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease    
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                   
Hit:3 http://security.ubuntu.com/ubuntu bionic-security InRelease              
Hit:4 http://dl.google.com/linux/chrome/deb stable Release                     
Hit:5 https://ocean.surfshark.com/debian stretch InRelease                     
Hit:6 http://ir.archive.ubuntu.com/ubuntu bionic InRelease                     
Hit:7 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic InRelease           
Hit:9 http://ir.archive.ubuntu.com/ubuntu bionic-updates InRelease             
Hit:10 http://packages.ros.org/ros/ubuntu bionic InRelease                     
Get:11 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease [6,259 B]     
Hit:12 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic InRelease
Hit:13 http://ir.archive.ubuntu.com/ubuntu bionic-backports InRelease          
Err:11 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease               
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Ign:14 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease        
Get:15 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease [6,259 B]     
Err:16 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release    
  404  Not Found [IP: 91.189.95.83 80]
Err:15 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Reading package lists... Done 
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
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: 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.
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial InRelease' is not signed.
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.

Now, when I use python, it runs python2.7.17 and successfully imports apt_pkg and apt_inst, but when I use python3, it runs Python 3.7.5 and successfully imports apt_pkg, but cannot import apt_inst.

Thanks to @JerareYoshi, I tried to remove Xenial from the PPA list, but, as I said, the Software and Updates app doesn't open, so I tried to use ppa-purge to remove it (but I don't know if I used it correctly or not) and I get this error when I want to use sudo ppa-purge -o wine-builds/ubuntu xenial:

Updating packages lists
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial InRelease' is not signed.
E: The repository 'http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release' does not have a Release file.
Warning:  apt-get update failed for some reason

After that I searched the PPA list and I couldn't find Xenial in it.

Output of apt policy:

Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://ocean.surfshark.com/debian stretch/main i386 Packages
     release o=Surfshark,n=stretch,l=Surfshark packages,c=main,b=i386
     origin ocean.surfshark.com
 500 https://ocean.surfshark.com/debian stretch/main amd64 Packages
     release o=Surfshark,n=stretch,l=Surfshark packages,c=main,b=amd64
     origin ocean.surfshark.com
 500 http://packages.ros.org/ros/ubuntu bionic/main i386 Packages
     release o=ROS,a=bionic,n=bionic,l=ROS bionic,c=main,b=i386
     origin packages.ros.org
 500 http://packages.ros.org/ros/ubuntu bionic/main amd64 Packages
     release o=ROS,a=bionic,n=bionic,l=ROS bionic,c=main,b=amd64
     origin packages.ros.org
 500 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic/main i386 Packages
     release v=18.04,o=LP-PPA-plushuang-tw-uget-stable,a=bionic,n=bionic,l=uGet stable version,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-plushuang-tw-uget-stable,a=bionic,n=bionic,l=uGet stable version,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic/main i386 Packages
     release v=18.04,o=LP-PPA-noobslab-apps,a=bionic,n=bionic,l=Apps collection by NoobsLab.com,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-noobslab-apps,a=bionic,n=bionic,l=Apps collection by NoobsLab.com,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main i386 Packages
     release v=18.04,o=LP-PPA-graphics-drivers,a=bionic,n=bionic,l=Proprietary GPU Drivers,c=main,b=i386
     origin ppa.launchpad.net
 500 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-graphics-drivers,a=bionic,n=bionic,l=Proprietary GPU Drivers,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages
     release v=1.0,o=Google LLC,a=stable,n=stable,l=Google,c=main,b=amd64
     origin dl.google.com
 500 http://security.ubuntu.com/ubuntu bionic-security/multiverse i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=multiverse,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=universe,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/restricted i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=restricted,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=main,b=i386
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=main,b=amd64
     origin security.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=universe,b=i386
     origin ir.archive.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin ir.archive.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=main,b=i386
     origin ir.archive.ubuntu.com
 100 http://ir.archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=main,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/multiverse i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=multiverse,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=universe,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/restricted i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=restricted,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=main,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=main,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/multiverse i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=multiverse,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/universe i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=universe,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/restricted i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=restricted,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/main i386 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=i386
     origin ir.archive.ubuntu.com
 500 http://ir.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=amd64
     origin ir.archive.ubuntu.com
Pinned packages:

Output of ls -lh /etc/apt/sources.list.d:

total 56K
-rw-r--r-- 1 root root 189 Mar 19 13:25 google-chrome.list
-rw-r--r-- 1 root root 189 Mar 19 13:25 google-chrome.list.save
-rw-r--r-- 1 root root 219 Mar 19 13:25 graphics-drivers-ubuntu-ppa-bionic.list
-rw-r--r-- 1 root root 219 Mar 19 13:25 graphics-drivers-ubuntu-ppa-bionic.list.save
-rw-r--r-- 1 root root 470 Mar 19 13:25 noobslab-ubuntu-apps-bionic.list
-rw-r--r-- 1 root root 470 Mar 19 13:25 noobslab-ubuntu-apps-bionic.list.save
-rw-r--r-- 1 root root 152 Mar 19 13:25 plushuang-tw-ubuntu-uget-stable-bionic.list
-rw-r--r-- 1 root root 152 Mar 19 13:25 plushuang-tw-ubuntu-uget-stable-bionic.list.save
-rw-r--r-- 1 root root  51 Mar 19 13:25 ros-latest.list
-rw-r--r-- 1 root root  51 Mar 19 13:25 ros-latest.list.save
-rw-r--r-- 1 root root  52 Mar 19 13:25 surfshark.list
-rw-r--r-- 1 root root  52 Mar 19 13:25 surfshark.list.save
-rw-r--r-- 1 root root 274 Mar 19 13:25 ubuntu-wine-ubuntu-ppa-bionic.list
-rw-r--r-- 1 root root 204 Mar 19 13:25 ubuntu-wine-ubuntu-ppa-bionic.list.save

And as I said there is no Xenial.

But now, when I run sudo apt-get update, I get this message again:

Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                                  
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                 
Hit:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease                                                                  
Hit:4 http://ir.archive.ubuntu.com/ubuntu bionic InRelease                                                                                   
Hit:5 http://dl.google.com/linux/chrome/deb stable Release                                                                                   
Hit:6 https://ocean.surfshark.com/debian stretch InRelease                                                                                   
Hit:8 http://ppa.launchpad.net/noobslab/apps/ubuntu bionic InRelease                                                                         
Hit:9 http://ir.archive.ubuntu.com/ubuntu bionic-updates InRelease                                                                           
Hit:10 http://packages.ros.org/ros/ubuntu bionic InRelease                                                                                   
Hit:11 http://ir.archive.ubuntu.com/ubuntu bionic-backports InRelease                                                                        
Hit:12 http://ppa.launchpad.net/plushuang-tw/uget-stable/ubuntu bionic InRelease          
Get:13 http://security.ubuntu.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]                              
Get:14 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease [6,259 B]                                                                   
Err:14 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease                                                                             
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Get:15 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]                                
Get:16 http://security.ubuntu.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]                  
Get:17 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.1 kB]                                   
Get:18 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]                                           
Get:19 http://security.ubuntu.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [111 kB]                                              
Ign:20 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic InRelease                                   
Get:21 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]                     
Err:22 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu bionic Release                                                                        
  404  Not Found [IP: 91.189.95.83 80]
Get:23 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease [6,259 B]
Err:23 https://dl.winehq.org/wine-builds/ubuntu xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
Reading package lists... Done 
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu bionic InRelease' is not signed.
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: 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.
W: GPG error: https://dl.winehq.org/wine-builds/ubuntu xenial InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 76F1A20FF987672F
E: The repository 'https://dl.winehq.org/wine-builds/ubuntu xenial InRelease' is not signed.
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.
  • For the apt-get update part: You should only add ppa when it's necessary. You have a conflict with two WINE ppa (bionic and xenial). You are running Ubuntu 18.04 so try to remove the xenial one. – Jeryosh Mar 25 '20 at 11:41
  • @JerareYoshi thanks, if I remove xenial Wine will work correctly? something else that terminal doesn't open from GUI icon and I only can open it with Right-click software and update also don't open from the GUI icon and I don't know how I can open it to remove ppa??

    I installed WINE before these problems....You mean that WINE makes these problems for me????

    – Mohammad Alipour Mar 25 '20 at 16:05
  • Xenial is for Ubuntu 16.04 and conflict with the bionic wine ppa making apt unusable. You can remove it by installation ppa-purge (sudo apt install ppa-purge) or delete it with the Software and Update app in the "Other Software" tab. – Jeryosh Mar 25 '20 at 19:59

0 Answers0