The solution of error “ERROR 1067 (42000) at line 211: Invalid default value for ‘blablabla'”

I noticed once when importing a sql file the following error:

ERROR 1067 (42000) at line 211: Invalid default value for ‘blablabla’

It arises because new versions of MySQL server use strict mode and parameters such as NO_ZERO_DATE do not allow entering date values like ‘0000-00-00’ into the database.

Connect to mysql server:

mysql -u root -p

Execute a query that displays the values of sql_mode:

show variables like 'sql_mode';

Copy the string with these values and exit mysql:

exit

Open the configuration file for example in the text editor nano (Ctrl+X for exit, y/n for saving or canceling the changes):

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

I did not have sql_mode = in the file, so at the end of the file I inserted the line with the previously copied values, removing NO_ZERO_IN_DATE, NO_ZERO_DATE from it, in my case, the following happened:

sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Restart mysql to apply the changes:

sudo service mysql restart

Done, now when importing this error should not be.

The solution to the error “Service virtual port has existed already”

I noticed once on Huawei MA5683T when I added the service port for ONT the following error:

Failure: Service virtual port has existed already

As reported by the error, the service port is already registered for this ONT.
In my case, there was simply a misprint in ONT ID, it was accidentally indicated by the wrong one, after specifying the correct service port, it was registered.

And if you need to register several service port for one ONT, then see my article – Adding an ONT with trunk port to Huawei SmartAX MA5683T

Adding an ONT with trunk port to Huawei SmartAX MA5683T

Here is an example of adding ONT so that at the output of the ethernet port all VLANs are tagged.
Suppose OLT is configured for my article – Configuring Huawei SmartAX MA5683T through the console.
ONT for the test I’ll take TP-Link GP110 with the configured mode transparent and off DHCP, well, in fact with other single-port ethernet ONT setting is similar.

Continue reading “Adding an ONT with trunk port to Huawei SmartAX MA5683T”

How to disable Windows 10 updates

I’ll describe several options for disabling Windows 10 updates:

1) Disable the update service.
Open the “ Services ” window through the Control Panel, or press the Win+R key combination and in the “ Run ” window, enter:

services.msc

In the list of services, usually at the end, we find “ Windows Update” , click on it with the left mouse button twice, in the opened window, select “ Startup Type: Disabled “and click the” Stop “button, then click” OK “and close the windows.

2) You can disable the automatic downloading of drivers from the Internet.
Using the Win+R keys, open the “ Run ” window and enter:

rundll32 newdev.dll,DeviceInternetSettingUi

In the window that opens, select “ No, give the option to select “, then for example “ Never install drivers from Windows Update ” and click the “ Save “.

3) You can hide updates by running the official utility Show or hide updates and tapping “Hide updates“.

4) You can also turn on the “ Set as limit connection ” radio button for any network connection by going to “ Settings ” – “ Network and Internet ” and selecting the network connection, after that Windows will not download updates via this network connection.

5) Open the “Local Group Policy Editor” by pressing the Win+R keys and typing:

gpedit.msc

Select “ Computer Configuration ” -> “ Administrative Templates ” -> “ Windows Components ” -> “ Windows Update “, then on the right” Set up automatic updates “. In the window that opens, select “ Enabled ” and the desired option, for example, “ Download notification and Automatic installation “.

How to fix error “host NAME greeted me with my own hostname NAME”

I noticed once on one server that Postfix does not always send mail, the logs had the following error:

warning: host NAME[192.168.5.5]:25 greeted me with my own hostname NAME

After seeing the host name:

hostname -f

Found that it is not correct and coincides with that on which the mail is sent!

Changed the host name to the correct one in the following files (in the nano editor Ctrl+X to exit, y/n to save or cancel changes):

sudo nano /etc/hostname
sudo nano /etc/postfix/main.cf
sudo nano /etc/hosts

Done, after that the error did not appear and the mail was successfully delivered.

Redmine Backup

Create a script (in the text editor nano Ctrl+X to exit, y/n to save or cancel changes):

sudo nano /etc/cron.daily/redmine

Sample script content:

#!/bin/sh
/usr/bin/mysqldump -u root -p<password> redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz
rsync -a /var/lib/redmine/default/files /path/to/backups/files

Let’s make the script executable:

chmod +x /etc/cron.daily/redmine

In the script, you can also add the command to delete old files or directories so that the disk does not overflow, see my article – Script to delete old files

See also other my articles about backup – Backup

How to fix error “dhcpd self-test failed. Please fix the config file”

I noticed once in the syslog:

dhcpd self-test failed. Please fix the config file

Isc-dhcp-server was installed on the server.

To check the correctness of the configuration file, use the command:

dhcpd -t
dhcpd -t -cf /dir/dhcpd.conf
/usr/sbin/dhcpd -t

The command should tell which line the error is, but noted that if it is not critical, it may not.
The key “t” executes the configuration test, and “cf” allows you to specify the path to the configuration file if it is not standard.

In my case, in the configuration file /etc/dhcp/dhcpd.conf, someone made a typo, in the line below (there was an extra letter):

authorivtative;

Because of this, an error occurred, but despite the error dhcp worked.
Although there were also some critical errors, such as an incorrectly written mac address, DHCP did not start because of this error.

How to fix error Failed binding to authentication address * port 1812: Address already in use freeradius

I once ran FreeRADIUS in debug mode:

sudo radiusd -X

And I noticed the following error:

Failed binding to authentication address * port 1812: Address already in use freeradius
/usr/local/freeradius/etc/raddb/radiusd.conf[84]: Error binding to port for 0.0.0.0 port 1812

The error indicates that the address is already in use, so you need to stop the running FreeRADIUS process, look for it and see what’s running on the ports:

sudo ps ax | grep radius
sudo netstat -tulpn | grep :1812
sudo netstat -tulpn | grep :1813
sudo netstat -tulpn | grep :67

In my case, /usr/sbin/radiusd was already started, it can be terminated by PID:

sudo kill -9 PID

Or so:

sudo /etc/init.d/radiusd status
sudo /etc/init.d/radiusd stop
sudo /etc/init.d/freeradius stop