Users have trouble opening terminals

I am new to BSD so please bear with me. :)

I have tested this behavior in three different environments, dwm, spectrwm, and xfce.

Basically whenever I issue a command to open any sort of terminal (I tried xterm, lxterm, xfce, and gnome's terminals) as a user the window opens and then closes immediately. I have tried this from menu's, using hotkeys, and by calling a new terminal from a previous one. As root in all three environments the terminals open correctly with no issues.

Non terminal applications open correctly.

What makes this problem strange is that if I issue several commands to open xterm (for example, but the others as well) using a hotkey eventually one will open and stay open. An error I can see when I close X that I think might be related to this is "getty repeating too quickly on port /dev/ttyv8, sleeping for 30 seconds", but I think that this is related to the terminals that stay open, not the ones that close immediatley. My user is a part of the wheel and operator groups.

It is strange to me that:
1. Root has no issues (which makes me think it's an issue with permissions)
2. If I issue several quick commands to open the terminal finally one opens (which makes me think it is NOT permissions)

Is there a log I can look in to invesigate this issue further?

Thanks. :)
 
The commands that are failing were any commands that opened a terminal of any kind as the user. Xterm, UXterm, Lxterm, Xfce-Terminal, Gnome-Terminal, and I tried a few others as well. When I would issue the command to open the terminal, be it from a menu or from another terminal as a user it would open and then close immediately 99% of the time.

When logged in as root however, this did not happen a single time. Also if I logged in as user and su-ed to root there were no problems. I tried two different GUI's to make sure that wasn't the issue (Xfce and Dwm) and it happened in both environments.

I was able to fix it by 1. Rebuilding the login manager (Slim) from source and 2. Ignoring the instructions to activate it via ttys and instead using rc.conf. It was a weird issue for sure, would sure like to understand what went wrong, and more importantly what I did wrong. All other applications worked fine, just the terminal applications were malfunctioning.
 
I have also expecienced this problem with 10.0 - with dwm and windowmaker I can't open xterm but I can open it on fluxbox, on the same user.
 
It appears my diagnosis was WAY off. I have been able to recreate the problem described above and now I understand it a little better. It appears to be related to the users shell. When I create and set their default shell to sh, I have the problems described above. When I create a user who's default shell is either csh or tcsh then there are no problems.

I sure would like to understand what is going on here. There is obviously something very silly that I am missing.
 
rc.conf
Code:
hostname="bladeebla"
wlans_bwi0="wlan0"
ifconfig_wlan0="DHCP WPA"
hald_enable="YES"
dbus_enable="YES"
intel_enable="YES"
slim_enable="YES"
ifconfig_bge0="DHCP"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

loader.conf
Code:
if_bwi_load="YES"
.xinitrc (dwm)
Code:
xset b off
exec dwm


.xinitrc (xfce)
Code:
xset b off
exec startxfce

I believe that is all of the changes I have made on this box.
 
I forgot I also added this xorg.conf generated with Xorg -configure:
Code:
Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        ModulePath   "/usr/local/lib/xorg/modules"
        FontPath     "/usr/local/lib/X11/fonts/misc/"
        FontPath     "/usr/local/lib/X11/fonts/TTF/"
        FontPath     "/usr/local/lib/X11/fonts/OTF"
        FontPath     "/usr/local/lib/X11/fonts/Type1/"
        FontPath     "/usr/local/lib/X11/fonts/100dpi/"
        FontPath     "/usr/local/lib/X11/fonts/75dpi/"
        FontPath     "/usr/local/lib/X11/fonts/dejavu"
EndSection

Section "Module"
        Load  "dbe"
        Load  "dri"
        Load  "dri2"
        Load  "extmod"
        Load  "record"
        Load  "glx"
        Load  "freetype"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/sysmouse"
        Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"                   # [<bool>]
        #Option     "SWcursor"                  # [<bool>]
        #Option     "ColorKey"                  # <i>
        #Option     "CacheLines"                # <i>
        #Option     "Dac6Bit"                   # [<bool>]
        #Option     "DRI"                       # [<bool>]
        #Option     "NoDDC"                     # [<bool>]
        #Option     "ShowCache"                 # [<bool>]
        #Option     "XvMCSurfaces"              # <i>
        #Option     "PageFlip"                  # [<bool>]
        Identifier  "Card0"
        Driver      "intel"
        VendorName  "Intel Corporation"
        BoardName   "82Q963/Q965 Integrated Graphics Controller"
        BusID       "PCI:0:2:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                Viewport   0 0
                Depth     1
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     4
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     8
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     15
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     16
        EndSubSection
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection
 
Does intel_enable="YES" do anything?

Just to verify: normal users can log in at the console, correct?
 
@wblock@, I thought I needed it for my video card. I looked it up and found out that if I needed it it needs to be in bootloader.conf. Thanks for pointing that out. I probably don't need it, the video has been displaying just fine.

I assume that you are asking if users can log in while X is not running, and the answer is yes. Everything is normal until I go into X, everything is normal if the user's shell is not sh.


@SirDice@, locale for root and the users are identical, but that is good to know. As far as fonts go I don't really know how to check to see if I have the right ones installed. There are no issues with root opening terminals, or like i said above if the users shell is not sh there are no problems.

For now things are working fine. I don't mind tcsh. It's a little different than bash. Did some pretty messy cp's and learned that. I have been reading about dtrace and I THINK I might be able to observe what is going on with it. Might take me a minute though. I just heard about it yesterday and there is a lot of reading to do. I really do want to know what is going on though. This problem is weird and seems to defy logic. Computers should either let you do things or not. This whole not letting me open a terminal but sometimes letting me is baffling! :)

I will make sure and report back if I find anything.
 
Last edited by a moderator:
Probably not the issue here, but remember that sh(1) is not shells/bash on FreeBSD.

It's not necessary to load the kernel module for the KMS drivers, that is done automatically. And I don't think it's called intel, but don't know the actual name.
 
What shell is set in your /usr/local/etc/slim.conf file? I think the default is shells/bash if I remember correctly, but it may be changed to /bin/tcsh for the FreeBSD port. I'm not sure however.
 
If you open a terminal (xterm or some other) as root, does su - myuser work? If you can su(1) to another user, what happens if you open a terminal from there?
 
SirDice said:
If you open a terminal (xterm or some other) as root, does su - myuser work? If you can su(1) to another user, what happens if you open a terminal from there?

If I su to root and then open a terminal from the existing one it opens with no problem.

protocelt said:
What shell is set in your /usr/local/etc/slim.conf file? I think the default is shells/bash if I remember correctly, but it may be changed to /bin/tcsh for the FreeBSD port. I'm not sure however.

I checked /usr/local/etc/slim.conf and it is configured to /bin/sh

I was able to use the DTraceToolkit errinfo script and track what was happening a little further. Below is the output. Again this is a user who's shell is sh.

Doesn't ring any bells for me yet. I can see there is a problem though.

Code:
            EXEC          SYSCALL  ERR  COUNT  DESC
            Xorg           writev   32      1  Broken pipe 
             dwm             poll    4      1  Interrupted system call 
             dwm        sigreturn   -2      1 
      perl5.16.3             read    4      1  Interrupted system call 
      perl5.16.3        sigreturn   -2      1 
              sh            ioctl    4      1  Interrupted system call 
              sh             open    2      1  No such file or directory 
              sh        sigreturn   -2      1 
         syslogd           select    4      1  Interrupted system call 
         syslogd        sigreturn   -2      1 
           xterm             kill    3      1  No such process 
           xterm            lstat    2      1  No such file or directory 
           xterm             open    6      1  Device not configured 
           xterm             read   35      1  Resource temporarily unavailable 
           xterm         readlink    2      1  No such file or directory 
           xterm        sigreturn   -2      1 
           xterm            wait4   10      1  No child processes 
             dwm           execve    2      2  No such file or directory 
            hald             read   35      2  Resource temporarily unavailable 
          locale            ioctl   25      2  Inappropriate ioctl for device 
          locale            lstat    2      2  No such file or directory 
          locale         readlink    2      2  No such file or directory 
              sh           execve    2      2  No such file or directory 
              sh          setpgid    1      2  Operation not permitted 
              sh             stat    2      2  No such file or directory 
     ulog-helper            ioctl   25      2  Inappropriate ioctl for device 
     ulog-helper            lstat    2      2  No such file or directory 
     ulog-helper         readlink    2      2  No such file or directory 
           xterm          setpgid    1      2  Operation not permitted 
           xterm             stat    2      2  No such file or directory 
              sh            lstat    2      4  No such file or directory 
              sh         readlink    2      4  No such file or directory 
           xterm            ioctl   25      8  Inappropriate ioctl for device 
     ulog-helper           access    2     44  No such file or directory 
           xterm             open    2     63  No such file or directory 
           xterm           access    2     97  No such file or directory 
            Xorg           select    4    126  Interrupted system call 
            Xorg        sigreturn   -2    126 
             dwm          recvmsg   35    182  Resource temporarily unavailable 
            Xorg           writev   35    573  Resource temporarily unavailable 
           xterm         recvfrom   35    576  Resource temporarily unavailable 
            Xorg             read   35   1056  Resource temporarily unavailable 
           xterm          recvmsg   35   2141  Resource temporarily unavailable
 
3l3vans said:
I was able to use the DTraceToolkit errinfo script and track what was happening a little further. Below is the output. Again this is a user who's shell is sh.
Unfortunately that doesn't show where things go wrong or why. This may work better: truss /usr/local/bin/xterm (or any other terminal that doesn't work). Hopefully that shows us where things go amiss. It might be a bit much to post here though, in that case please post on pastebin or a similar service and post the link here.
 
That's odd. I could certainly be wrong but it looks like maybe your $PATH isn't being picked up when you log in (No such file or directory). Could you post your slim.conf file? Since you're using sh, although it should, maybe slim isn't sourcing .profile when starting X. Just a guess.
 
/usr/local/etc/slim.conf
Code:
# Path, X server and arguments (if needed)
# Note: -xauth $authfile is automatically appended
default_path        /bin:/usr/bin:/usr/local/bin
default_xserver     /usr/local/bin/X
# The X server needs to be started on an unused virtual terminal,
# for FreeBSD in a default configuration, the first one of those is #09
xserver_arguments   vt09

# Commands for halt, login, etc.
halt_cmd            /sbin/shutdown -p now
reboot_cmd          /sbin/shutdown -r now
console_cmd         /usr/local/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/motd; exec /usr/bin/login"
suspend_cmd        /usr/sbin/acpiconf -s 3

# Full path to the xauth binary
xauth_path         /usr/local/bin/xauth

# Xauth file for server
authfile           /var/run/slim.auth


# Activate numlock when slim starts. Valid values: on|off
# numlock             on

# Hide the mouse cursor (note: does not work with some WMs).
# Valid values: true|false
# hidecursor          false

# This command is executed after a succesful login.
# you can place the %session and %theme variables
# to handle launching of specific commands in .xinitrc
# depending of chosen session and slim theme
#
# NOTE: if your system does not have bash you need
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
login_cmd           exec /bin/sh - ~/.xinitrc %session
#login_cmd           exec /bin/bash -login ~/.xinitrc %session

# Commands executed when starting and exiting a session.
# They can be used for registering a X11 session with
# sessreg. You can use the %user variable
#
# sessionstart_cmd      some command
# sessionstop_cmd       some command

# Start in daemon mode. Valid values: yes | no
# Note that this can be overriden by the command line
# options "-d" and "-nodaemon"
# daemon        yes

# Available sessions (first one is the default).
# The current chosen session name is replaced in the login_cmd
# above, so your login command can handle different sessions.
# see the xinitrc.sample file shipped with slim sources
sessions            xfce4,icewm-session,wmaker,blackbox

# Executed when pressing F11 (requires imagemagick)
screenshot_cmd      import -window root /slim.png

# welcome message. Available variables: %host, %domain
welcome_msg         Welcome to %host

# Session message. Prepended to the session name when pressing F1
# session_msg         Session: 

# shutdown / reboot messages
shutdown_msg       The system is powering down...
reboot_msg         The system is rebooting...

# default user, leave blank or remove this line
# for avoid pre-loading the username.
#default_user        simone

# Focus the password field on start when default_user is set
# Set to "yes" to enable this feature
#focus_password      no

# Automatically login the default user (without entering
# the password. Set to "yes" to enable this feature
#auto_login          no


# current theme, use comma separated list to specify a set to 
# randomly choose from
current_theme       fbsd

# Lock file
lockfile            /var/run/slim.pid

# Log file
logfile             /var/log/slim.log


And truss (thanks for that nice one to know)

Short output:
truss -c -o truss_out.txt xterm &
Code:
SIGNAL 20 (SIGCHLD)
syscall                     seconds   calls  errors
fcntl                   0.000098616       3       0
fork                    0.019786314       3       0
getegid                 0.000048889       2       0
geteuid                 0.000054476       2       0
getgid                  0.000070959       3       0
getpid                  0.000051125       2       0
getuid                  0.000074032       3       0
readlink                0.000067606       1       1
lseek                   0.000089396       3       0
mmap                    0.005440912     125       0
mprotect                0.000028215       1       0
open                    0.005660780     102      61
close                   0.002252521      45       0
fstat                   0.001882915      40       0
stat                    0.000337752       5       2
lstat                   0.000359264       6       1
ioctl                   0.000700088      16       0
access                  0.004827427      85      53
sigaction               0.000373789      10       0
connect                 0.000281321       1       0
getpeername             0.000055594       1       0
getsockname             0.000051682       1       0
recvfrom                0.379932924     389       0
select                  0.000035758       1       0
poll                    0.060718597    2080       0
setitimer               0.000083810       2       0
sigprocmask             0.002362028      67       0
socket                  0.000048050       1       0
pipe                    0.000072076       2       0
kill                    0.002952890       2       1
munmap                  0.001121092      32       0
read                    0.010440990      39       0
posix_openpt            0.001369448       1       0
wait4                   0.000244165       4       1
                      ------------- ------- -------
                        0.501975501    3080     120

And the long output is at Pastebin: truss xterm
 
SirDice said:
Terminals not opening is usually the result of missing fonts or a badly set locale(1).

Indeed. My locale was not set correctly and I did not have the correct fonts installed. Dum du dum dum!!!

It just seems weird to me that the terminals would open some of the time. Once I corrected both of these problems my terminals began to behave. For anyone having a problem similar to this you can test it by doing ctrl-alt-f1 to log out of x and looking in your first console to see if there are any error messages having to do with missing fonts. Somehow I didn't notice the errors right away.

Also your locale is set in different places depending on the shell you are using, this can be extremely frustrating if you are not aware of it. There are two methods for setting locale. I chose the not reccomended method because the only users on my boxes are me. --->http://www.freebsd.org/doc/en/books/handbook/using-localization.html#startup-file

The recommended method seems like a cool feature for larger deployments.--> http://www.freebsd.org/doc/en/books/handbook/using-localization.html#login-class

Feel a little bit stoopid about this one, but, oh well, I learned how to use a couple new tools in the process. :)
 
3l3vans said:
SirDice said:
Terminals not opening is usually the result of missing fonts or a badly set locale(1).

Indeed. My locale was not set correctly and I did not have the correct fonts installed. Dum du dum dum!!!

It just seems weird to me that the terminals would open some of the time. Once I corrected both of these problems my terminals began to behave. For anyone having a problem similar to this you can test it by doing ctrl-alt-f1 to log out of x and looking in your first console to see if there are any error messages having to do with missing fonts. Somehow I didn't notice the errors right away.

Also your locale is set in different places depending on the shell you are using, this can be extremely frustrating if you are not aware of it. There are two methods for setting locale. I chose the not reccomended method because the only users on my boxes are me. --->http://www.freebsd.org/doc/en/books/handbook/using-localization.html#startup-file

The recommended method seems like a cool feature for larger deployments.--> http://www.freebsd.org/doc/en/books/handbook/using-localization.html#login-class

Feel a little bit stoopid about this one, but, oh well, I learned how to use a couple new tools in the process. :)

I sure we've all made a mistake like that at some point ;) Glad you got things sorted out.
 
Back
Top