Thursday, July 23, 2015

Touchpad not working after suspend on Debian Jessie

You can try some tricks, like adding

quiet splash i8042.notimeout atkbd.reset

to /etc/default/grub (line GRUB_CMDLINE_LINUX_DEFAULT=)

and then run
sudo update-grup and reboot

Or run
gconftool-2 --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled true
if your touchpad is simply hardware-disabled.

As for me, nothing mentioned above worked. I use a workaround, that unplugs and plugs in the touchpad again, here what it looks like

#!/bin/bash
rmmod psmouse
modprobe psmouse

I was forced to call this after every awakening, and this was very annoying. I thought about automating all this. Most articles I read tried to use pm-suspend and some custom hooks for it:

sudo vim /etc/pm/sleep.d/0000trackpad
  1 cat /etc/pm/sleep.d/0000trackpad
  2 #!/bin/sh
  3 case "$1" in
  4     suspend|hibernate)
  5          modprobe -r psmouse ;;
  6     resume|thaw)
  7         modprobe psmouse ;;
  8 esac



This worked, but... It turned out that debian does not use pm-suspend when it suspends =(
To suspend and awake with touchpad working I had to sudo pm-suspend manually, so annoying. And again, when debian suspends from low battery or lid closed, it suspends without pm-suspend, so I had to run my annoying script.

Arghh!..

Debian uses systemd to manage power, so should I. By the way, when duckduckgoing word "systemd" a lot of controversial and critical posts come up about it being too complex and handling too much responsibility, try it!

systemd provides it's own environment to create hooks, so I created one that finally worked!

sudo vim /etc/systemd/system/touchpad_awakening.service 

[Unit]
Description=Reload mouse after suspend
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
ExecStart=/home/asalle/bin/mouse

[Install]
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

(mouse is the script that modprobes the psmouse)

then, enable the service by
sudo systemctl enable touchpad_awakening.service 
and start manually to check it by
sudo systemctl start touchpad_awakening.service
check the result
sudo systemctl status touchpad_awakening.service

it reads:
● touchpad_awakening.service - Reload mouse after suspend
   Loaded: loaded (/etc/systemd/system/touchpad_awakening.service; enabled)
   Active: inactive (dead) since Thu 2015-07-23 16:08:20 EEST; 5s ago
  Process: 4285 ExecStart=/home/asalle/bin/mouse (code=exited, status=0/SUCCESS)
 Main PID: 4285 (code=exited, status=0/SUCCESS)

After suspend it worked okay. 
At last!

Monday, July 20, 2015

Debian Jessie on Fujitsu UH 552

So I had my Fujitsu UH 552 for a while now.
First, I had pre-installed Windows 8 there. First day I got it, I partitioned the hard disk for several parts:

Here is fdisk -l
Device         Start       End   Sectors   Size Type
/dev/sda1       2048    194559    192512    94M EFI System
/dev/sda2     194560  30914559  30720000  14.7G Linux filesystem
/dev/sda3  968669184 976771071   8101888   3.9G Linux swap
/dev/sda4   30914560  92354559  61440000  29.3G Microsoft basic data
/dev/sda5   92354560 153794013  61439454  29.3G Microsoft basic data
/dev/sda6  153794560 866269183 712474624 339.8G Microsoft basic data
/dev/sda7  866269184 968667135 102397952  48.8G Linux filesystem


sda1 is the boot partition, since I have UEFI, it is marked as EFI System. The grub and bootloader stuff is stored there.

sda2 is the /opt/ on his own partition (I have almost 5 GB of additional software, most of it are IDEs).

sda3 is a swap partition

sda4 is the C:/ drive of Windows 8

sda5 is the root directory (/). I'm wondering, why it is marked as Microsoft basic data by the fdisk.

sda6 is a ntfs data partition, where all the big data is stored, as archives of my university files and so on.

sda7 is /home on his own partition.

So, with this crazy-crazy situation I made up my mind to move from Ubuntu to Debian.
First, I made a live-usb. Just jigdo-ed the latest (Jessie) livecd distribution and tried to

dd if=debian-8.1-livecd.iso of=/dev/sdb1

and... nothing happened.
I guess there was some problem with bootloader, but I didn't want to dig deep this time, I wanted my Jessie to be right away! So I used the UNetBootin app. Great stuff, saved me a lot of times! So I flashed the liveusb with the jigdo-ed iso and UNetBootin and booted from the usb.

Installation process is rather ordinary, the only thing I changed is used sda7 as /home and didn't format it.

The several problems of fresh-installed Debian Jessie:
  1. no touchpad
  2. no wlan
  3. =(
 During the installation I missed that no Ethernet card was found on my laptop, so there was no driver installed for it. What a pity.
 Also, a classical problem of debian-like OS: Synaptic touchpad is not working. I must add, that even if you  fix it by adding

i8042.nomux

to /etc/default/grub, you will still face the problem after every single suspend. This is also fixable (but I'm telling it not now).

For wifi you need to install iwlwifi driver (I have Inter 3022 Ethernet card). You need to install firmware-iwlwifi_versionhere.deb or something like that. After installing the package, just do

modprobe iwlwifi

and reboot. Voila, after that I immediately had my wifi working, hooray.

Result: safe moving with several partitions and Windows8  from Ubuntu to Debian, no skill required. Thank you, great developers!