How to resolve "mesg: ttyname failed: No such device" in the chroot environment?

Asked by Cubic PPA on 2019-04-04

I get the following error message whenever I enter the Cubic chroot environment:

    Enter chroot environment.

    mesg: ttyname failed: No such device

How to resolve this?

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
Cubic PPA
Solved:
2019-04-04
Last query:
2019-04-04
Last reply:
Cubic PPA (cubic-wizard) said : #1

This message is harmless and can be safely ignored.

It is caused by the following line in your .profile, file inside the chroot environment:

    mesg n || true

Essentially, the "mesg n" command should not be executed in an environment (like chroot) that does no have a tty device.

To correct this issue, edit ~/.profile and replace the above line with:

    (tty > /dev/null) && (mesg n || true)

You can use nano to edit the .profile file, or you can execute the following command in chroot:

    $ sed -i 's/^mesg n || true$/(tty > /dev/null) && (mesg n || true)/g' ~/.profile