Error in linux console : Couldn't get a file descriptor referring to the console
Asked Answered
E

3

18

When I start Terminal the first 2 messages that i see it is :

Couldn't get a file descriptor referring to the console
Couldn't get a file descriptor referring to the console

and then prompt from console , and nothing another , also this problem creates when type setfont :

[gyok@localhost ~]$ setfont
Couldn't get a file descriptor referring to the console

if I go to Ctrl+Alt+F2 terminal all works fine and without this messages , same situation in root console, so can you try help me to repair this ? I have Fedora 21 whith Gnome, my laptop model is Y570.

Etienne answered 5/2, 2015 at 20:17 Comment(0)
R
25

setfont modifies the font in the VGA console (what you get when you press CTRL-ALT-F1, etc) It won't do anything in Terminal.

Normally only the root user can access the console device that setfont needs to connect to in order to make the font change. This is why you get an error message when you run it from your normal user account. An exception is when a user is logged into the VGA console... then the user has access to the console and setfont succeeds.

The fact that you get the error message whenever you start Terminal, means that you likely have some command in your .bashrc, .bash_profile, .bash_login, .profile or /etc/profile that is run whenever you start a terminal. Could it be that you have setfont in one of these places? otherwise, look for something else that may be accessing the console.

Rolan answered 5/2, 2015 at 21:35 Comment(4)
Could you enhance your answer? When you intentionally put it in ~/.bashrc what is the simplest test to ensure console mode and not gnome-terminal is parent? eg if console-mode; then setfont...; endifLamrouex
@Lamrouex - have not thoroughly tested this, but: if [[ `tty` =~ ^/dev/tty[0-9]+ ]] ; then setfont ... ; fi might do the job for you since console terminals seem to be named /dev/tty# and pseudo terminals in most other processes are /dev/pts/# Also, use .bash_profile for this rather than .bashrc (the latter is read for non-interactive bash invocations and can cause problems when you try to do interactive related stuff there)Rolan
@Rolan I totally forgot about my comment. I ended up changing my ~/.bashrc to look like this: if [ $TERM == linux ]; then, followed by: /bin/setfont /usr/share/consolefonts/Lat2-Terminus32x16.psf.gz and of course the final fi. When in Ubuntu (gnome-terminal) then $TERM would be equal to xterm-256color so the if test fails and the font isn't changed and the error message doesn't appear.Lamrouex
I had this issue when calling loadkeys. Running sudo loadkeys fixed it for me, thanks.Sylviasylviculture
L
8

Fixed similar error in Ubuntu by typing xdg-open followed by the filename.

Lahdidah answered 10/2, 2020 at 21:28 Comment(0)
S
1

For me, was loadkeys fr in /etc/profile sourced from ~/.bashrc

Strander answered 27/2, 2018 at 21:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.