Howto Reboot or halt Linux system in emergency (ZT)
http://www.cyberciti.biz/tips/reboot-or-halt-linux-system-in-emergency.html
Linux kernel includes magic system request keys. It was originally developed for kernel hackers. However, you can use this hack to reboot, shutdown or halt computer safely (remember safe reboot/shutdown == flush filesystem buffers and unmount file system and then reboot so that data loss can be avoided).
This is quite useful when Linux based system is not available after boot or after a X server crashed ( svgalib program crashes) or no display on screen. Sysrq key combo forces the kernel to respond it regardless of whatever else it is doing, unless it is completely locked up (dead).
Using further extension to iptables called ipt_sysrq (new iptables target), which allows you to do the same as the magic sysrq key on a keyboard does, but over the network. So if your network server is not responding you can still reboot it. Please note that Magic SysRq support need to be compiled in your kernel. You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when configuring the kernel. I'm assuming that you have Magic SysRq key' support is compiled in your kernel.
Enable sysrq keys
By default it is not enabled on many Linux distributions. Add or modify following line (as soon as new Linux system installed) /etc/sysctl.conf: # vi /etc/sysctl.conf
Append following config directive: kernel.sysrq=1
Save and close the file. Reload settings: # sysctl -p
Save and close the file and reboot system to take effect
How do I use the magic SysRq keys in emergency?
You need to use following key combination in order to reboot/halt/sync file system etc:
ALT+SysRq+COMMAND-KEY
The 'SysRq' key is also known as the 'Print Screen' key. COMMAND-KEY can be any one of the following (all keys need to hit simultaneously) :
- 'b' : Will immediately reboot the system without syncing or unmounting your disks.
- 'o' : Will shutdown your system off (if configured and supported).
- 's': Will attempt to sync all mounted filesystems.
- 'u' : Will attempt to remount all mounted filesystems read-only.
- 'e' : Send a SIGTERM to all processes, except for init.
- 'h': Show help, indeed this the one you need to remember.
So whey you need to tell your Linux computer to reboot or when your X server is crashed or you don't see anything going across the screen then just press:
ALT+SysRQ+s : (Press and hold down ALT, then SysRQ (Print Screen) key and press 's') -Will try to syn all mounted system
ALT+SysRQ+r : (Press and hold down ALT, then SysRQ (Print Screen) key and press 'r') -Will reboot the system.
If you wish to shutdown the system instead of reboot then press following key combination:
ALT+SysRQ+o
ipt_sysrq is a new iptables target that allows you to do the same as the magic sysrq key on a keyboard does, but over the network. Sometimes a remote server hangs and only responds to icmp echo request (ping). Every administrator of such machine is very unhappy because (s)he must go there and press the reset button. It takes a long time and it's inconvenient. So use the Network Magic SysRq and you will be able to do more than just pressing a reset button. You can remotely sync disks, remount them read-only, then do a reboot. And everything comfortably and only in a few seconds. Please see Marek Zelem page to enableIP Tables network magic SysRq function.
For more information read official Documentation for sysrq.c version 1.15 stored in /usr/src/linux/Documentation/sysrq.txt and read man page of sysctl, sysctl.conf.
Howto Reboot or halt Linux system in emergency (ZT)的更多相关文章
- 【2016-10-11】Linux系统常用的关机或重启命令shutdown、reboot、halt、poweroff、init 0及init 6的联系与区别
Linux下常用的关机/重启命令一般包括: shutdown.reboot.halt.poweroff等,当然了我们可以使用init 运行等级runlevel 0即halt来关机,或使用init 运行 ...
- linux reboot ,shutdown,halt区别
reboot ,shutdown,halt区别 重启 reboot 和 shutdown -r now 效果是一样的都是重启 区别在于reboot 是重启时,删除所有的进程,为不是平稳的终止他 ...
- init shutdown reboot poweroff halt区别
init 首先看看LINUX系统几种运行级别# 0 - 停机(千万别把initdefault设置为0,否则系统永远无法启动)# 1 - 单用户模式# 2 - 多用户,没有 NFS# 3 - 完全多用户 ...
- (copy) Shell Script to Check Linux System Health
source: http://linoxide.com/linux-shell-script/shell-script-check-linux-system-health/ This article ...
- How to rebuild RPM database on a Red Hat Enterprise Linux system?
本文是笔者最近遇到的一个故障的处理过程,解决方案是Rebuild RPM 的DB,后面内容其实是REDHAT官方的solutions,不过我遇到的现象和解决方案都与官方有点出入,故一直帖出来: 我遇到 ...
- Linux System and Performance Monitoring
写在前面:本文是对OSCon09的<Linux System and Performance Monitoring>一文的学习笔记,主要内容是总结了其中的要点,以及加上了笔者自己的一些理解 ...
- The frequent used operation in Linux system
The frequently used operation in Linux system 2017-04-08 12:48:09 1. mount the hard disk: #: fd ...
- Linux System.map文件【转】
转自:http://blog.csdn.net/ysbj123/article/details/51233618 当运行GNU链接器gld(ld)时若使用了"-M"选项,或者使用n ...
- the install of mysql in Linux System
一.下载MySql 浏览器打开 https://www.mysql.com/downloads/mysql/#downloads 下载 我下载的版本是Red Hat 5 版本的 https://www ...
随机推荐
- svn working copy locked的解决方法
在使用svn更新或提交代码时,会报"svn working copy XXX locked"的错误,利用svn客户端工具TortoiseSVN的cleanup也不能解决问题. 我们 ...
- 使用Putty和Xshell远程登录之密钥认证
本次实验主要使用目前使用最多的Putty和Xshell工具进行实验 关于SSH密钥认证原理,请参考链接:http://www.cnblogs.com/ImJerryChan/p/6661815.htm ...
- Apache虚拟主机配置模板
/////////////////////////////////写在前头////////////////////////////////////////1.Apache HTTP 服务器2.4文档: ...
- underscore中template的使用Demo
在客户端渲染数据时,一般可通过underscore中的template对数据模板进行渲染,例如: 定义模板,需要把type类型设置为“text/template” <script type=&q ...
- Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions
Model compatibility cannot be checked because the database does not contain model metadata. Ensure t ...
- 机器学习(三)—线性回归、逻辑回归、Softmax回归 的区别
1.什么是回归? 是一种监督学习方式,用于预测输入变量和输出变量之间的关系,等价于函数拟合,选择一条函数曲线使其更好的拟合已知数据且更好的预测未知数据. 2.线性回归 于一个一般的线性模型而言,其 ...
- hzau 1200 Choosy in Food
1200: Choosy in Food Time Limit: 1 Sec Memory Limit: 1280 MBSubmit: 32 Solved: 5[Submit][Status][W ...
- 总结一下内核DEBUG中的dump_stack, BUG, BUG_ON以及panic
有点空闲时间,让我们来总结一下内核DEBUG中的各个语句吧.随便找个内核驱动,在init函数里面加入如下代码测试: u8 a = 1, b = 0; printk("----------du ...
- NAT123之类的软件是如何实现访问域名然后穿透到内网主机的80端口?——有公网ip就是动态域名解析,没有就是穿透+代理转发
实际上两种都用到了:1,服务提供商(123NAT,花生壳)做Proxy转发 2,两个私网地址直接连接:STUN 和TURN 使用动态域名解析还是端口映射 什么情况下使用动态域名解析?什么情况下使用 ...
- LeetCode OJ:Delete Node in a Linked List(链表节点删除)
Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...