Hybrid Graphics in Ubuntu 14.04

Here’s a short list of the new features concerning hybrid graphics in Ubuntu 14.04:

  • External displays connected to the NVIDIA GPU can now be used through the “nvidia-settings” panel. We used to disable them but this is no longer the case (also there’s a fix pending for LP: #1296020, in case your BIOS provides a fake output)
  • We have a more robust system to detect and enable hybrid graphics, thanks to the new gpu-manager (I’ll write a more technical article with all the details soon).
  • We now fall back on the open Intel driver if any of the required components is missing (e.g. the kernel module was not built for the newly installed kernel, or a key package was accidentally removed).
  • Installing the nvidia or the fglrx driver should allow hybrid graphics to work with no further action required. Switching from a power profile to another can be done using the relevant control panels (either AMD’s or NVIDIA’s), as usual.
  • A direct benefit of using a recent kernel is that tearing on Intel/NVIDIA systems, while still an issue, should be a little reduced.

My special thanks go to Maarten Lankhorst (of Nouveau fame), who helped a lot by providing guidance, testing, and debugging X issues.

Known issues

Instructions

GPG key transition


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1,SHA512

Sun, 01 Dec 2013 16:11:29 +0100

For a number of reasons, I've recently set up a new OpenPGP key, and
will be transitioning away from my old one.

The old key will continue to be valid for some time, but I prefer all
future correspondence to come to the new one. I would also like this
new key to be re-integrated into the web of trust. This message is
signed by both keys to certify the transition.

The old key was:

pub 1024D/8EB26AF1 2006-05-22
Key fingerprint: 9C4E 6858 CFD9 41F5 5937 F717 1592 49E9 8EB2 6AF1

And the new key is:

pub 4096R/B3C98EDD 2013-12-01
Key fingerprint: F6AF C513 FCB0 A3AC DFD0 B930 937D 6BFE B3C9 8EDD

To fetch my new key from a public key server, you can do:

gpg --keyserver pgp.mit.edu --recv-key B3C98EDD

If you already know my old key, you can now verify that the new key is
signed by the old one:

gpg --check-sigs B3C98EDD

If you don't already know my old key, or you just want to be double
extra paranoid, you can check the fingerprint against the one above:

gpg --fingerprint B3C98EDD

If you are satisfied that you've got the right key, and the UIDs match
what you expect, I'd appreciate it if you would sign my key:

gpg --sign-key B3C98EDD

Lastly, if you could upload these signatures, I would appreciate it.
You can just upload the signatures to a public keyserver directly:

gpg --keyserver pgp.mit.edu --send-key B3C98EDD

You can also find this signed message at:

http://www.albertomilone.com/tseliot/key-transition-2013-12-01-tseliot.txt

Please let me know if there is any trouble, and sorry for the
inconvenience.

Alberto Milone
IRC: tseliot

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlKbV2AACgkQFZJJ6Y6yavFrUACdE7SKNtdpesxA+Y00PYE09j+j
gToAoMLdl8dak6NWzZZEvr8uLRq6JUfTiQIcBAEBCgAGBQJSm1dgAAoJEJN9a/6z
yY7dp3QP/jcUm5SLFfuad1D7otDNLvbxsOKnK7qF2KwEL5cc3J71mup88qeT2DcW
VUhCIOnirNAW1OddlJJZ9XCK9T8B8hneZDOJ/D9xPTCvfVcpl9lXzVpll6R8KZoY
U4yZHajdU8YzM0Zfzgvq7VWyi6KrE6yYRHo6pF2TkS1/BoWse/n3583ODnx12b9/
kP3pYFauk48kpDWOHciuB1GQOOOy7EC+Dxd59wWW32MyAadFq83pqSx9VlTD/EpX
30jpsp1ymh5fxPY7rsNwRoTfhmb4IZ+WbM4QDtQtq45Y6geDijxy1YSnh8VIjsrq
6fwDtFdKbJUViin5W+o+siXvQc2STflcQ/hLBKUO7yvwBIKWPimRtEAgVm/K2P9M
Pa3Nmrs7BbQcmRL5QRUiyk0b91SNgnetNo5M6QIQvzHpITTghBBj6jMkfEmHevKd
KJVyq6p6pz3/NMaKFpuP2rLkIiLeQVOPouvJ2zDFbsjCD50MUm4JqpKsI8ss/pzh
4KXLVewV5yhLVdX9HhKwU/HxhBmJxAPr6ZUeI1r11BxwgRsbBNbNfSe9Wn+MTs0E
CbdJ7KYscyHVdY6BiKIjnP9WxGwqqTCkDfPnxA65/pXh/MJE4yb1BRfg4uKvs0VU
94D2g2LYhYGeX1TMB8QKmVGG9nPMb3ZI2GKRyrU4gCqwi464BUUR
=9P7Y
-----END PGP SIGNATURE-----

On Heated Technical Discussions

In the light of the (relatively) recent heated technical discussions on display servers and init systems, I thought I would weigh in on how to handle this kind of discussions which, honestly, I find kind of annoying (at least their “heated” side).

I do not represent my employer in any way and I base the following considerations only on what I deem sensible and respectful behaviour.

Flamewars have always existed (in their different forms) and they will not certainly end today but we can (and should) all avoid them by simply not taking part in them.

Here are some points that I consider the minimum requirements for a civil debate.

1. Mutual Respect

It is never ok to insult others. No matter what they said to upset us, we should always do our best to keep it civil. Usually developers write their responses on their blogs, in mailing lists, chat rooms, and one of the benefits of written language is that, differently from spoken language, you have the time to calm down, think carefully about the message you want to convey, re-read the text and edit out the parts you perhaps wrote out of anger and frustration. Please think twice about what you write, before you send it out.

2. Offending Others

Name-calling is not the only way to be perceived as rude or to hurt other people’s feelings. Let’s face it, if I said that you are not reliable, you change your mind every other day, your project is badly designed, etc. or if I made silly jokes about you and your software, you would not be pleased about my assessment of your work or of your personality. Furthermore please pay attention to the overall tone of what you write. There is always a respectful way to say no or to dismiss other people’s claims. Passive-aggressive behaviour1 should never be an option.

Always ask yourself if what you wrote and how phrased it were 100% appropriate and necessary. Also try to see it from the perspective of the other side. Would you consider it acceptable if others said the same to you?

And no, being rude to the people who have been rude to you will not make you any better than them. Do not let them drag you down to their level.

3. Taking Responsibility

Whatever you said, as an adult, you should take responsibility for it. If you think you are right and that you were respectful (see point 2), stand your ground and do not pay too much attention to hostile responses, as unpleasant as they can be. If you think you crossed the line, then simply put your ego aside, and apologise.

4. Playing the Victim vs Being the Victim

Do not necessarily consider yourself a victim if people react the way they do to what you said. For example, the passive-aggressive are known to see themselves as some kinds of martyrs, innocent victims attacked for no apparent reason. This way they do not have to take responsibility for their actions (see point 3).

If you are not sure as to whether this applies to you or not, go through what you wrote – see point 2 and be honest to yourself about it – and then move on to point 3. Victims do exist but are you really one?

5. Disagreeing

Sometimes it is not possible to come to an agreement. Either side will not do what the other side asked, or even meet halfway. If you feel you have done everything in your power to come to an agreement and it was not enough, then simply give up and leave the discussion. Insulting the other side will not do you (or anybody else) any good. The world will not cease to exist if there is no solution to a discussion, no matter the consequences. After all, we are still talking about software, right?

 

 


  1. Passive-aggressive behavior is the indirect expression of hostility, such as through procrastination, hostile jokes, stubbornness, resentment, sullenness, or deliberate/repeated failure to accomplish requested tasks for which one is (often explicitly) responsible.” (Wikipedia)  

Hybrid Graphics with AMD and NVIDIA in Ubuntu 13.10 and 12.04.3

In this Ubuntu release cycle I worked, among other things, on improving user experience with hybrid systems and proprietary graphics drivers. The aim was to make it easier to enable the discrete card when in need of better performance i.e. when the integrated card wouldn’t be enough.

In 13.10 I focused mainly on enablement, making sure that by installing one extra package together with the driver, users would end up with a fully working system with no additional configuration required on their end.

As for 12.04.3, I backported my work from 13.10 and I also made sure that Jockey (the restricted drivers manager in Precise) detects systems with hybrid graphics, recommends the correct driver – hiding any drivers which may support the card but not in a hybrid graphics context – and installs the extra package when users decide to enable the discrete card. The installation process is very straightforward, however, if you’re still using the old kernel/X stack, Jockey won’t show any drivers. The backported stack from Raring (which comes by default with 12.04.3) is required.

There are some known issues, which will be fixed in a near future.

If you would like to try this work on your system, you can find the instructions here.

 

Getting back tethering on Android Jellybean

Apparently Android >= 4.1.2 breaks tethering in some cases.

Basically you can connect to your phone but you will get no data whatsoever.

This may be fair (at least from Google’s point of view) if your mobile phone operator doesn’t allow tethering and Google wants to respect that. If, like me, you’re using a virtual operator (such as Coopvoce, which relies on TIM’s network) which clearly allows tethering (it’s written on their website), this new “feature” will break tethering for no reason and I’m not sure if such operators can or will actually do anything to fix the issue on their side.

The main reason I have an Internet connection on my phone is because my ADSL at home has poor upstream bandwidth, therefore (for lack of alternatives) I use my phone’s HSUPA connection to upload stuff for work. Breaking tethering for me means making my life more difficult.

Fortunately, in that bug report in the link above I also found part of the solution which helped me get Wireless tethering. Then I managed to enable USB tethering by myself.

This tutorial will require rooting your phone, which you will do at your own risk and googling how to do it.

Requirements:

  • Grab the Android SDK
  • Make a backup of your data (as unlocking the bootloader will erase everything)
  • Unlock your bootloader
  • Root your phone (install Superuser.apk)
  • Install “Scripts Manager” (SManager)
  • Install a Text editor

Follow these steps:

Connect your phone to your PC using the USB cable

Check your devices and their IP addresses:

(Make sure that tethering is disabled and that your 3G/2G/HSUPA connection is enabled and running)

sudo adb kill-server
sudo adb start-server
adb shell
su
netcfg

Which will give you something like the following:

lo       UP           127.0.0.1/8   0x00000049 00:00:00:00:00:00
ifb0     DOWN           0.0.0.0/0   0x00000082 22:b3:ab:4e:2b:0c
ifb1     DOWN           0.0.0.0/0   0x00000082 6e:67:b2:6f:8d:6c
sit0     DOWN           0.0.0.0/0   0x00000080 00:00:00:00:00:00
ip6tnl0  DOWN           0.0.0.0/0   0x00000080 00:00:00:00:00:00
rmnet0   UP      217.202.140.0/24   0x000010d1 00:00:00:00:00:00
rmnet1   DOWN           0.0.0.0/0   0x00001090 00:00:00:00:00:00
rmnet2   DOWN           0.0.0.0/0   0x00001090 00:00:00:00:00:00
p2p0     DOWN           0.0.0.0/0   0x00001002 a2:0b:ba:21:d1:fe
wlan0    DOWN           0.0.0.0/0   0x00001002 a0:0b:ba:21:d1:fe

In this case the interesting device is “rmnet0” (let’s call it the 3G device). Write down its name and its IP address.

Now enable USB tethering and run “netcfg” again:

lo       UP           127.0.0.1/8   0x00000049 00:00:00:00:00:00
ifb0     DOWN           0.0.0.0/0   0x00000082 22:b3:ab:4e:2b:0c
ifb1     DOWN           0.0.0.0/0   0x00000082 6e:67:b2:6f:8d:6c
sit0     DOWN           0.0.0.0/0   0x00000080 00:00:00:00:00:00
ip6tnl0  DOWN           0.0.0.0/0   0x00000080 00:00:00:00:00:00
rmnet0   UP      217.202.140.0/24   0x000010d1 00:00:00:00:00:00
rmnet1   DOWN           0.0.0.0/0   0x00001090 00:00:00:00:00:00
rmnet2   DOWN           0.0.0.0/0   0x00001090 00:00:00:00:00:00
p2p0     DOWN           0.0.0.0/0   0x00001002 a2:0b:ba:21:d1:fe
wlan0    DOWN           0.0.0.0/0   0x00001002 a0:0b:ba:21:d1:fe
rndis0   UP      192.168.42.129/24  0x00001043 c2:09:33:df:45:64

You will notice the presence of a new device (in this case “rndis0” which is the USB device). Again take note of its name and IP address (which will vary but it’s not a problem).

We can now try to route traffic using iptables.

So, for Wireless tethering (use the name of the 3G device and leave the IP address as it is):

iptables -tnat -A natctrl_nat_POSTROUTING -s 192.168.0.0/16 -o rmnet0 -j MASQUERADE

And for USB tethering (use the name of the USB device and use the IP address of the 3G device):

iptables -tnat -A natctrl_nat_POSTROUTING -s 217.202.140.0/24 -o rndis0 -j MASQUERADE

Note: I’m not very familiar with iptables but I’ve found these commands to solve the problem here.

Test tethering using a PC. If it works, then we can save the two lines above in a script.

Open a text editor from your phone and type (or you can write it on your PC and then push it to your phone using adb push):

#!/system/bin/sh
iptables -tnat -A natctrl_nat_POSTROUTING -s 192.168.0.0/16 -o rmnet0 -j MASQUERADE
iptables -tnat -A natctrl_nat_POSTROUTING -s 217.202.140.0/24 -o rndis0 -j MASQUERADE

 

Then save the file, open it using SManager and tap on the “Boot” and on the “Su” labels (since we want this to run on boot and it requires root privileges).

Note: Make sure to give SManager root permissions when the Superuser app asks you.

And that’s it, restart your phone and everything should work flawlessly from now on.

An Indicator for Cryptkeeper

I’ve been very busy with life and work in general and I haven’t blogged for a few months now. I finally get the chance to talk about something I worked on in my spare time.

I use Cryptkeeper to decrypt and mount some encrypted directories that I have in my Ubuntu One space but I noticed that its applet didn’t make use of Ubuntu’s Appindicators. Since the whitelist for old style applets had been removed in Raring, I was left with no way to use Cryptkeeper. For this reason I rolled up my sleeves and I worked on a patch to (optionally) enable support for Appindicators in the program.

open_indicator_edited

The main problem I had to face is the fact that Appindicators don’t support right click gestures, so I had to create an entry in the indicator (labelled “Edit”) to allow users to get information, change passwords or delete encrypted directories. Clicking on that entry pops up a dialog which then hooks into the old dialogs to perform the said operations.

cryptkeeper_edit

I uploaded my work in Saucy and made packages for Precise and Raring available in my PPA.

I hope you enjoy my work!

My father passed away

On 2 January my father passed away at 63, after a little more than a year fighting (a rather aggressive type of) lung cancer. I won’t go into the details of how it went but let it suffice to say that pain and tears have been our bread and butter.

A little bit of history

My father was an honest and kind man who did everything he could for his family. A big part of who I am today, I owe it to him. Since when I was little he always encouraged me to learn and contributed a lot to my education, ranging from history and science to politics.

He supported my (at the time) crazy idea to pursue my current career (as I graduated in a field other than Computer Science) as he’s always believed in me. My father – an electrical engineer who worked in the world of software development – was more than glad to know that I had developed an interest in programming and supported my early studies. I’ll never forget that time when I was coding my first port of Envy (my first program) to the Python programming language and I was stuck and feeling miserable, almost ready to give up, when he sat down beside me and helped me solve the problem. From that point on, nothing stopped me from learning and from facing any other kind of programming problem, which I always take as a challenge.

The funeral and the support we received

I was really amazed at the warmth of my friends and colleagues, my father’s friends, our relatives and neighbours. Whether through the phone, telegram or in person at the funeral, we felt all the love they feel for us and it was beautiful. We couldn’t have asked for more. I’d like to thank you all.

Conclusions

Despite the tragic conclusion, I can say that I’m a much better and mature man than I was when all this misfortune began. This was my father’s last teaching, how to face your worst fears and how to take care of yourself and of the ones beside you in the face of an adverse destiny. It’s a lesson I’ll never forget.

SFTP uploads to the Ubuntu archive

Some time ago I had problems using ftp when uploading packages to upload.ubuntu.com (which stalled at about 13% for 100Mb uploads). Somehow sftp seems not to be affected by the problem. Here’s the relevant snippet to use in your ~/.dput.conf:

[ubuntu]
fqdn = upload.ubuntu.com
method = sftp
incoming = ubuntu
login = <YOURUSERNAME>
allow_unsigned_uploads = 0

I’ve found sftp to be much more reliable, at least with my (less than stellar) internet connection.

Updates on Nvidia (285.05.09) and Fglrx (11.11)

As you might already know, this release cycle we’re providing updated proprietary graphics drivers using the -updates flavours of our driver packages (e.g. nvidia-current-updates, fglrx-updates). These updates are optional and, if you don’t want to run the risk of dealing with regressions, you may want to keep using the non-updates flavours (e.g. nvidia-current, fglrx, etc.).

If you’d like to help us test the new drivers, we have 2 updates available:

Nvidia’s (nvidia-current-updates) 285.05.09 and AMD’s fglrx 11.11 release

Please leave your feedback in the bug reports so that the SRU team can promote the drivers (currently in the oneiric-proposed repository) to regular distro updates.

NOTE: you might also want to keep an eye on this twitter page for more updates.

Appindicator for Hamster part 2

This week I’m supposed to be on holiday but I decided to spend some time on my appindicator for Hamster. To be honest, though, a merge request on github from Izidor Matušov, together with our discussion in the merge review thread, was what made me want to focus on hamster again. He provided a light monochrome icon, based on the original icon, (to use with the Ambiance theme) and some code to switch icons when the indicator requires attention. I worked more on the light icon and made a dark variant for the Radiance theme, so that we finally have monochromatic icons for hamster. Although icon design is definitely not my field, I’m quite happy with the results (help is always welcome though).

The main problem I wanted to solve was to allow users to see when hamster has an active task, without having to click on the indicator. I implemented two solutions but I enabled only one by default:

  • I added a slight blue glow (which you can disable) to the icon so that you can see when there is an active task in hamster.


  • I made it possible to have a text label (disabled by default) with the current activity beside the icon. This is quite similar to how the old gnome applet used to work. You can also set the maximum length of this label (the default is 20 characters).

Finally, as promised, I packaged the indicator and set up a PPA with packages for both Natty and Oneiric.

Note: in Oneiric you’ll also have to install my patched hamster-applet, otherwise hamster-applet will crash looking for gnomeapplet (which we no longer ship).

If you want to configure the indicator you can either open gconf-editor and look for /apps/hamster-indicator/ or follow these steps from the command line:

To enable/disable the icon glow:

$ gconftool-2 --set "/apps/hamster-indicator/icon_glow" --type bool "false"
$ gconftool-2 --set "/apps/hamster-indicator/icon_glow" --type bool "true"

To enable/disable the activity label:

$ gconftool-2 --set "/apps/hamster-indicator/show_label" --type bool "true"
$ gconftool-2 --set "/apps/hamster-indicator/show_label" --type bool "false"

To set the maximum label length:

$ gconftool-2 --set "/apps/hamster-indicator/label_length" --type int "20"

EDIT: you can launch the indicator with the following command:

$ hamster-indicator