In Kernel by Murat Demirten about 5 hours ago 0 Comment

After June 30, 2015 if you have NTP or PTP time synchronization services installed in your Linux system, you'll see a kernel log like that:

Clock: inserting leap second 23:59:60 UTC

This is normal because of the extra leap second issue. It exists because the rotation of the earth is not very constant and varies a bit over time, while decreasing the mean rotation speed slowly.

Coordinated Universal Time (UTC) is derived from 250+ atomic clocks distributed in several countries. Main function of these atomic clocks is measuring the transition of energy levels in an atom to calculate UTC, and as this time measuring mechanism is independent of the Earth periodically the two must be brought into alignment with a leap second.

If you have a Linux kernel before the year 2013, you may have several problems after leap second adjustment. It is related to hrtimers in kernel and described detailly in the https://lwn.net/Articles/504744/ article. If you have such a system, it is strongly advised to upgrade your kernel to newer versions.

It is not possible to run fsck on actively working filesystem. You have to run it before the filesystem mounted as read-write mode.

If you don't have any chance to unmount the filesystem which you want to run fsck on it, you can force to run fsck on next boot before the filesystem mounted as read-write mode.

To do this, just create or touch an empty file as /forcefsck like that:

$ sudo touch /forcefsck

and reboot the system. With the help of init scripts fsck will be started automatically and after the process /forcefsck file will be removed from your filesystem to prevent forced fsck runs on next boots.

Tags: fsck

There are two ways to keep ssh sessions alive.

Client-Side:

On the client side, it is possible to configure your ssh client to send keep alive packets to server. It can be configured by system wide through /etc/ssh/ssh_config or user specific ~/.ssh/config files.

Host *
ServerAliveInterval 60
ServerAliveCountMax 3

With above configuration, your ssh client will send keep alive packets to server on every 60 seconds and if it couldn't receive any response for sequential 3 keep alive packets, connection will be closed.

Server-Side:

It is also possible to change ssh keep alive packets behaviour on the server side. By this way, you can keep your clients' sessions alive without need to make special configuration on the client side.

Append following lines to your /etc/ssh/sshd_config file:

ClientAliveInterval 180
ClientAliveCountMax 2

and restart your ssh service:

$ sudo service ssh restart

After this configuration your sshd server will start to send keep alive packets to their clients on every 180 seconds and if it couldn't receive answer on 2 sequential packets, client connection will be closed.

Tags: ssh keep-alive
In Programming by Murat Demirten about 1 month ago 0 Comment

When you want to use adb for debugging in android development, you can get permissions error like this:

$ adb devices -l
List of devices attached 
????????????           no permissions usb:1-1

Most people try to solve this problem with running adb as root user or make adb binary setuid-root. But it is not suggested to being root to run adb.

When an usb device plugged into the system, udev system takes required actions if there is a matching rule for the device. If no special rule exists, permission for device set for the root user which you can check on /dev/bus/usb/<bus-no>/<device-no>

You need to add correct rules to udev for your android device. To do this, first of all you have to learn Vendor ID and Product ID of your device from lsusb output:

$ lsusb
...
Bus 001 Device 002: ID 0fce:51bb Sony Ericsson Mobile Communications AB

In above example, vendor id is 0fce and product id is 51bb. After that you must create a new udev rules file with a name like /etc/udev/rules.d/99-android.rules and add following line:

SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", ATTR{idProduct}=="51bb" MODE="0666", GROUP="plugdev"

Above line basically tells about udev to when it detects an usb device with specific vendor and product id, group ownership of the device must be set to plugdev.

Plugdev group automatically created by the Linux distributions and probably you already in this group. If not, you will need to add yourself to plugdev group too.

After all the configuration completed, you need to reload udev rules and restart the service:

$ sudo udevadm control --reload-rules
$ sudo service udev restart

If your usb cable already plugged, removed it and plug again. Now you can see your device on adb output:

$ adb devices -l
List of devices attached 
YT9111K3H1             unauthorized usb:1-1

Device seen but it says still unauthorized, your android system must be show a popup window to give authorize to your Linux system. When you accept it, you will start to use adb as a normal user:

$ adb devices -l
List of devices attached 
YT9111K3H1             device usb:1-1 product:D5803 model:D5803 device:D5803

Tags: android adb udev
In Administration by Debian User about 1 month ago 0 Comment

Sometimes it is needed to extend the size of the disk which is used by VirtualBox.

To do this, you have to extend physical size of the disk image file. For example if you have disk file named WindowsC.vdi with 25 GB of size and you want to make it 50 GB, locate the image file and run the following command:

$ VBoxManage modifyhd Win7.vdi --resize 50000

If you got an error like this:

VBoxManage: error: Cannot register the hard disk 'WindowsC.vdi' {114b110c-65bd-4088-b3e1-7770bf39675d} because a hard disk 'WindowsC.vdi' with UUID {114b110c-65bd-4088-b3e1-7770bf39675d} already exists

you have to give disk image parameter by its uuid value which shown in error message:

$ VBoxManage modifyhd 114b110c-65bd-4088-b3e1-7770bf39675d --resize 50000
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

After that, you have to start your virtual machine and extend the partition on that disk and resize the filesystem. This procedure depends on the operating system and filesystem in use.

In GUI by Debian User 2 months ago 0 Comment

Java Network Launching Protocol (JNLP) files describes how to launch Java Web Start applications.

To execute a jnlp file, you need javaws binary which you can install with:

$ sudo apt-get install icedtea-netx

After that, it is simple to execute a jnlp file like that:

$ javaws filename.jnlp

You can also install icedtea-plugin package to integrate with web browser:

$ sudo apt-get install icedtea-plugin

Please note that, this plugin uses NPAPI and Google Chrome dropped support for NPAPI starting from version 35 on Linux and Mac. It will be dropped on Windows versions too. You need to run in console for this case.

See also: Javaws trusted.certs error fix

Tags: jnlp java chrome
In Database by Uğur Engin 3 months ago 0 Comment

MySQL 5.5.8-linux2.6 setup problems in RHEL6.x/CentOS6.x distributions and quick fixes:

Problem 1:

/etc/init.d/mysql: line 256: my_print_defaults: command not found

Solution:

find /usr/local/mysql -name "my_print_defaults"
cp my_print_defaults /usr/bin/

Problem 2:

Couldn't find MySQL server (./bin/mysqld_safe)

Solution:

Open /usr/local/mysql/support-files/mysql.server script file then replace the line 

"basedir="

to

"basedir=/usr/local/mysql"

Tags: mysql 5.5.8
In Kernel by Murat Demirten 3 months ago 0 Comment

There are some cases in which you couldn't reboot a Linux system with reboot command or alternatives. If you have this problem and you don't have physical access to server, it is also possible to simulate pressing hardware reset button with the help of sysrq support in kernel.

To reboot the system through this magic interface, you need to activate sysrq first because it is disabled by default on all modern Linux distributions:

echo 1 > /proc/sys/kernel/sysrq

After that you can send b trigger to reboot system immediately like that:

echo b > /proc/sysrq-trigger

Please note that, rebooting with this method results to some data being lost. So, this method must be used only if there are no other chance to reboot system.

In Shell by Murat Demirten 3 months ago 0 Comment

Sometimes you may want to send binary data to a TCP or UDP connection. You can send text data to a TCP port with telnet command but it doesn't work for binary streams. There are some other alternatives which you can use like netcat or socat but it is also possible to send any data from TCP or UDP with just using bash shell's internal functionality. For example to send text data to 192.168.2.5's port 80 you can use:

$ echo "GET / HTTP/1.0" > /dev/tcp/192.168.2.5/80

or to send 160 bytes of a binary data to port 9000:

$ dd if=binary.dat bs=160 count=1 > /dev/tcp/192.168.2.5/9000

it is also possible to use udp too:

$ dd if=binary.dat bs=160 count=1 > /dev/udp/192.168.2.5/9000

Please note that, there is no /dev/tcp or /dev/udp folder exists in the system, this redirection mechanism is a feature of the bash shell itself.

In Networking by Debian User 3 months ago 0 Comment

If you're using vsftpd with chroot local user option and write enable like this:

write_enable=YES
chroot_local_user=YES

and you're getting following error when you log-in through ftp:

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

you can fix the problem with adding following line to /etc/vsftpd.conf and restart the vsftpd service:

allow_writeable_chroot=YES

Tags: vsftpd chroot