SUSE Support

Here When You Need Us

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.

Environment

SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 12 Service Pack 1
SUSE Linux Enterprise Server 12 Service Pack 2

Situation

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.

Resolution

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.



Cause

To keep the ramdisk as small as possible, vi / vim was not included in the ramdisk by default.

Additional Information

For checking, if it has been added properly, please check:
hoth:~ # lsinitrd | grep "bin/vi"
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
hoth:~ #

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.
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).

Disclaimer

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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.