Tag Archives: operations

Problem solving / etc/ rc.local The boot entry of the file configuration is invalid

Fixed issue: The boot entry for /etc/rc.local file configuration does not work
Start by looking at the contents of the /etc/rc.local file to find the cause of the problem.

[root@localhost ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#**这This file was added for compatibility**
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#** It is highly advisable to create your own systemd services or udev rules to run scripts during boot instead of using this file. ***
# In contrast to previous versions due to parallel execution during boot
# This script will NOT be run after all other services.
#** In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. **Please note that you must run 'parallel execution during boot'.
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
#** Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot.
touch /var/lock/subsys/local
#**Create the file /var/lock/subsys/local**

According to the prompt, it may not execute because the file permissions are insufficient. So, first look at the permissions for the /etc/rc.local file.

[root@localhost ~]# ll /etc/rc.local
-rw-r--r--. 1 root root 13 Apr 21 23:06 /etc/rc.local -> rc.d/rc.local

/etc/rc.d/rc.local = /etc/rc.local = /etc/rc.local = /etc/rc.local = /etc/rc.local = /etc/rc.local = /etc/rc.local = /etc/rc.local = /etc/rc.local

[root@localhost ~]# chmod +x /etc/rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local 
-rwxr-xr-x. 1 root root 13 Apr  21 23:06 /etc/rc.d/rc.local

After restarting the server, I found that the boot items set in the /etc/rc.local file are working properly.

How to Solve mount error(6): No such device or address

Error:

mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Samba server Settings:
[root@test1 ~]#cat /etc/samba/smb.conf
Global Settings:
[global]

    workgroup = test
    server string = Samba Server Version %v
    #log files split per-machine:
    log file = /var/log/samba/log.%m
    #maximum size of 50KB per log file, then rotate:
    max log size = 50
    security = user
    passdb backend = tdbsam
    load printers = no
    cups options = raw

The home Settings
[homes]

    comment = Home Directories
    browseable = no
    writable = yes
    create mode = 0664
    directory =0755

Projects

    comment = smbuser's home
    path    = /share
    browseable = yes
    writable = yes
    write list = @users

3 . font – family: tahoma; mso – bidi – font – family: tahoma;从/etc/samba/smb.Load smb configuration file conf
rlimit_max: increase rlimit_max(1024) to the minimum window limit (16384)
Process section “[homes]”
Processing section “[project]”
Loaded service file OK.
Server role:ROLE_STANDALONE
View service definition dumps by enter
# global parameters
(Global)

    server string = Samba Server Version %v
    workgroup = TEST
    log file = /var/log/samba/log.%m
    max log size = 50
    load printers = No
    security = USER
    idmap config * : backend = tdb
    cups options = raw

(home)

    comment = Home Directories
    path = 0755
    browseable = No
    create mask = 0664
    read only = No

(project)

    comment = smbuser's home
    path = /share
    read only = No
    write list = @users

Client mount
[root@test2 ~]# mount -t cifs //2.2.1.2/user1/mnt-o username=user1,password=4321
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)


Check found an error setting for the server:
Solution: Change directory = 0755 in the home directory to Directory Mode = 0755
[homes]

    comment = Home Directories
    browseable = no
    writable = yes
    create mode = 0664
    directory **mode** = 0755

Testparm didn’t detect a problem, so it took a long time. The key is carefulness, carefulness!

The problem of “value error: zero length field name in format” in Python 2.6.6 of CentOS 6.9

[root@MrYang ~]# python
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fabric.api import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/fabric/api.py", line 9, in <module>
    from fabric.context_managers import (cd, hide, settings, show, path, prefix,
  File "/usr/lib/python2.6/site-packages/fabric/context_managers.py", line 42, in <module>
    from fabric.state import output, win32, connections, env
  File "/usr/lib/python2.6/site-packages/fabric/state.py", line 9, in <module>
    from fabric.network import HostConnectionCache, ssh
  File "/usr/lib/python2.6/site-packages/fabric/network.py", line 24, in <module>
    import paramiko as ssh
  File "/usr/lib/python2.6/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 89, in <module>
    class Transport(threading.Thread, ClosingContextManager):
  File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 103, in Transport
    _CLIENT_ID = 'paramiko_{}'.format(paramiko.__version__)
ValueError: zero length field name in format

When using the paramiko third-party library of python2.6.6 and python3.6 on centos6.9, the above error has been reported all the time

Python official recommendation str.format () to format strings, so using “{} / N”. Format (x) to process strings may encounter problems.

In Python 2 & gt; = 2.7 and python 3 & gt; = 3.1, str.format The positional parameter in () method can be omitted by default, but in Python 2 (& lt; 2.7) and python 3 (& lt; 3.1), you must display the specified (subscript starts from 0), otherwise “zero length field name in format” error will appear.

“{}CMD”.format( os.sep )# “{0} CMD”. Format can run normally in Python 2.7( os.sep )# in Python & lt; = 2.6 / 3.1, the specified subscript must be displayed, even if there is only one element.

Reference link: https://www.aliyun.com/jiaocheng/460757.html

SSH appears warning: remote host identification has changed!

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

When SSH is used to connect remote address: port for the first time, the remote public key will be saved to known_ In hosts , form a record

If the same remote address is detected during the second connection: the public key of the port is the same as known_ When the records in hosts are different, this warning will be generated

This means that the remote device has been changed

In the local environment, because the device pointed to by the remote address is replaced, the public key is different, and the remote device is still secure

So the solution here is:

    Notepad + + Open know_ Host delete the record of the corresponding remote address

After that, you can get the new public key by re SSH connection

How to solve the problem of “blocked loading mixed active content” in Firefox

Today, I put the project on the server. When debugging, there was a message “Preventing loading of mixed activity content…” Error:

The solution is as follows:
Method 1: Let Firefox leave it unblocked for a while
Open a new TAB and enter about:config in the address bar to go to the configuration page.
Search for security.mixed_content.block_active_content and change true to false.

Approach 2: Avoid including HTTP content in HTTPS pages.
The first approach is impractical because we cannot require all users to change this configuration.
we can see if the HTTPS submissions to the HTTP reason, if so, the request URL to HTTPS.
After checking the URL, it is found that the URL is indeed HTTP, change it to HTTPS, no longer report error.

Reproduced in: https://www.cnblogs.com/sunshineliulu/p/6694839.html

Root password of windows 10 WSL Ubuntu system

The root password for Windows 10 WSL Ubuntu system
After installing Ubuntu, you realize that you do not have a root password. If you do not know the password, you will not be able to access the root user.
to the search on the net, the original is the way it is:
the Ubuntu’s default root password is random, namely each have switched on a new root password.
we can command in a terminal input sudo passwd , and then enter the current user password, the terminal will be prompted to enter a new password and we confirm that the new password is root password.
> root>> code>>
> su root>
>
> su root> >
Reprinted from: https://www.jianshu.com/p/e43e11d6ba09

Git authentication failure solution, due to the problem of password modification

fatal: Authentication failed for ‘http:xxxxxxxxxx.git/’

The solution

1. git config –global user.name “username”

Git config –global user.email “email” git config –global user.email

 

2. Git config –system –unset credential

 

3. Control Panel – User Account – Voucher Manager – Ordinary Voucher, modify and delete the git password in it

Reproduced in: https://www.cnblogs.com/ChineseLiao/p/9400191.html

Error! Failed to start nginx

The following error occurred when the blogger started the Nginx service

[root@localhost ~]# /usr/local/nginx/sbin/nginx 
nginx: [emerg] getpwnam("nginx") failed

The function of getPwnam in the error message is to get information about the user’s login
So you can see that getting “nginx” users failed
Query the user with id, and sure enough, it does not exist

[root@localhost ~]# id nginx
id: nginx: no such user

Once the user is added, it works

[root@localhost ~]# useradd -M -s /sbin/nologin nginx
[root@localhost ~]# /usr/local/nginx/sbin/nginx
[root@localhost ~]# netstat -anpt | grep nginx
tcp        0      0 10.0.0.100:80           0.0.0.0:*               LISTEN      3843/nginx: master  

Recall that the configuration for source code compilation and installation was as follows

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx && make && make install 

At that time, the user group and user group of Nginx were set. In the absence of nginx users in the system, it could not be started naturally.

Mac upgrade pip

I haven’t upgraded PIP for a long time. Today I will upgrade once:

$ pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 300, in move
    rmtree(src)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 250, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/EGG-INFO/PKG-INFO'
You are using pip version 9.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Prompt permission is not enough, assign permission to the current user:

mac-temp:~ zyh$ sudo chown -R $USER /Library/Python/2.7

Upgrade again:

mac-temp:~ zyh$ pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Using cached https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-19.0.3

$ pip --version
pip 19.0.3 from /Users/zyh/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)

 
 

Mongodb encountered an error: connect econnreused 127.0.0.1:27017

Node with MongoDB is configured to appear when access is completed
Error: reach econnunion 127.0.0.0.1 :27017, return Error
The reason is that your MongoDB database is not open,
The solution under Node can be turned on by Mongod
 
Here are the links I found:
https://cnodejs.org/topic/5646b746c5dcc06702210adf
https://stackoverflow.com/questions/36400233/connect-econnrefused-127-0-0-127017

Reproduced in: https://www.cnblogs.com/herewego/p/9278904.html

Mount error (112): host is down


centos7 minial system when sharing directory with a storage device, use mount-t cifs-o username=”***”,password=”***” \\ \ storage device IP \\ directory name \\ directory name, system error mount error(112): Host is down, after performing yum install cifs-utils and smb-related dependencies, mount -t cifs-o vers=1.0,username=”***”,password=”***” \\ \ storage device IP \ directory name \\ directory name, load successfully, this situation mainly involves two problems:
1, cifs and SMB. SMB (Server Message Block) is also known as CIFS(Common Internet File System), an application layer network transport protocol (developed by Microsoft and Intel in 1987). The main function of SMB is to enable machines on the network to share computer files, printers, serial ports, communications and other resources. It also provides certified interprocess communication skills. It is mainly used on Windows machines. CIFS is a protocol developed by Microsoft based on SMB and extended to the Internet. It has nothing to do with the specific OS; CIFS is available after Samba is installed on Unix. It enables a program to access files on a remote Internet computer and request the services of that computer. CIFS USES client/server mode. The client requests the server application on the remote server to serve it. The server gets the request and returns the response.
CIFS is a public or open version of the SMB protocol and is used by Microsoft. The SMB protocol is now a LAN protocol for accessing and printing server files. Like the SMB protocol, CIFS runs at a high level, rather than at the bottom, as TCP/IP does. CIFS can be seen as an implementation of application protocols such as file transfer protocol and hypertext transfer Protocol. Ii. The first packet sent by cifs protocol contains version information. Mount vfstype
mount vfstype
DOS fat16 file system: msdos
Windows 9x fat32 file system: vfat
Windows NT NTFS
mount Windows file network sharing: SMBFS
UNIX(LINUX) file network sharing: NFS

.. ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status make[2]: ***

2019 Unicorn enterprise heavily recruited Python engineer standard & GT; > >

./configure –prefix=/usr/local/nginx –with-http_ssl_module –with-http_stub_status_module –add-module=/usr/local/ngx_devel_kit-0.3.0 –add-module=/usr/local/ lua-nginx-Module-0.10.6 – add – the module =/usr/local/echo – nginx – module – 0.60
– with – cc – opt = “-i/usr/local/Cellar/pcre/8.39/include” – with – ld – opt = “-l/usr/local/lib/Cellar/pcre/8.39”
 
 
The e problem that had puzzled us for two days was finally solved.
Increase these two parameters
– with – cc – opt = “-i/usr/local/Cellar/pcre/8.39/include” – with – ld – opt = “-l/usr/local/lib/Cellar/pcre/8.39”
 

Reproduced in: https://my.oschina.net/cooler1217/blog/736886