Category Archives: Linux

Docker Start Container Error: Error response from daemon: task already exists: unknown

Prompt: docker restart XXX error response from daemon: cannot restart container XXX: container “XXX”: already exists

Even if you run systemctl restart docker, it doesn’t work. Maybe some containers use systemctl stop docker, which will start the container of the bridge network, but will not kill the docker??? Using docker start XXX, the error “already exists” is always reported.

Cause: the container did not exit safely

Solution 1:

#xxx is the container of hash_id
rm -r /var/run/docker/runtime-runc/moby/xxx

Solution 2:
never mind. Restart can solve 50% of the problems:

reboot

[Solved] yum Command Error: Error: Failed to download metadata for repo ‘appstream‘

From the official explanation:
CentOS Linux 8 had reached the End Of Life (EOL) on December 31st, 2021. It means that CentOS 8 will no longer receive development resources from the official CentOS project. After Dec 31st, 2021, if you need to update your CentOS, you need to change the mirrors to vault.centos.org where they will be archived permanently.

Solution: Execute the following statements in sequence

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum update

[Solved] filebeat Startup Error: Exiting: error unpacking config data: more than one namespace configured accessing

After extracting filebeat from the virtual machine, enter #: ./filebeat -c filebeat.yml

Encountered the following problems!!!!!!

Exiting: error unpacking config data: more than one namespace configured accessing ‘output’ (source:’filebeat.yml’)

resolvent:

#Note that you must install filebeat in your own directory to modify filebeat.yml

[filebeat directory] #: VIM filebeat.yml

After entering, find the following configuration location

#—————————-Elasticsearch output ———————————-

output. elasticsearch:

#Array of hosts to connecr to.

hosts: [“localhost:9200”]

=====================Modification====================

Just comment out the contents under Elasticsearch output

#—————————-Elasticsearch output ———————————-

#output. elasticsearch:

#Array of hosts to connecr to.

hosts: [“localhost:9200”]

Save exit after modification

Restart filebeat

Enter #:/ filebeat -c filebeat.yml

View process

Enter #:/ filebeat -e -c filebeat.yml

Successfully started filebeat!!!!!

[Solved] yum Install rpmdb Error: error: rpmdb: BDB0113 failed: BDB1507 Thread died in Berkeley DB library

Yum setup failed in CentOS

Yum failed to install git with the following error prompt

[root@doc1 data]# yum -y install git
error: rpmdb: BDB0113 Thread/process 16754/139715004069952 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

Solution:

View RPM Directory:/var/lib/rpm

Enter cat/var/lib/RPM
CD/var/lib/rpm on the command line

 [root@doc1 data]# cd /var/lib/rpm
[root@doc1 rpm]# ls
Basenames     __db.002  Group       Obsoletename  Requirename  Triggername
Conflictname  __db.003  Installtid  Packages      Sha1header
__db.001      Dirnames  Name        Providename   Sigmd5

Delete database file

rm -f /var/lib/rpm/__db.*

[root@doc1 rpm]# rm -f /var/lib/rpm/__db.*

Rebuild RPM database

rpm –rebuilddb

[root@doc1 rpm]# rpm --rebuilddb

Clear Yum’s cache

yum clean all

[root@doc1 rpm]# yum clean all
Loaded plugins: fastestmirror, langpacks
Repodata is over 2 weeks old. Install yum-cron?Or run: yum makecache fast
Cleaning repos: Subversion epel extras jenkins os updates
Cleaning up list of fastest mirrors
Other repos take up 6.5 M of disk space (use --verbose for details)

Rebuild Yum cache

yum makecache

[root@doc1 rpm]# yum makecache
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
Subversion                                               | 2.9 kB     00:00
epel                                                     | 4.7 kB     00:00
extras                                                   | 2.9 kB     00:00
jenkins                                                  | 2.9 kB     00:00
os                                                       | 3.6 kB     00:00
updates                                                  | 2.9 kB     00:00
(1/22): Subversion/7/x86_64/primary_db                     |  66 kB   00:00
(2/22): Subversion/7/x86_64/filelists_db                   |  71 kB   00:00
(3/22): epel/7/x86_64/group_gz                             |  96 kB   00:00
(4/22): Subversion/7/x86_64/other_db                       | 7.7 kB   00:00
(5/22): epel/7/x86_64/updateinfo                           | 1.0 MB   00:00
(6/22): epel/7/x86_64/prestodelta                          |  708 B   00:00
(7/22): epel/7/x86_64/primary_db                           | 7.0 MB   00:00
(8/22): epel/7/x86_64/other_db                             | 3.4 MB   00:00
(9/22): extras/7/x86_64/primary_db                         | 243 kB   00:00
(10/22): extras/7/x86_64/filelists_db                      | 259 kB   00:00
(11/22): extras/7/x86_64/other_db                          | 145 kB   00:00
(12/22): epel/7/x86_64/filelists_db                        |  12 MB   00:00
(13/22): jenkins/filelists_db                              |  24 kB   00:01
(14/22): os/7/x86_64/group_gz                              | 153 kB   00:00
(15/22): os/7/x86_64/primary_db                            | 6.1 MB   00:00
(16/22): jenkins/primary_db                                |  40 kB   00:02
(17/22): os/7/x86_64/filelists_db                          | 7.2 MB   00:00
(18/22): os/7/x86_64/other_db                              | 2.6 MB   00:00
(19/22): updates/7/x86_64/primary_db                       |  13 MB   00:00
(20/22): updates/7/x86_64/filelists_db                     | 7.4 MB   00:00
(21/22): updates/7/x86_64/other_db                         | 959 kB   00:00
(22/22): jenkins/other_db                                  |  40 kB   00:01
Metadata Cache Created

Virtual machine ping Command Error: ping name or service not known

Problem description

In the process of using VMware, the virtual machine environment was configured, but due to the confusion of pending shutdown, the following errors were found when restarting today:
Ping www.google.com, the following errors are found: Ping name or service not known

Since it can be used correctly before, ensure that the virtual network editor of the virtual machine is configured correctly. If it is the first configuration and has not been successfully started before, you can check the configuration of the network editor.

In the process of finding a solution, the following errors are found by using the restart network command service network restart :
restarting network failed journalctl - Xe for detail control process exited with error code

Problem-solving

systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start network.service

[Solved] Linux shell Script Error: syntax error near unexpected token `do

[problem] the error content reported by the Linux server running the shell script is shown in the following figure.

[reason] incompatible carriage return and line feed characters under Linux and windows

[solution] change the windows newline character “CR lf” in the file to UNIX “LF”

Use Notepad + + to set the view first -> Display symbol -> When all symbols are displayed, you will see “CR lf”

Edit -> with Notepad + +; Document format conversion -> Convert to UNIX (LF)

Re-run to solve the problem.

[Solved] catkin_make Error: pkg_resources.DistributionNotFound: pyparsing

A new workspace is created and catkin_make gives the following error:

Base path: /home/caohaojie/ros_ws
Source space: /home/caohaojie/ros_ws/src
Build space: /home/caohaojie/ros_ws/build
Devel space: /home/caohaojie/ros_ws/devel
Install space: /home/caohaojie/ros_ws/install
####
#### Running command: "cmake /home/caohaojie/ros_ws/src -DCATKIN_DEVEL_PREFIX=/home/caohaojie/ros_ws/devel -DCMAKE_INSTALL_PREFIX=/home/caohaojie/ros_ws/install -G Unix Makefiles" in "/home/caohaojie/ros_ws/build"
####
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:22 (message):
  Search for 'catkin' in workspace failed (catkin_find_pkg catkin
  /home/caohaojie/ros_ws/src): Traceback (most recent call last):
    File "/home/caohaojie/.local/bin/catkin_find_pkg", line 5, in <module>
      from pkg_resources import load_entry_point
    File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2603, in <module>
    File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 666, in require
    File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 565, in resolve
  pkg_resources.DistributionNotFound: pyparsing

-- Configuring incomplete, errors occurred!
See also "/home/caohaojie/ros_ws/build/CMakeFiles/CMakeOutput.log".
Invoking "cmake" failed

 

Solution:
Downgrade the version of catkin-pkg
$pip3 install catkin-pkg==0.4.16 

[Solved] source /etc/profile Error: not a valid identifier

During the recent web automation test, I used Jenkins, a continuous integration tool, and then added my own alicloud server as the node, which is CentOS server. I am ready to install allure and configure the environment variables for it. I have set the environment variables myself, as shown below

-Use the source command to activate the environment variable

source /etc/profile

As a result, the following errors are reported

 

Solution:

Go directly to ~/.bash_profile to add environment variables, then go to activate it, and finally use the following command, go to enter, you can see my alure installation successfully

allure --version

OSS Error: The difference between the request time and the current time is too large

1. Problem
alicloud OSS reports an error when uploading a file: the difference between the request time and the current time is too large

2. Reason
the request was initiated 15 minutes later than the current time of the OSS server. The OSS determines that the request is invalid and returns an error

3. Solution
the system time of OSS adopts GMT time. The system time of the equipment needs to be adjusted to GMT time or its corresponding time zone.