# Keyboard won't work in Xorg after vt(4) enabled



## epopen (Nov 19, 2014)

Hi all.

I upgraded to FreeBSD 10.1-RELEASE (VGA: Intel GM45 express) and enabled vt(4). But the keyboard won't work. It looks like the keyboard does not exist.

I found that the description of x11-drivers/xf86-input-keyboard, revision 1.8.0_2 said:


> Don't query console keymap
> 
> This seems to be useless and doesn't work anymore with vt(4), due to the
> use of Unicode codepoints in vt(4). The new patch remove the related
> code. This fixes a segmentation fault during X.Org server startup.


Does that mean it causes the problem?

Thanks a lot.
Epopen.


----------



## wblock@ (Nov 19, 2014)

That is an older version of x11-drivers/xf86-input-keyboard.  Try the latest, 1.8.0_6.


----------



## epopen (Nov 20, 2014)

wblock@ said:


> That is an older version of x11-drivers/xf86-input-keyboard.  Try the latest, 1.8.0_6.



Hi wblock@,

Thanks your reply. In fact, I'm using x11-drivers/xf86-input-keyboard revision 1.8.0_6 now and it causes the problem. Sorry not clear enough to explain it.

I saw the description from revision 1.8.0_2 to 1.8.0_6. Looks like vt(4) support was removed in 1.8.0_2, not restored yet until 1.8.0_6..

Because poor English, I can't make sure it correct or mistake.

Thanks a lot.
Epopen


----------



## wblock@ (Nov 20, 2014)

Sorry, I don't understand the problem.  What do you mean by "the keyboard won't work"?  Does it type things, but the keys are wrong?  Does it not type at all?  Please install sysutils/bsdadminscripts and run `pkg_libchk -qo`.


----------



## epopen (Nov 21, 2014)

wblock@ said:


> Sorry, I don't understand the problem.  What do you mean by "the keyboard won't work"?  Does it type things, but the keys are wrong?  Does it not type at all?  Please install sysutils/bsdadminscripts and run `pkg_libchk -qo`.



Hi wblock@.
About "the keyboard won't work".
It means that vt(4) is enabled, the keyboard types fine in the console, but X11(GNOME2/3) can't type anything, looks like the keyboard is gone.

I had been trying sysutils/bsdadminscripts and ran `pkg_libchk -qo` and got below result:

```
devel/gitg
net/gnome-nettool
ports-mgmt/gnome-packagekit
x11-toolkits/gtksourceviewmm3
editors/libreoffice
devel/regexxer
```

Thanks a lot.
Epopen


----------



## SirDice (Nov 21, 2014)

Please post your /var/log/Xorg.0.log and, if it exists, /etc/X11/xorg.conf.


----------



## wblock@ (Nov 21, 2014)

Is hal enabled in /etc/rc.conf?


----------



## epopen (Nov 22, 2014)

Thanks all!
I show my test procedure..

File
/etc/X11/xorg.conf (Whole)

```
Section "ServerLayout"
  Identifier  "X.org Configured"
  Screen  0  "Screen0" 0 0
  InputDevice  "Mouse0" "CorePointer"
  InputDevice  "Keyboard0" "CoreKeyboard"
  Option  "AutoAddDevices" "off"
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/"
EndSection

Section "Module"
  Load  "dbe"
  Load  "dri"
  Load  "dri2"
  Load  "extmod"
  Load  "record"
  Load  "glx"
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  "vesa"
#  Driver  "intel"
  VendorName  "Intel Corporation"
  BoardName  "Mobile 4 Series Chipset Integrated Graphics Controller"
  BusID  "PCI:0:2:0"
EndSection

Section "Screen"
  Identifier "Screen0"
  Device  "Card0"
  Monitor  "Monitor0"
  SubSection "Display"
  Viewport  0 0
  Depth  24
  Modes  "1280x800"
  EndSubSection
EndSection
```

/usr/src/sys/amd64/conf/MY_CONFIG (part of a whole)

```
#device  vga  # VGA video card driver
#options  VESA  # Add support for VESA BIOS Extensions (VBE)
#device  sc
#options  SC_PIXEL_MODE  # add support for the raster text mode
device  vt
device  vt_vga
device  vt_efifb
#device  agp  # support several AGP chipsets
```

/etc/rc.conf (part of a whole)

```
keymap="us.iso"
hald_enable="YES"
```


System boot finished..
`dmesg -a` (part of a whole)

```
Configuring vt: keymap blanktime.
```


After `startx`, GNOME 3 shell loaded.
`kldstat` Add under line..(Got it after ALT+F2 press)

```
15  1 0xffffffff81198000 630de  i915kms.ko
16  1 0xffffffff811fc000 40c71  drm2.ko
17  2 0xffffffff8123d000 aedd  agp.ko
18  4 0xffffffff81248000 17db  iicbus.ko
19  1 0xffffffff8124a000 d73  iic.ko
20  1 0xffffffff8124b000 16db  iicbb.ko
```
`dmesg -a` Add under line..(Got it after ALT+F2 press)

```
agp0: <Intel GM45 SVGA controller> on vgapci0
agp0: aperture size is 256M, detected 131068k stolen memory
info: [drm] Initialized drm 1.1.0 20060810
drmn0: <Mobile Intel® GM45 Express Chipset> on vgapci0
info: [drm] MSI enabled 1 message(s)
info: [drm] AGP at 0xd0000000 256MB
iicbus0: <Philips I2C bus> on iicbb0 addr 0xff
iic0: <I2C generic I/O> on iicbus0
iic1: <I2C generic I/O> on iicbus1
iicbus2: <Philips I2C bus> on iicbb1 addr 0x0
iic2: <I2C generic I/O> on iicbus2
iic3: <I2C generic I/O> on iicbus3
iicbus4: <Philips I2C bus> on iicbb2 addr 0x0
iic4: <I2C generic I/O> on iicbus4
iic5: <I2C generic I/O> on iicbus5
iicbus6: <Philips I2C bus> on iicbb3 addr 0x0
iic6: <I2C generic I/O> on iicbus6
iic7: <I2C generic I/O> on iicbus7
iicbus8: <Philips I2C bus> on iicbb4 addr 0x0
iic8: <I2C generic I/O> on iicbus8
iic9: <I2C generic I/O> on iicbus9
iicbus10: <Philips I2C bus> on iicbb5 addr 0x0
iic10: <I2C generic I/O> on iicbus10
iic11: <I2C generic I/O> on iicbus11
iicbus12: <Philips I2C bus> on iicbb6 addr 0x0
iic12: <I2C generic I/O> on iicbus12
iic13: <I2C generic I/O> on iicbus13
iicbus14: <Philips I2C bus> on iicbb7 addr 0x0
iic14: <I2C generic I/O> on iicbus14
iic15: <I2C generic I/O> on iicbus15
info: [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
info: [drm] Driver supports precise vblank timestamp query.
drmn0: taking over the fictitious range 0xd0000000-0xe0000000
fbd0 on drmn0
VT: Replacing driver "vga" with new "fb".
info: [drm] Initialized i915 1.6.0 20080730
Nov 22 09:45:39 epopen dbus[91310]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.38" (uid=1001 pid=82931 comm="") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination=":1.2" (uid=0 pid=10042 comm="")
Nov 22 09:45:45 epopen dbus[91310]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.38" (uid=1001 pid=82931 comm="") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination=":1.2" (uid=0 pid=10042 comm="")
```

`Console message` at http://pastebin.com/PsSt8aJn (Got it after ALT+F2 press,  duplicate removed)

/var/log/Xorg.0.log at http://pastebin.com/JS2PhZkQ

Here, GNOME 3 shell load successful.
Open `Gedit` for test.

*First several key stroke , hadn't any character appear in Gedit.*

*But after storke(less 50 time I think), some random repeat character appear in Gedit.*
*Look like random key press and hold down.*

GNOME3-shell out of control.
Only press ALT+F2 jump to console mode and record upper message.
In ALT+F2 console mode, press Ctrl+C broke X11.

After Ctrl+C press.
`Console message` Add under line.


```
^Cxinit: connection to X server lost

waiting for X server to shut down
xscreensaver: 09:48:08: SIGHUP received: restarting...
xscreensaver: 09:48:08: initial effective uid/gid was root/epopen (0/1001)
xscreensaver: 09:48:08: running as epopen/epopen (1001/1001)

xscreensaver: 09:48:08: Can't open display: :0
xscreensaver: 09:48:08: initial effective uid/gid was root/epopen (0/1001)
xscreensaver: 09:48:08: running as epopen/epopen (1001/1001)

xscreensaver: 09:48:08: This is probably because you're logging in as root.  You
  shouldn't log in as root: you should log in as a normal user,
  and then `su' as needed.  If you insist on logging in as
  root, you will have to turn off X's security features before
  xscreensaver will work.

  Please read the manual and FAQ for more information:

  http://www.jwz.org/xscreensaver/faq.html
  http://www.jwz.org/xscreensaver/man.html

Server terminated successfully (0). Closing log file.
Received signal:1->'Hangup'

Received signal:1->'Hangup'

(tracker-miner-apps:79844): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.HalVolumeMonitor disconnected from the bus; removing drives/volumes/mounts

(tracker-miner-apps:79844): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.GPhoto2VolumeMonitor disconnected from the bus; removing drives/volumes/mounts
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.

Received signal:15->'Terminated'

OK

Received signal:1->'Hangup'

(tracker-miner-user-guides:81989): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.HalVolumeMonitor disconnected from the bus; removing drives/volumes/mounts
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.

(tracker-miner-fs:21187): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.HalVolumeMonitor disconnected from the bus; removing drives/volumes/mounts
Received signal:1->'Hangup'

(tracker-miner-user-guides:81989): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.GPhoto2VolumeMonitor disconnected from the bus; removing drives/volumes/mounts
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.

Received signal:15->'Terminated'

OK

(tracker-miner-fs:21187): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.GPhoto2VolumeMonitor disconnected from the bus; removing drives/volumes/mounts

(tracker-extract:47242): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.HalVolumeMonitor disconnected from the bus; removing drives/volumes/mounts
Received signal:15->'Terminated'

(tracker-extract:47242): GVFS-RemoteVolumeMonitor-WARNING **: Owner of volume monitor org.gtk.Private.GPhoto2VolumeMonitor disconnected from the bus; removing drives/volumes/mounts

(tracker-miner-fs:21187): GLib-GIO-CRITICAL **: Error while sending AddMatch() message: 這個連線已關閉
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.

Received signal:15->'Terminated'

OK
xinit: unexpected signal 2
```

/var/log/Xorg.0.log Add under line.

```
[  347.725] (II) UnloadModule: "kbd"
[  347.725] (II) UnloadModule: "mouse"
[  347.796] Server terminated successfully (0). Closing log file.
```

Note:

Even Option  "AutoAddDevices" "off" set to "on" in /etc/X11/xorg.conf same problem.
Reference http://negativo17.org/quickly-test-...ewcons-support-hald-and-your-keyboard-layout/
Add Option "XkbLayout" "us" in /etc/X11/xorg.conf same problem.
Upper is my tested procedure and result.
Thanks a lot.
Epopen.


----------



## epopen (Jan 21, 2015)

Hi All.

Issue update..
I upgraded x11-servers/xorg-server to 1.14.7.
It said new "input device detection backend based on devd(8), it relation keyboard.
So I tried again.

Reference http://blogs.freebsdish.org/graphics/2014/11/19/xserver-1-14-update-ready/
Some configuration file updated and show below.
/usr/local/etc/X11/xorg.conf

```
Section "ServerLayout"
  Identifier  "Epopen's X.org Configured"
  Screen  0  "Screen0" 0 0
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/"
EndSection

Section "Monitor"
  Identifier  "Monitor0"
  VendorName  "TOSHIBA"
  ModelName  "PORTEGE M800"
  Option  "DPMS"
EndSection

Section "Device"
  Identifier  "Card0"
  Driver  "intel"
  #Driver  "vesa"
  VendorName  "Intel Corporation"
  BoardName  "Mobile 4 Series Chipset Integrated Graphics Controller"
  BusID  "PCI:0:2:0"
  #Option  "AccelMethod" "uxa"
EndSection

Section "Screen"
  Identifier  "Screen0"
  Device  "Card0"
  Monitor  "Monitor0"
  SubSection  "Display"
  Viewport  0 0
  Depth  24
  Modes  "1280x800"
  EndSubSection
EndSection
```

/usr/local/etc/X11/xorg.conf.d/input.conf

```
Section "InputClass"
  Identifier  "Keyboard Defaults"
  Driver  "keyboard"
  MatchIsKeyboard "on"
  Option  "XkbLayout" "tw"
  Option  "XkbVariant" "tw"
EndSection

Section "InputClass"
  Identifier  "Mouse Defaults"
  Driver  "mouse"
  MatchIsPointer  "on"
  Option  "ZAxisMapping" "4 5 6 7"
EndSection
```

Under log from `startx` to `logout` back to console.
Console log refer http://pastebin.com/5YhFiQCC
/var/log/Xorg.0.log refer http://pastebin.com/7tdtDqs8
devd(8) activity look like.

But same issue( No key output when key strike and sticky key randomly, cause key repeat  output infinite).

Thanks a lot.

Note:
In VT enabled kernel , Driver  "intel" or Driver  "vesa" in /usr/local/etc/X11/xorg.conf
same keyboard issue.


----------



## chrbr (Jan 21, 2015)

epopen said:


> Option "XkbVariant" "tw"


It is just a shot into the dark, but I have "oss" instead of "tw" as in the example you have quoted in my /usr/local/etc/X11/xorg.conf.d/input.conf. I hope it helps!


----------



## wblock@ (Jan 21, 2015)

Why are both intel and vesa entered in the Driver section?


----------



## epopen (Jan 22, 2015)

wblock@ said:


> Why are both intel and vesa entered in the Driver section?


Oh I sorry, It is for test. I forgot to remove vesa before post.
Post fixed.
In real world test, only one activity, other one add # to inactivity.

Thanks you a lot.


----------



## epopen (Jan 22, 2015)

chrbr said:


> It is just a shot into the dark, but I have "oss" instead of "tw" as in the example you have quoted in my /usr/local/etc/X11/xorg.conf.d/input.conf. I hope it helps!


Hi chrbr
Thanks your suggest.
I had been "oss" instead of "tw" @ Option "XkbVariant" and test, but it won't work.

Thansk you a lot.


----------



## chrbr (Jan 22, 2015)

Some postings above you mention Gnome. I do not use it, but I think these huge packages allow to tune a lot. And software does not care if something is done intentionally or not. Therefore it might make sense to test with a very basic window manager as x11-wm/twm to check whether your keyboard issue is related to X11 or may be related to Gnome.


----------



## epopen (Jan 25, 2015)

chrbr said:


> Some postings above you mention Gnome. I do not use it, but I think these huge packages allow to tune a lot. And software does not care if something is done intentionally or not. Therefore it might make sense to test with a very basic window manager as x11-wm/twm to check whether your keyboard issue is related to X11 or may be related to Gnome.


Hi chrbr.

Thanks you very much.
I had been test your suggest x11-wm/twm, but same problem.
Of course, use VT enabled kernel and driver "Intel" @ /usr/local/etc/X11/xorg.conf
Please reference the screen-shot http://www.tiikoni.com/tis/view/?id=3409302 .
I tried key-in someone into address bar in `Firefox`.
First key struck (random time) nothing appear at address bar.
Later (after random seconds), random character appear  and repeat output infinite like key sticky.
In screen-shot, repeat output character is "=".

The issue cause from `xorg` look-like.
PS: x11-drivers/xf86-input-keyboard version = 1.8.0_7

Thanks all.


----------

