Category Archives: Linux

[Solved] Dpkg: error: dpkg status database is locked by another process

Use the dpkg -i/apt command to install, an error is reported:

————————————————– ———–

dpkg: error: dpkg status database is locked by another process

Unable to obtain lock /var/lib/apt/lists/lock-open

————————————————– ————

1. It may be the software center, just close it, or open ‵System Monitor‵, and kill the process with the words apt, dpkg in the process.

2. It may also be caused by an ubuntu upgrade error or forced interruption, then proceed as follows:

 

$ sudo rm /var/lib/dpkg/lock

$ sudo dpkg –configure -a

$ sudo rm /var/lib/apt/lists/lock

 

 

sudo -i can directly switch root permissions

Linux sendmail can’t send email [How to Solve]

You have been installing sendmail according to the previous installation, but you can’t send email this time. Check the email log and report an error

Jun 18 11:34:23 iZ255lfo12hZ sendmail[4859]: t5I3YJd0004857: to=< [email protected]> , delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120430, relay=mx3.qq.com. [183.57.48.35], dsn=5.0.0, stat=Service unavailable
Jun 18 11:34:23 iZ255lfo12hZ sendmail[4859]: t5I3YJd0004857: to=< [email protected]> , delay=00:00:03, mailer=local, pri=120430, dsn=5.1.1, stat=User unknown
Jun 18 11:34:23 iZ255lfo12hZ sendmail[4859]: t5I3YJd0004857: t5I3YNd0004859: postmaster notify: User unknown
Jun 18 11:34:23 iZ255lfo12hZ sendmail[4859]: t5I3YNd0004859: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31639, dsn=2.0.0, stat=Sent

There is no service, stat = service unavailable, failed to send. My email address also tells stat = user unknown that there is no such user. I have tried all kinds of methods to find information on the Internet, but there is no result. But to 163 mailbox can send mail, and finally found a solution

Solution: resolve the sender’s domain name address to the mail server

[How to Solve] Centos 14: problem making ssl connection

When you execute the yum command, you will be prompted

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not get metalink https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64 error was
14: problem making ssl connection

The solution is to comment out mirrorlist from the [epel] node in the /etc/yum.repos.d/epel.repo file, and baseurl to remove the comment,enable. code>enable with a value of 1

command:

Open the /etc/yum.repos.d/epel.repo file with the vim editor

vim /etc/yum.repos.d/epel.repo

Will

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
# baseurl Remove the # sign before
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
# mirrorlist 前加#好
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
# enable change to 1
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

After modifying the EPEL. Repo file, try the Yum command again, such as:

yum list php

 

[Solved] Shell Script [: -ge/-le/=/… : unary operator expected (standard_in) 1: syntax error

There was a syntax error when writing the script, but the result was correct

Error reporting behavior in script:

for (( i=0; i<=$ line1; i=i+1 ))
do
if [ $(echo “${R12S[i]} < 3” |bc) -eq 1 ] && amp; [ $( echo “${R23S[i]} > 3″|bc) -eq 1 ]\
&& amp; [ $( echo “${R13S[i]} > 3″|bc) -eq 1 ]; then
P1=P1+1
elif [ $(echo “${R12S[i]} > 3” |bc) -eq 1 ] && amp; [ $( echo “${R23S[i]} > 3” |bc) -eq 1 ]\
&& amp; [ $( echo “${R13S[i]} < 3″|bc) -eq 1 ]; then
P2=P2+1
elif [ $(echo “${R12S[i]} > 3” |bc) -eq 1 ] && amp; [ $( echo “${R23S[i]} < 3” |bc) -eq 1 ]\
&& amp; [ $( echo “${R13S[i]} > 3” |bc) -eq 1 ]; then
P3=P3+1
elif [ $(echo “${R12S[i]} > 3” |bc) -eq 1 ] && amp; [ $( echo “${R23S[i]} > 3” |bc) -eq 1 ]\
&& amp; [ $( echo “${R13S[i]} > 3” |bc) -eq 1 ]; then
P4=P4+1
fi
done

The error is as follows:

(standard_ in) 1: syntax error
path.sh: line 84: [: -eq: unary operator expected
(standard_ in) 1: syntax error
path.sh: line 87: [: -eq: unary operator expected
(standard_ in) 1: syntax error
path.sh: line 90: [: -eq: unary operator expected
(standard_ in) 1: syntax error
path.sh: line 93: [: -eq: unary operator expected

Use the SH – C path.sh command to check whether there are syntax errors in the script
or not

However, there is no error, indicating that the script itself is not a problem, the problem should be in the run time

Baidu reported an error [: – EQ: unary operator expected], some netizens said it was because the condition after if had to be double []

So all the conditional statements were modified, but the error was still reported

(standard_ in) 1: syntax error

(standard_ in) 1: syntax error

(standard_ in) 1: syntax error

(standard_ in) 1: syntax error

Later, I found that it was the problem of circulation

for (( i=0; i<=$ line1; This cycle starts from 0 and ends at $Line1, which is equivalent to $Line1 + 1 cycles

However, there is only $Line1 number in the array, so one number is missing, so an error will occur. This also proves why the running result is correct, because the last number is empty, which will not affect the previous number

Modify: change for ((I = 0; i<=$ line1; I = I + 1) is changed to for ((I = 0; i<=$ line1-1; If I = I + 1), there will be no error message when running again

After checking the information again, it is found that many people encounter this type of error reporting:

[: – Ge/- Le/= /…: unary operator expected error

Error reason:

Since the initialization value of the variable rate is empty, it becomes [- Ge “10”]. Obviously [is not compared with “10” and lacks [symbol], so this error is reported

Solution:

1. Check whether the assignment is null due to the wrong writing of the assignment statement

2. Add declare – I rate = 0 before assignment

3. Change it to if [[$rate – Ge 10]] and add a pair of []

CentOS 7 Restart Error: Entering emergency mode. Exit the shell to continue…

1. Enter emergency mode. Exit the shell to continue

2. Fault analysis (guess): file system failure caused by not following the specification to hang up or restart

3. Fault status:

Note: note that the intermediate read is sda3 failed

4. Troubleshooting:

Input command: XFS_ repair -v -L /dev/sda3

-The L option specifies to force log zeroing and XFS_ Repair zeros the log even if it contains dirty data (metadata changes)

Ubuntu Error: Invalid or corrupt jarfile xxx.jar [How to Solve]

1. Problem description

After packaging Maven project into jar package in Ubuntu environment, run the following instructions:

1 $ java -jar my.jar

An error occurred:

1 Error: Invalid or corrupt jarfile my.jar

2. Problem analysis

First, make sure that the jar package is not damaged during transmission

If the jar package is not damaged, it is most likely that the entry information is misconfigured or lost

3. Solutions

Case 1: the configuration of information in manifest.mf file in meta-inf folder in Java directory is wrong

Open the manifest.mf file and observe whether the main function entry corresponding to main class: is correct, for example:

1 Manifest-Version: 1.0
2 Main-Class: com.myproject.Main

Case 2: the information in manifest.mf file is configured correctly, but the program entry cannot be found correctly

In this case, the entry information may be lost in the packaging process, there are too many entries, the main entry is not specified, or the entry cannot be successfully found for other reasons. You can use the – CP instruction to forcibly specify the program entry. The instruction is as follows:

1 $ java -cp my.jar com.myproject.Main

After finding the entry, the program can run smoothly

Git Permission issues: insufficient permission for adding an object to repository database .git

Error in Git pull: invalid permission for adding an object to repository database. Git

(go to the object folder in the warehouse and execute Chmod 777 – R *)

Git made a mistake in pull. The situation is as follows:

[lixinglei@bogon my]$ ll -a|grep .git  
drwxrwxr-x.  8 lixinglei lixinglei 4096 Jun   6 19:58 .git  
-rw-rw-r--.  1 lixinglei lixinglei  109 Apr  23 14:02 .gitignore  
[lixinglei@bogon my]$ cd .git  
[lixinglei@bogon .git]$ cd objects/  
[lixinglei@bogon objects]$ ll | grep root  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 3b  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 68

According to the error prompt, it is found that there is a problem with the ownership of some files under “. Git/objects”:

[lixinglei@bogon my]$ git pull [email protected]:XXX.git  
remote: Counting objects: 29, done.  
remote: Compressing objects: 100% (22/22), done.  
remote: Total 22 (delta 17), reused 0 (delta 0)  
error: insufficient permission for adding an object to repository database .git/objects  
  
fatal: failed to write object  
fatal: unpack-objects failed

Log in as root and enter the directory:

[root@bogon objects]# ll | grep root  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 3b  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 68  
[root@bogon objects]# chown lixinglei: 3b  
[root@bogon objects]# ll | grep root  
drwxr-xr-x. 2 root      root      4096 May  27 19:37 68  
[root@bogon objects]# chown lixinglei: 68  
[root@bogon objects]# cd 68  
[root@bogon 68]# ll  
Totally 4  
-r--r--r--. 1 root root 213 May  27 19:37 cb6ab3332e342158b1b27341a2c396cd570a4c  
[root@bogon 68]# chown lixinglei: cb6ab3332e342158b1b27341a2c396cd570a4c  
[root@bogon 68]# cd ../  
[root@bogon objects]# cd 3b  
[root@bogon 3b]# ll  
Totally 4  
-r--r--r--. 1 root root 1647 May  27 19:37 d60abd850ecacb4002ed870176172426f662d2  
[root@bogon 3b]# chown lixinglei: d60abd850ecacb4002ed870176172426f662d2  

How to deal with git file damage caused by sudden shutdown

Administrator@wangxinqiang-PC MINGW32 /d/juejinqifu (develop)
$ git status
On branch develop
error: inflate: data stream error (unknown compression method)
error: unable to unpack e77ede4f4eb99996e9312a9e8f231d1fc3558db0 header
error: inflate: data stream error (unknown compression method)
fatal: loose object e77ede4f4eb99996e9312a9e8f231d1fc3558db0 (stored in .git/objects/e7/7ede4f4eb99996e9312a9e8f231d1fc3558db0) is corrupt

Administrator@wangxinqiang-PC MINGW32 /d/juejinqifu (develop)
$ git show 831a5d31af4a0af2f5a367689bee27a44efc22c9 > 831a5-file^C

Administrator@wangxinqiang-PC MINGW32 /d/juejinqifu (develop)
$ git show e77ede4f4eb99996e9312a9e8f231d1fc3558db0 > 831a5-file
error: inflate: data stream error (unknown compression method)
error: unable to unpack e77ede4f4eb99996e9312a9e8f231d1fc3558db0 header
error: inflate: data stream error (unknown compression method)
fatal: loose object e77ede4f4eb99996e9312a9e8f231d1fc3558db0 (stored in .git/objects/e7/7ede4f4eb99996e9312a9e8f231d1fc3558db0) is corrupt

Administrator@wangxinqiang-PC MINGW32 /d/juejinqifu (develop)
$ ls .git/objects/e7/7ede4f4eb99996e9312a9e8f231d1fc3558db0
.git/objects/e7/7ede4f4eb99996e9312a9e8f231d1fc3558db0

Administrator@wangxinqiang-PC MINGW32 /d/juejinqifu (develop)
$ rm -rf .git/objects/e7/7ede4f4eb99996e9312a9e8f231d1fc3558db0

Administrator@wangxinqiang-PC MINGW32 /d/juejinqifu (develop)

Node is not handled by link after installation [How to Solve]

Warning:

Error: The brew link step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink share/doc/node/gdbinit /usr/local/share/doc/node is not writable.

sudo chmod 776 /usr/local/lib
brew link --overwrite node
Outputs: Linking /usr/local/Cellar/node/9.6.1... 49 symlinks created
sudo chmod 755 /usr/local/lib

Git prompt error setting certificate verify locations solution

Question: Use git extension to pull or push code, prompt

“C:\Program Files\Git\bin\git.exe” pull –progress “origin” +refs/heads/zjw
fatal: unable to access’https://github.com/**/ ‘: error setting certificate verify locations:

CAfile: C:/Program Files/Git/mingw64/libexec/ssl/certs/ca-bundle.crt
CApath: none
Done

Press Enter or Esc to close console…

This is because git requires security certification when submitting code, which can be set by the following method to cancel the verification

solve:

Find the git config configuration file, the path should be
C:\ProgramData\Git\config, add the following two lines

[http]
sslVerify = false
sslCAinfo = /bin/curl-ca-bundle.crt

After saving, submit the code again.