Category Archives: Linux

Ubuntu problem: E45:’readonly’ option is set (add! To override) error solved

Problem description: E45:’readonly’ option is set (add! To override)

Problem analysis: The error is that the current user does not have permission to modify the file

problem solved:

Input : w! Sudo tee%

  • :w – write
  • !sudo – call shell sudo command
  • tee – the output of write (:w) command is redirected using tee
  • % – Current file name

 

Ubuntu: How to Solve RTNETLINK answers: File exists (Two Methods)

There are two reasons for this problem

###1. When there are two gateways, there are two gateways in IP address configuration

    auto eth0
    iface eth0 inet static
    address 192.168.5.21
    netmask 255.255.2550
    gateway 192.168.5.1

    # VM traffic interface
    auto eth1
    iface eth1 inet static
    address 192.168.5.22
    netmask 255.255.255.0
    gateway 192.168.5.1

eth0 and eth1 have different IP addresses, but they have both configured gateways. At this time, after one starts, the other fails to start

RTNETLINK answers: File exists
Failed to bring up eth2.

If you still have this situation after modification, you need to refresh eth0 and eth1

    ip addr flush dev eth0
    ip addre flush dev eth1
    ifdown eth0 && ifup eth0 && ifdown eth1 && ifup eth1

###2. When the bridge or other network is deleted and the network is changed correctly, this problem still occurs # IP addr flush dev eth0 # restart the network configuration under the condition of ensuring that the network configuration is correct

IP addr flush also dumps all the deleted addresses in the format described in the previous subsection

How to Solve Linux resize2fs error: Bad magic number in super-block

How to Solve Linux resize2fs error: Bad magic number in super-block

[root@backup binlog]# vgdisplay
— Volume group —
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 8
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 2
Act PV 2
VG Size 2.73 TiB
PE Size 4.00 MiB
Total PE 715273
Alloc PE/Size 712822/2.72 TiB
Free PE/Size 2451/9.57 GiB
VG UUID 6rIzMZ-cqff-oWy6-0EvS-YENe-37U9-65SunU

[root@backup binlog]# lvextend -L +4G /dev/mapper/centos-home
Size of logical volume centos/home changed from 2.66 TiB (697542 extents) to 2.66 TiB (698566 extents).
Logical volume home successfully resized.

Error executing resize2fs:
[root@backup binlog]# resize2fs /dev/mapper/centos-home
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block

When trying to open /dev/mapper/centos-home
no valid filesystem superblock is found.

Make sure the file system is xfs:
[root@backup binlog]# cat /etc/fstab | grep centos-home
/dev/mapper/centos-home /home xfs defaults 0 0

xfs uses the following command to expand disk space:
[root@backup binlog]# xfs_growfs /dev/mapper/centos-home
meta-data=/dev/mapper/centos-home isize=256 agcount=6, agsize=118277632 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=709040128, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=231011, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 709040128 to 715331584

Tomcat Command Error: Catalina.stop: connect reused solution

The following error message appears when you execute the close Tomcat command on the server

[root@server classes]# service tomcat restart
Stopping Tomcat service:  Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:       /usr
Apr 17, 2011 10:11:53 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:381)
    at java.net.Socket.connect(Socket.java:537)
    at java.net.Socket.connect(Socket.java:487)
    at java.net.Socket.<init>(Socket.java:384)
    at java.net.Socket.<init>(Socket.java:198)
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:421)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:337)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)

Then check the relevant information. On the stack overflow website, it says that it may be a CentOS firewall problem. Check the firewall configuration file, and the 8005 port has been configured. Then close the firewall, and it is still connection refused

Then use the telnet command to test. First test telnet 127.0.0.1 80, normal, then telnet 127.0.0.1 8005, normal, later test telnet localhost 80, abnormal connection refused, telnet localhost 8005, also abnormal, connection refused

It should be the problem of localhost parsing

#vim /etc/hosts

View the local hosts configuration file

 

127.0.0.1   IT2YWMHA01 localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

Modify localhost, add it to 127.0.0.1, and change it to

127.0.0.1   IT2YWMHA01 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost.localdomain localhost6 localhost6.localdomain6

Test #sh shutdown.sh, now it can shut down Tomcat normally and no longer prompts Connection refused.
 

 

Under Ubuntu system, selenium opens the Firefox browser and prompts’ unable to find a matching set of capabilities. And message: connect

Environment.

1.ubuntu system

2.selenium 3.141.0

3.Firefox driver geckodriver-v0.24.0-linux32

To execute the script in Python.

from selenium import webdriver
browser = webdriver.Firefox()

Result tips: Message: Unable to find a matching set of capabilities

Traceback (most recent call last):
File “/home/yanner/seleniumtest/sousuo.py”, line 2, in <module>
browser = webdriver.Firefox()
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py”, line 174, in __init__
keep_alive=True)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 157, in __init__
self.start_session(capabilities, browser_profile)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 321, in execute
self.error_handler.check_response(response)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py”, line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

Solution: Update firefox browser</strong

1. Go to the official firefox website from your browser and download the latest version of firefox-67.0.4.tar.bz2

2. Go to the download directory and unzip the file. </strong

3. Open the terminal emulator, go to the download directory, and enter the install command line. <strong

root@yanner-VirtualBox:/home/yanner/download/firefox# sudo apt-get install firefox
After updating, Firefox 52.0.2

Execute the script again to open the browser normally:

from selenium import webdriver
browser = webdriver.Firefox()

However, opening the page fails with the message Message: connection refused:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get(“http://www.baidu.com”)
browser.find_element_by_id(“kw”).send_keys(“selenium”)
browser.find_element_by_id(“su”).click()
browser.quit()

After half a day of research, the driver geckodriver-v0.24.0-linux32 down version, the directory /usr/local/bin under the driver geckodriver deleted, downloaded geckodriver-v0.17.0-linux32 unzip copy to /usr/local/bin

Run the above script again and it opens normally!

Linux Install Tomcat Error: service tomcat does not support chkconfig

Installing Tomcat under Linux

 1 //Decompress
 2 # tar zxvf apache-tomcat-7.0.92.tar.gz
 3 // Copy to the init.d directory
 4 # cp -p /usr/tomcat/apache-tomcat-7.0.92/bin/catalina.sh /etc/init.d/tomcat
 5 # chmod 755 /etc/init.d/tomcat 
 6 # chkconfig --add tomca
 7 //add tomcat and java directories
 8 # vim /etc/init.d/tomcat
 9 // finally start tomcat directly
10 # chkconfig tomcat on
11 # service tomcat start

Copy catalina.sh to the init. D directory to ensure that Tomcat can be started anywhere. Use service Tomcat start to start Tomcat more conveniently

Problems:

service tomcat does not support chkconfig

Add:

#chkconfig:2345 10 90

And Java_ Home and Catalina_ Home address, here I am:

JAVA_HOME=/usr/java/jdk1.8.0_191/
CATALINA_HOME=/usr/tomcat/apache-tomcat-7.0.92

Renewal operation:

#chkconfig –add tomcat

About Oct

Nginx -T Error: server_names_hash_bucket_size: 64; ignoring server_names_hash_bucket_size

When operating nginx – t on the server, an error is reported


nginx: [warn] could not build optimal server_names_hash, you should increase either 
server_names_hash_max_size: 512 or server_names_hash_bucket_size: 64; ignoring 
server_names_hash_bucket_size

What is the meaning of the question_ names_ hash_ bucket_ The number of alias websites created by size is 64, which can be increased by 64 times

Open: nginx.conf file and add it at http {}


server_names_hash_bucket_size 128;

Nginx Error: nginx: [emerg] “server” directive is not allowed here in

If you want to check whether a configuration file is correct, an error is reported after – C is specified, as follows:

[root@op-2:~# nginx -t -c /etc/nginx/conf.d/default.conf
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/conf.d/default.conf:1
nginx: configuration file /etc/nginx/conf.d/default.conf test failed

Sometimes the file is correct, but it will also report an error

The practical problem is that the object of syntax detection has problems

To detect whether there are errors in the existing modified nginx configuration, we should not only detect the. Conf file, but always detect the main file/etc/nginx/nginx.conf at any time. Only in this way can we load the. Conf file in the corresponding module smoothly

This ensures the correctness of the context before and after the configuration, which is the real detection

So the correct command to detect whether the syntax of the modified nginx is wrong should be: nginx - t - C/etc/nginx/nginx. Conf , if there is an exception in the configuration file, it will be reported directly, otherwise it will be

[ root@op-2 :~# nginx -t -c /etc/nginx/nginx.conf
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

[ root@op-2 :~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Ubuntu Tomcat Server:insserv: warning: script ‘tomcat’ missing LSB tags and overrides

 

If you use apt get and apt fast to install the software, you will report an error and the installation fails

A Tomcat startup script is written, which is easy to execute, but there are a lot of problems when installing mysql

insserv: warning: script 'S20tomcat' missing LSB tags and overrides
insserv: warning: script 'tomcat' missing LSB tags and overrides
insserv: There is a loop at service rmnologin if started insserv: There is a loop between service rmnologin and mountnfs if started insserv: loop involving service mountnfs at depth 6 insserv: loop involving service networking at depth 5 insserv: There is a loop between service tomcat and hwclock if started insserv: loop involving service hwclock at depth 3 insserv: loop involving service mountdevsubfs at depth 2 insserv: There is a loop between service tomcat and udev if started insserv: loop involving service udev at depth 1 insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true! insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!

Actually, it also led to the failure of automatic configuration prompt after MySQL installation. According to LSB tags specification, the rewriting script is as follows (debian8 environment)

#!/bin/bash
### BEGIN INIT INFO
# Provides:          bbzhh.com
# Required-Start:    $local_fs $network
# Required-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: tomcat service # Description: tomcat service daemon ### END INIT INFO # # description: Apache Tomcat init script # processname: tomcat # chkconfig: 234 20 80 # # # Copyright (C) 2014 Miglen Evlogiev # # This program is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation, either version 3 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. # # Initially forked from: gist.github.com/valotas/1000094 # Source: gist.github.com/miglen/5590986 #Location of JAVA_HOME (bin files) export JAVA_HOME=/opt/jdk #Add Java binary files to PATH export PATH=$JAVA_HOME</span>/bin:<span class="variable">$PATH #CATALINA_HOME is the location of the bin files of Tomcat export CATALINA_HOME=/opt/tomcat #CATALINA_BASE is the location of the configuration files of this instance of Tomcat export CATALINA_BASE=/opt/tomcat export CATALINA_BOOTSTRAP=/opt/tomcat/bin/bootstrap.jar #TOMCAT_USER is the default user of tomcat export TOMCAT_USER=tomcat #TOMCAT_USAGE is the message if this script is called without any options TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;31mkill\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}" #SHUTDOWN_WAIT is wait time in seconds for java proccess to stop SHUTDOWN_WAIT=20 tomcat_pid() { echo `ps -fe | grep $CATALINA_BOOTSTRAP | grep -v grep | tr -s " "|cut -d" " -f2` } start() { pid=$(tomcat_pid) if [ -n "$pid" ] then echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m" else # Start tomcat echo -e "\e[00;32mStarting tomcat\e[00m" #ulimit -n 100000 #umask 007 #/bin/su -p -s /bin/sh $TOMCAT_USER if [ `user_exists $TOMCAT_USER` = "1" ] then /bin/su $TOMCAT_USER</span> -c <span class="variable">$CATALINA_HOME/bin/startup.sh else echo -e "\e[00;31mTomcat user $TOMCAT_USER</span> does not exists. Starting with <span class="variable">$(id)\e[00m" sh $CATALINA_HOME/bin/startup.sh fi status fi return 0 } status(){ pid=$(tomcat_pid) if [ -n "$pid" ] then echo -e "\e[00;32mTomcat is running with pid: $pid\e[00m" else echo -e "\e[00;31mTomcat is not running\e[00m" return 3 fi } terminate() { echo -e "\e[00;31mTerminating Tomcat\e[00m" kill -9 $(tomcat_pid) } stop() { pid=$(tomcat_pid) if [ -n "$pid" ] then echo -e "\e[00;31mStoping Tomcat\e[00m" #/bin/su -p -s /bin/sh $TOMCAT_USER sh $CATALINA_HOME/bin/shutdown.sh let kwait=$SHUTDOWN_WAIT count=0; until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count</span> <span class="operator">-gt</span> <span class="variable">$kwait ] do echo -n -e "\n\e[00;31mwaiting for processes to exit\e[00m"; sleep 1 let count=$count+1; done if [ $count</span> <span class="operator">-gt</span> <span class="variable">$kwait ]; then echo -n -e "\n\e[00;31mkilling processes didn't stop after $SHUTDOWN_WAIT seconds\e[00m" terminate fi else echo -e "\e[00;31mTomcat is not running\e[00m" fi return 0 } user_exists(){ if id -u $1 >/dev/null 2>&1; then echo "1" else echo "0" fi } case $1 in start) start ;; stop) stop ;; restart) stop start ;; status) status exit $?;; kill) terminate ;; *) echo -e $TOMCAT_USAGE ;; esac exit 0 

In fact, the solution is in the future/ Bin/Bash

### BEGIN INIT INFO
# Provides:          bbzhh.com
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: tomcat service # Description: tomcat service daemon ### END INIT INFO

Of course, once and for all:

apt-get remove insserv

The startup script file is placed in the/etc/init.d/ folder, and the file name is the service name that reported the error. What I reported is tomcat8, which is installed according to other people’s tutorial. It seems that even if you follow the tutorial, there is no error
(PS: I still suggest not to go once and for all. It’s safer to change the above documents. Anyway, I succeeded according to the above, but the once and for all method was not successful. On the contrary, there were some other problems.)

SQL0668N Operation not allowed for reason code “3” on table “TEST”. SQLSTAT…

 

Problem Description:

Query, operation table report the following error

SQL0668N Operation not allowed for reason code “3” on table “TEST”. SQLSTATE=57016

operation steps:

first, the following error occurred when executing the reorg unlock table

[test@TEST-DB1 ~]$ db2 "reorg table test"
SQL0668N Operation not allowed for reason code "3" on table "test". 
SQLSTATE=57016

Second: the following error occurs when the load empty file terminates the table

[test@TEST-DB1 ~]$ db2 load from/of del terminate into test

Agent Type Node SQL Code Result
______________________________________________________________________________
LOAD 001 +00000000 Success.
______________________________________________________________________________
LOAD 002 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 003 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 004 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 005 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 006 +00000000 Success.
______________________________________________________________________________
LOAD 007 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 008 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 009 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 010 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 011 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 012 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 013 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 014 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 015 -00027902 Init error. Table unchanged.
______________________________________________________________________________
LOAD 016 -00027902 Init error. Table unchanged.
______________________________________________________________________________
RESULTS: 2 of 16 LOADs completed successfully.
______________________________________________________________________________

Summary of LOAD Agents:
Number of rows read = 0
Number of rows skipped = 0
Number of rows loaded = 0
Number of rows rejected = 0
Number of rows deleted = 0
Number of rows committed = 0

SQL27902N LOAD RESTART/TERMINATE is not allowed on a table that is not in 
LOAD PENDING state.

Generally, the above two steps can basically solve the problem that the table can’t be operated, but some can’t be completed as this time

Analysis may be that some partitions are not terminated or are forcibly killed when loading

Third: query partition table status

[test@TEST-DB1 ~]$ db2 -x "SELECT DBPARTITIONNUM FROM TABLE(SYSPROC.ADMIN_GET_TAB_INFO('TEST','TEST')) AS T where load_status='PENDING' "

Terminate the partition number one by one

[test@TEST-DB1 ~]$db2 load from /dev/null of del terminate into TEST.TEST  partitioned db config OUTPUT_DBPARTNUMS('分区号')

Execution complete