4

I have tried the following with both LinuxMint 13 Cinnamon 32 bit and Trisquel 7.0 Gnome 32 bit and get the same error message:

$ yes | sudo e2fsck /dev/sdax
e2fsck 1.42 (29-Nov-2011)
e2fsck: need terminal for interactive repairs

In each case, the partition /dev/sdax was not mounted.

Is it not possible to use yes with e2fsck?

3
  • yes - output a string repeatedly until killed what is the reason to use it here?
    – Costas
    Jan 20, 2015 at 12:06
  • 3
    Based on the error message, I guess it insists on a terminal. Could you trick it in order to be able to use yes with it? Maybe, but you don't need to: it already has a -y option that does the same thing.
    – Celada
    Jan 20, 2015 at 12:06
  • @Costas: I'd much rather have a program keep feeding 'y' to e2fsck than having to type it over and over again when there are file system errors.
    – Don Nadie
    Jan 22, 2015 at 16:32

4 Answers 4

22

If you are sceptical whether e2fsck -y works for you next time, coins might help.

enter image description here

I used to use this trick when there were no yes or -y or equivalent options in MS-DOS.

5

Try using

sudo e2fsck -y /dev/sdax
5
  • 2
    The first solution is exactly equivalent to the nonworking example in the question (other than outputting "yes" instead of "y," which won't make any difference in this case).
    – Doorknob
    Jan 20, 2015 at 14:39
  • Yes, I have expected that but I couldn't check it on my drive. But sometimes small details make difference. Jan 20, 2015 at 15:57
  • In the future, I'll try e2fsck -y /dev/sdax but really won't know if it does what I want until the next time I have file system errors and e2fsck repeatedly asks me if I want to perform its suggested fixes. e2fsck can suggest a lot of fixes when a file system is messed up; I just don't want to type 'y' over and over again when there are lots of errors.
    – Don Nadie
    Jan 22, 2015 at 16:42
  • this answer is too short and is not adding anything to the previous answer
    – alicef
    May 12, 2017 at 10:52
  • but "the previous" answer is younger... May 8, 2020 at 17:38
2

i had to enter "n" (don't abort) before "yes", so i used script:

(echo n; yes) | script --return -c "e2fsck /dev/sda1"

0

You can try also:

sudo e2fsck -p /dev/sdax

See man e2fsck for description of all arguments.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .