Upgrading to Fedora 23 was a bad idea

Posted on . Updated on .

As I planned previously, when Fedora 23 was released a few weeks ago I didn’t upgrade right away. This time I waited a bit more. Specifically, I waited until RPM Fusion for Fedora 23 was released. It was still too soon.

Fedora 23 shipped with a release candidate of the X.org server, which is a bit weird. Fortunately, it has already been upgraded to the stable 1.18 release. The bad news is that the ABI for X drivers has changed and NVIDIA has not released a compatible new version of their proprietary drivers yet. This means you need to downgrade the X.org server to the one shipped with Fedora 22 for the time being. It’s not the first time such a thing happens in Fedora, from what I’m reading online, and other distributions like Arch are also affected.

This situation may last several more weeks. I’m still adapting to Fedora and I’m happy with the distribution so far. And, to be fair, this situation only affects Fedora users with an NVIDIA card and wanting to use the proprietary drivers. However, that’s my case. I will now adopt a new fully conservative policy: I will be one release behind, so as not to run the bleeding edge version. In practice that means I’ll be 6 months behind the software ecosystem, which is not much. And, anyway, some specific packages like Firefox are always at the latest release due to security fixes. And my custom packages will always be at the latest release too. I don’t think I’ll miss anything and I’m sure I’ll avoid many problems that way. Other boxes I own will continue to run Fedora 22 until the beta for Fedora 24 is announced. At that moment, more or less, I’ll switch them to Fedora 23.

Note Fedora supports versions for 18 months, and releases a new version every 6 months. This means you could even be running Fedora 21 as I’m writing this and it’s still supported, but in that case you should be preparing for migration. Being one version behind is probably a sane policy I should have adopted sooner.

Edit: On 2015-11-16 NVIDIA released new driver versions with support for X.org 1.18. I’m now using version 352.63. My former distribution, Slackware, was also affected for a couple of days as the new X.org version made its way to -current.

Firefox right-click menu delay

Posted on .

Some days ago I started experiencing a small two or three seconds delay before the right-click menu showed up in Firefox the first time I right-clicked on something. It turned out to be related to PulseAudio and here’s the technical explanation.

Enabling PulseAudio

I had enabled PulseAudio a few days before I started experiencing the problem, but it took me some time to notice it happened consistently and frequently. By that time, a Firefox upgrade had rolled in and blurred the connection until I debugged the problem.

Before enabling PulseAudio, I was using plain ALSA with the dmix plugin, with excellent results. However, despite a very rough start in the first months or years, PulseAudio nowadays presents several significant technical advantages and works very well, and I wanted to try it out. Essentially, what PulseAudio achieves is a disconnection between the application playing sounds and a specific audio device. Applications talk to the PulseAudio daemon. The daemon, in the background, manages audio devices and routes audio to them dynamically. This means you can be playing music or a movie and if you suddenly connect a Bluetooth headset to the system, or a monitor through an HDMI cable, audio can start playing through that new device without restarting the application at all. The daemon can be controlled with a variety of command line and GUI tools.

Applications can talk to PulseAudio directly if they know how to use the PulseAudio library. If they only “speak” ALSA or OSS, there’s no problem. PulseAudio ships an ALSA plugin that lets you configure the PulseAudio daemon as a default virtual ALSA device (in that case, the route is alsa-libraries to PulseAudio to ALSA kernel driver to the device). It also ships a command line program launcher that wraps OSS audio devices transparently to the launched programs, so any specific OSS application can be re-routed through PulseAudio too.

PulseAudio, as shipped in Fedora, is set up through socket activation. This means PulseAudio is not running normally until someone tries to connect to it for the first time. At that moment, systemd launches PulseAudio and passes the new connection to it. There may be a small two or three seconds pause before the daemon is launched for the first time when an application starts using PulseAudio (do you start to see a connection with my problem there?).

Most users do not experience this pause normally. Full-fledged desktop environments like KDE or Gnome have notification and sound systems that start up with the desktop environment and probably request access to the sound devices or sound daemon early. When a KDE or Gnome desktop is fully loaded, PulseAudio is usually already running.

How this relates to the Firefox right-click menu

Users of more lightweight window managers like Fluxbox or i3 (the latter in my case) may end up in a fully loaded session with everything running and find out nobody has requested access to PulseAudio yet. The first application that tries to access an audio device, directly or indirectly, will have to wait just a few seconds before PulseAudio starts.

It turns out one of the first programs I usually launch in my session is Firefox and, at least in my setup and as it’s shipped in Fedora, Firefox triggers PulseAudio when right-clicking on the text of a webpage. At that moment PulseAudio is launched and the context menu takes two or three seconds to show up. It’s not a long time at all, but it’s very weird and noticeable.

I ran Firefox through strace to see what it’s doing. I didn’t interact with it for several seconds and then, at around 19:59:20, I right-clicked on a piece of text in my default location webpage. This is a selection of those lines.

(Skipped 16000 lines of initializations and other calls...)

19:59:20.265679 open("/usr/share/icons/Adwaita/16x16/actions/document-save-as.png", O_RDONLY) = 59
19:59:20.265698 fstat(59, {st_mode=S_IFREG|0644, st_size=689, ...}) = 0
19:59:20.265716 read(59, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0\20\0\0\0\20\10\3\0\0\0(-\17"..., 65536) = 689
19:59:20.265731 read(59, "", 65536)     = 0

(More icons loading...)

19:59:20.284973 open("/lib64/libcanberra.so.0", O_RDONLY|O_CLOEXEC) = 59
19:59:20.284989 read(59, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3203\0\0\0\0\0\0"..., 832) = 832
19:59:20.285112 open("/lib64/libvorbisfile.so.3", O_RDONLY|O_CLOEXEC) = 59
19:59:20.285127 read(59, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20!\0\0\0\0\0\0"..., 832) = 832

(More audio libraries loading...)

19:59:20.286375 open("/usr/lib64/libcanberra-0.30/libcanberra-pulse.so", O_RDONLY|O_CLOEXEC) = 59
19:59:20.286389 read(59, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220!\0\0\0\0\0\0"..., 832) = 832

(More PulseAudio, X11, systemd libraries loading...)

(PulseAudio libraries reading configuration files below...)
19:59:20.291283 open("/etc/pulse/client.conf", O_RDONLY|O_CLOEXEC) = 66
19:59:20.291298 fcntl(66, F_GETFD)      = 0x1 (flags FD_CLOEXEC)
19:59:20.291311 readlink("/proc/self/exe", "/usr/lib64/firefox/firefox", 99) = 26
19:59:20.291344 fstat(66, {st_mode=S_IFREG|0644, st_size=1201, ...}) = 0
19:59:20.291358 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5553ee7000
19:59:20.291372 read(66, "# This file is part of PulseAudi"..., 4096) = 1201

(Opening a socket to the X server and requesting some PulseAudio properties below...)
19:59:20.291430 socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0) = 66
19:59:20.291459 connect(66, {sa_family=AF_LOCAL, sun_path=@"/tmp/.X11-unix/X0"}, 20) = 0
19:59:20.291560 getpeername(66, {sa_family=AF_LOCAL, sun_path=@"/tmp/.X11-unix/X0"}, [20]) = 0
19:59:20.291575 uname({sysname="Linux", nodename="localhost.localdomain", ...}) = 0
19:59:20.291589 access("/home/rg3/.Xauthority", R_OK) = 0
19:59:20.291605 open("/home/rg3/.Xauthority", O_RDONLY) = 67
19:59:20.291619 fstat(67, {st_mode=S_IFREG|0600, st_size=118, ...}) = 0
19:59:20.291640 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5553ee7000
19:59:20.291653 read(67, "\1\0\0\7deckard\0\0010\0\22MIT-MAGIC-COOKIE"..., 4096) = 118
19:59:20.291670 close(67)               = 0
19:59:20.291681 munmap(0x7f5553ee7000, 4096) = 0
19:59:20.291694 getsockname(66, {sa_family=AF_LOCAL, NULL}, [2]) = 0
19:59:20.291716 fcntl(66, F_GETFL)      = 0x2 (flags O_RDWR)
19:59:20.291727 fcntl(66, F_SETFL, O_RDWR|O_NONBLOCK) = 0
19:59:20.291739 fcntl(66, F_SETFD, FD_CLOEXEC) = 0
19:59:20.291751 poll([{fd=66, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=66, revents=POLLOUT}])
19:59:20.291765 writev(66, [{"l\0\v\0\0\0\22\0\20\0\0\0", 12}, {"", 0}, {"MIT-MAGIC-COOKIE-1", 18}, {"\0\0", 2}, {";xm<Q\300\16m\3\234\221\317\355O\222\v", 16}, {"", 0}], 6) = 48
19:59:20.291796 recvfrom(66, 0x7f55271c85f0, 8, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
19:59:20.291809 poll([{fd=66, events=POLLIN}], 1, 4294967295) = 1 ([{fd=66, revents=POLLIN}])
19:59:20.291828 recvfrom(66, "\1\0\v\0\0\0\212\5", 8, 0, NULL, NULL) = 8
19:59:20.291852 recvfrom(66, "\300\226\262\0\0\0\240\1\377\377\37\0\0\1\0\0\16\0\377\377\1\7\0\0  \10\377\0\0\0\0"..., 5672, 0, NULL, NULL) = 5672
19:59:20.291872 poll([{fd=66, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=66, revents=POLLOUT}])
19:59:20.291885 writev(66, [{"\20\0\5\0\f\0\0\0PULSE_SERVER", 20}], 1) = 20
19:59:20.291909 poll([{fd=66, events=POLLIN}], 1, 4294967295) = 1 ([{fd=66, revents=POLLIN}])
19:59:20.291934 recvmsg(66, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\1\0\0\0\0\0\241\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
19:59:20.291961 poll([{fd=66, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=66, revents=POLLOUT}])
19:59:20.291983 writev(66, [{"\24\0\6\0\230\2\0\0\241\1\0\0\37\0\0\0\0\0\0\0\377\3\0\0", 24}], 1) = 24
19:59:20.292005 poll([{fd=66, events=POLLIN}], 1, 4294967295) = 1 ([{fd=66, revents=POLLIN}])
19:59:20.292030 recvmsg(66, {msg_name(0)=NULL, msg_iov(1)=[{"\1\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096}], msg_controllen=0, msg_flags=0}, 0) = 32
19:59:20.292053 poll([{fd=66, events=POLLIN|POLLOUT}], 1, 4294967295) = 1 ([{fd=66, revents=POLLOUT}])
19:59:20.292065 writev(66, [{"\20\0\5\0\n\0\0\0PULSE_SINK\0\0", 20}], 1) = 20

(Finally Firefox connecting to the PulseAudio socket...)
19:59:20.293778 socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0) = 66
19:59:20.293799 fcntl(66, F_GETFD)      = 0x1 (flags FD_CLOEXEC)
19:59:20.293812 setsockopt(66, SOL_SOCKET, SO_PRIORITY, [6], 4) = 0
19:59:20.293826 fcntl(66, F_GETFL)      = 0x2 (flags O_RDWR)
19:59:20.293838 fcntl(66, F_SETFL, O_RDWR|O_NONBLOCK) = 0
19:59:20.293850 connect(66, {sa_family=AF_LOCAL, sun_path="/run/user/1000/pulse/native"}, 110) = 0

As you can see, for some reason at that moment, apart from loading up some icons that may be needed for the context menu, Firefox also requests access to the sound system for the first time, loading some sound libraries in the process, and starts exchanging data with the PulseAudio daemon.

Firefox seems to be using a library called libcanberra for system sounds which in turn triggers PulseAudio usage. It tries to ask the X server about PulseAudio first (PulseAudio registers itself with some properties in the X server when launched in a certain way). Finally, it connects to the PulseAudio server socket.

The solution for this delay “problem” is very simple. Just launch PulseAudio with start-pulseaudio-x11 when loading the window manager. In i3, it’s as simple as adding the following line to ~/.i3/config.

exec --no-startup-id start-pulseaudio-x11

I’m sure other lightweight window managers have a similar mechanism. This will make i3 launch PulseAudio when starting up if not already running. The i3 session will not take longer to load. PulseAudio will be started in the background together with other processes and will be instantly available the first time a program requests access to it.

Game review: Wolfenstein: The New Order and The Talos Principle

Posted on .

I’ve recently played Wolfenstein: The New Order and The Talos Principle. What follows is a dual review of both.

Wolfenstein: The New Order

Wolfenstein: The New Order was one of the surprises of 2014 and was considered one of the recommended first person shooters in many game publications. If this game is considered one of the good games of that year, we can easily conclude the year was weak. Don’t get me wrong. I enjoyed the game very much and it gets many things right, but it’s far from a top level game.

The game itself is one more title in the Wolfenstein series and a sequel to Wolfenstein, released in 2009, a much weaker game. So let’s focus on what The New Order gets right.

Character development is unusually nice for a Wolfenstein game. Both for the protagonist and the many NPCs and other main characters in the story. The levels are varied and the single player campaign is long but not too long, with ample room for replays, instead of relying on pointless achievements to trick you into playing until the magical 100% completion number. The campaign length and level variety remind me of Deus Ex. The creators knew about this strength, I think, and that’s why they included two timelines as well as a browsable list of secret rooms and items. This, coupled with the chapter selection menu, increase the game value.

Another aspect the game gets right is when mixing styles. Goofy and overpowered weapons are mixed with simpler ones. Over-the-top action is mixed with dramatic moments and some comic relief. Many levels admit several approaches, from stealth to dual-wielding rocket launchers. The game even has unlockable skill chains for different styles to encourage you to change your approach and keep you entertained.

As I mentioned previously, the game prefers to give you replay value and a sane list of achievements so if you’re a completionist you won’t find yourself locating and killing pigeons all over a city. After getting to 100%, and if you found the game to be a bit easy (I played in “I am death incarnate”, replayed it in “Über” and found it to be easy except for the final act, which is a bit painful in Über), after getting 100% you can still solve the enigma codes and unlock new and challenging gameplay modes that will be difficult even for expert gamers. A very wise choice from the game creators.

The technical aspect of the game is a bit worse. It’s been over a year since its release and people are still having sound problems with the game. Usually, getting no sound at all (it happened to a friend of mine) or out-of-sync audio in cutscenes (it happened to me). It feels unpolished. In the graphics department, there is a marked contrast in texture resolution sometimes. While not as noticeable as in Rage, game world textures have sometimes much lower resolution than items on it or other interactive elements. Texture pop-in, typical from id Tech 5 games, is still present. However, with an SSD and a modern graphics card, it’s only noticeable in very specific cases and does not distract the player.

In fact, the best technical aspect of the game is how, despite the low resolutions in very close-up situations in the game world, the level geometry and texture work is amazing. The game look is really good and the it runs amazingly well in many systems. Framerate drops were very infrequent to me and the game ran smoothly at 60 fps all the time in the highest settings it allowed me to use, which were “High” (reminder: I have a GTX 760).

Let’s go for the scores. Technical: 8. Gameplay: 9. Overall: probably in the middle, a nice 8.5.

The Talos Principle

After The New Order, I played The Talos Principle. 100% recommended. I’ve wasted a lot of ink on The New Order and it feels like I’m running out of words for this game, which doesn’t do it justice. The Talos Principle is a puzzle game. It feels a bit like Portal or Portal 2, but on steroids. Its puzzles rely less on physics (jumps, speed and momentum) and more on geometry. I found it to be totally addictive.

Many things can be praised in this game. The way the plot is slowly revealed, the philosophical texts and discussions about humanity, culture and the life cycle, the music, the simple controls and game mechanics, or even its price. I get the feeling if I talk too much about the game itself, I would spoil it for you, so let me sum it up: just get it and play it.

Not everything is rosy, of course. Graphics are OK and fit the game and its mood, but they don’t shine nowadays. Physics are not very good either. They worked for Serious Sam 3 (the game uses the same engine) and fortunately and as I said before, puzzles are more based on geometry than physics, so they simply do their job, but sometimes you can’t help but notice Quake 1 felt better when playing. In the gameplay aspect, the main problem is that at the end of the game you more or less get the hang of the puzzles and the last, say, quarter of the game can feel less challenging than some of the middle game puzzles. This end-of-game decay is one of the few flaws in an otherwise amazing experience.

Scores. Technical: 7. Gameplay: 9.5. Overall: 9. The gameplay dominates. Hey, don’t blame me if you play it and don’t like it. :-)

Disappointed with mobile

Posted on .

It’s been two and a half years since I bought my Nexus 4 and I can say with confidence that I feel disappointed with mobile computing as it is today, both in the hardware aspect and in the software aspect. Let me explain.

In hardware, phone quality leaves a lot to be desired. My Nexus 4 had power button problems after no more than a year of usage, and a few other people I know had the same problem. It was not designed to be pushed dozens of times a day to turn the screen on and lock the phone. After being tired of those problems, I finally took the phone to a local shop to replace the button at a cost of 25 euros. Moreover, two close people have Nexus 5 phones and both have suffered problems too. One of them has been sent to Google to be repaired, unable to boot, fortunately a bit before the two-year warranty expired. Another one had internal storage hardware failures a bit after two years, out of warranty, and had to be replaced with another phone.

In software, quality has been steadily downhill since I bought the phone, and has never worked as good as it was out of the box. With each software update, a few problems are solved and many new problems are introduced. For example, since about the last update a few weeks ago, WiFi and Bluetooth have turned themselves on randomly a couple of times. My wife’s Moto G will not vibrate more than once with the official flipcase closed in vibrate mode when receiving a call. This is a known problem, unsolved despite source patches being available and was introduced with Android 5. The list goes on and on. Furthermore, Google’s position in some technical issues change more frequently than wind direction, and now they say they won’t provide updates for phones older than two years and, in theory, no security updates after three years.

Apple phones are out of the question for me. I don’t want to contribute to such a blatant walled garden approach and being unable to run my own applications in my own phone, and having to pay a fee to see them published in the official applications store.

Don’t get me wrong. I don’t regret having bought the phone. Specially taking into account the state of the market in the middle and low price segments at that moment. Simply, I thought I would be using the phone for around 4 years, but with security updates not available after three years, that’s risky. I’ll have to change phones more frequently than I thought, and taking that into account, I doesn’t make sense, in my humble opinion, to spend more than 200 euros in a phone. Fortunately, that amount of money nowadays gives you access to some pretty decent phones. If my Nexus 4 makes it through until next summer, I’ll replace it with the Moto G or even the Moto E of the day. It’s worth noting both phones may be actually worse, hardware wise, than the Nexus 4 I have in my hands today, so the move wouldn’t make sense in the PC world, were I would simply install the latest software and security updates on the best hardware I have. But mobile, even in the vanilla-Android Nexus line world, has turned out to be different to what I expected it to be. I’ll be buying cheap phones every two or three years instead of good phones every four or five.

CardDAV support in FastMail

Posted on .

Two days ago FastMail announced CardDAV support was finally out of beta state. This is great news for people who, like myself, would like to stay a bit away from Google for all their personal information.

CardDAV is a standardized protocol to access contact data on a server. FastMail already supported accessing email through a web interface, client app and of course IMAP. They also supported CalDAV for calendars and provide web space to host bits of content, like this blog.

In a mobile environment, this allows you to have your personal information stored in “the cloud” but not tied to Google. The Google account is merely an enabler that gives you access to the Play Store, were you can download a signed copy of TextSecure and remembers you have bought CalDAV Sync and CardDAV Sync.

Using the latter two apps, contacts and calendar events stored at FastMail are available globally at the system level, and can be accessed normally with the calendar and contacts applications you’d normally use. Contacts and calendar events added from any normal app can be stored at FastMail instead of Google.

I realize I’ve never really blogged about why I use FastMail. I’ve been using their services for several years now. It started when I wanted to use my own domain for email and, at that point, you have to start paying money. Both to pay for the domain and for having someone handle your email for that domain. I investigated a few options and I remember reading good things about FastMail. They’re an Australian company, not very big. They have always cared about user privacy. Despite having their servers located in the US, they’ve stated in the past they actively avoid storing unencrypted information in their infrastructure abroad and do not obey US court orders. When Australian law changed recently, they sat together with their lawyers, analyzed the text and provided a public statement on why they believed the new law didn’t affect them.

This enthusiasm defending user privacy, coupled with their contributions to free and open source software, respect for standard protocols and efforts to push the state of email technology forward explains why I chose them. I highly recommend their services if you want more control over your personal data and email. Naturally, it’s not free. My enhanced account costs a bit over 30 euros a year (less than 3 euros a month), but you have to understand they’re not in the advertising business. They don’t profile you or use your data. You’re not the product in any sense, you’re a client. You pay for the storage, bandwidth and infrastructure you use, plain and simple.