Tag Archives: Operation and maintenance

[Solved] Linux shell Script Error: syntax error near unexpected token `do

[problem] the error content reported by the Linux server running the shell script is shown in the following figure.

[reason] incompatible carriage return and line feed characters under Linux and windows

[solution] change the windows newline character “CR lf” in the file to UNIX “LF”

Use Notepad + + to set the view first -> Display symbol -> When all symbols are displayed, you will see “CR lf”

Edit -> with Notepad + +; Document format conversion -> Convert to UNIX (LF)

Re-run to solve the problem.

[Solved] ubuntu Boot Error: /dev/nume0n1p2:clean

This is an error that cannot be reported in the graphical interface. Sometimes this problem occurs when the driver or program is updated.

Solution:
Ctrl + Alt + F2 enter the command line, enter the user name and password, and then enter the update library: sudo apt update

update kernel:
sudo apt upgrade

check for updates:
sudo apt install - f

delete old kernel:
sudo apt autoremove

Restart: reboot
Congratulations on your success!

[Solved] docker Commands Execute Error: Segmentation fault

If you execute any docker command, you will report an error segmentation fault. There have been no similar errors when using docker before. After troubleshooting, it was found that the available memory was only 110m. It was speculated that the memory was not enough, so the command to clean the memory was executed, but the parameters were changed to 1, 2 and 3, which could not clean the memory.

sync
echo 1 > /proc/sys/vm/drop_caches

The solution is found on GitHub. First enter

sysctl vm.overcommit_memory

The output is 0, and then change the parameters

sysctl vm.overcommit_memory=1

At this time, the application that occupies a lot of memory has been restarted automatically. If not, execute the above cleaning command.

[Solved] ImportError:lib***.so–cannot open shared object file: No such…(pycharm/clion Error but shell No Error)

Problem Description: after the compilation is successful (there is an executable file in the folder), an error is reported when running (Ubuntu) clip, and the error cannot be found So shared library (but shell can execute normally) solution (similar error reporting in pycharm)

/home/luoxinhao/Desktop/mywork/bin/Infantry: error while loading shared libraries: libopencv_features2d.so.4.5: cannot open shared object file: No such file or directory

Reason: the execution of clion may be different from the environment variables of our shell. The following is the solution

Method 1: each time you start the clion, use the terminal to enter the folder where the clion is located and input/clion.SH, it can be executed normally. (feasible but troublesome)

Method 2: soft link method (both shell error reporting and idle error reporting are feasible, but many libraries may need to be linked, one by one)

My clion was successfully modified in this way, but pycharm gave up seven or eight links without completing the chain

1.1 find files

find  / -name  lib**. So (missing DLL)

1.2 establishing soft links

ln -s  /path/to/lib**. so   /usr/lib

1.3 sudo ldconfig

Method 3: modify LD_LIBRARY_Path (for me, it can only solve the shell error, and the modified idle still reports an error)

sudo gedit ~/. bashrc

export LD_LIBRARY_PATH=/where/you/install/lib:$LD_LIBRARY_PATH

sudo source ~/.bashrc

Method 4: modify/etc/LD so.Conf (ibid.)

vim  /etc/ld.so.conf

add  /where/you/install/lib

sudo ldconfig

Method 5: add it to the environment variable (available, used to solve the error reported by idle, which may need to be used in conjunction with method 3, without separate attempt)

First, open pycharm and modify the environment variable of the running configuration in the upper right corner

If you already have an environment variable, type a semicolon after it and paste it.

Paste content is similar to method 3

For example, method 3 is as follows

export LD_LIBRARY_PATH="/opt/intel/openvino_2021.4.689/opencv/lib:$LD_LIBRARY_PATH"

Then add after the semicolon

LD_LIBRARY_PATH=/opt/intel/openvino_2021.4.689/opencv/lib

[Solved] Tomcat configurate HTTPS error: java.net.SocketException: Permission denied

Tomcat configuration HTTPS error Java net. SocketException: Permission denied

1. Error message

Today, when configuring HTTPS certificate for tomcat, an error was reported when starting Tomcat:

25-Jan-2022 22:01:59.398 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[HTTP/1.1-443]]
        org.apache.catalina.LifecycleException: Protocol handler initialization failed
                at org.apache.catalina.connector.Connector.initInternal(Connector.java:1060)
                at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
                at org.apache.catalina.core.StandardService.initInternal(StandardService.java:552)
                at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
                at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:848)
                at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
                at org.apache.catalina.startup.Catalina.load(Catalina.java:639)
                at org.apache.catalina.startup.Catalina.load(Catalina.java:662)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:303)
                at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)
        Caused by: java.net.SocketException: Permission denied
                at sun.nio.ch.Net.bind0(Native Method)
                at sun.nio.ch.Net.bind(Net.java:438)
                at sun.nio.ch.Net.bind(Net.java:430)
                at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:225)
                at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
                at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:221)
                at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1118)
                at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(AbstractJsseEndpoint.java:223)
                at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:587)
                at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74)
                at org.apache.catalina.connector.Connector.initInternal(Connector.java:1058)
                ... 13 more

The reason for the error is: java.net.Socketexception: permission denied , which is obviously a network permission problem. The reason for this problem is that the Linux operating system does not allow non root users to use ports less than 1024.

2. Solutions

1. Use the root account to start Tomcat
2. Change the port number to a port number greater than 1024, but add the port number to the URL request
3. Change the port number to a port number greater than 1024, and use iptables to forward port 443 to the configured port. The command is as follows:

#Execute the commands under the root
# Mapping port 443 to 8443
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443

[Solved] Jenkins error: Asynchronous execution failure

The job normally builds success, and then reports asynchronous execution failure, as shown below

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.983 s
[INFO] Finished at: 2022-01-12T09:56:29+08:00
[INFO] ------------------------------------------------------------------------
ERROR: Asynchronous execution failure
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at hudson.remoting.Channel$2.adapt(Channel.java:1037)
	at hudson.remoting.Channel$2.adapt(Channel.java:1031)
	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:60)
	at hudson.maven.AbstractMavenBuilder.waitForAsynchronousExecutions(AbstractMavenBuilder.java:186)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:144)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
ERROR: Asynchronous execution failure
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at hudson.remoting.Channel$2.adapt(Channel.java:1037)
	at hudson.remoting.Channel$2.adapt(Channel.java:1031)
	at hudson.remoting.FutureAdapter.get(FutureAdapter.java:60)
	at hudson.maven.AbstractMavenBuilder.waitForAsynchronousExecutions(AbstractMavenBuilder.java:186)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:144)
	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Solution: find the fingerprints folder in Jenkins’s home directory, delete the contents, and then build without reporting an error.

How to Solve “RIP Address Out Of Range” Error

When restarting Windows Server 2008 R2, you see this error on the HP ProLiant} dl388 Gen 9 server. The error may display several messages that do not mean much to you, such as:

X64 exception type 0d – General protection exception

Rip address out of range

RIP Address Out Of Range

This error was seen when Windows Server 2008 R2 was restarted

To resolve this error, disable the following settings in the BIOS:

UEFI optimization startup

[Solved] nvidia-docker runtime Error: (Unknown runtime specified nvidia)

1. An error is reported when running the docker command

root@test:~# docker run --runtime=nvidia -ti  -v $(pwd):/workspace -w /workspace -v /nfs:/nfs $@ --privileged -v /var/run/docker.sock:/var/run/docker.sock registry.test.cn/mla/cxx_toolchains:latest
docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.

According to the error prompt, check whether NVIDIA-docker is installed

root@test:~# nvidia-docker
nvidia-docker: command not found
root@test:~# 

Obviously, it is not installed

2 execute the script and install NVIDIA-docker

root@test:~# cat install-nvidia-docker.sh
sudo curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
sudo curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
root@test:~#

Check that NVIDIA-docker and NVIDIA-container-Runtim are installed successfully

root@test:~# which nvidia-docker
/usr/bin/nvidia-docker
root@test:~# which nvidia-container-runtime
/usr/bin/nvidia-container-runtime
root@test:~#

3 edit /etc/docker/daemon.JSON is as follows

root@test:~# cat /etc/docker/daemon.json
{
  "insecure-registries": ["registry.test.cn"],
  "max-concurrent-downloads": 10,
  "log-driver": "json-file",
  "log-level": "warn",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "live-restore": true,
  "metrics-addr": "0.0.0.0:9323",
  "default-runtime": "nvidia",
  "experimental": true,
    "runtimes": {
        "nvidia": {
            "path": "/usr/bin/nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}
root@test:~#

4 restart docker

root@test:~# systemctl daemon-reload
root@test:~# systemctl restart docker

5 verification

root@test:~# docker run --runtime=nvidia -ti  -v $(pwd):/workspace -w /workspace -v /nfs:/nfs $@ --privileged -v /var/run/docker.sock:/var/run/docker.sock registry.test.cn/mla/cxx_toolchains:latest
root@c3a43f4564a8:/workspace#
root@c3a43f4564a8:/workspace# ls
root@c3a43f4564a8:/workspace# pwd
/workspace
root@c3a43f4564a8:/workspace#

[Solved] VMware Create a Virtual Machine Error: unsuccessful

VMware encountered a classic error when creating a virtual machine:

Attempting to start up from:
EFI VMware Virtual SCSI Hard Drive (0.0) … unsuccessful.
EFI VMware Virtual SATA CDROM Drive (1.0) … unsuccessful.
EFI Network…

Solution:
1 Find the VMX file in the installation directory of the virtual machine
2 Delete firmware = “EFI”
3 Save and restart the virtual machine to install normally

[Solved] ××: error while loading shared libraries: ××.so.19: cannot open shared object file: No such file or directory

××: error while loading shared libraries: ××. so. 19: cannot open shared object file: No such file or directory

When starting some programs, the corresponding link library could not find a solution

[root@feng1 build]# ttyd --help
ttyd: error while loading shared libraries: libwebsockets.so.19: cannot open shared object file: No such file or directory
[root@feng1 build]# ttyd --help
ttyd: error while loading shared libraries: libjson-c.so.5: cannot open shared object file: No such file or directory

This means that the program needs libwebsockets.so.19 and libjson-c.so.5 the functions in the two dynamic link libraries can not be found in the corresponding directory. The dynamic link library under Linux is composed of LD So is responsible for loading, and his configuration file is in etc/LD.so.conf , it is found that there is really no ××.So file under/usr/local/lib configured, we can manually add the specified path to solve the error problem

/environment/libwebsockets/build/lib		## libwebsockets.so.19
/cpack/json-c/build					## libjson-c.so.5

Then refresh the cache and run it again

[root@feng1 build]# sudo ldconfig		

[root@feng1 build]# ttyd --help
ttyd is a tool for sharing terminal over the web

USAGE:
    ttyd [options] <command> [<arguments...>]

VERSION:
    1.6.3-3e37e33

OPTIONS:
    -p, --port              Port to listen (default: 7681, use `0` for random port)
    -i, --interface         Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
    -c, --credential        Credential for basic authentication (format: username:password)
    -H, --auth-header       HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
    -u, --uid               User id to run with
    -g, --gid               Group id to run with
    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
    -w, --cwd               Working directory to be set for the child program
    -a, --url-arg           Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
    -R, --readonly          Do not allow clients to write to the TTY
    -t, --client-option     Send option to client (format: key=value), repeat to add more options
    -T, --terminal-type     Terminal type to report, default: xterm-256color
    -O, --check-origin      Do not allow websocket connection from different origin
    -m, --max-clients       Maximum clients to support (default: 0, no limit)
    -o, --once              Accept only one client and exit on disconnection
    -B, --browser           Open terminal with the default system browser
    -I, --index             Custom index.html path
    -b, --base-path         Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
    -P, --ping-interval     Websocket ping interval(sec) (default: 5)
    -S, --ssl               Enable SSL
    -C, --ssl-cert          SSL certificate file path
    -K, --ssl-key           SSL key file path
    -A, --ssl-ca            SSL CA file path for client certificate verification
    -d, --debug             Set log level (default: 7)
    -v, --version           Print the version and exit
    -h, --help              Print this text and exit

Visit https://github.com/tsl0922/ttyd to get more information and report bugs.
[root@feng1 build]#

[Solved] ERROR A malformed block was encountered while loading a block

ERROR! A malformed block was encountered while loading a block
[root@ansible test]# ansible-playbook -C roles_redis.yml -i hosts
ERROR! A malformed block was encountered while loading a block

Reason:
You don’t add the follow code after include when you are write main file:

- include add_group.yml

Solution:

We must pay attention to the problem of space format. The specification is very strict

- include: add_group.yml