0

I'm working on a RH 7.3 with some issues on the partitions so It doesn't boot properly and goes in emergency mode. I booted the machine from an RH 7.3 iso and I need to extract an sosreport in Rescue mode but I have the following errors:

chroot /mnt/sysimage
chroot: failed to run command '/bin/sh': No such file or directory

So I use the following command as in the page https://access.redhat.com/solutions/43133:

ln -s bash /mnt/sysimage/bin/sh

but I'm getting the error message:

ln: failed to create symbolic link /mnt/sysimage/bin/sh: No such file or directory

Could you help me please?

4
  • symlinking to a file outside the chroot will not and can not work. the linked file is inaccessible inside the chroot, and the symlink is followed with the chroot dir as /. copy the file instead, e.g. cp -a /bin/bash /mnt/sysimage/bin/. Note that a symlink like ln -s /bin/bash /mnt/sysimage/bin/sh will now work because there is now a /bin/bash inside the chroot – cas Oct 22 '19 at 3:38
  • BTW, the chroot will also need its own copy of any shared libs required by bash. and lots of other stuff if you want to do anything useful inside the chroot. – cas Oct 22 '19 at 3:40
  • I can't copy because the directory bin in /mnt/sysimage/ doesn't exist – intore Oct 22 '19 at 9:52
  • that's what mkdir is for. mkdir then cp. BTW that explains your "No such file or directory" error message - you can't create a symlink in a non-existent directory, either. – cas Oct 22 '19 at 10:22
0

The link is not public. But most likely you have to use the full path to the bash shell (or be in the folder /bin). Try:

ln -s /bin/bash /mnt/sysimage/bin/sh
5
  • I already tried that command but It goes in error because the directory /mnt/sysimage/ is empty. – intore Oct 21 '19 at 15:49
  • So, you solved the problem? – Eduardo Trápani Oct 21 '19 at 15:51
  • unfortunatelly not. I can't proceed because that directory is empty. – intore Oct 21 '19 at 15:52
  • You might want to update the question with the current status. Commands you tried, error messages,... – Eduardo Trápani Oct 21 '19 at 15:55
  • The command ln -s /bin/bash /mnt/sysimage/bin/sh shows the error message: ln: failed to create symbolic link /mnt/sysimage/bin/sh: No such file or directory. I have the directory /mnt/sysimage/ empty. This is the current status. – intore Oct 22 '19 at 8:29

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.