Category Archives: Linux

[Solved] Failed to get D-Bus connection: Operation not permitted

After installing httpd service in docker, use the command systemctl start httpd.service , and an error is found. The error message is: failed to get D-Bus connection: operation not allowed

Solution: use the command docker run - D -- name centos7 -- privileged = true CentOS: 7/usr/SBIN/init to create a container, and then use docker exec - it centos7/bin/bash to enter the container

Nginx Error: Nginx 403 error:directory index of “xxx“ is forbidden

After deploying the nginx server, enter the IP address and port number and return 403 Forbidden

Check the log error.log and find that the error message is:

directory index of “xxx” is forbidden

Where XXX is the root directory specified in/etc/nginx/nginx.conf.

Root cause of error: when accessing directly using IP address and port number, you need to specify index. If it is not specified, this error occurs.

At this time, you can add configurations in nginx/nginx.conf:
autoindex on# Automatic indexing

In this way, when accessed again, all resource indexes will be listed.

[note] after modifying nginx.conf, remember to restart the service to take effect.

Ubuntu System Goland Error: External file changes sync may be slow: The current inotify(7) watch limit is too low

 

vim /etc/sysctl.conf

Increase the value of fs.inotify.max_user_watches inside (or add the following line if you don't have this value).
fs.inotify.max_user_watches=524288

After saving, execute.
sysctl -p

Restart Goland it's OK

Link: https://stackoverflow.com/questions/65064450/how-to-fix-external-file-changes-sync-may-be-slow-the-current-inotify7-watch

Linux transport error 202: bind failed: Address already in use

Let’s start with the conclusion: the remote debug port is occupied. Replace the port configured by your own script, or directly kill the process occupied by the port, and then occupy the port again

Linux server, starting the project, encountered the following problems:

The error log says that the transmission is wrong and the address has been occupied.

Use the losf - I: port number command to view the occupation of ports, as shown in the figure:

Non root users need to add sudo

Use the kill - 9 process number command to kill the process occupying the port, as shown in the figure:

Re run the project and it will start successfully.

Linux: How to configurate Environment Variables

Configure by modifying the ~ /. Bashrc file in the user directory:

vim ~/.bashrc

# add in the last line
export PATH=$PATH:/home/uusama/mysql/bin

matters needing attention:

Effective time: it takes effect when a new terminal is opened with the same user, or it takes effect manually source ~ /. Bashrc

Effective period: permanent

Effective range: only valid for the current user

If a subsequent environment variable loading file overwrites the Path definition, it may not take effect

Linux Error: _mysql.c:32:20: fatal error: Python.h: No such file or directory [Solved]

Error Description
When installing mysqlclient with pip3, an error occurs:  _mysql.c:32:20: fatal error: Python.h: No such file or directory

pip3 install mysqlclient==1.3.12

Error content

  _mysql.c:32:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

 

Solution:

At first, I saw command 'GCC' failed and thought it was the lack of GCC compilation package, so I installed GCC related tools using Yum or up2date

yum install gcc gcc-c++ kernel-devel

After the installation is completed, an error is still reported, so search:_ Mysql. C: 32:20: fatal error: Python. H: no such file or directory. It is found that python3 devel is missing

CentOS system

Python 2 version execution: sudo Yum install Python devel

Python 3 version execution: sudo Yum install Python 3 devel

Ubuntu, Debian system

Python 2 version execution: sudo apt get install Python dev

Python 3 version execution: sudo apt get install Python 3 dev

After installing the python 3-devel dependency, re-execute it to solve the problem

[Solved] Linux Core Compile Error: No rule to make … ipt_ecn.c

Problem phenomenon:

The following error occurred while compiling the kernel:

make[3]: *** No rule to make target 'net/ipv4/netfilter/ipt_ecn.c', needed by 'net/ipv4/netfilter/ipt_ecn.o'
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2

Cause analysis:

The main reason is that the Linux kernel code is decompressed under windows (I think a convenient reference is also needed on Windows), but some files (such as ipt_ecn. C, etc.) are case sensitive. When decompressing on windows, they overwrite each other because they are not case sensitive, resulting in the lack of files.

Solution:

Just decompress your source code and compile it again. When decompressing under windows, you will be prompted whether the same files need to be processed. Select no for all.

Git Error: fatal: remote origin already exists.

Today, when using git to add a remote GitHub warehouse, you will be prompted with an error: fatal: remote origin already exists

Finally, the solutions are as follows:
1. Delete the remote git warehouse first

$ git remote rm origin

2. Add remote git warehouse

$ git remote add origin [email protected] :FBing/java-code-generator

If an error is reported when git remote RM origin is executed, we can manually modify the contents of the gitconfig file

$ vi .git/config