Tag Archives: cents

[Solved] Centos error: collect2: fatal error: cannot find ‘ld‘

When executing a compiled file in Linux (. /configure) with collect2: fatal error: cannot find ‘ld’, which is also preceded by gcc: error: unrecognized command line option -V and configure: error: C compiler cannot create executables. When you find that your gcc and the corresponding dependency packages are installed, you still get the error. At this point you look under /usr/bin/ to see if there is an ld. which ld is not found, but you find a file called ld.gold under /usr/bin by running ls -l |grep ld.

Solution:

Copy ld.gold under /usr/bin/ (do not delete the original file) and rename it to ld. You can also create a soft connection.

Re-execute the compilation

Problem found solved!

Brief description.

gcc compiles the source code to .o, then linker links the .o to .so or executable, linker can use ld.bfd, ld.gold or lld.

[Solved] Nacos Cluster startup error: error=‘Cannot allocate memory‘ (errno=12)

Problem discovery

1. Start one of the Nacos clusters

2. Query the number of starts through the number of starts in the cluster command

ps -ef|grep nacos|grep -v grep|wc -l

This is the second startup. One has been started before, so the problem comes. Why is it still one after the second startup

3. Use the tail-f command to read the contents of the file loop, monitor the growth of the file and find out the reason

tail -f 文件路径   #The file path is given after the start command

Normal start

Second startup error

From the Nacos startup log information, we can see that the memory is insufficient

4. Check the memory usage through the free -h command

There is only 70m of available memory left

5. By viewing startup.sh file to view the JVM startup command

– xms2g represents 2G of initially allocated memory
– xmx2g represents the maximum value of JVM memory
– xmn1g represents 1g of Cenozoic memory;

Solution:

1. Increase system memory

2. Modify the startup parameters of the JVM in the startup script and reduce the memory allocated to the JVM

Allocate according to your current usage mode and the memory of your virtual machine

After modification, it is started successfully

yum: Error: Failed to download metadata for repo ‘aliyun-AppStream‘: Cannot download repomd.xml

preface

centos8 stopped the service of source on December 31, 2021

The current system is CentOS

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 8.5.2111
[root@localhost ~]# 

Yum error message

[root@localhost ~]# yum install ipmitool
CentOS-8 - AppStream                                                                                                                                                                   439  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 182.105.147.113)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost ~]# 

Solution

1. Execute the following commands

[root@localhost ~]#cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls -lh        
total 24K
-rwxr-xr-x. 1 root root  288 Mar 22 20:07 CentOS-AppStream.repo
-rwxr-xr-x. 1 root root  276 Mar 22 20:07 CentOS-BaseOS.repo
-rwxr-xr-x. 1 root root 3.0K Mar 22 20:07 CentOS-Base.repo
-rwxr-xr-x. 1 root root  279 Mar 22 20:07 CentOS-Extras.repo
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum update -y
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream                                                                                                                                                             437  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 124.225.134.244)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

2. If the problem is not solved, do the following:

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-22 20:08:42--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.225.134.241, 124.225.134.239, 124.225.134.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.225.134.241|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo                    100%[===================================================================================================================>]   2.44K  --.-KB/s    in 0s      

2022-03-22 20:08:47 (49.0 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum clean all
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
18 files removed
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum makecache
Repository base is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository AppStream is listed more than once in the configuration
CentOS-8 - AppStream                                                                                                                                                             428  B/s | 2.3 kB     00:05    
Errors during downloading metadata for repository 'aliyun-AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos-Vault/8.5.2111/BaseOS/x86_64/os/repodata/repomd.xml (IP: 119.41.210.242)
Error: Failed to download metadata for repo 'aliyun-AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
[root@localhost yum.repos.d]# 

3. Then perform the following operations

[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# ls -lh        
total 24K
-rwxr-xr-x. 1 root root  288 Mar 22 20:07 CentOS-AppStream.repo
-rwxr-xr-x. 1 root root  276 Mar 22 20:07 CentOS-BaseOS.repo
-rwxr-xr-x. 1 root root 3.0K Mar 22 20:07 CentOS-Base.repo
-rwxr-xr-x. 1 root root  279 Mar 22 20:07 CentOS-Extras.repo
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv  *.repo  bak
[root@localhost yum.repos.d]# ls
bak
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
--2022-03-22 20:10:10--  https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 124.225.134.239, 124.225.134.241, 124.225.134.243, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|124.225.134.239|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2495 (2.4K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo   100%[==================================================================>]   2.44K  --.-KB/s    in 0s      

2022-03-22 20:10:15 (98.3 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2495/2495]

[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum clean all
0 files removed
[root@localhost yum.repos.d]# yum makecache
CentOS-8.5.2111 - Base - mirrors.aliyun.com                                                                                     454 kB/s | 4.6 MB     00:10    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com                                                                                                                                    1.0 kB/s |  10 kB     00:10    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com                                                                                                                                 571 kB/s | 8.4 MB     00:15    
Metadata cache created.
[root@localhost yum.repos.d]# ls 
bak  CentOS-Base.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum install ipmitool
Last metadata expiration check: 0:00:27 ago on Tue 22 Mar 2022 08:10:54 PM CST.
Dependencies resolved.
=================================================================================================================================================================================================================
 Package                                          Architecture                                   Version                                                 Repository                                         Size
=================================================================================================================================================================================================================
Installing:
 ipmitool                                         x86_64                                         1.8.18-18.el8                                           AppStream                                         395 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 395 k
Installed size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
ipmitool-1.8.18-18.el8.x86_64.rpm                                                                                                                                                 71 kB/s | 395 kB     00:05    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             71 kB/s | 395 kB     00:05     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                         1/1 
  Installing       : ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 
  Running scriptlet: ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 
  Verifying        : ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                           1/1 

Installed:
  ipmitool-1.8.18-18.el8.x86_64                                                                                                                                                                                  

Complete!
[root@localhost yum.repos.d]#

At this point, you can use the yum install command.

[Solved] Yum Install Software Error: Invalid configuration value: failovermethod=priority…

Error 1:

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-BaseOS.repo; Configuration: OptionBinding with id "failovermethod" does not exist
CentOS Linux 8 - AppStream                                                 6.3 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'appstream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

The current environment is:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# uname -srm
Linux 4.18.0-348.2.1.el8_5.x86_64 x86_64

CentOS version:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 8.5.2111

Solution:

1. Find CentOS related directory, backup CentOS-AppStream, CentOS-Base files, generally CentOS directory is under /etc/yum.repos.d folder, as follows:

Backup:

cp CentOS-Linux-AppStream.repo CentOS-Linux-AppStream.repo1
cp CentOS-Linux-BaseOS.repo CentOS-Linux-BaseOS.repo1

2. Edit the files CentOS-Linux-AppStream.repo,CentOS-Linux-BaseOS.repo for string replacement:

vi CentOS-Linux-BaseOS.repo
# esc 键盘 : 命令模式下执行:
%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g 
# 继续执行:
%s/$releasever/$releasever-stream/g

vi CentOS-Linux-AppStream.repo
# esc 键盘 : 命令模式下执行:
%s/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g 
# 继续执行:
%s/$releasever/$releasever-stream/g

3. Execute the order:

yum makecache
yum update

Command execution effect:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# yum update
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:01:22 ago on Wed 09 Mar 2022 10:20:01 AM CST.
Error: 
 Problem: package centos-stream-release-8.6-1.el8.noarch requires centos-stream-repos, but none of the providers can be installed
  - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-2.el8.noarch
  - package centos-stream-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch
  - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-3.el8.noarch
  - package centos-stream-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch
  - package centos-linux-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-4.el8.noarch
  - package centos-stream-repos-8-4.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-3.el8.noarch
  - cannot install the best update candidate for package centos-linux-release-8.5-1.2111.el8.noarch
  - problem with installed package centos-linux-repos-8-3.el8.noarch
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Execute the command Yum install * expect * again, and the results are as follows:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# yum install *expect*
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:07:00 ago on Wed 09 Mar 2022 10:20:01 AM CST.
Package python3-pexpect-4.3.1-3.el8.noarch is already installed.
Dependencies resolved.
===========================================================================================================
 Package                       Architecture         Version                     Repository            Size
===========================================================================================================
Installing:
 expect                        x86_64               5.45.4-5.el8                baseos               267 k
 python3-aexpect               noarch               1.6.2-1.el8                 epel                  93 k
Installing dependencies:
 tcl                           x86_64               1:8.6.8-2.el8               baseos               1.1 M

Transaction Summary
===========================================================================================================
Install  3 Packages

Total download size: 1.5 M
Installed size: 5.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): python3-aexpect-1.6.2-1.el8.noarch.rpm                              467 kB/s |  93 kB     00:00    
(2/3): expect-5.45.4-5.el8.x86_64.rpm                                      282 kB/s | 267 kB     00:00    
(3/3): tcl-8.6.8-2.el8.x86_64.rpm                                          351 kB/s | 1.1 MB     00:03    
-----------------------------------------------------------------------------------------------------------
Total                                                                      461 kB/s | 1.5 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                   1/1 
  Installing       : tcl-1:8.6.8-2.el8.x86_64                                                          1/3 
  Running scriptlet: tcl-1:8.6.8-2.el8.x86_64                                                          1/3 
  Installing       : expect-5.45.4-5.el8.x86_64                                                        2/3 
  Installing       : python3-aexpect-1.6.2-1.el8.noarch                                                3/3 
  Running scriptlet: python3-aexpect-1.6.2-1.el8.noarch                                                3/3 
  Verifying        : expect-5.45.4-5.el8.x86_64                                                        1/3 
  Verifying        : tcl-1:8.6.8-2.el8.x86_64                                                          2/3 
  Verifying        : python3-aexpect-1.6.2-1.el8.noarch                                                3/3 

Installed:
  expect-5.45.4-5.el8.x86_64       python3-aexpect-1.6.2-1.el8.noarch       tcl-1:8.6.8-2.el8.x86_64      

Complete!

OK, you can install yum

Note: in actual use, if there is no CentOS-AppStream.repo related files, do not operate on them

Eg: install git:

[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# yum -y install git
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Last metadata expiration check: 0:07:51 ago on Wed 09 Mar 2022 10:20:01 AM CST.
Dependencies resolved.
===========================================================================================================
 Package                      Architecture       Version                       Repository             Size
===========================================================================================================
Installing:
 git                          x86_64             2.31.1-2.el8                  appstream             161 k
Installing dependencies:
 git-core                     x86_64             2.31.1-2.el8                  appstream             4.7 M
 git-core-doc                 noarch             2.31.1-2.el8                  appstream             2.6 M
 perl-Error                   noarch             1:0.17025-2.el8               appstream              46 k
 perl-Git                     noarch             2.31.1-2.el8                  appstream              78 k
 perl-TermReadKey             x86_64             2.37-7.el8                    appstream              40 k

Transaction Summary
===========================================================================================================
Install  6 Packages

Total download size: 7.7 M
Installed size: 38 M
Downloading Packages:
(1/6): git-2.31.1-2.el8.x86_64.rpm                                         299 kB/s | 161 kB     00:00    
(2/6): perl-Error-0.17025-2.el8.noarch.rpm                                 185 kB/s |  46 kB     00:00    
(3/6): perl-Git-2.31.1-2.el8.noarch.rpm                                    290 kB/s |  78 kB     00:00    
(4/6): perl-TermReadKey-2.37-7.el8.x86_64.rpm                              148 kB/s |  40 kB     00:00    
(5/6): git-core-doc-2.31.1-2.el8.noarch.rpm                                385 kB/s | 2.6 MB     00:07    
(6/6): git-core-2.31.1-2.el8.x86_64.rpm                                    394 kB/s | 4.7 MB     00:12    
-----------------------------------------------------------------------------------------------------------
Total                                                                      640 kB/s | 7.7 MB     00:12     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                   1/1 
  Installing       : git-core-2.31.1-2.el8.x86_64                                                      1/6 
  Installing       : git-core-doc-2.31.1-2.el8.noarch                                                  2/6 
  Installing       : perl-TermReadKey-2.37-7.el8.x86_64                                                3/6 
  Installing       : perl-Error-1:0.17025-2.el8.noarch                                                 4/6 
  Installing       : perl-Git-2.31.1-2.el8.noarch                                                      5/6 
  Installing       : git-2.31.1-2.el8.x86_64                                                           6/6 
  Running scriptlet: git-2.31.1-2.el8.x86_64                                                           6/6 
  Verifying        : git-2.31.1-2.el8.x86_64                                                           1/6 
  Verifying        : git-core-2.31.1-2.el8.x86_64                                                      2/6 
  Verifying        : git-core-doc-2.31.1-2.el8.noarch                                                  3/6 
  Verifying        : perl-Error-1:0.17025-2.el8.noarch                                                 4/6 
  Verifying        : perl-Git-2.31.1-2.el8.noarch                                                      5/6 
  Verifying        : perl-TermReadKey-2.37-7.el8.x86_64                                                6/6 

Installed:
  git-2.31.1-2.el8.x86_64             git-core-2.31.1-2.el8.x86_64   git-core-doc-2.31.1-2.el8.noarch    
  perl-Error-1:0.17025-2.el8.noarch   perl-Git-2.31.1-2.el8.noarch   perl-TermReadKey-2.37-7.el8.x86_64  

Complete!
[root@iZ2vc5xk901ftf2vfscwc1Z yum.repos.d]# git --version
git version 2.31.1

Error 2:

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Repository extras is listed more than once in the configuration
CentOS Linux 8 - AppStream                                                 6.7 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'appstream':
  - Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: xxx.xxx.xxx.xxx)
Error: Failed to download metadata for repo 'appstream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

Solution

Enter the file /etc/yum.repos.d/CentOS-Epel.repo, and comment out  failovermethod=priority :

OK, you can also install yum

How to Solve Yum Error: db5 error(30973)

Problem error: failed to open rpmdb. db5 error(30973)

error: rpmdb: BDB0113 Thread/process 8442/140713489532992 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@VM-0-6-centos ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
error: rpmdb: BDB0113 Thread/process 8442/140713489532992 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.cli:Yum Error: Error: rpmdb open failed

The reason why rpm is damaged: the database needs to be rebuilt.

Solution: clear the original link through the command and re-establish it.

[root@localhost ~]# rm -rf /var/lib/rpm/_db*  #Delete the original
[root@localhost ~]# rpm --rebuilddb # New
[root@localhost ~]# yum clean all # Clear all yum caches

It can be used normally at present

[Solved] Sshd startup error: Failed at step CGROUP spawning /usr/sbin/sshd: No space left on device

sshd restart error:
systemctl restart sshd.service
The screenshot is as following:

Error Messages:

Failed at step CGROUP spawning /usr/sbin/sshd: No space left on device
Failed to create cgroup /system.slice/sshd.service: No such file or directory

 

The reason for this is that the cgroup is not mounted.

Solution:
Mount the cgroup directory
mount -t tmpfs cgroup_root /sys/fs/cgroup
umount -t tmpfs cgroup_root /sys/fs/cgroup
umount /sys/fs/cgroup

then restart to connect normally
systemctl start sshd.service

Centos7.2 Install vscode Error: error while loading shared libraries: libxkbcommon.so.0: cannot open shared pro

1. I recently needed to install vscode on centos 7.2, and after installing it, I ran it and found that it kept reporting the following error

2. Using the #ldd code command, I found that libxkbcommon.so.0 is indeed missing

3. Then install libxkbcommon

yum install libxkbcommon

4. The following problems occur during operation

5. Then install NSS

yum install nss

6. Running, OK

[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