I am booted into rescue mode after inserting the DVD. OS is CentOS 6.7 64
cd /mnt/sysimage chroot /mnt/sysimage service sshd restart
which gave back
service command not found.
What do I do next?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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
#sh-4.2:service sshd start
and it started. But couldn't reach my files from shell and I get
#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.
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 /usr/sbin/sshd
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
ip) and default route (
ip). This could be done in chroot too by
ifup <interface> or
/etc/init.d/network start and maybe by
systemctl start NetworkManager.