5

I have a need to launch Xubuntu as a root user for a stand-alone demo system.

Whether I use the auto-login feature from lightdm, or when logging in via "Other" > "root" when prompted, I always get the following response:

Error found when loading /root/.profile
mesg: ttyname failed: Inappropriate ioctl for device
As result the session will not be configured correctly.
You should fix the problem as soon as feasible.

enter image description here

After clearing the popup box above, the system performs as expected with the ROOT user.

Here are the contents of /etc/lightdm/lightdm.conf:

[Seat:*]
autologin-guest=false 
autologin-user=root
autologin-user-timeout=0

I have seen other similar issues online relating to Vagrind, and that the issues was solved with some of the latest updates, but this still seems to be happening on Xubuntu 16.04

https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1584488

How to solve `ttyname failed: Inappropriate ioctl for device` in Vagrant?

Most forums state that this message is erroneous and should not be displayed. Is there anyway to launch Xubuntu automatically as root while avoiding this erroneous popup?

  • (1) Did you try the answers from the Super User question that you linked to?  (2) The error message says that an error was found when loading /root/.profile.  Have you looked at that file?  We might have a better chance of answering your question if you post the contents of that file.  (If it’s too long to post, look for the words “mesg” and “tty” and post relevant excerpts.)   Please do not respond in comments; edit your question to make it clearer and more complete. – Scott Aug 16 '17 at 19:43
10

The ultimate cause is that Xubuntu clearly didn't expect anyone to perform a graphical login to the root account, so its default .profile file generates a spurious error in this situation. If you look at the last line of /root/.profile, you find:

mesg n || true

This is to prevent programs like talk from writing to your console. This is especially important if you logged in to root via a text session (su from xterm, ssh, etc.) since those messages can clutter up the screen.

The || true bit is to prevent the shell script from terminating if mesg should fail (as it is failing here), but that doesn't prevent it from generating error messages when it fails, which you are seeing.

The cause of the problem is that by putting the line in .profile, it runs every time bash is executed, even when it is run from a session without a tty device (like during the earliest parts of a graphical login), so you see the error. It's harmless, because mesg would be meaningless when run from a session without a TTY anyway, but the desktop doesn't know this and displays the message.

One solution (as a comment in a question you referenced said) is to change the line so it doesn't try to call mesg when there is no TTY:

tty -s && mesg n || true

This tells it to not try calling mesg when there is no TTY, but will still call it when there is a TTY (e.g. from an SSH login).

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.