Category Archives: Linux

[Solved] curl: (6) Could not resolve host: harbor.od.com; Unknown error

implement

curl harbor.od.com

The following error occurred

curl: (6) Could not resolve host: harbor.od.com; Unknown error

The reason is that there is an error in DNS

Open DNS profile

vim /etc/resolv.conf

Find the following. It is found that the DNS is inconsistent with your own configuration.

Modify the content behind the nameserver

Run again and you’ll succeed

[Solved] yum command Error: “except keyboardinterrupt, e: syntax error: invalid syntax”“

Use the yum command prompt “except keyboardinterrupt, e: syntax error: invalid syntax”

Troubleshooting of error reporting using Yum command

Error reporting using Yum command

File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax

Reason for the problem:
Yum package management uses python2 X, python2 X to Python 3.0 After X, problems occurred due to Python version syntax compatibility

Solution:

Modify the yum configuration file to point the python version to the previous version

vi /usr/bin/yum
#!/usr/bin/python2.7

Modify the urlgrabber ext down file and change the python version

vi /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python2.7

[Solved] redis Startup Error: Creating Server TCP listening socket 127.0. 0.1:6379: bind: no error redis

Error: [52904] 08 Dec 15:09:41.278 # creating server TCP listening socket 127.0 0.1:6379: bind: No error

Solution:

You can connect successfully by entering the following commands in sequence

D:\zip\redis\Redis-x64-3.2.100>redis-server.exe redis.windows.conf
[52904] 08 Dec 15:09:41.278 # Creating Server TCP listening socket 127.0.0.1:6379: bind: No error

D:\zip\redis\Redis-x64-3.2.100>redis-cli.exe
127.0.0.1:6379> shutdown
not connected> exit

D:\zip\redis\Redis-x64-3.2.100>redis-server.exe  redis.windows.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.100 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._   /    _.-'    |     PID: 47344
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[47344] 08 Dec 15:10:36.580 # Server started, Redis version 3.2.100
[47344] 08 Dec 15:10:36.583 * DB loaded from disk: 0.000 seconds
[47344] 08 Dec 15:10:36.584 * The server is now ready to accept connections on port 6379

redhat7. 5 system service is not started automatically and use systemctl start error: error getting authority: error initializing authority: CO, (the server will restart)

After the server is powered on, the default system service SSH network card will not start automatically
when using systemctl start sshd command, the following error will be reported. After the error is reported, the server will restart automatically
error getting authority: error initializing authority: could not connect: no such file or directory (g-io-error-wuark, 1)
view the system log, The following error is reported
#journalctl – XB
dependency failed for migrate local SELinux policy changes from the old store structure to the new structure

It may be that the attached system file does not exist.
#mount – a check whether the system attachment is normal, and the following error is reported.
mount special device XXX does not exist
#cat/etc/fstab check whether there is redundant attachment configuration for boot attachment, and delete the attachment configuration

[Solved] Linux executes SQL script Error: Syntax error

Demand scenario:

when deploying the production environment, you need to run the SQL script uploaded locally


Problem Description:

the local script runs normally, and liunux reports syntax error </ font>

syntax error

Cause analysis:

when running stored procedures or a long string of SQL scripts in Linux, you need to add fixed syntax at the beginning and end
beginning: \set sqlterm/
end:/\ set sqlterm


Solution:

add fixed statements \set sqlterm/and
/\ set sqlterm
as shown in the figure:
 

mysqlclient in Ubuntu: How to Solve mysqlclient Install Error

After running pip3 install mysqlclient, the following error occurs:

ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o3rs50h8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/mysqlclient
         cwd: /tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/
    Complete output (46 lines):
    mysql_config --version
    ['5.7.33']
    mysql_config --libs
    ['-L/usr/lib/x86_64-linux-gnu', '-lmysqlclient', '-lpthread', '-lz', '-lm', '-lrt', '-lssl', '-lcrypto', '-ldl']
    mysql_config --cflags
    ['-I/usr/include/mysql']
    ext_options:
      library_dirs: ['/usr/lib/x86_64-linux-gnu']
      libraries: ['mysqlclient', 'pthread', 'm', 'rt', 'dl']
      extra_compile_args: ['-std=c99']
      extra_link_args: []
      include_dirs: ['/usr/include/mysql']
      extra_objects: []
      define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')]
    /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires'
      warnings.warn(msg)
    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/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_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/include/mysql -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -std=c99
    MySQLdb/_mysql.c:46:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o3rs50h8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/mysqlclient Check the logs for full command output.

 

Solution:

sudo apt-get install python3.6-dev

It may be due to the mismatch of dev version due to the installation of Python 3.6 in Ubuntu.

[Solved] CentOS Install pycrypto Error: RuntimeError: autoconf error

Solution:  yum -y install gcc

 

File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-ydg0qryh/pycrypto/setup.py", line 251, in run
self.run_command(cmd_name)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-ydg0qryh/pycrypto/setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error

----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ydg0qryh/pycrypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-544nn9hj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ydg0qryh/pycrypto/

[Solved] Docker error: “unknown runtime specified NVIDIA” using GPU“

Question 1 recurrence

System: Ubuntu 18.04 docker version: 20.10.7
when I start a container, run the following command:

docker run -itd \
   --runtime=nvidia --gpus=all \
   -e NVIDIA_DRIVER_CAPABILITIES=compute,utility,video,graphics \
   image_name
   

report errors:

docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.

Solution 1

This is because the user did not join the docker group and added his own user to the docker user group.

sudo usermod -a -G docker $USER

Question 2 recurrence

docker: Error response from daemon: Unknown runtime specified nvidia.
See 'docker run --help'.

Solution 2

NVIDIA docker2 needs to be installed

sudo apt-get install -y nvidia-docker2

Restart docker

sudo systemctl daemon-reload
sudo systemctl restart docker

[Solved] WSUS client access server exception error – 0x8024401f

Background: the customer reported that the Windows Server reported an error during automatic update and could not update

Server version: Windows Server 2012 R2 standard

IIS version: 8

WSUS version: 6.3.9600

Error message:

2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      Warning: and at“ http://xxxx.xxxx.xxx.xxx:8530/ClientWebService/client.asmx ”An error occurred while communicating with the endpoint of
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      Warning: the server has returned the HTTP status code "500 (0x1f4)" and the text "internal server error"
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      Warning: the server cannot process the request
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      WARNING: MapToSusHResult mapped Nws error 0x803d000f to 0x8024401f
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      WARNING: Web service call failed with hr = 8024401f.
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      WARNING: Current service auth scheme='None'.
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      WARNING: Proxy List used: '(null)', Bypass List used: '(null)', Last Proxy used: '(null)', Last auth Schemes used: 'None'.
2021-11-29      22:15:10:401      eight hundred and four      cd8      WS      FATAL: OnCallFailure failed with hr=0X8024401F

Troubleshooting steps:

1. Access the URL on the client according to the log   http://xxxx.xxxx.xxx.xxx:8530/ClientWebService/client.asmx

The following occurs:

You can see the specific reason why the client cannot troubleshoot

2. Use the server to directly access the URL   http://xxxx.xxxx.xxx.xxx:8530/ClientWebService/client.asmx

There is an error in which the type cannot be converted

Because I have contacted the code before and thought that some program files of WSUS had problems, I tried to copy files from other WSUS servers for backup and replacement, but it didn’t work

3. Search problem, and finally compare the hosting mode of WSUS service application resource pool in IIS server from “classic” to “integration”

4. When the client accesses the URL again, the following page appears and returns to normal