How to add vi to a ramdisk for debug purposes
This document (7018734) is provided subject to the disclaimer at the end of this document.
SUSE Linux Enterprise Server 12 Service Pack 1
SUSE Linux Enterprise Server 12 Service Pack 2
A system is not booting up properly and exiting to an emergency shell. As the default emergency shell does not contain any editor, changing files in the system can be challenging.
The following steps will add vi to the initrd:
Add install_items+="/bin/vi" to a custom dracut.conf file (e.g. /etc/dracut.conf.d/10-debugme.conf, assuming vi(m) has been installed before)
Rebuild the ramdisk by invoking the mkinird wrapper script, or by calling dracut --rebuild directly.
hoth:~ # lsinitrd | grep "bin/vi"For testing, if the editor would work for you, feel free to boot directly in a emergency shell by adding rd.break as a kernel cmdline option.
lrwxrwxrwx 1 root root 3 Mar 24 11:06 bin/vi -> vim
-rwxr-xr-x 1 root root 2417808 Mar 24 11:06 bin/vim
This will drop off to a shell after processing the ramdisk (note: to edit files persistently in your root filesystem mounted in /sysroot, it is necessary to
remount it in read-write mode (mount -o remount,rw /sysroot).
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7018734
- Creation Date: 24-Mar-2017
- Modified Date:03-Mar-2020
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com