Thursday, October 1, 2020

Input/Output Error How to Reboot or shutdown the Linux server?

 Input/Output Error : Bad Blocks - How to Reboot or shutdown the Linux server?  


Input/output error while running the command mostly due to it could be bad blocks on the disk. 

In this situation, first suggestion would be to check /var/log/messages for any disk-related alerts (might see some sense key alerts).


tail -n 100 /var/log/messages or tail -n 100 /var/log/syslog

tail -f /var/log/messages


#du

bash: /usr/bin/du: Input/output error




Now if try to reboot,it can also give the same output. You can try to init 6.



# reboot or init 6

bash: /sbin/reboot: Input/output error


# shutdown -r now

bash: /sbin/shutdown: Input/output error



If the above reboot commands don’t work try either forced reboot or shutdown


echo "number" >/proc/sys/kernel/sysrq


The number may be written here either as decimal or as hexadecimal with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be written in hexadecimal.


Note that the value of /proc/sys/kernel/sysrq influences only the invocation via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always allowed (by a user with admin privileges).



0 - disable sysrq completely


1 - enable all functions of sysrq


Where  b Will immediately reboot the system without syncing or unmounting your disks.

              o Will shut your system off



Forced Reboot


echo 1 > /proc/sys/kernel/sysrq

echo b > /proc/sysrq-trigger


Forced Shutdown

echo 1 > /proc/sys/kernel/sysrq

echo o > /proc/sysrq-trigger