Tag Archives: linux

[Solved] fatal error: openssl/hmac.h: No such file or directory

Background

Error in compiling MSOffice encryption binary file on Debian 10 server

GitHub address: https://github.com/herumi/msoffice

report errors:

root@e0fef8daa858:/var/www/msoffice# make -j RELEASE=1
/usr/bin/make -C src
make[1]: Entering directory '/var/www/msoffice/src'
g++ -c msoffice-crypt.cpp -o release/msoffice-crypt.o -g -D_FILE_OFFSET_BITS=64 -msse2 -fno-operator-names -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith  -Ofast -fomit-frame-pointer -DNDEBUG -march=native -msse4 -I/var/www/msoffice/include -I/var/www/msoffice/../cybozulib/include -I/var/www/msoffice/../mie/include
g++ -c attack.cpp -o release/attack.o -g -D_FILE_OFFSET_BITS=64 -msse2 -fno-operator-names -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith  -Ofast -fomit-frame-pointer -DNDEBUG -march=native -msse4 -I/var/www/msoffice/include -I/var/www/msoffice/../cybozulib/include -I/var/www/msoffice/../mie/include
In file included from /var/www/msoffice/include/decode.hpp:14,
                 from msoffice-crypt.cpp:16:
/var/www/msoffice/../cybozulib/include/cybozu/crypto.hpp:30:10: fatal error: openssl/hmac.h: No such file or directory
   30 | #include <openssl/hmac.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [../common.mk:57: release/msoffice-crypt.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from /var/www/msoffice/include/attack.hpp:14,
                 from attack.cpp:14:
/var/www/msoffice/../cybozulib/include/cybozu/crypto.hpp:30:10: fatal error: openssl/hmac.h: No such file or directory
   30 | #include <openssl/hmac.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [../common.mk:57: release/attack.o] Error 1
make[1]: Leaving directory '/var/www/msoffice/src'
make: *** [Makefile:7: all] Error 2

Solution:

To solve this problem, you need to install the OpenSSL development package, execute the following command to install it, and then recompile it

apt update && apt install libssl-dev

If it is CentOS, you can execute the following command to solve the problem

yum install openssl-dev -y

[Solved] vcpkg Error: Error: Could not detect vcpkg-root.

Phenomenon

When transferring vcpkg from CentOS 8 to CentOS virtual machine through SCP, the above error is always reported when running vcpkg

Root cause

The Linux environment needs to add the system variable $VCPKG_ROOT

Solution:

vim ~/. bash_profile

Add a line:

export VCPKG_ROOT=”/home/devuser1/vcpkg”

Change the directory to your directory

Close the shell, reconnect, and everything is OK

verification

[root@localhost vcpkg]# ./vcpkg list
abseil:x64-linux                                   2021-03-24#1     an open-source collection designed to augment th...
amqpcpp:x64-linux                                  4.3.11           AMQP-CPP is a C++ library for communicating with..

[Solved] MySQL Startup Error: Job for mysqld.service failed because the control process exited with error code

Question

An error is reported when starting MySQL service, as shown below:

[root@node2 hadoop]# systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.

or

[root@node2 hadoop]# systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.

Solution

This is because the /var/lib/MySQL directory has insufficient permissions

[root@node2 hadoop]# cd /var/lib/mysql
[root@node2 mysql]# ll
all 167348
-rw-r-----. 1 root  root        56 6月  19 20:00  auto.cnf
-rw-r-----. 1 mysql mysql        0 6月  19 20:01  binlog.index
-rw-------. 1 root  root      1676 6月  19 20:00  ca-key.pem
-rw-r--r--. 1 root  root      1112 6月  19 20:00  ca.pem
-rw-r--r--. 1 root  root      1112 6月  19 20:00  client-cert.pem
-rw-------. 1 root  root      1676 6月  19 20:00  client-key.pem
-rw-r-----. 1 root  root    196608 6月  19 20:00 '#ib_16384_0.dblwr'
-rw-r-----. 1 root  root   8585216 6月  19 20:00 '#ib_16384_1.dblwr'
-rw-r-----. 1 root  root      3595 6月  19 20:00  ib_buffer_pool
-rw-r-----. 1 root  root  12582912 6月  19 20:00  ibdata1
-rw-r-----. 1 root  root  50331648 6月  19 20:00  ib_logfile0
-rw-r-----. 1 root  root  50331648 6月  19 20:00  ib_logfile1
drwxr-x---. 2 root  root         6 6月  19 20:00 '#innodb_temp'
drwxr-x---. 2 root  root         6 6月  19 20:00  mysql
-rw-r-----. 1 root  root  15728640 6月  19 20:00  mysql.ibd
drwxr-x---. 2 root  root      8192 6月  19 20:00  performance_schema
-rw-------. 1 root  root      1676 6月  19 20:00  private_key.pem
-rw-r--r--. 1 root  root       452 6月  19 20:00  public_key.pem
-rw-r--r--. 1 root  root      1112 6月  19 20:00  server-cert.pem
-rw-------. 1 root  root      1676 6月  19 20:00  server-key.pem
-rw-r-----. 1 root  root  16777216 6月  19 20:00  undo_001
-rw-r-----. 1 root  root  16777216 6月  19 20:00  undo_002

Modify permissions and start MySQL

[root@node2 ~]# setenforce 0 
[root@node2 ~]# chown -R mysql:mysql /var/lib/mysql
[root@node2 ~]# chmod -R 777 /var/lib/mysql
[root@node2 ~]# systemctl start mysqld.service
[root@node2 ~]# ps -ef |grep mysql
mysql      26627       1  4 23:57 ?       00:00:00 /usr/sbin/mysqld
root       26671   10438  0 23:57 pts/0    00:00:00 grep --color=auto mysql
[root@node2 ~]# cd /var/lib/mysql
[root@node2 mysql]# ll
all 190916
-rw-r-----. 1 mysql mysql       56 6月  19 23:57  auto.cnf
-rw-r-----. 1 mysql mysql      156 6月  19 23:57  binlog.000001
-rw-r-----. 1 mysql mysql       16 6月  19 23:57  binlog.index
-rwxrwxrwx. 1 mysql mysql     1680 6月  19 23:50  ca-key.pem
-rwxrwxrwx. 1 mysql mysql     1112 6月  19 23:50  ca.pem
-rwxrwxrwx. 1 mysql mysql     1112 6月  19 23:50  client-cert.pem
-rwxrwxrwx. 1 mysql mysql     1676 6月  19 23:50  client-key.pem
-rwxrwxrwx. 1 mysql mysql   196608 6月  19 23:57 '#ib_16384_0.dblwr'
-rwxrwxrwx. 1 mysql mysql  8585216 6月  19 23:50 '#ib_16384_1.dblwr'
-rwxrwxrwx. 1 mysql mysql     6059 6月  19 23:50  ib_buffer_pool
-rwxrwxrwx. 1 mysql mysql 12582912 6月  19 23:57  ibdata1
-rwxrwxrwx. 1 mysql mysql 50331648 6月  19 23:57  ib_logfile0
-rwxrwxrwx. 1 mysql mysql 50331648 6月  19 23:50  ib_logfile1
-rw-r-----. 1 mysql mysql 12582912 6月  19 23:57  ibtmp1
drwxrwxrwx. 2 mysql mysql      187 6月  19 23:57 '#innodb_temp'
drwxrwxrwx. 2 mysql mysql      143 6月  19 23:50  mysql
-rwxrwxrwx. 1 mysql mysql 27262976 6月  19 23:57  mysql.ibd
srwxrwxrwx. 1 mysql mysql        0 6月  19 23:57  mysql.sock
-rw-------. 1 mysql mysql        6 6月  19 23:57  mysql.sock.lock
drwxrwxrwx. 2 mysql mysql     8192 6月  19 23:50  performance_schema
-rwxrwxrwx. 1 mysql mysql     1676 6月  19 23:50  private_key.pem
-rwxrwxrwx. 1 mysql mysql      452 6月  19 23:50  public_key.pem
-rwxrwxrwx. 1 mysql mysql     1112 6月  19 23:50  server-cert.pem
-rwxrwxrwx. 1 mysql mysql     1680 6月  19 23:50  server-key.pem
drwxrwxrwx. 2 mysql mysql       28 6月  19 23:50  sys
-rwxrwxrwx. 1 mysql mysql 16777216 6月  19 23:57  undo_001
-rwxrwxrwx. 1 mysql mysql 16777216 6月  19 23:57  undo_002
[root@node2 mysql]# 

Note:

  1. Setenforce 0 is used to solve [InnoDB] Operating system error number 13 in a file operation.
  2. Directory permissions must be set to 777, just 755 will also cause an error

[Solved] Virtual machine Failed to restart network Error: Error:Failed to start LSB: Bring up/down networking

Problem description

A virtual machine that has been running normally. After a shutdown and restart, it is found that SSH cannot connect

Restart network discovery failed

service networkrestart

Solution:

[root@lexsaints ~]#systemctl stop NetworkManager
[root@lexsaints ~]#systemctl disable NetworkManager
[root@lexsaints ~]#systemctl restart  network
or
[root@lexsaints ~]#systemctl  restart NetworkManager
[root@lexsaints ~]#systemctl restart  network

Cause of problem

NetworkManager is a program that detects the network and automatically connects to the network.

Whether it’s wireless or wired, it makes it easy for you to manage.

For wireless networks, the network manager can automatically switch to the most reliable wireless network.

The program using the network manager can freely switch between online and offline modes.

The network manager can preferentially select wired network and support VPN.

The network manager was originally developed by RedHat and is now managed by gnome.

[Solved] CUDA failure 999: unknown error ; GPU=-351697408 ; hostname=4f5e6dff58e6 ; expr=cudaSetDevice(info_.device_id);

How to Solve error: CUDA failure 999: unknown error

1. Error Message:

CUDA failure 999: unknown error ; GPU=-351697408 ; hostname=4f5e6dff58e6 ; expr=cudaSetDevice(info_.device_id);

 

2. Solution:

To reload the nvidia kernel module, enter the following command.

sudo rmmod nvidia_uvm

sudo modprobe nvidia_uvm

[Solved] Fatal error in PMPI_Init: Other MPI error, error stack:MPIR_Init_thread(138)

1. Problems

Use the compiler of onepai 2021.3. After compiling the program, use the slurm scheduling system to run the job and report an error:

2. Solutions

In the sbatch script of slurm, add the environment variable of libpmi2.so

export I_MPI_PMI_LIBRARY=../slurm/lib/libpmi2.so

If the application image is made in a container (such as docker)

1. Copy the libpmi2.so file into the container

2. At the same time, the corresponding environment variables are configured for export

 

[Solved] Compose error “HTTP request took too long to complete“

Recently, I noticed that the following error messages often appear in docker-compose:

ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

Adding COMPOSE_HTTP_TIMEOUT seems to only delay the error. Is this a known issue? Or is there a workaround?
Tried increasing the COMPOSE_HTTP_TIMEOUT environment variable and it didn’t work.

# Increase timeout period to 120 seconds.
export COMPOSE_HTTP_TIMEOUT=120;
# Rebuild all containers using the new images.
docker-compose up -d;

# or use docker-compose --verbose up -d to check out the errors

My Solution:

sudo service docker restart
docker-compose up

Maybe I have a high inode

df -ih			#  -i, --inodes   List information about information nodes, not data block usage
Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             493K   390  492K    1% /dev
tmpfs            494K   537  494K    1% /run
/dev/xvda1       1.3M  1.2M   70K   95% /
tmpfs            494K     1  494K    1% /dev/shm
tmpfs            494K     3  494K    1% /run/lock
tmpfs            494K    16  494K    1% /sys/fs/cgroup
tmpfs            494K     4  494K    1% /run/user/1000

[Solved] gawk: error while loading shared libraries: libreadline.so.4

While cross-compiling, I encountered gawk: error while loading shared libraries: libreadline.so.4: cannot open shared object file: No such file or directory. The current build environment is x86_64, Ubuntu 20.04, the target runtime environment is mips32. The first thing I thought of when I encountered this problem was to install this lib.

On Ubuntu, we can use the apt-file program to find out where this library is installed. If you don’t have apt-file installed on your system, you need to install apt-file first, and then run it as follows:

$sudo apt-file update
$sudo apt-file search libreadline.so.4   #find no results
$sudo apt-file search libreadline.so    #returns the following
lib32readline-dev: /usr/lib32/libreadline.so

lib32readline8: /lib32/libreadline.so.8

lib32readline8: /lib32/libreadline.so.8.0

libreadline-dev: /usr/lib/x86_64-linux-gnu/libreadline.so

libreadline-gplv2-dev: /usr/lib/x86_64-linux-gnu/libreadline.so

libreadline5: /lib/x86_64-linux-gnu/libreadline.so.5

libreadline5: /lib/x86_64-linux-gnu/libreadline.so.5.2

libreadline5-dbg: /usr/lib/debug/libreadline.so.5

libreadline5-dbg: /usr/lib/debug/libreadline.so.5.2

libreadline8: /lib/x86_64-linux-gnu/libreadline.so.8

libreadline8: /lib/x86_64-linux-gnu/libreadline.so.8.0

libreadline.so.4 is a very old library and is no longer available on Ubuntu’s library sources, but try the later versions. Since the source code is developed and compiled on 32bit centos, choose the 32bit library: lib32readline8.

Run as below:

$sudo apt install lib32readline8

After installation, enter the /lib32 directory and you can see libreadline.so.8 and libreadline.so.8.0.

lrwxrwxrwx 1 root root     18 Feb 25  2020 /lib32/libreadline.so.8 -> libreadline.so.8.0
-rw-r--r-- 1 root root 311884 Feb 25  2020 /lib32/libreadline.so.8.0

Then run:

$ sudo ln -sv /lib32/libreadline.so.8.0 /lib32/libreadline.so.4

In $ls -l you can see that the symbolic link has been created.

However, running the cross-compilation task still reports the same error. After posting this issue on stack overflow, someone left a comment below reminding me to fix not libreadline.so.4, but the gawk version being too old.

I ran $gawk which prompted no such command, so

$sudo apt install gawk

Then Enter $gawk –version to check the other version, and return

GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)

Enter $whereis gawk to find its installation path:

gawk: /usr/bin/gawk /usr/lib/x86_64-linux-gnu/gawk /usr/share/man/man1/gawk.1.gz

The path is /usr/bin, and running the cross-compile job again still gives the same error, which means that there is another gawk installed in a directory that is called first when running the cross-compile. And this directory is not in the $PATH, or if it is, it is after /usr/bin.

I found the possible installation directory of gawk in the configuration file of the source code to be compiled, cd to that directory, run $gawk, and report the same error, and here it is. Run the following command:

$cp /usr/bin/gawk gawk

Run gawk in the current directory again to confirm that it has been updated to the latest version.

Run cross compilation again without error. The problem has been solved.

[FAILED] Failed to start Raise network interfaces

[FAILED] Failed to start Raise network interfaces. 

The following error occurred during startup. Linux and windows cannot communicate. The reason may be that DHCP and static IP conflict. Use the ifconfig command to check that there is only IPv6 address but no IPv4 address.

 

Solution:

Modify the following file: /etc/network/interfaces.d/eth0, remove static IP settings or DHCP settings:
for example:

remove DHCP and replace it with:

auto eth0
iface eth0 inet static
address 192.168.2.99
netmask 255.255.255.0

Restart and the problem is solved.

[Solved] Docker Download Mirror Error: Cannot connect to the Docker daemon at…

If you want to download an image with docker, you will report an error

cannot connect to the docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

cause analysis: maybe docker did not exit normally last time, so docker did not start normally, and the docker process could not be found in the corresponding /var/run/ path.

Solution:
enter the command

systemctl start docker.service

Then you can download

Ubuntu18.04 Install ROS Error: rosdep update [How to Solve]

In the installation of ros for rosdep update often reported errors, there is a way to 100% success, solved by modifying the download source files, a total of 5 files, here is a record.

1) open sources_list.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

1.1 add a line between lines 310 and 311

url = 'https://ghproxy.com/'+url

After adding, it is shown in the following figure.

1.2 Modify line 72 and add after the equal sign

'https://ghproxy.com/' + 

After modification, it is shown in the following figure.

After modification, save and exit.

2) open gbpdistro_support.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py

2.1 Modify line 36 to add

'https://ghproxy.com/' + 

After modification, it is shown in the following figure.

2.2 modify 204 lines and add the same contents as 2.1

After modification, see the following figure.

After modification, save and exit.

3) open rep3.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

Modify line 39 and add the same content as 2.1, namely

'https://ghproxy.com/' + 

After modification, it is shown in the following figure.

After modification, save and exit.

(4) open __init__.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

Line 68, add the same as 2.1, namely

'https://ghproxy.com/' + 

After modification, it is shown in the following figure.

After modification, save and exit.

5 open github.py

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py

Amend line 68 to add

'https://ghproxy.com/' + 

After modification, it is shown in the following figure.

After modification, save and exit.

After all the modifications are saved, execute rosdep update. After the update is completed, see the following figure:

[Solved] openssl error: libcrypto.so.1.0.0: cannot open shared object file: Error 40

Problem Description: start to execute OpenSSL and report an error:

openssl

openssl: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

Then find the corresponding file through the search instruction, and soft connect it

find/-name libcrypto.so.1.0.0    find files
/opt/acb/lib/libcrypto.so.1.0.0   search the outcome
ln -s libcrypto.so.1.0.0 /usr/lib64/  soft connect

However, it is found that the implementation of OpenSSL still reports errors, as follows

openssl
openssl: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: Error 40

Check libcrypto.so.1.0.0 that reported error, and find that libcrypto.so.1.0.0 is also a soft connection

lrwxrwxrwx 1 splunk root      15 Jan  9  2020 libssl.so -> libssl.so.1.0.0
-r-xr-xr-x 2 splunk root  485304 Jan  9  2020 libssl.so.1.0.0

The solution is to connect the source file directly and solve the problem

ln -s libcrypto.so /usr/lib64/libcrypto.so.1.0.0