In Kernel by Murat Demirten 16 days 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 21 days 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's port 80 you can use:

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

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

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

it is also possible to use udp too:

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

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 24 days ago 0 Comment

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


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:


Tags: vsftpd chroot
In Database by Debian User about 1 month ago 0 Comment

In a MySQL master-slave replication setup, if relay log files corrupted on the slave server's filesystem replication status becomes as:

  • Slave_IO_Running    => Yes
  • Slave_SQL_Running => No
  • Last_SQL_Errno       => 1594

If you have the same problem you can fix the replication with following steps:

  1. Check the slave status output and save the values of Relay_Master_Log_File and Exec_Master_Log_Pos variables:

      Relay_Master_Log_File: mysql-bin.000278
        Exec_Master_Log_Pos: 58392316

  2. After that stop the slave node:


  3. Reset replication (removes all the binlogs after the replication stop point)


  4. Change the master_log_file and master_log_pos variables of current replication setup with the values you save on first step like that:

    > CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000278', MASTER_LOG_POS=58392316;

  5. Start the replication again:


Everything should be ok.

In Database by Debian User about 1 month ago 0 Comment

When you want to start multiple MySQL instance on the same server or you already have some other services which also heavily depends on asynchronous io framework in Linux, you may get following error on MySQL startup:

InnoDB: Warning: io_setup() failed with EAGAIN

There are two ways to fix this problem.

First solution is you can disable native asynchronous io support in InnoDB storage engine with putting following configuration in [mysqld] section of your my.cnf file:

innodb_use_native_aio = 0

But you will also loose some performance because of the aio disabled.

Second solution is, you can increase the maximum number of asynchronous request limit in kernel. Most distributions use default value of 65536 which you can see with following command:

cat /proc/sys/fs/aio-max-nr

You can set this number to 500000 or even more with:

echo 500000 > /proc/sys/fs/aio-max-nr

or it is better to make changes permanent with adding following lines to /etc/sysctl.conf or /etc/sysctl.d/XXX.conf file:

fs.aio-max-nr = 500000

Tags: mysql aio innodb
In Tools by Turker Sezer 2 months ago 0 Comment

Rygel is the one of the most popular DLNA softwares on Linux. It is a home media solution that allows you to easily share audio, video and pictures to other devices.

Rygel configuration is very simple except two tricky points. If you can't see all folders which you shared, follow instructions below.

Before we start to share our media files over network using rygel, we have to edit few lines in config file. Rygel config file is in ~/.config/rygel.conf path.

  • Select Folders to Share

We will list all folder names which we want to share as semicolon-seperated in uris parameter in [MediaExport] section. We don't need to escape special characters or spaces.

uris=/mnt/D/sample-folder/NEW;/mnt/D/sample folder/Videos;

  • Disable Tracker Plugin
Rygel disables MediaExport plugin which we use to share user-selected folders if Tracker plugin is enabled. So you can see only default pictures, videos and music folders as shared instead of user-defined folders. To disable Tracker plugin, we will change enabled parameter in [Tracker] section as False.


Now we can run rygel command, and access all shared folders from other devices.

If you have a delay about 10-15 seconds when mounting shared NFS folders, check logfiles (/var/log/syslog, /var/log/messages) for a log like this:

RPC: AUTH_GSS upcall timed out

If you can see similar logs, your nfs mounts delayed by the Kerberos authentication on server side. If your NFS server in a network which needs Kerberos authentication, you have to set NEED_GSSD=yes in /etc/default/nfs-common file. After reboot, mount delays will be disappear.

But, most of the time you're not in a Kerberos enabled network or you don't need Kerberos authentication mechanism in your NFS server. If so, you have to blacklist rpcsec_gss_krb5 Linux kernel module. To do this create a file named /etc/modprobe.d/blacklist-nfs-gss.conf and add following line into that file:

blacklist rpcsec_gss_krb5

After reboot, you can mount without any delays.

Tags: nfs rpc
In Filesystem by Turker Sezer 2 months ago 0 Comment

We can browse and mount Windows shared folders from Linux machines. We can also use same methods to access SMB shares from Linux servers.

Most of Linux distros include smbfs package as default. This package contains smb related commands.

To get a list of shares on a server, run,

/usr/bin/smbclient -L <server>

'server' parameter will be IP address or hostname of server. This command will return a list of services which contains shared drives and printers. If smb shares have security configured, that command will ask for a password.

To use a share on client machine, run,

/usr/bin/smbclient <service> <password>

'service' will be hostname and share name. For example, if you want to access 'images' directory on 'johndoe' server, service would be called \\johndoe\\images. But, due to shell restrictions, you need to escape backslashes, so you should use that command,

/usr/bin/smbclient \\\\johndoe\\\\images yourpassword

When you run that command, you will access to smbclient prompt. If you type 'h', you can see all available commands.

smb: \> h
ls             dir            lcd            cd             pwd           
get            mget           put            mput           rename        
more           mask           del            rm             mkdir         
md             rmdir          rd             prompt         recurse       
translate      lowercase      print          printmode      queue         
cancel         stat           quit           q              exit          
newer          archive        tar            blocksize      tarmode       
setmode        help           ?              !

If you are familiar with ftp command, you can use smbclient prompt easily.

smbclient prompt is good for testing but it isn't enough for real work. Probably, you will want to mount smb shares to your local and use them like a standard folder. So you should use smbmount and smbumount commands for that. These commands work like mount and umount commands.

To mount a smb share to your system, run,

smbmount "\\\\johndoe\\\\images" -U <username> -c 'mount /target_folder -u 500 -g 100'

We use same 'service' parameter in that command. And we also specify target folder name to mount share to that folder. After you run that command, you will see smb share as mounted in mount command output like a NFS share.

[root@myhost]# mount
/dev/hda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,mode=622)
//JOHNDOE/IMAGES on /target_folder type smbfs (0)

You may receive this errors on Linux systems in several programs specifically on installation on service setup step.

Most common reason for this problem, if your fully qualified domain name does not include any . (dot) character, software used to setup the service thinks that your hostname is not set properly.

If following command returns a hostname with dot(s), this makes setup software happy:

$ hostname --fqdn

As you can see, it doesn't return a dotted hostname. We can solve this problem with adding a dotted hostname in /etc/hosts file like below:    myserver.localhost  myserver

You can provide more than one hostname for ip but the first entry must be a dotted version.

After that run the command again:

$ hostname --fqdn

It probably solves your problem.

Please check hostname related articles below.

Tags: hostname fqdn