Skip to content

Instantly share code, notes, and snippets.

@elw00d
Last active January 9, 2023 17:59
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save elw00d/0826917118d58e81843e2d11bc6cf885 to your computer and use it in GitHub Desktop.
Save elw00d/0826917118d58e81843e2d11bc6cf885 to your computer and use it in GitHub Desktop.
How to patch xorg in ubuntu 16.04.3 (bug of keyboard layout change)
# Bug https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1683383
# Original article https://habrahabr.ru/post/87408/
# create directory
mkdir xorg-server
cd xorg-server
# get sources of required package
# may be need to uncomment 'deb-src' lines in sources.list before
apt-get source xserver-xorg-core-hwe-16.04
# install dependencies required for building
sudo apt-get build-dep xserver-xorg-core-hwe-16.04
# download patch
wget https://bugs.freedesktop.org/attachment.cgi?id=129861
# apply patch
patch xserver-xorg-core-hwe-16.04_19.3.1/xkb/xkbAction.c < attachment.cgi\?id\=129861
# build
cd xserver-xorg-core-hwe-16.04_19.3.1/
debuild -us -uc
cd ..
# install patched package
sudo dpkg -i ./xserver-xorg-core-hwe-16.04_1.19.3-1ubuntu1-16.04.2_amd64.deb
# pin version of this package to prevent updating later
cat <<EOF>> /etc/apt/preferences.d/xserver-xorg-core-hwe
Package: xserver-xorg-core-hwe-16.04
Pin: version 2:1.19.3-1ubuntu1~16.04.2
Pin-Priority: 700
EOF
# check that pinning works properly
apt-cache policy xserver-xorg-core-hwe-16.04
@Panoptik
Copy link

Panoptik commented Dec 15, 2017

Thanks for script. It's has been usefull.
Currently script is outdated
I have changed a little bit your script for ubuntu 16.04.03 LTS xfce (maybe also for mate, etc)

#!/bin/bash

# Bug https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1683383
# Original article https://habrahabr.ru/post/87408/

# create directory
mkdir xorg-server
cd xorg-server

# get sources of required package
# may be need to uncomment 'deb-src' lines in sources.list before
apt-get source xserver-xorg-core-hwe-16.04

# install dependencies required for building
sudo apt-get build-dep xserver-xorg-core-hwe-16.04

# download patch
wget https://bugs.freedesktop.org/attachment.cgi?id=129861

# apply patch
patch xorg-server-hwe-16.04-1.19.3/xkb/xkbActions.c < attachment.cgi\?id\=129861

# build
cd xorg-server-hwe-16.04-1.19.3/
debuild -us -uc
cd ..

# install patched package
sudo dpkg -i ./xserver-xorg-core-hwe-16.04_1.19.3-1ubuntu1~16.04.4_amd64.deb

# pin version of this package to prevent updating later
cat <<EOF>> /etc/apt/preferences.d/xserver-xorg-core-hwe
Package: xserver-xorg-core-hwe-16.04
Pin: version 2:1.19.3-1ubuntu1~16.04.2
Pin-Priority: 700
EOF


# check that pinning works properly
apt-cache policy xserver-xorg-core-hwe-16.04

@AltS1
Copy link

AltS1 commented Jan 7, 2018

more universal/future-proof
cd xorg-server-hwe-16.04-1.19.3
cd xorg-server*
Also I prefer holding package instead of pinning.
This way updater will remind you that you need to rebuild package :-)
sudo apt-mark hold xserver-xorg-core-hwe-16.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment