11

It's a surprise why now tail -f isn't working while earlier was.

I've the below command to run for backup.

ubuntu@ubuntu:~$ sudo tar -cvf /media/ubuntu/My*Linux/ub*data/zebra.tar /media/ubuntu/home > z1 2> z2 && echo "pass" || echo "fail"

To see the output and error, there are those 2 files z1 and z2.

Now I want to see the output of the command on a terminal from file z1:

ubuntu@ubuntu:~$ tail -f z1

but this command is not showing the data that's getting appended with time.

I'm working on live install of Ubuntu 14.04.1 using usb pen drive. Can this be the reason?

7
  • 1
    Possibly unrelated to your problem, but you say 2 > z2. I think the stderr redirection syntax 2> does actually not allow a space bewtween the 2 and the >. Jul 31 '14 at 11:05
  • @UlrichSchwarz sorry that's my mistake. I've corrected
    – Ravi
    Jul 31 '14 at 11:07
  • 1
    Since you gave tar an f outputfilename option, z1 is going to be an empty file. Jul 31 '14 at 11:24
  • @MarkPlotnick no z1 has the output corresponding to -v option. If I run 'cat z1', it will show all files backed up. The issue is the tail command isn't working.
    – Ravi
    Jul 31 '14 at 14:16
  • @Ravi sorry, you are correct, GNU tar will write the list to stdout when v and f are used together. This goes against the written standard for tar. Will try to reproduce your problem. What directory are z1 and z2 in? The live CD's RAM disk or the USB drive? If USB, What is the filesystem type (ext3, vfat)? Jul 31 '14 at 15:44
10

I can reproduce this. It's a bug.

On an Ubuntu live CD, the filesystem that contains the default user's home directory is type overlayfs, which claims to support inotify but doesn't.

So tail -f on a file on overlayfs tries to use inotify and then doesn't get any notifications when the file has changed.

The Ubuntu bug report for this is Bug #882147: overlayfs does not implement inotify interfaces correctly. A workaround cited in that bug report, from Jim Meyering via Andrea Ranieri, is to use

tail -f ---disable-inotify file

(There really are three hyphens there.)

0

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.