How to upload rdsosreport.txt to another system from the dracut emergency shell

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 10

Issue

  • How to collect data required for troubleshooting when system fails in dracut emergency shell?
  • How to copy and upload /run/initramfs/rdsosreport.txt file?

Resolution

Enter the dracut shell

The dracut shell will replace a kernel panic after an error in the initial ramdisk, allowing you to troubleshoot and possibly resolve the issue from there. To enter the dracut shell in place of the panic, interrupt the GRUB boot process, edit the kernel command line as follows, and then continue the boot process:

- Remove these (if present): `rhgb quiet`
- Add this: `rd.shell`

Continue to boot with this change. After the dracut warning, you should see something like this:

Dropping to debug shell.

sh: can't access tty; job control turned off
dracut:/# 

Note: In RHEL Dracut shell is automatically triggered when something goes wrong early in the boot process (e.g., missing root device, fstab issues, LVM failures).

Bring up networking in the dracut emergency shell

  1. If using DHCP, simply execute the dhclient command.
  2. Then confirm with ip a and ping that an appropriate address is up and reachable from another machine.

Configure another networked machine to listen on a particular port

  • Use nmap-ncat to open listening port

    1. Install the nmap-ncat package.

      # yum install nmap-ncat
      
    2. Choose an unused port and ensure that port is allowed through the firewall.

    3. Execute:

      # nc -l ADDRESS PORT >rdsosreport.txt
      

      Where ADDRESS is a local IP addr and PORT is a number, e.g., 7000

Back in dracut emergency shell, send the file

  • Execute:

    # cat /run/initramfs/rdsosreport.txt >/dev/tcp/ADDRESS/PORT
    

    Where ADDRESS and PORT correspond with what was chosen above

Video overview of different methods:


Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.