I have just found out that the Linux kernel patch for
this issue has appeared on Linux Kernel Mailing List. I think it is supposed to be included in Linux kernel 4.10. Here is how I applied the patch on Debian 8 (Jessie).
Requirements
- Debian 8 (Jessie)
- Linux kernel source code 4.4.x LTS (Vanilla)
- Some basic knowledge on compiling Linux kernel source code
Instructions
1. Download Linux kernel source code.
$ wget "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.35.tar.xz"
2. Extract kernel source code.
$ tar xvf linux-4.4.35.tar.xz
3. Enter extracted kernel source code.
$ cd linux-4.4.35
4. Download USB3 HDD safely remove patch
here and apply it.
$ patch -p1 -i fix-auto-remount-of-safely-removed-or-ejected-usb-3-devices-v3.patch
5. Copy kernel config from default kernel
$ cp /boot/config-3.16.0-4-686-pae .config
$ make olddefconfig
6. Adjust kernel config. Enable CONFIG_IP_NF_NAT and its sub-configs as modules (or else you will lose iptables NAT).
$ make menuconfig
7. Compile kernel.
$ make -j $(nproc) deb-pkg KDEB_PKGVERSION=$(make kernelversion)-1~local1
8. Install kernel. See notes below for any errors encountered.
$ sudo dpkg -i linux-image-4.4.35_4.4.35-1~local1_i386.deb linux-headers-4.4.35_4.4.35-1~local1_i386.deb
Notes
1. The open-vm-tools included in Debian Jessie cannot be compiled with kernel 4.4. It can be safely purged if you don't use it.
$ sudo apt-get purge open-vm-tools-dkms
2. If you use broadcom-sta-dkms, use the one from backports. The one from stable is too old for kernel 4.4.
$ sudo apt-get -t jessie-backports install broadcom-sta-dkms
3. To suppress error about pcspkr already registered on boot, blacklist snd-pcsp.
$ echo "blacklist snd-pcsp" > "/etc/modprobe.d/snd-pcsp-blacklist.conf"
4. If you are on Intel graphics and Xorg occasionally crash e.g. when you are playing video using VAAPI, add "i915.semaphores=1" to GRUB_CMDLINE_LINUX_DEFAULT in "/etc/default/grub" and run "sudo update-grub"
GRUB_CMDLINE_LINUX_DEFAULT="quiet i915.semaphores=1"
References