I have Linux Centos 7.

My server keeps booting in emergency mode:

xfs (dm-0): failed to recover intents

journalctl gives me: Failed to mount /sysroot

Mounting /dev/dm-0 fails to mount.

I'm trying to use xfs_repair but:

xfs_repair /dev/dm-0
xfs_repair: cannot open /dev/dm-0: Device or resource busy

So I tried to unmount it.

umount /dev/dm-0
umount: /dev/dm-0: not mounted

I went ahead and tried to kill all active processes on the mountpoint.

So I did:

dmsetup table
vg_cpanel-lv-root (252:2)

dmsetup remove vg_cpanel-lv_root
device-mapper: remove ioctl on vg_cpanel-lv_root failed: Device or resource busy.

Trying to find the PID on 252:2.

lsof | grep 252,2
lsof: command not found.
sudo lsof | grep 252,2
sudo: command not found.

Going in circles here. Why can't I use lsof in emergency mode and is there an alternative?

  • The error is clear: The shell cannot find the lsof command. Where is it? Can you run it by typing the full path, such as /usr/bin/lsof? Or adding it's directory to the $PATH? The "emergency shell" may not set everything up the same as a running live system, because it cannot reliably presume certain directories or executables exist at certain locations. It also runs in it's own filesystem (not the one your hard drive normally mounts when booting), which may not have all the same installed commands.
    – C. M.
    Jul 3 at 16:38
  • You can see the same issue when you tried to execute the sudo command. And the same for the reason why umount reported /dev/dm-0: not mounted.
    – C. M.
    Jul 3 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.