A strange stdin error started coming recently while logging in Ubuntu GUI as root. While this is actually a bug which was assumed by ubuntu developers while creating .profile file. The main culprit is the
line at the end of this file. This line assumes that you are logging in as terminal user and not GUI user and therefore it needs to be modified to the following condition
if `tty -s`; then
Hope some of you find it useful to remove this error.