chroot from bash script not working
I have a bash script as follows:
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt/root$i; done cat << EOF | sudo chroot /mnt/root update-initramfs -u grub-install --recheck /dev/sda grub-install --recheck /dev/sdb update-grub EOF The commands work if entered manually in a terminal, but when the bash script runs, I get the following error message: "unable to execute /usr/sbin/chroot: input output error" Why? |
Quote:
Are you aware that Code:
update-initramfs -u |
Perhaps you want to pass the commands to a chroot'ed shell?
Code:
sudo chroot /mnt/root /bin/sh << EOF |
Quote:
2) No, I was NOT aware that the commands following the "chroot" command won't execute but will only appear as text. Apparently I misunderstand what the "cat << EOF |" command does. I'm not trying to pipe the text output to chroot. I'm trying to pipe the command input to chroot. (This is what happens when I try to learn bash from forum examples). 3) I tried what "MadeinGermany" has suggested, and it worked. 4) Thank both of you for your help. |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 05:15 PM. |