I am booted into rescue mode after inserting the DVD. OS is CentOS 6.7 64

I've tried

cd /mnt/sysimage
chroot /mnt/sysimage
service sshd restart

which gave back service command not found.

What do I do next?

  • 2
    Why are you trying to do this? Could you just run /usr/sbin/sshd without the service trappings? – Eric Renouf Aug 23 '15 at 0:19
  • Also, do you have networking setup? – Eric Renouf Aug 23 '15 at 0:19
  • Yes network is setup and pinging. There is no /usr/sbin/sshd – Teddy291 Aug 23 '15 at 0:28
  • That also isn't in the chroot under /mnt/sysimage? – Eric Renouf Aug 23 '15 at 0:29
  • Correct (chara limit) – Teddy291 Aug 23 '15 at 0:37

I tried to do same thing with CentOS 7.2 to save some files. I booted into rescue mode after inserting the DVD and open the shell.

First I configure network with nmtui than I started ssh service without getting #bash:

#sh-4.2:service sshd start

and it started. But couldn't reach my files from shell and I get bash

#sh-4.2:chroot /mnt/sysimage
#bash:cd 'myfiles'
#bash:scp /* user@IPADDRESS:/path

This worked just fine. I tried to start ssh service and it didn't work. Do it with shell.

| improve this answer | |

In CentOS 7/RHEL 7 if rescue mode mounts your CentOS/RHEL/Fedora under /mnt/sysimage succesfully, then systemctl start sshd.service will not work in chroot (it detect chroot). You have to run SSHD manually with full path:

chroot /mnt/sysimage

If rescue mode does not detect your system properly, you have to mount all needed stuff to chroot environment by hand:

mount <your_root_device> /mnt/sysimage
mount -o bind /dev /mnt/sysimage/dev
mount -o bind /dev/pts /mnt/sysimage/pts
mount -o bind /proc /mnt/sysimage/proc
mount -o bind /sys /mnt/sysimage/sys

Then chroot and run SSHD like above. Rescue mode does not have own SSHD, you have to use the one from chroot. Don't forget to configure network interface (by nm-tui, ifconfig or ip) and default route (route or ip). This could be done in chroot too by ifup <interface> or /etc/init.d/network start and maybe by systemctl start NetworkManager.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.