Category Archives: Linux

[Solved] Module yaml error: Unexpected key in data: static_context

Problem description

An error occurs when executing the linux command on centos8

[root@VM-16-14-centos ~]# dnf update epel-release
Repository epel is listed more than once in the configuration
Last metadata expiration check: 2:24:16 ago on Mon 25 Apr 2022 07:27:51 AM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Dependencies resolved.
Nothing to do.
Complete!

Solution:

It can be solved by upgrading libmodulemd (DNF upgrade libmodulemd). The problem can be fixed in libmodulemd-2.13.0-1.fc33.

[Solved] Jenkins build error: esbuild install failed

When building the front-end package of the company’s test environment, an error was suddenly reported and the construction failed. After checking the log, an error was reported and the esbuild installation failed. I have not installed this esbuild on Jenkins server, and the code proposed by the development is no problem.
solution:
first look for the esbuild directory in the front-end package. I found that there are two esbuild directories in my front-end package, and then I went in and found that there are install JS file, NPM – V check your own NPM version. If it is greater than 7, execute
node node_modules/esbuild/install.js
after manual installation, build from Jenkins again, and there will be no error

[Solved] Linux startup jar package error: Communications link failure

Linux Start jar package error: Communications link failure
Error Messages:

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

create connection SQLException, url: jdbc:mysql://www.shaoming.com:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai, errorCode 0, state 08S01

 

Solution:

Modify the information of the database connection you had setted before.

url: jdbc:mysql://www.shaoming.com:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

Modified data connection information

 url: jdbc:mysql://www.shaoming.com:3306/renren_security?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

[Solved] kali Execute history -c Error: fc: event not found: – C

Error content: “FC: event not found: – C”

Error reason: Kali’s default shell environment has been changed from bash to Zsh, and history – C needs to run in Bash environment

Method 1: Clear history command

rm -rf /root/.zsh_history
exit

Method 2: Clear history command

cat /dev/null > .zsh_history 
rm .zsh_history
exit

Note: after execution, you need to log in again to take effect

[Solved] gcc: error trying to exec ‘cc1‘: execvp: No such file or directory

An execution error occurred after installing GCC An error occurred while loading the C file

gcc: error trying to exec 'cc1': execvp: No such file or directory

After adding environment variables

whereis cc1

Find out where CC1 is

/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1

Position of CC1 in my centos7

If you can’t find it

locate cc1

Once found, copy

/usr/libexec/gcc/x86_64-redhat-linux/4.8.2

then

PATH="$PATH":/usr/libexec/gcc/x86_64-redhat-linux/4.8.2

Import environment variables

export PATH

That’s it

Debian9 g++ Compile Error: error: ‘EDOM’ was not declared in this scope

In file included from /usr/include/c++/6/bits/basic_string.h:5417:0,
                 from /usr/include/c++/6/string:52,
                 from ../../../linux/../Include/I2Str.h:3,
                 from ../../../linux/../Include/trk_CfgMgr.h:11,
                 from ../../../linux/../Include/trk_svc_policy.h:10,
                 from trk_svc_tk_policy_sync.cpp:9:
/usr/include/c++/6/ext/string_conversions.h: In function ‘_Ret __gnu_cxx::__stoa(_TRet (*)(const _CharT*, _CharT**, _Base ...), const char*, const _CharT*, std::size_t*, _Base ...)’:
/usr/include/c++/6/ext/string_conversions.h:72:25: error: ‘ERANGE’ was not declared in this scope
       else if (errno == ERANGE
                         ^~~~~~
In file included from /usr/include/c++/6/system_error:39:0,
                 from /usr/include/c++/6/bits/ios_base.h:46,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from ../../../linux/../Include/I2Str.h:4,
                 from ../../../linux/../Include/trk_CfgMgr.h:11,
                 from ../../../linux/../Include/trk_svc_policy.h:10,
                 from trk_svc_tk_policy_sync.cpp:9:
/usr/include/x86_64-linux-gnu/c++/6/bits/error_constants.h: At global scope:
/usr/include/x86_64-linux-gnu/c++/6/bits/error_constants.h:47:35: error: ‘EDOM’ was not declared in this scope
       argument_out_of_domain =    EDOM,
                                   ^~~~
/usr/include/x86_64-linux-gnu/c++/6/bits/error_constants.h:75:34: error: ‘EILSEQ’ was not declared in this scope
       illegal_byte_sequence =    EILSEQ,
                                  ^~~~~~
/usr/include/x86_64-linux-gnu/c++/6/bits/error_constants.h:148:32: error: ‘ERANGE’ was not declared in this scope
       result_out_of_range =    ERANGE,

 

Solution:
Add #include <errno.h>

[Solved] Linux wget Error: ERROR: cannot verify Issued certificate has expire

Linux wget download Tomact error.

The following error appears:

wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.78/bin/apache-tomcat-8.5.78.tar.gz --2022-04-06 21:54:57-- https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.78/bin/apache-tomcat-8.5.78.tar.gz Resolving dlcdn.apache.org (dlcdn.apache.org)… 191.101.2.132, 2a04:4e42::644 Connecting to dlcdn.apache.org (dlcdn.apache.org)|191.101.2.132|:443… connected. ERROR: cannot verify dlcdn.apache.org’s certificate, issued by ‘/C=US/O=Let’s Encrypt/CN=R3’: Issued certificate has expired. To connect to dlcdn.apache.org insecurely, use `–no-check-certificate’.

 

Solution:

Add parameters in wget: –no-check-certificate

「wget –no-check-certificate https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.78/bin/apache-tomcat-8.5.78.tar.gz」

Done!!!

[Solved] Ubuntu 20.04.3 Fail to Start sshd Error: Failed to start OpenBSD Secure Shell server

Environmental Science:

Ubuntu 20.04.3-live-server
Hyper-V virtual environment

Problem Description:

Ubuntu 20.04.3 fails to start sshd with error: failed to start OpenBSD secure shell server
sshd – T
prompt sshd: no hostkeys available – exiting.

Solution:

1. Check whether the SSH service is enabled
PS - e | grep ssh

No response

2. Install ssh

 apt update
apt-get install openssh-server openssh-client

Prompt installed

3. Implementation

/etc/init.d/ssh start

fail to start

Continue to execute ssh-keygen -A
Restart successfully

[Solved]unpacking of archive failed: cpio: lstat failed – Not a directory

A strange CPIO error was reported when installing the RPM package on the company server today. (most errors can be solved by reinstalling CPIO or downloading RPM package again)

unpacking of archive failed: cpio: lstat failed - Not a directory

 

Solution:

After learning CPIO, I found a solution:

Step 1: check the directory required by the RPM package

 rpm2cpio XXXX.rpm | cpio -idmv

Step 2: check the corresponding directory, and you will find that it really exists, and it is not a directory…

Step 3: delete this directory and reinstall successfully!!!!

Reference: https://access.redhat.com/solutions/6189481

[Solved] NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver

environment

– notebook model: Dell precision 5520
– graphics card model: M1200
– system: Ubuntu 20.04

 

Question

After installing the N card driver, execute NVIDIA SMI , and an error is reported:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

 

Solution:

Method 1

Cause: the system kernel is upgraded, resulting in the mismatch between the new version of kernel and the original graphics card driver
solution: use DKMS to generate the corresponding kernel file

View driver version

ls /usr/src | grep nvidia

For example, my result is nvidia-470.103.01

matching

sudo apt-get install dkms
sudo dkms install -m nvidia -v 470.103.01

Method 2

Reason: the same as scheme 1
solution: log in using the kernel. Then set the default to start with the kernel.

Method 3 (work for me)

Reason: the secure boot of the BIOS is in the enable state
Solution: enter the BIOS (generally press F2 when starting up) and turn off secure boot
it is strongly recommended that even if your secure boot is already in disable, it is recommended to execute it once: enable, restart, disable, and then restart. (this is my situation, so confused!!)

hb set Error: OHOS ERROR] Invalid vendor path: /home/openharmony/vendor (openharmony Compile ubuntu20.04 official document)

ubuntu20.04 hb set error: OHOS ERROR] Invalid vendor path: /home/openharmony/vendor

Compilation error

View environment

View version

Try to delete the ohos_config.json file in the project root directory, and then execute the “hb set” command, it still reports an error

Solution:

Uninstall this one: pip3 uninstall ohos-build
and then execute three lines of code in the source code path

 pythom3 -m  pip install build/lite

 pythom3 -m  pip install ohos-build 

pip3 install build/lite