Tag Archives: ubuntu

Ubuntu update source error: E: Problem executing scripts APT::Update::Post-Invoke-Success…

UBUNTU update source error:

E: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi’ E: Sub-process returned an error code

 

Solution:

apt-get purge libappstream3
apt-get update

[Solved] dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)

Problem phenomenon

sudo apt install nvidia-340
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libargtable2-0 libass5 libavcodec-ffmpeg56 libavdevice-ffmpeg56
  libavfilter-ffmpeg5 libavformat-ffmpeg56 libavresample-ffmpeg2
  libavutil-ffmpeg54 libbluray1 libboost-random1.58.0 libboost-regex1.58.0
  libboost-thread1.58.0 libcryptopp-dev libethereum libfdk-aac0 libjsoncpp1
  libjsonrpccpp-client0 libjsonrpccpp-common0 libjsonrpccpp-server0
  libleveldb1v5 libmicrohttpd10 libmicrohttpd12 libnvidia-common-396
  libopencv-core2.4v5 libopencv-imgproc2.4v5 libopenjpeg5 libpostproc-ffmpeg53
  libschroedinger-1.0-0 libsdl-ttf2.0-0 libswresample-ffmpeg1
  libswscale-ffmpeg3 libtbb2 libva1 libx264-148 libx265-79 miniupnpc
  nvidia-kernel-common-396 nvidia-kernel-source-396 nvidia-prime php7.1-common
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nvidia-340
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/51,9 MB of archives.
After this operation, 274 MB of additional disk space will be used.
(Reading database ... 345463 files and directories currently installed.)
Preparing to unpack .../nvidia-340_340.107-0ubuntu0~gpu18.04.1_amd64.deb ...
diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340
Removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
diversion of /usr/lib/x86_64-linux-gnu/libGL.so to /usr/lib/x86_64-linux-gnu/libGL.so.distrib by nvidia-340
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so to /usr/lib/x86_64-linux-gnu/libGL.so.distrib by nvidia-340'
diversion of /usr/lib/i386-linux-gnu/libGL.so to /usr/lib/i386-linux-gnu/libGL.so.distrib by nvidia-340
Removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so to /usr/lib/i386-linux-gnu/libGL.so.distrib by nvidia-340'
diversion of /usr/lib/x86_64-linux-gnu/libEGL.so.1 to /usr/lib/x86_64-linux-gnu/libEGL.so.1.distrib by nvidia-340
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libEGL.so.1 to /usr/lib/x86_64-linux-gnu/libEGL.so.1.distrib by nvidia-340'
diversion of /usr/lib/i386-linux-gnu/libEGL.so.1 to /usr/lib/i386-linux-gnu/libEGL.so.1.distrib by nvidia-340
Removing 'diversion of /usr/lib/i386-linux-gnu/libEGL.so.1 to /usr/lib/i386-linux-gnu/libEGL.so.1.distrib by nvidia-340'
diversion of /usr/lib/x86_64-linux-gnu/libEGL.so to /usr/lib/x86_64-linux-gnu/libEGL.so.distrib by nvidia-340
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libEGL.so to /usr/lib/x86_64-linux-gnu/libEGL.so.distrib by nvidia-340'
diversion of /usr/lib/i386-linux-gnu/libEGL.so to /usr/lib/i386-linux-gnu/libEGL.so.distrib by nvidia-340
Removing 'diversion of /usr/lib/i386-linux-gnu/libEGL.so to /usr/lib/i386-linux-gnu/libEGL.so.distrib by nvidia-340'
diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so to /usr/lib/x86_64-linux-gnu/libGLESv2.so.distrib by nvidia-340
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so to /usr/lib/x86_64-linux-gnu/libGLESv2.so.distrib by nvidia-340'
diversion of /usr/lib/i386-linux-gnu/libGLESv2.so to /usr/lib/i386-linux-gnu/libGLESv2.so.distrib by nvidia-340
Removing 'diversion of /usr/lib/i386-linux-gnu/libGLESv2.so to /usr/lib/i386-linux-gnu/libGLESv2.so.distrib by nvidia-340'
diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so.2 to /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.distrib by nvidia-340
Removing 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so.2 to /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.distrib by nvidia-340'
diversion of /usr/lib/i386-linux-gnu/libGLESv2.so.2 to /usr/lib/i386-linux-gnu/libGLESv2.so.2.distrib by nvidia-340
Removing 'diversion of /usr/lib/i386-linux-gnu/libGLESv2.so.2 to /usr/lib/i386-linux-gnu/libGLESv2.so.2.distrib by nvidia-340'
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so to /usr/lib/x86_64-linux-gnu/libGL.so.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libGL.so to /usr/lib/i386-linux-gnu/libGL.so.distrib by nvidia-340'
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libEGL.so.1 to /usr/lib/x86_64-linux-gnu/libEGL.so.1.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libEGL.so.1 to /usr/lib/i386-linux-gnu/libEGL.so.1.distrib by nvidia-340'
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libEGL.so to /usr/lib/x86_64-linux-gnu/libEGL.so.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libEGL.so to /usr/lib/i386-linux-gnu/libEGL.so.distrib by nvidia-340'
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so to /usr/lib/x86_64-linux-gnu/libGLESv2.so.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libGLESv2.so to /usr/lib/i386-linux-gnu/libGLESv2.so.distrib by nvidia-340'
Adding 'diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so.2 to /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.distrib by nvidia-340'
Adding 'diversion of /usr/lib/i386-linux-gnu/libGLESv2.so.2 to /usr/lib/i386-linux-gnu/libGLESv2.so.2.distrib by nvidia-340'
Unpacking nvidia-340 (340.107-0ubuntu0~gpu18.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-340_340.107-0ubuntu0~gpu18.04.1_amd64.deb (--unpack):
 trying to overwrite '/lib/udev/rules.d/71-nvidia.rules', which is also in package nvidia-kernel-common-396 396.45-0ubuntu0~gpu18.04.2
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nvidia-340_340.107-0ubuntu0~gpu18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Solution:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/nvidia-340_340.107-0ubuntu0~gpu18.04.1_amd64.deb

This will resolve “the trying to overwrite error” with the mighty force of dpkg. 😃
Then run:

sudo apt -f install

to fix if any broken packages.

[Solved] Except CvBridgeError,e:SyntaxError:invalid syntax

Error reporting for problem:

File “file location”, line 40

Except CvBridgeError,e:

SyntaxError:invalid syntax

 

Solution:

This is the result of a python version mismatch.

    1. 1. Find the code file according to the file location after File, and find the problematic line of code according to line
    1. 2. Change the code line to except CvBridgeError as e:
    1. 3. Save and exit

[Solved] Invalid signature error for ROS repository while trying to do sudo apt-get update

After installing ROS in Ubuntu system, the apt-get update command reports an error:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.ros.org/ros/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected]>
W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/InRelease  Could not resolve 'dl.google.com'
W: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/bionic/InRelease  The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected]>
W: Failed to fetch http://packages.microsoft.com/repos/code/dists/stable/InRelease  Could not resolve 'packages.microsoft.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Solution:
we have to re-add the mentioned GPG key to the system by using command below

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

Ubuntu Error: dpkg: error processing package mysql-community-server (–configure):

Dpkg: error dpkg: error processing package mysql-community-server (–configure):

Whether sudo apt upgrade or sudo apt autoremove is used, the problem remains.

Use mysql deb package to install report error:

sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  libmysqlclient-dev mysql-client mysql-server mysql-testsuite
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue?[Y/n] y
Setting up mysql-community-server (5.7.37-1ubuntu18.04) ...
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 5.7.37-1ubuntu18.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-community-test:No apport report written because the error message indicates its a followup error from a previous failure.

 mysql-community-test depends on mysql-community-server (= 5.7.37-1ubuntu18.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-community-test (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-testsuite:No apport report written because the error message indicates its a followup error from a previous failure.

 mysql-testsuite depends on mysql-community-test (= 5.7.37-1ubuntu18.04); however:
  Package mysql-community-test is not configured yet.

dpkg: error processing package mysql-testsuite (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already

The solution is as follows:

Try the following command

sudo apt-get install -f

To see if it can fix broken dependencies

If failed, clear MySQL server:

 sudo apt-get purge mysql-community-server mysql-community-server 

Then clean up and update:

 sudo apt-get autoclean && sudo apt-get clean && sudo apt-get update 

General upgrade:

 sudo apt-get upgrade 

Now try reinstalling:

sudo apt-get install mysql-server and mysql-community-server 

If you do this from the root prompt, the leading sudo command will not be booted

[Solved] ffmpeg Error: fatal error: zlib.h: Not having that file or directory

Environmental Science:

Ubuntu18. 04×86-64

Error phenomenon:

When compiling ffmpeg code, the following errors sometimes occur:

libavformat/http.c:25:10: fatal error: zlib.h: Not having that file or directory
 #include <zlib.h>

Solution:

Enter the following on the command line

sudo apt-get install zlib1g-dev

Press enter to execute, and the following output appears:

Reading the package list... Done
Analyzing the dependency tree of the package       
Reading status information... Done       
The following [new] packages will be installed.
  zlib1g-dev
0 packages upgraded, 1 new package installed, 0 packages to uninstall, and 316 packages not upgraded.
176 kB of archives need to be downloaded.
Unpacking will consume 457 kB of additional space.
Get:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-0ubuntu2 [176 kB]
Downloaded 176 kB in 2 seconds (82.2 kB/s)  
Unselected package zlib1g-dev:amd64 is being selected.
(Database is being read ... The system currently has 149705 files and directories installed.)
Preparing to unpack ... /zlib1g-dev_1%3a1.2.11.dfsg-0ubuntu2_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) ...
Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-0ubuntu2) ...
Working on triggers for man-db (2.8.3-2ubuntu0.1) ...

Problem solving

[Solved] WSL error: wslregisterdistribution failed with error: 0x800701bc

1. Introduction

For the new computer, WSL has installed Ubuntu. When entering Ubuntu, an error occurs

WslRegisterDistribution failed with error: 0x800701bc

2. Solution

This is because the wsl2 kernel is not updated

Enter the administrator permission command line, WSL — update

wsl --update
Checking for updates...
Downloading updates...
Installing the update...
This change will take effect the next time WSL is fully rebooted. To force a reboot, run "wsl --shutdown".
Kernel version: 5.10.60.1

Then force restart

wsl --shutdown

[Solved] Some index files failed to download.They have been ignored, or old ones used instead

sudo apt-get updateerror:

Err:1 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu bionic InRelease
  Temporary failure resolving 'ppa.launchpad.net'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://ppa.launchpad.net/wireshark-dev/stable/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Use Ping www.google.comtest the network. If it appears: Ping: www.google.com: temporary failure in name resolution is a network problem,

Solution:

first

sudo vim /etc/systemd/resolved.conf

Modify DNS as follows:

[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes

Modify the following configuration file

vim /etc/resolv.conf 

Add the following:

nameserver 8.8.8.8

Then restart:

reboot

Just update the source after restart:

sudo apt-get update

Ubuntu 20.04 Desktop Install sublime-text Error: “Certificate verification failed”

Sublime is the editor I am used to. I want to download it after reinstalling the system recently, but according to the download method on the official website, the following error will appear:

@ubuntu:~$ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
OK
@ubuntu:~$ echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
deb https://download.sublimetext.com/ apt/stable/
@ubuntu:~$ sudo apt update && sudo apt install sublime-text
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease                      
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease               
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease              
Ign:4 https://download.sublimetext.com apt/stable/ InRelease                   
Hit:5 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease            
Err:6 https://download.sublimetext.com apt/stable/ Release 
  Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 104.236.0.104 443]
Reading package lists... Done                             
E: The repository 'https://download.sublimetext.com apt/stable/ 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.

The reason is that a software package called “ca-certificates” is not installed. After installation, you can execute the installation instruction of sublime from the beginning.

@ubuntu:~$ sudo apt install ca-certificates

[Solved] wsl Error: WslRegisterDistribution failed with error: 0x800701bc

After WSL is enabled on the windows system, install Ubuntu in the Microsoft Store, and then open Ubuntu. Prompt:
Cause:
After wsl1 is upgraded to wsl2, but the kernel is not upgraded, so this error message will appear, just go to Microsoft WSL official website to download and install the latest WSL2 Linux kernel update package for x64 computers.

Solution:
1、Download the latest wsl installation package, download address: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

2、After downloading the installation package, just run the installation directly!

Ubuntu install and compile OpenCV3.4.0 fatal error: dynlink_nvcuvid.h: No such file or directory #include <dynlink_nv

Problems encountered

fatal error: dynlink_nvcuvid.h: No such file or directory #include <dynlink_nvcuvid.h>

Solution
Add: -dbuild_opencv_cudacodec=OFF

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_TIFF=ON -DBUILD_opencv_cudacodec=OFF ..

sudo make -j12
sudo make install

Problems encountered

[ WARN:0] cvCreateFileCaptureWithPreference: backend FFMPEG doesn't support legacy API anymore.

Solution

install opencv3.4.0 

It must be 3.4.0, others 3.4 X is wrong
3.4.0 download address https://codeload.github.com/opencv/opencv/tar.gz/refs/tags/3.4.0
Then install the extension package of OpenCV 3.4.0, download address, https://codeload.github.com/opencv/opencv_contrib/tar.gz/refs/tags/3.4.0