Keyboard + mouse not responding after startx (/home & /swap encrypted)

35 replies [Last post]
hack and hack
Offline
Joined: 04/02/2015

Hi,

the keyboard and mouse respond very well in the shell (well not the mouse of course),
but after startx, which boots i3wm, it doesn't.

At first I thought i3wm was freezing, but the mouse pointer changed from the waiting icon to the normal pointer after a bit (yet still immovable). And the keyboard doesn't activate the screen after moments of inactivity.

It did work after startx on an earlier non-encrypted install.
But after encrypting /home and /swap, I have this.
Maybe it's a matter of groups/user rights.

--------

After a third install, this time only leaving /boot unencrypted,
my usb keyboard can't open the encrypted partition (though it worked at first).

hack and hack
Offline
Joined: 04/02/2015

Encryption shouldn't be an issue after unlocking the disks/partition. I don't understand. The install went just the same way beyond the partitioning.

It must be something related to xorg.

It kinda makes sense for the USB keyboard not available until reaching the shell though.

hack and hack
Offline
Joined: 04/02/2015

I'm even more sure that i3/the X session didn't freeze as the time display progresses.

This time I enabled the numpad, and what's odd is that he led stays on even if I unplug, then replug the keyboard.
I tried to switch to a tty, or even kill the X session, but neither the mouse or keyboard react.
dmesg displays ps2 mouse (but not keyboard, even though it works. Maybe because I can't scroll up the messages) and the USB keyboard. Of Course that's before launching startx.
Even the Sysrg+R or something like that (I tried with and without caps) does nothing.

I'll try to fetch the Xorg log.
It seems I can get it with journal ctl -e _COMM=Xorg.bin

Not sure it's related yet, but I've read about:
* service dbus start && service hald start
* in /etc/rc.conf --> dbus_enable="YES"
* check the Xorg.conf in /etc/X11/

But before trying things, I want to get a more accurate diagnostic.

hack and hack
Offline
Joined: 04/02/2015

sudo startx worked.
It's not recommended, so it's not a solution. But it's a decisive clue.

EDIT:
Even my manual .xinitrc in ~ insn't recognised (doesn't contain startx for some reason, but it should load X with i3wm automatically, which it does on my other PC).

And I have read and write rights, plus I'm the owner of the files in ~.

removing .Xauthority didn't work.

albertoefg
Offline
Joined: 04/21/2016

Did you modify ~/.bash or ~/.bash_profile or ~/.bashrc or something like that?

Maybe your ~/.config/i3/config is executing some program you have not installed or configured properly??

hack and hack
Offline
Joined: 04/02/2015

No, any of the bash files are the default ones.

The i3 config is also the default (I didn't have the opportunity to copy my personal config yet).

It's basically a fresh install (with the drive erased) with xorg, i3 and pcmanfm installed.
I added a personal .xinitrc just to see if it would work the way it did previously (before encrypting partitions).

albertoefg
Offline
Joined: 04/21/2016

Try to describe more the current problem than your guesses or previous problems


Describe the problem's symptoms, not your guesses

It's not useful to tell hackers what you think is causing your problem. (If your diagnostic theories were such hot stuff, would you be consulting others for help?) So, make sure you're telling them the raw symptoms of what goes wrong, rather than your interpretations and theories. Let them do the interpretation and diagnosis. If you feel it's important to state your guess, clearly label it as such and describe why that answer isn't working for you.

How To Ask Questions The Smart Way - http://catb.org/~esr/faqs/smart-questions.html#symptoms

hack and hack
Offline
Joined: 04/02/2015

You're right, let me try again this way then:
* the keyboard and mouse respond very well in the shell (well not the mouse of course), but after startx, which boots i3wm, it doesn't.
* the keyboard doesn't activate the screen after moments of inactivity.
* It did work after startx on an earlier non-encrypted install.
But after encrypting /home and /swap, I have this.
* i3/the X session didn't freeze as the time display progresses.
* This time I enabled the numpad, and what's odd is that he led stays on even if I unplug, then replug the keyboard.
I tried to switch to a tty, or even kill the X session, but neither the mouse or keyboard react.
* my manual .xinitrc in ~ insn't recognised (it worked on the attempt without encrypted partitions) because X and i3 aren't launched on startup.

*** ALL of these issues cease if I use sudo startx instead, which isn't recommended. ***

* I have read and write rights, plus I'm the owner of the files in ~.
* removing .Xauthority didn't work.
* After a third install, this time only leaving /boot unencrypted,
my usb keyboard can't open the encrypted partition.

albertoefg
Offline
Joined: 04/21/2016

I3 requires to read config which is in /home

root user has a different config file that is not in /home but in /root

If you encrypted disk and /home when you unlock at boot you are only unblocking the disk but not /home

Probably i3 freezes because it can't read config file on /home and also all the other important files like .bash .bashrc .bash_profile and everything else.

For this same reason sudo works because it reads this files from /root not /home
Make sure /home is decrypted before startx

hack and hack
Offline
Joined: 04/02/2015

Many thanks for your help albertoefg!

root user has a different config file that is not in /home but in /root
--------
If you encrypted disk and /home when you unlock at boot you are only unblocking the disk but not /home
--------
Make sure /home is decrypted before startx

On the disk where the system is installed, I created /boot and left it unencrypted, and used a whole partition where /home, /root and /swap were created.

On boot, I unput my decrypting passphrase (twice), which is supposed to unlock the partition containing /root, /home and /swap.
Then I input my account login and passphrase), where I land in a tty.

I didn't check the rights of the /home folder itself yet (though I did check the its content, which is owned by me as the user, and it belongs to my group).

albertoefg
Offline
Joined: 04/21/2016

Ok.

So currently you have an install with only disk encryption apart from /boot but /home has not its own encryption?

Do you have any custom config files? I would delete them first

albertoefg
Offline
Joined: 04/21/2016

If that doesn't... Then I would rename ~/.config/i3/config

And after that maybe .bash_profile or .bashrc or .bash

Rename them to something else, if the problem continues then you can change the name back to the original.

In an extreme case I would rename all ~./config to something like ~/.config_old

The only thing I can't think of is that something in bash or in config is executing something you don't want, that is why root works but user doesn't.

Of course this only if /home is decrypted

albertoefg
Offline
Joined: 04/21/2016

As you said, checking files and directories permissions is also a good thing to do.

hack and hack
Offline
Joined: 04/02/2015

Compared to a working install, /home, and the folders and files inside it have the same ownership and permissions.

I can try with a fresh copy of .xinitrc from /etc/X11/xinit and modify it accordingly (with exec i3).

hack and hack
Offline
Joined: 04/02/2015

OK, I'll try renaming the bash files, thanks again.

If that doesn't... Then I would rename ~/.config/i3/config
Acually, because of the keyboard issue, I didn't have the oportunity to validate the i3 prompt that creates the i3 config file.
I just checked, the i3 folder is fully empty (no hidden files either).

hack and hack
Offline
Joined: 04/02/2015

Yes, no dedicated /home encryption, but an encrypted partition containing /home, /root and /swap.
On the other hand, I have other fully encrypted disks (nothing installed on them though).

No custom config files by default yet (besides the .xinitrc for testing).

I notice now that /home belongs to root.
inside home, I have:
* my user folder which belongs to me as a user (so not root)
* I have a lost+found belonging to root
* also "." and ".." listed as belonging to root. I tried to get inside one of these, but it either brings me forward or back from the the folder I'm in.

hack and hack
Offline
Joined: 04/02/2015

I only have a .bashrc, and a .profile which redirects to .bashrc.
I renamed it to _old (same wit .xinitrc), the issue still remains.

hack and hack
Offline
Joined: 04/02/2015

As it could be important, one thing I did during the install is the following:
the /boot partition I set up as the one to be initialized.
But now in my directory tree, I see in / another /boot folder, and also another /lost+found (the same I find in /home).

EDIT: Also, I don't find my xorg.conf. Though it's actually normal:
https://askubuntu.com/questions/4662/where-is-the-x-org-config-file-how-do-i-configure-x-there

hack and hack
Offline
Joined: 04/02/2015

Uh, something new:
* I deleted i3 (apt-get purge, autoremove, clean), and startx still lands me in i3
* I removed the (empty) i3 folder present in .config, but I still land in i3...
* even though I installed i3, purging i3-wm worked.
* trying startx without i3, I land in some tty (but looking a bit different), though the keyboard is inactive just as it was with i3.

I also tried to reinstall xorg.
I did an apt-get purge autoremove clean and then install xorg.

albertoefg
Offline
Joined: 04/21/2016

What does ~./xinitrc says could yei share it?

Could you check if you have xorg-xinit and it is configured properly?
https://wiki.archlinux.org/index.php/Xinit

Thoug, it must be because root works.. :/

Maybe install a different Desktop Environment see if it works?

hack and hack
Offline
Joined: 04/02/2015

Sure, I just added exec i3.

But my original one is like this:
#!/bin/sh
# /etc/X11/xinit/xinitrc
#
# global xinitrc file, used by all X sessions started by xinit (startx)
# invoke global X session script
. /etc/X11/Xsession
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # &
exec dbus-launch ck-launch-session i3
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
#export SUDO_ASKPASS=/bin/dpass.sh sudo -A $(dmenu_path | dmenu)
#export SUDO_ASKPASS="$HOME/bin/dpass.sh" sudo -A $(dmenu_path | dmenu)
# Start the window manager:
#if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
# exec ck-launch-session dbus-launch --exit-with-session /usr/bin/i3
#else
# exec /usr/bin/i3
#fi
# The x11 line was already there.
# The lxpolkit line is supposed to launch lxpolkit on startup.
# The i3 line was supposed to solve the issue.
# The last one works, it's to launch the config file of urxvt.

Keep in mind that I'm sure it works both on other machines and on this same machine, but when the partition wasn't encrypted (meaning there was 3 partitions: for /, for /home and for /swap).

I don't have xorg-xinit, but I installed xorg --no-install-recommends, which also worked just fine when the partition wasn't encrypted (meaning there was 3 partitions: for /, for /home and for /swap).
I do have both startx and xinit, and I don't remember on other installs if I had the .xinitrc provided as default.

I can try another WM or even a DE. But really, I see no difference with the working install and this one besides encryption, and a slightly different partitioning scheme.

Up to this point, we eliminated:
* config files (ownership and permissions, disabling some of them like bashrc and xinitrc)
* completely removing i3 an launching startx gives me a tty with a different font, and the keyboard behaves just the same (inactive, numpad led always on or off, depending on how it was befre launching startx)
* reinstalling xorg. Maybe purge xorg wasn't enough?
* encryption shouldn't be an issue since the partition is opened before reaching the tty.
* Maybe I've made a mistake during the install, but besides having a separated /boot, I did nothing out of the ordinary. Plus I have no boot issues anyway. /root (including another /boot partition without the initialization option), /home and /swap are just logical volumes of the same encrypted volume group.

What I can also try is to redo a non-encrypted install, but with the exact same partitioning scheme and see how it goes.

albertoefg
Offline
Joined: 04/21/2016

I am getting out of ideas :/ specially because you say it works on other computers and it worked before.

This is weird. I hope that a fresh install will solve it then :/

Or maybe someone else could join and suggest something else??

albertoefg
Offline
Joined: 04/21/2016

Wait....

New Idea... Could you create a new user and see if with a new user it works?

hack and hack
Offline
Joined: 04/02/2015

Good call, with the new user, I can't launch startx at all, and it seems I have now access to some xorg log.
The plot unfolds (I hope so)!

OK so:
* I created a user and added it to the sudo group
* startx doesn't get started with this user, but there is a log in /home/newuser/.local/share/xorg/Xorg.0.log (roughly, I'll get the exact name of the path if needed).

*in the log, I have this (I only picked warnings and errors):
+ (EE) dbus-core: error connecting to system bus:org/freedesktop.DBus.Error.FileNotFound. (Failed to connect to socket /var/run/dbus/system_bus_socket: no such file or directory)
+ (WW) Warning, couldn't open module "nv", followed a bit further by "(EE) Failed to load module "nv" (module does not exist, 0)
+ Fatal server error: (EE) xf86OpenConsole: Cannot open virtual console 1 (Permission denied)
(WW) xf86CloseConsole: KDSETMODE (and VT_GETMODE in the line after) failed: Bad file descriptor
(EE) Server terminated with error (1). Closing log file.

I'll see if I can get the log for the normal user as well.

hack and hack
Offline
Joined: 04/02/2015

In the original user's xorg's log, in addition to what's listed for the new test user:
* (WW) Falling back to old probe method for modesetting (and for fdev on the line efter)
* (WW) Falling back to old probe method for vesa
* (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support
* (EE)xf86OpenSerial: Cannot open device /dev/input/event2 Permission denied.
* right after: (II)opening input device '/dev/input/event2' failed (Permission denied)
* right after: (II) failed to create input device '/dev/input/even2'
* (EE) libinput: Power Button: Failed to create a device for /dev/input/event2
* (EE)Preinit returned 2 for "Power Button"
* (II) Unload module: "libinput"
* (EE) xf86OpenSerial: Cannot open device /dev/input/event1 Permission denied. (followed by the same lines for event2, but this time for event1).
* Same thing for event8, which is the USB keyboard. Same thing with event 9 wich is also for the USB keyboard (instead of libinput: Power Button, it's libinput: name of usb keyboard).
* Then it's the same thing for the PS2 mouse, which is named after usb keyboard (only diff is /dev/input/mouse1). For the mouse, it also says no input driver specified, ignoring this device.
* the 3 last lines are the same: (EE) dbus-core: error connecting to system bus: org.freedesktop.DBus.Error.FileNotFound (Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory)

So that's for the original user that startx into i3 but without keyboard enabled.

Wait, I just realized I could copy the logs on USB...
Well, let's do it, even though most of it I have written above.
EDIT: I tried to copy them, but I forgot to mount the thumb drive.
Now I can't even mount it...

hack and hack
Offline
Joined: 04/02/2015

Before trying to fix (most likely format) my thumb drive and fetching the full logs, I'll reboot into the new user and try startx again. It seems startx might be occupied by the old user.

And it still gives me a bunch of stuff. I think I'll format my thumb drive and put everything here from pastebin.

I stumbled upon this while trying to understand error messages.
https://gist.github.com/alepez/6273dc5220c1c5ec5f3f126e739d58bf

hack and hack
Offline
Joined: 04/02/2015
albertoefg
Offline
Joined: 04/21/2016

Install nvdia drivers and blacklist nv as stated here:

troubleshooting X server. (EE) Failed to load module "nv" (module does not exist, 0) - Ask Ubuntu - https://askubuntu.com/questions/90915/troubleshooting-x-server-ee-failed-to-load-module-nv-module-does-not-exist

albertoefg
Offline
Joined: 04/21/2016

Also try upgrading to jxself kernel.

hack and hack
Offline
Joined: 04/02/2015

It fails when I try "wget https://jxself.org/gpg.inc":
"error: untrusted certificate"

The command "gpg --with-fingerprint gpg.inc" gives:
"gpg: can't open gpg.inc"

hack and hack
Offline
Joined: 04/02/2015

is it fine in terms of free software? If so, I guess I can find them on nvidia's website?
But I thought my GPU worked just fine with Nouveau (which it does, even right now with an incomplete startx launch).

hack and hack
Offline
Joined: 04/02/2015

It seems I need to add myself in the input group: https://github.com/bulletmark/libinput-gestures/issues/7

But How come I'm not into this group in the first place?
Well, I'll test that first, because there's no point to this question if it doesn't solve the issue.

Right now, my user is in:
user cdrom floppy sudo audio video dip netdev plugdev

In comparison, my user on a working machine lists:
user adm disk dialout cdrom floppy sudo audio dip video plugdev users netdev lpadmin sambashare fuse

So, no input either.

hack and hack
Offline
Joined: 04/02/2015

Bingo, adding my user to input did work.

But I'm not satisfied:
Why do I need to add my user to the input group? Do I need to belong to other groups just to have a functional machine?

All I did was to create a separated /boot partition, and another encrypted one containing volume groups for /, /home and /swap. Is it because I have 2 /boot folders (there's one inside / after all)?

albertoefg
Offline
Joined: 04/21/2016

Maybe there is a bug related to the encryption method. It seems the problem is not that uncommon.

Is it working normally now?? That is great :)

I don't feel like I helped much but at least your machine is working now :D

hack and hack
Offline
Joined: 04/02/2015

Well, regarding mouse and keyboard(s) being accessible from startx without sudo, it definitely works :)

If I have other bad surprises, now I know I can add my user to more groups for different purposes.
But I still don't like how it's a bit hacked (instead of a working directly from a clean install).
Oh well, it works for now.

And you definitely helped a lot:
* my communication style is hopefully more direct
* many important files/folders I wouldn't have noticed without you. Specially trying with a new user, which revealed to me the location of the xorg log (well hidden).

So thanks again albertoefg!!!

hack and hack
Offline
Joined: 04/02/2015

Additional info: --no-install-recommends might be the culprit. It seems it is to be used sparingly, not all the time.

I'd have to reinstall to be sure though, because even removing myself from the input group works just fine now.

EDIT: It didn't change a thing.
All I can do is to add myself into the input group, and I can remove myself from it after without any issue.

But It's not reassuring to have such bugs.
Oh well... At least it works for now.