GPG and Apt-Key make agents that do not read directly from the terminal set up and need to be set separately. Keyserver timed out when trying to add a GPG public key – Unix & Linux Stack Exchange
for example, the default command is:
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEY
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys AKEYXXX
The error of not setting the agent is as follows:
root@ubuntu:/home/zhang# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
Executing: /tmp/apt-key-gpghome.ar8g11QK0Q/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
gpg: keyserver receive failed: Connection timed out
Set the agent as follows:
gpg --keyserver-options http-proxy=test.com:8080/" --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys SOMEKEY
apt-key adv --keyserver-options http-proxy=test.com:8080/" --keyserver hkp://keyserver.ubuntu.com --recv-keys AKEYXXX
div>
Centos6 suddenly cannot access the network VM communication interface socket family: failed
Question:
VM communication interface socket family: failed
Determining IP information for eth0... failed; no link present. Check cable?
Solutions:
- open the terminal, administrator identity (su, then enter the password), run
/usr/bin/vmware-config-tools.pl -d
, close the image, close the virtual machine, and restart the computer. ps: copy a big guy’s picture, encounter similar problem.

Use yum to prompt Error: rpmdb open failed
rpmdb: Thread/process 6539/140448388269824 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
The reason is that the RPM database is corrupted
Restore the database to normal after rebuilding:
cd /var/lib/rpm/
for i in `ls | grep 'db.'`;do mv $i $i.bak;done
rpm --rebuilddb
yum clean all
div>
Linux dynamically loads kernel modules
Linux is a single kernel. In order to make up for the poor scalability and maintenance of a single kernel, Linux introduces dynamic loadable kernel modules, which can be loaded into or unloaded from the kernel during the running of the system. A module is a stand-alone program that can be compiled but not run independently. It is linked to the kernel at runtime and runs in kernel space as part of the kernel. A module usually consists of a set of functions and data structures used to implement a file system, a driver, or other functions on top of the kernel.
Here’s a simple example: the
(1) module hello.c file
#include <linux/init.h>
//specify the initialization and cleanup functions
#include <linux/module.h>
// Contains definitions for a large number of functions and symbols needed to load the module.
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("WFJ");
// Declare the module's license, for any version of the GNU General Public License
static int hello_init (void)
{
printk(KERN_ALERT "Hello module init/n");
return 0;
}
//The initialization function should be declared as static.
static void hello_exit (void)
{
printk(KERN_ALERT "Hello module exit/n");
}
//Purge function, which logs out the interface and returns all resources to the system before the module is removed.
module_init(hello_init);
//This macro definition adds a special segment to the module object code, indicating where to find the module's initialization function.
//Without this definition, the initialization function will not be called.
module_exit(hello_exit);
A Linux kernel module must contain module initialization and module uninstall functions, which run at insmod and rmMOD, which must be defined before the macros module_init and module_exit are used, otherwise there will be a compilation error.
(2) Makefile file
CONFIG_MODULE_SIG=n
obj-m := hello.o
KERNELBUILD :=/usr/src/linux-source-3.13.0
default:
make -C $(KERNELBUILD) M=$(shell pwd) modules
clean:
rm -rf *.o *.ko *.mod.c .*.cmd .tmp_versions *.order *.symvers
(3) the compilation Module
is compiled with make
command. After the compilation, several new files will be produced: hello.ko, hello.mod. C, hello.mod. O, hello.o, modules. Order, module.symvers. Where Hello.ko is required.
(4) insert module
sudo insmod hello.ko
(5) View module
lsmod
Lsmod is short for list Modules. It lists all the modules.
does not print out the output of hello.c file on the port, but you can use the dmesg command to view it.
dmesg > hello.txt
Save the output of dMESg in the hello.txt file. If the CONFIG_MODULE_SIG=n statement is not included in the Makefile, then the hello.txt file will show: Hello: module verification failed: signature and/or required key missing-tainting kernel
: module verification failed. If this statement is present, the hello.txt file will show:
[ 9753.846136] Hello module init/n
[12601.703040] Hello module exit/n
That is: output the output content of the hello.c file.
(7) unload the module
sudo rmmod hello.ko
yum Times Error: rpmdb open failed solution
Yum-y install Telnet
error: rpmdb: BDB0113 Thread/process 29682/140047880361792 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
Solutions:
cd /var/lib/rpm
rm -rf __db*
rpm --rebuilddb
div>
linux startx problem
Today, I suddenly found that none of the users except root could start startx.
Fatal server error:
PAM authentication failed, cannot start X server.
Perhaps you do not have console ownership?
When reporting a problem related to a server crash, please send
the full server output, not just the last messages.
Please report problems to [email protected].
giving up.
xinit: No such file or directory (errno 2): unable to connect to X server
xinit: No such process (errno 3): Server error.
Couldnt get a file descriptor referring to the console
Solution:
Check /var/run/console.lock contains the username, and /var/run/console/< user> To exist. When authenticating, pam_console compares the user name to the content of Console.lock, and if not, the authentication fails. /var/run/console/< user> Used to record the number of times the user logged in, and then the console.lock can be deleted after the user logged out.
Solutions:
I used the ordinary user of Oracle. I created a file named Oracle by running touch Oracle command under /var/run/console/, and then I could enter the graphical interface by re-running Startx.
Solve the problem of Too many levels of symbolic links
Too many levels of symbolic links
when using ln to create soft links
root@instance-vgiv786y:/opt/jdk1.8.0_181/bin# ln-s Java /usr/local/bin/ Java
change to:
root @instancevgiv786y :/opt/jdk1.8.0_181/bin# ln-s /opt/jdk1.8.0_181/bin/ Java /usr/local/bin/ Java
Obviously I’m installing the JDK, but why would I want to create this soft connection?Just add the environment variable at /etc/profile
. However, when I connected this server as one of Jenkins’ nodes, I was surprised to find that Java could not be found. Obviously, I added the environment variable and it took effect. Jenkins had to look under various bin
directory, so I created this soft connection.
ssh can connect but sftp can not connect
sftp subsystem request is rejected.
please make sure that sftp subsystem is properly installed in ssh server.
Here’s why:
[root@bogon ~]# tail /var/log/secure
Feb 23 16:29:48 localhost sshd[2989]: subsystem request for sftp
Feb 23 16:29:48 localhost sshd[2989]: subsystem request for sftp failed, subsystem not found
It can be seen that there is no directory for FTP – Server
Let’s look for the path address of FTP – Server:
[root@bogon ~]# locate sftp-server
/usr/libexec/openssh/sftp-server
/usr/share/man/man8/sftp-server.8.gz
Then open configuration:
[root@bogon ~]# vi /etc/ssh/sshd_config
will
# # override the default of no subsystems
Subsystem SFTP/usr/libexec/openssh/SFTP server. –
replace
# override the default of no subsystems
Subsystem SFTP/usr/libexec/openssh/SFTP server. –
Ok, load SSHD again.
[root@bogon ~]# /etc/init.d/sshd reload
Reconnect found OK.
ssh port forwarding
Goddady’s Linux virtual host is used to provide SSH. However, when using SSH-D port XXX @server, I encountered the following error of SSH printing:
channel 3: open failed: administratively prohibited: open failed
When the Firefox browser is configured with SOCKS5 pointing to a local port, browsing any web page appears blank.
What is the reason for this?
SSH, open sSHd_config and have a look.
cat /etc/ssh/sshd_config
There was a row:
AllowTcpForwarding no
The original host set the TCP port forwarding for SSH to be disabled. That wants to use SSH as agent to carry out port forwarding is certainly unsuccessful.
Look at the system configuration again, also prohibit IP forwarding;
cat /etc/sysctl.conf | grep ip_forward
net.ipv4.ip_forward = 0
Therefore, the virtual host prompt port forwarding is prohibited, normal.
Apache2 cannot be started and an error is reported for apache2.service failed because the control process exited with error code.
Today, when I was preparing to use Kali to build a website, The Apache server could not run normally. After patiently understanding the error code and Baidu finally solved the problem.
1. Error problem:
When you started apache2, the following error occurred. At first I thought it was not root, but switching to root still reported an error.
root@kali:/root# service apache2 start
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
At that time, I felt that KALI had not been used for a long time, because the software package was too old, so I updated it first.
root@kali:~# apt-get update
But the same error is reported, so you view the error message through the apache2 –help command.
apache2 --help
[Mon Apr 13 23:45:17.772837 2020] [core:warn] [pid 24587] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
No new Apache environment variables were imported due to a change in the Apache configuration file after the upgrade. Solutions:
source /etc/apache2/envvars
Update later and still report an error, but the error message is different. The reasons for the error are:
root@kali:/root# apache2 --help
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
2. Solution:
Through the error code, we can know that it should not be able to bind to port 80, because the default port of Apache is 80. Of course, now there are two choices, one is to kill the process occupying the port, and the other is the better default port of Apache. I choose the first one.
First look at what process is occupying the port.
root@kali:/root# netstat -lnp|grep 80
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 18594/gsad
unix 2 [ ACC ] STREAM LISTENING 18198 808/VGAuthService /var/run/vmware/guestServicePipe
Then kill the process.
root@kali:/root# kill -9 18594
Finally, apache2 was successfully restarted.
root@kali:/root# /etc/init.d/apache2 start
[ ok ] Starting apache2 (via systemctl): apache2.service.
You can also change the default port for apache2, as shown in the response on StackOverflow.
Build LNMPR Error — php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
background
After installing Ubuntu subsystem in Win10 system, L(Linux)N(Nginx)M(mysql)P(PHP)R(Redis) environment was set up.
The error message
php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
The screening process
- check whether the services of nginx, php-fpm and redis-server are started normally;
sudo /etc/init.d/nginx status
check whether win10 can ping the ubuntu subsystem; Check if Redis configuration is correct; Check that Hosts is configured correctly; is finally determined that DNS cannot be resolved normally, and DNS configuration
needs to be modified
The solution
Gateway configuration:
, 1 sudo vi/etc/resolvconf resolv. Conf., d/base code>
# 添加下面网关(223.5.5.5 和 223.6.6.6 是阿里的网关)
nameserver 223.5.5.5
nameserver 223.6.6.6
2, sudo resolvconf-u
will synchronize the configured DNS to /etc/resolv.conf
3, check vi /etc/resolv.conf
whether there is a newly configured DNS
4. Restart PHP sudo /etc/init.d/php-fpm restart
ubuntu install mysqlclient error ERROR: Failed building wheel for mysqlclient solution
Under Windows error
This site has been written by many predecessors, go to this site to download the corresponding file installation is good I will not teach fish to swim.
An error under ubuntu
(cai_django) ubuntu@VM-0-2-ubuntu:~$ pip3 install mysqlclient
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting mysqlclient
Downloading http://mirrors.tencentyun.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.ta
|████████████████████████████████| 92kB 711kB/s
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/.virtualenvs/cai_django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jqj_z28, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bd
cwd: /tmp/pip-install-jqj_z28y/mysqlclient/
Complete output (31 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY6m -I/home/ubuntu/.virtualenvs/cai_django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,re-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpyth
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /home/ubuntu/.virtualenvs/cai_django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jqj_zze, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' all-headers /home/ubuntu/.virtualenvs/cai_django/include/site/python3.6/mysqlclient
cwd: /tmp/pip-install-jqj_z28y/mysqlclient/
Complete output (31 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTI3.6m -I/home/ubuntu/.virtualenvs/cai_django/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,ux-x86_64-3.6/MySQLdb/_mysql.o -lmysqlclient -lpthread -lz -lm -lrt -latomic -lssl -lcrypto -ldl -o build/lib.linux-x86_64-3.6/MySQLdb/_mysql.cpy
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/ubuntu/.virtualenvs/cai_django/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argvnt/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(cternally-managed --compile --install-headers /home/ubuntu/.virtualenvs/cai_django/include/site/python3.6/mysqlclient Check the logs for full com
The key point is ERROR: Failed Building Wheel for MysqlClient
The solution
sudo apt-get install python3 python-dev python3-dev
sudo apt-get install build-essential libssl-dev libffi-dev
sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev
Install it all again
pip3 install mysqlclient
The problem is solved.