I noticed several times that the server was crashing with Ubuntu Server installed on 14.04.01, after which only a hard reset with power outage helped.
Continue reading “Solution of the error NMI watchdog: BUG: soft lockup – CPU#0 stuck for 23s!”Author Archives: Vyacheslav
Install and use Partclone
Partclone — utility for cloning and restoring disk partitions.
Perform the installation of Partclone in Ubuntu:
sudo apt-get update sudo apt-get install partclone
Partclone can work with many file systems, when you start it through a point, you must specify the type of file system, for example:
partclone.btrfs (btrfs) partclone.ext2/ext3/ext4 (ext2, ext3, ext4) partclone.reiserfs (reiserfs 3.5) partclone.reiser4 (reiser 4) partclone.xfs (xfs) partclone.ufs (ufs/ufs2) partclone.jfs (jfs) partclone.hfs+/hfsplus (hfs plusfs) partclone.vmfs (vmfs) partclone.ntfs (ntfs) partclone.fat12/fat16/fat32 (fat12, fat16, fat32) partclone.exfat (exfat) partclone.minix (minix) partclone.f2fs (f2fs) partclone.nilfs2 (nilfs2)
Here are the possible startup options:
-s FILE, --source FILE
The data source specifies the file or partition to be cloned from or from which data will be restored.
-o FILE, --output FILE
The output file in which the data or partition to which data will be restored will be stored.
-O FILE, --overwrite FILE
Overwrite the file if it exists.
-c, --clone
Preservation
-r, --restore
Recovery
-b, --dev-to-dev
Copy from device to device mode
-l FILE, --logfile FILE
Path to the log file (default /var/log/partclone.log)
-R, --rescue
Continue after disk read errors
-C, --no_check
Do not check disk size and free space
-N, --ncurse
Ncurses text-based user interface
-X, --dialog
Output of messages in a dialogue format
-I, --ignore_fschk
Ignore file system check
--ignore_crc
Ignore crc errors
-F, --force
Forced mode
-f SECONDS, --UI-fresh SECONDS
Changing the interval
-z SIZE, --buffer_size SIZE
The size of the read / write buffer (default: 1048576)
-q, --quiet
Quiet mode, information about the execution process will not be displayed
-dlevel, --debug level
Debug mode level 1/2/3
-h, --help
Display Help
-v, --version
Display the version of the program
I will give examples of running partclone.
First let’s see what drives in the system are used:
sudo fdisk -l | grep '/dev/'
Example of cloning a partition to a file:
sudo partclone.ext3 -c -d -s /dev/sda1 -o sda1.img
Example of cloning a partition into an archive:
sudo partclone.ext3 -c -d -s /dev/sda1 | gzip -c > /dev/sdb2/sda1.gz
Restoring the partition from the file:
sudo partclone.ext3 -r -d -s sda1.img -o /dev/sda1
Restoring the partition from the archive:
sudo gzip -d /dev/sdb2/sda1.gz | partclone.ext3 -d -r -o /dev/sda1
We clone the partition into the partition of another disk:
sudo partclone.ext3 -b -d -s /dev/sda1 -o /dev/sdb2
The solution of the error “Permission denied: .htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable”
I noticed somehow the following error:
[Mon Sep 05 10:24:38 2016] [crit] [client 192.168.1.1] (13)Permission denied: /home/user/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Before the error occurred, I moved the files through sudo (from the root user) and to return the rights I executed the command:
sudo chown user:user -R /home/user/public_html
Which changed the owner to the one specified in all the subfolders and files, but the other directory should have been specified to the public_html directory (not its contents), because of which apache2 wrote that access was denied. Therefore, if you point to the public_html of the user and the group from which apache2 is running, the error disappears.
It can also be helped by specifying permissions 777 on this folder, it will give full access to all users (but this option is better not to use for security purposes).
How to restore the standard mac-addresses of MikroTik interfaces
Recently, I had to copy the settings of one MikroTik router to another one and after I saved the settings to a file and populated them on the second, I noticed that mac addresses were also copied.
Therefore, we had to reset them to standard ones.
First, let’s see what the interface numbers are (I have ether1 for 0, ether2 for 1, etc.):
interface ethernet print
And reset their mac-addresses:
interface ethernet reset-mac-address 0 interface ethernet reset-mac-address 1 interface ethernet reset-mac-address 2 interface ethernet reset-mac-address 3 interface ethernet reset-mac-address 4
If you need to reset the mac of the wireless interface, then save the wireless settings to the file:
interface wireless export file wifibackup
Look at the wireless interfaces (I have one at number 0):
interface wireless print
Reset all settings including the mac address:
interface wireless reset-configuration 0
Restore the settings from the previously saved file (mac-address in this case will remain standard):
import wifibackup.rsc
Done.
Limiting access to management of Huawei SmartAX MA5600
For example, to allow to connect to the Huawei SmartAX MA5600 series via telnet only to the specified IP address ranges 192.168.0.100-192.168.0.254 and 172.16.24.1-172.16.24.50 we will connect to the device and go into the configuration mode:
enable config
And execute the following commands (for non-specified IP access is immediately prohibited):
sysman ip-access telnet 192.168.0.100 192.168.0.254 sysman ip-access telnet 172.16.24.1 172.16.24.50 sysman firewall telnet enable
Similarly for SSH:
sysman ip-access ssh 192.168.0.100 192.168.0.254 sysman firewall ssh enable
And SNMP for example for one IP:
sysman ip-access snmp 192.168.0.100 192.168.0.100 sysman firewall snmp enable
To deny access to the specified subnet, we specify ip-refuse instead of ip-access, for example:
sysman ip-refuse telnet 192.168.1.200 192.168.1.220 sysman firewall telnet enable
On the test, I performed the settings for Huawei SmartAX MA5683T, they are essentially the same for the entire MA5600 series.
Solution of VirtualBox error “Kernel driver not installed (rc=-1908)”
I noticed somehow an error in VirtualBox working on Linux Ubuntu Desktop 16.04:
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please install virtualbox-dkms package and load the kernel module by executing
‘modprobe vboxdrv’
as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) – The support driver is not installed. On linux, open returned ENOENT.
To solve the problem it was necessary to disable the secure boot in the BIOS, in my case “Windows UEFI” was selected, changed to “Other OS”.
Then, after running the system, executed the command from the root user:
modprobe vboxdrv
In Ubuntu, you can switch to root as follows:
sudo -i
Done, the error is solved.
IPTables rules for Asterisk
To allow SIP connection in IPTables, add rules (the first for connections, the second for voice traffic):
Continue reading “IPTables rules for Asterisk”Packet capturing with tcpdump
tcpdump – A utility that allows you to intercept and analyze network traffic.
Continue reading “Packet capturing with tcpdump”Adding SIP clients to Asterisk
SIP clients in Asterisk are specified in the sip.conf file, so open it for example in the nano text editor (Ctrl+X to exit the editor, y or n to save or discard changes):
Continue reading “Adding SIP clients to Asterisk”Adding a SIP client to FreePBX
To add a SIP client to FreePBX, open the menu “Applications” – “Extensions“, choose for example “Generic CHAN SIP Device” and we indicate the main parameters:
User Extension: 6000 (SIP number)
Display Name: Operator (any name to display)
Secret: PASSWORD
and click “Submit“.
Done, SIP is added, it can already be registered at the specified number and password.
How to add SIP in the configuration file I described in this article – Adding SIP clients to Asterisk