Setkeycode Lenovo Yoga 13

I have a problem with my touchpad on my laptop. And to figure out what is wrong I checked dmesg and found this unrelated problem. And fixing this problem should not hurt.

[ 3290.177993] atkbd serio0: Unknown key released (translated set 2, code 0xbe on isa0060/serio0).
[ 3290.178007] atkbd serio0: Use 'setkeycodes e03e <keycode>' to make it known.

As you can see it sends a unknown keycode which we can map with setkeycodes e03e. According to the Internet TM this is send every second and tells the OS the orientation of the Screen. So I mapped it to 255 to do nothing like this: sudo setkeycodes e03e 255. This solves the problem until the next reboot which is not good enough.

So we create a systemd service file

$ cat /etc/systemd/system/setkeycodes.service 
Description=Change keycodes at boot

ExecStart=/usr/bin/setkeycodes e03e 255


And enable the service:

sudo systemctl enable setkeycodes 

Logitech F710 Windows 10 Driver

This Blogpost describes how you can use your Logitech F710 controller on a Windows 10. For some reasons the offical Logitech driver doesn't work on Windows 10. But you can just use the Xbox driver, here is how:

device manager

Right click -> Update Driver Software... -> Browse my computer for driver software -> Let me pick from a list of device drivers on my computer -> Xbox 360 Peripherals -> Xbox 360 Wireless Receiver for Windows.

I would have made a short video how this works but Nvidia Shadowplay also doesn't work.

Rebuild Windows 10 Efi

My Windows 8 had some weird problems today. Since I migrated this specific installation over three different hardware configurations, I didn't try to solve it. Instead I just reinstalled a Windows 10. The installation of Windows 10 went smooth, even the creation of the USB stick worked at the first try.

But I wouldn't write a blog post if everything went flawless. Grub was unable to boot my new Windows 10. And a simple rebuild didn't fix the problem.

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

It made it even worse after that the Windows option was vanished from my boot menu.

So to fix this you need to recreate the Windows EFI files. To do this, start diskpart and find your EFI partition. It's the one which is FAT formated and around 200MB large.

DISKPART> list vol

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0                      FAT    Partition    200 MB  Healthy    System
  Volume 1                      RAW    Partition    585 GB  Healthy
  Volume 2                      NTFS   Partition    345 GB  Healthy
  Volume 3     E   System Rese  NTFS   Partition    500 MB  Healthy
  Volume 4     C                NTFS   Partition    223 GB  Healthy    Boot

DISKPART> sel vol 0

Volume 0 is the selected volume.

DISKPART> assign letter=b:

DiskPart successfully assigned the drive letter or mount point.


This mounts the EFI partition to the letter b.

Then open a cmd as admin and create the Microsoft\Boot directory and create the EFI boot files:

md b:\EFI\Microsoft\Boot
cd /d b:\EFI\Microsoft\Boot
bcdboot c:\Windows /s b: /f ALL

Now it's time to restart linux and recreate our grub config with:

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Now everything works again.

Build A Dns Server On Debian

Perhaps you read the blog post Build a DNS server on NetBSD. This is essentially the same thing except I use debian this time. The idea behind this is if one system goes down the other one should be running. So basically diversity for zero DNS downtime. (There will be a third blog post with images of the hardware I used)

I used the raspbian lite image from the official raspberrypi site.

So as always unzip it and dd it to the right sd card.

$ unzip
$ sudo dd if=2016-05-27-raspbian-jessie-lite.img of=/dev/sde
2709504+0 records in
2709504+0 records out
1387266048 bytes (1.4 GB) copied, 169.065 s, 8.2 MB/s

Now you can start your pi and login in with user:pi & password:raspberry. It's highly recommended to change your password with passwd. Also always a good idea is to upgrade your system.

apt-get update && apt-get upgrade

Configure a static IP on your interface:

$ cat /etc/dhcpcd.conf 
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.


interface eth0
static ip_address=	
static routers=

Now we are ready to install dnsmasq

sudo apt-get install dnsmasq

We can use now the exact same config files as in the previous post.


# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf

# Add other name servers here, with domain specs if they are for
# non-public domains.

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.

# Set the cachesize here.




#  = IP =       =  Domainname =               = PC name =          pandora            janus            atlas

The only thing that slightly changes is the path of the first config file.

Side note since I use a resolv-file you need for some reasons also edit /etc/default/dnsmasq and uncomment this line: IGNORE_RESOLVCONF=yes.

Now you can restart dnsmasq and your DNS server is ready to use.

Build A Dns Server On Netbsd

I run localy a dnsmasq server as my primary DNS server. This has two main reasons the first one is that it's really simple and small. Secondly it's platform indipenden, meaning I can run it on my NetBSD but also on my FreeBSD or even on linux. This means also I can just reuse the same config files.

Let's get started you need the right NetBSD image for your Raspberry Pi, if I'm not mistaken it should be evbarm-earmv6hf for a Raspberry Pi 1 and evbarm-earmv7hf for the newer ones (Raspberry Pi 2 & 3). Here is how to download it and flash it to your SD card.

Warning: as always double check that you are flashing your SD card and not something else!

gunzip rpi.img.gz
sudo dd if=rpi.img of=/dev/sdX

And thats all preparation needed, now you can plug a keyboard, ethernet, the SD card and HDMI cable in your Raspberry Pi and power it up. Then you just need to wait until the system has resized the root filesystem and prepared everything else.

The first thing you should do is to login as root and set a password for the root account. After that you can add a user like this (the wheel group is necessary to use su later):

useradd -m -G wheel l33tname
passwd l33tname

Also recomended is to edit /etc/rc.conf I changed the hostname and configured a static ip, meaning disable dhcpcd. Here are the important bits:

ifconfig_usmsc0=" netmask 0xffffff00"

After a reboot you should be able to login with your new user over ssh. Now you need time, downloading and unpacking or a cvs checkout of all ports take some time on a old Raspberry Pi.

Using the cvs source:

cd /usr && cvs -q -z2 -d checkout -P pkgsrc

Or download the tar archive:

tar -xzf pkgsrc.tar.gz -C /usr

I use cvs because you can update it with:

cd /usr/pkgsrc && cvs update -dP

But read Where to get pkgsrc and how to keep it up-to-date for more informations.

With the pkgsrc in place we can compile and install dnsmasq.

cd /usr/pkgsrc/net/dnsmasq
make install
cp /usr/pkg/share/examples/rc.d/dnsmasq /etc/rc.d/

The configuration is simple you only need 3 files. The first one is the main configuration which is located in /usr/pkg/etc/dnsmasq.conf

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf

# Add other name servers here, with domain specs if they are for
# non-public domains.

# Set the cachesize here.

As you can see the dns upstream servers are configured in /etc/resolv.conf.dnsmasq I'm using these serveres, but feel free to use any other dns server you trust.


And last but not least the /etc/hosts file where you now can add all your hosts.

#  = IP =       =  Domainname =               = PC name =          pandora            janus            atlas

And that's it you are almost finished with configure your dnsmasq, the last thing is obviously to start the deamon and test it. So add "dnsmasq=YES" it to /etc/rc.conf and start it with service dnsmasq start.

Test it with somethin like dig:

$ dig pandora @ | grep pandora
; <<>> DiG 9.10.3-P4-RedHat-9.10.3-9.P4.fc22 <<>> pandora @
;pandora.			IN	A
pandora.		0	IN	A