lördag 16 september 2017

Software updates and versioning

When publishing software, it is custom to update software version when releasing an update. Why would you just silently replace a released software package with an updated one without changing version? In most cases this means that users downloading the package for the first time will get the latest package, but users that have downloaded the software previously will receive no notification about an update (assuming that there is an upgrade mechanism such as apt, yum or dnf, or in the Windows world maybe a custom software updater). If the update isn't worth pushing out to all users, why not just wait with pushing out the change until next official release? I don't know, but it feels like hiding something. Or maybe the publisher is just clueless. The only thing I could think of that would justify doing this, is if the software installation package has some minor issue (or completely broken thus preventing any installation). But not updating version numbers is just, well... weird.

This is what Jagex is doing with their RuneScape NXT client. The 2.2.4 version was released April 03 2017. But the package downloaded in August had a game binary with modification date 2017-07-12 and when downloaded in September, the game binary has a modification date of 2017-09-01. The package still has the same 2.2.4 version and there is no note in the change log. Checksum also differs on the deb package, causing at least at some point apt to complain about wrong checksum (somebody forgot to update the repodata when pushing out the new package?).

Curiously the July and September versions have the same file size, meaning that the binary maybe only has been recompiled, possibly with different settings. Of course some bits could have been flipped by purpose here and there, who knows?

A binary diff shows the following:

On the second row, c47e has been changed to e47e, meaning that the entry point of the program has been relocated (this can also be checked more easily with "readelf -h"). Large parts of the rest of the file is then also different. No library changes detected, though (checked with ldd).

Curiously also the changelog gzip file has been updated, but not the content.

If you really care about your users, I suggest bumping at least package version numbers and updating the change log. Having a versioned package with checksum in a repository is a mechanism to make users trust that they are downloading the correct file and not some rougue one, maybe hacked or man-in-the-middled file.

Anyway, I've updated the Fedora rpm with the latest changed package in the unofficial Fedora Runescape repository.

Read about the Fedora repo in my earlier blog post or here: https://johanh.net/runescape.html

lördag 26 augusti 2017

RuneScape NXT client for Fedora

RuneScape is a massively multiplayer online role-playing game (MMORPG) created by Jagex Ltd.. Their Linux client allows you to play the game natively also in Ubuntu. The client is written in C++ and uses OpenGL rendering.

For reference, the Ubuntu client is available here: https://www.runescape.com/download.

It is possible to play also in other Linux distributions, if you use the same libraries as in Ubuntu.

This Fedora rpm is created from the Ubuntu package with two extra libraries that are privately installed. They don't interfere with the rest of the system.

I don't guarantee that the client will work in the future, but as of now it works fine. There is a 64-bit package available for Fedora 25 and 26.

Because the RuneScape client is proprietary, it isn't possible to host the package in the usual package repositories. For now it is provided here from my own private repository.

To enable this RuneScape repository in Fedora:

Install the RuneScape client with:

Note that this repository is private and is not affiliated with Fedora or Jagex in any way. You can browse the repository here: https://johanh.net/repos/.

The rpms are signed with my keybase key at https://keybase.io/johanh/pgp_keys.asc.

The source rpm is also available in the repository.

Known bugs:
  • The launch window can't currently be closed in linux.
Disclaimer: I take no responsibility for anything related to this package. You are using it at your own risk. Only the rpm scripts are made by me. You can find the scripts at https://github.com/hevanaa/runescape-launcher-spec. Issues related to the Fedora rpm package can be reported on github.

Happy gaming!

måndag 21 augusti 2017

Steelseries Arctis 7 headset in Linux

The Steelseries Arctis series headsets are very comfortable. You can wear this headset all day long thanks to the comfortable head strap.

Steelseries Arctis 7

There are three models, Arctis 3, 5 and 7. The last one is the most expensive and has wireless connection. Arctis 5 is basically the same without wireless (only USB connection). Arctis 3 has only analog inputs.

I've got the Arctis 7 model and of course I'm using it with Linux.

There were some issues setting it up. It works fine in Alsa, the device is recognized. You do have to adjust sound levels, at least the mic has too low sound level. Use alsamixer on command line to adjust all volume levels for the headset to 100% (the two outputs and one input).

But Pulseaudio has some issues. Only the mono device (chat output) and microphone is visible. This is because the headset uses a non-supported configuration with two output devices with the same name (PCM, 0 and PCM, 1). This is the output of "amixer -c1":
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 64 [100%] [0.00dB] [on]
Simple mixer control 'PCM',1
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 60 [94%] [-4.00dB] [on]
Simple mixer control 'Headset',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 70
  Mono: Capture 70 [100%] [6.00dB] [on]

Alternative 1

The easiest way to get the headset working as intended, is to issue the following command:

pacmd load-module module-alsa-sink device=hw:1,1

You need to replace the first number with the number of the sound card, which you can find with "aplay -l". The second number stands for the stereo sound output device on the card.

You need to script this command or run it manually, because you can't add it permanently. If the headset isn't connected, there might be issues when running the command. Also, the card number could be different depending on how many sound cards there already are in the PC.

The above command is the fastest way to get the headset to work. The downside is that you manually have to enable it.

Alternative 2

Update 2017-09-02 The below changes are now committed to pulseaudio next branch and will eventually arrive with a new version of pulseaudio to most linux distributions.

The following method now works to get all devices to show automatically in Pulseaudio and Gnome sound settings when plugging in the device.

Check the device id of the headset with the following command:
lsusb | grep SteelSeries

Bus 003 Device 003: ID 1038:1260 SteelSeries ApS

The above device id is same for all Steelseries Arctis 7 headsets (If we are lucky, the Arctis 5 has the same id). Use the device id to set an udev rule at the end of


(after the other ATTR rows). I'm using the following:

ATTRS{idVendor}=="1038", ATTRS{idProduct}=="1260", ENV{PULSE_PROFILE_SET}="steelseries-arctis-usb-audio.conf"

If you have another headset, you have to replace your idVendor and idProduct with the number you got from the lsusb output.

Then create a file

with the following content:

# This file is part of PulseAudio.
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

; Steelseries Arctis USB headset
; This headset has one mono output, one stereo output and one mono input.
; See default.conf for an explanation on the directives used here.

auto-profiles = yes

[Mapping analog-mono]
device-strings = hw:%f,0,0
channel-map = mono
paths-output = steelseries-arctis-output-mono
paths-input = steelseries-arctis-input

[Mapping analog-stereo]
device-strings = hw:%f,1,0
channel-map = left,right
paths-output = steelseries-arctis-output-stereo
direction = output

[Profile output:analog-mono+output:analog-stereo+input:analog-mono]
output-mappings = analog-mono analog-stereo
input-mappings = analog-mono
priority = 5100
skip-probe = yes
The custom Profile1 makes it possible to select both the stereo device and mono device separately in different applications.

Create a file
with the content:
description-key = analog-input-microphone-headset

[Element Headset]
volume = merge
switch = mute
override-map.1 = all
override-map.2 = all-left,all-right

And a file
with the content:
description = Headset Mono Output

[Element PCM]

volume = merge
switch = mute
override-map.1 = all
override-map.2 = all-left,all-right
And finally a file
with the content:
description-key = analog-output-headphones

The reason for only a [General] section in the stereo file is that the mixer devices are named the same (PCM for both stereo and mono device). This is to trick pulse to show the stereo device anyway. Unfortunately it also means that Pulseaudio can't control the hardware volume of the stereo device.

After creating the above, the headset should be recognized whenever you plug it in.

If there are any problems getting the device to show up in sound settings, open pavucontrol (install it if it isn't already) and in Configuration select "Analog mono output + Analog stereo output + Analog mono input" for the Steelseries headset.

You might also have to open alsamixer on command line and adjust volume level for the stereo channel to 100% (the stereo channel hardware mixer is not controlled by Pulseaudio due to the limitation).

Thanks to Tanu Kaskinen2 on the Pulseaudio discussion mailing list3 for all advice on making this headset play with Pulseaudio.

[1] https://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles/
[2] https://www.patreon.com/tanuk
[3] https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

lördag 11 mars 2017

E-books in Linux with Adobe Digital Editions

I've read a lot of e-books. And since I use Linux devices, it is sometimes a bit problematic. How do you read e-books that you have bought in Linux?

One way is to read public domain and free e-books. There are a lot, just search for them on the Internet. But they are mostly old books. Some writers actually publish some of their books explicitly without DRM. I like those writers. Then it is easy to transfer the book to any of your devices.

There are many e-book readers on linux. I like Calibre and Fbreader. Calibre for managing and converting ebooks and also reading on the PC, and fbreader for reading on smaller devices, like my linux phone and tablet.

The DRM-equipped e-books that I have bought are all the Adobe DRM type that have to be read in Linux using Adobe Digital Edition (ADE) using wine. So far the old 1.7 ADE version has been sufficient. The good thing with that version is that it just works. No runtime installation in wine or nothing, just install and fire it up in wine.

But when I bought the last e-book, I couldn't download the book anymore using ADE. It just timed out and said that it couldn't download the book due to an error. So I began looking at newer versions of ADE.

The problem with the later versions of ADE is that they require .NET Framework 3.5 SP1, also the 1.8 pre-release version. So far I've tried the 1.8 pre-release, 2.0 and 3.0. At least the ADE 3.0 version was successfully installed and now works without problems.

Here are the steps to install ADE in wine.

It is good to start with a clean wine prefix. If you are familiar with wine, you know that wine stores the Windows environment in a directory called a wine prefix. By default this is a hidden directory in your home named .wine. You can create as many separate wine prefixes as you want, but then you need to launch them explicitly with:

 WINEPREFIX="path/to/directory" wine <program to launch>

otherwise it just uses the default .wine directory. There are entire programs for managing your wineprefixes and windows programs, e.g. PlayOnLinux comes to mind.

Anyway, to get the .NET Framework installed, the following is recommended:

 mv .wine .wine_old
Exit winecfg. Now you have a clean wine prefix. Download the winetricks script. This is a helper script to install runtimes in the wine Windows environment.

wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks
Now you can either start winetricks with ./winetricks and there is a GUI that you can use to install runtimes. But in this case it is preferred to just run:

./winetricks dotnet35sp1
 This will automatically download all .NET runtimes in the 2.0 to 3.5sp1 range and install them. Beware that it is several hundred megabytes and takes many minutes. Sometimes the installation fails, and you just have to start over again by deleting the .wine directory. You have to click through some of the .NET dialogs. Be patient, at some point the installation seems to stall, but continues in a few minutes.

I think it depends on the wine version, but there is a .NET component that causes problems, at least for me. When running an application through wine I always got a message that "mscorsvw.exe" crasched. At some point this executable just hanged and ate a lot of CPU. The solution was to start winecfg and add the problematic component to the Libraries page. Enter mscorsvw.exe in the topmost field and click Add. It should have native as the first option. Now it doesn't crash anymore.

You also have to install a second component in wine:
./winetricks windowscodecs
Now download the ADE 3.0 installer from https://www.adobe.com/support/digitaleditions/downloads.html. Install it with:

 wine ADE_3.0_Installer.exe
Now you should be able to launch ADE (the shortcut should be available also in your desktop start menu). I noticed that the window sometimes didn't refresh, but it wasn't a big problem. Enter your existing Adobe account or create a new one. Note that you have to use the same account to read your existing ebooks. Now you can download ebooks from online stores and it will automatically download and put them in your ~/Documents/My Digital Editions directory in Linux.

If you need to try several versions and they clutter up your wine prefix, just uninstall them with:

wine .wine/drive_c/Program\ Files/Adobe/Adobe\ Digital\ Editions\ 3.0/uninstall.exe
The shortcuts can be removed by e.g.

rm -rf .local/share/applications/wine/Programs/Adobe/Adobe\ Digital\ Editions\ 3.0
 And about that DRM and other devices? Well, lets keep it for another article...

torsdag 5 januari 2017

Steam Family sharing working on Linux again

For a long time, at least a year, Steam Family sharing has been broken on Linux PCs. Fortunately something has changed and it is suddenly working again (as of January 2017).

I'm a bit disappointed at Valve's support, though. The problem hasn't been commented on at all by Valve, even though it has been reported both in the Steam support forum and on github: https://github.com/ValveSoftware/steam-for-linux/issues/4051

At least the problem could have been acknowledged.

NBASE-T or IEEE 802.3bz - faster speeds for your network

There have been efforts a few years ago in bringing 10 Gbit/s network speeds to PC motherboards. It has also been used in servers, but mostly using fiber cable. It is only recently when the standard has evolved to be usable with regular twisted pair copper cable. With CAT6a cable you could in theory reach 100 m using 10GBASE-T.

Due to the high requirements of 10 Gbit ethernet, it is often not possible to communicate over longer links due to not spec compliant cable, or when using much more common CAT5e cable. What happens then is that the network link speed is lowered from 10 Gbit/s to 1 GBit/s.

Recently a new standard has been evolving to lower the implications of this problem. New speeds of 5 Gbit/s and 2.5 Gbit/s have been introduced in a new standard IEEE 802.3bz and then later in practice as the NBASE-T alliance.

With IEEE 802.3bz, a speed of 5 GBit/s can be used with up to 100 m CAT5e copper cable.

What this means is that when your 10 Gbit/s link doesn't manage to keep the speed up, instead of dropping to 1 Gbit/s, it drops to 5 Gbit/s or 2.5 Gbit/s. Much better!

Most new motherboards and network cards in 2016 and 2017 that support 10 Gbit ethernet also seem to support NBASE-T, but be sure to check the specifications. Don't buy a 10GBASE-T device without NBASE-T support! An example controller is the Intel Ethernet Controller X550-AT that supports NBASE-T speeds.

Note that only Linux so far supports the new standard. There is no support in Windows drivers for NBASE-T.

Unfortunately there are no affordable (consumer) network switches yet on the market supporting the new NBASE-T standard, but I expect them to arrive shortly. In the professional segment there are already switches supporting this new standard.



Razer Deathadder on Linux

I've got a Razer Deathadder mouse connected to one of my PCs. This is a quite popular gaming mouse.

It doesn't work fine in a standard Linux distro (at least on Fedora). The resolution is too high and it isn't possible to turn down.

In the past I used a script and xinput to lower the mouse sensitivity.

But there is a driver for Linux created by the free software community, in this case by Michael Büsch.

The driver automatically sets the resolution to something usable and you can set different profiles and tune it from the command line or using a GUI application (the latter which doesn't currently work on Fedora due to missing python libraries, but no big deal).

I've been using this driver for a long time, first by compiling it from source, and later through the rpmsphere-release repostory at https://build.opensuse.org/project/show/home:zhonghuaren.

At one point it stopped working and I found out that it hadn't been updated in a few months in the repository, so it lagged behind the upstream release. I set out to fix this.

Installing from source is OK for me, but I prefer that also other people can use it, so I undertook to update the rpm package for Fedora.

The razer driver is now available in a Fedora Copr repository: https://copr.fedorainfracloud.org/coprs/johanh/razercfg/.

Due to missing python3-pyside and shiboken in Fedora, the razer GUI application doesn't work right now, but it is being worked upon. It is possible to compile the components yourself, but it is not trivial and it took a couple of hours.