xRDP – How to Fix the Infamous system crash popups in Ubuntu 18.04 (and previous versions)

 

Hello World, 

Today’s post is about a recurring issue that occurs when using xRDP software solution on Ubuntu systems.  The system crash popup that appears each time you login into your remote session after performing the xRDP installation process.  So far, we never had time to investigate this issue and usually this is considered as a minor annoyances for the users.  We have spend some time in investigating this problem and this post will show you how to get rid of this crash message system. 

Let’s do this… 

Our Scenario

Initial Connection

Let’s assume that we are performing a manual installation of xRDP package on Ubuntu 18.04. To perform this installation, we have simply issued the following command in a Terminal Console 

sudo apt-get install xrdp 

 

At this stage, we do not perform any additional configuration and we should be able to perform a remote connection to Ubuntu.   So, start your favorite remote desktop client, provide ip address or hostname and you should see the xrdp login page.  Provide your credentials and Press OK

U1704_xrdp_3

Click on picture for better resolution

If everything is ok, a remote connection to your system should be performed.  However, you will notice that you have received a popup asking you to authenticate 

Polkit_1

Click on picture for better resolution

Identifying the root cause 

In our previous post , we have explained why this behavior was triggered.   PolKit authorization framework is controlling which actions can be performed on the system by the users.  However, we have not yet provided the way to configure Ubuntu to avoid these popups.  We might publish a post about all the possible way to fix the popup issue.  However, if you google and look on internet, the most frequent answer to solve this issue consists in two steps 

  • create a file in /etc/polkit-1/localauthority.d.conf called 02-allow-color.d.conf 
  • copy/paste the text below in the file 
polkit.addRule(function(action, subject) {
if ((action.id == “org.freedesktop.color-manager.create-device” ||
action.id == “org.freedesktop.color-manager.create-profile” ||
action.id == “org.freedesktop.color-manager.delete-device” ||
action.id == “org.freedesktop.color-manager.delete-profile” ||
action.id == “org.freedesktop.color-manager.modify-device” ||
action.id == “org.freedesktop.color-manager.modify-profile”) &&
subject.isInGroup(“{users}”)) {
return polkit.Result.YES;
}
});

The file is basically an authorization file rules that can be used to override policies defined by the PolKit authorization framework component. This file is basically saying that if a user is part of the group users (in this example), it will be allowed to perform the colord actions defined in the policy file.  With this configuration change in place, when performing a remote connection to Ubuntu, no more popups about authentication required will be displayed but the system  crash popup start to showing up

FixCrash_10

Click on picture for better resolution

So, it seems that the creation of this file is actually causing the crash popup.  By checking the /var/crash library content, a crash report related to the PolcyKit is available.  So, logically, the issue is related to the PolKit component and the error is caused by the addition of this  02-allow-colord.conf file.  As soon as the file is deleted, the Authentication Required popups are displayed but no more crash system popup.  

FixCrash_11

Click on picture for better resolution

The problem is indeed related to the Polkit engine and more specifically to the file being used…..Searching on Internet for some tips (or even better a solution), we came across this post .  Apparently, it’s important to know the Polkit version in use on the system as this will define how the authorization rules files would be processed (or not processed).  If the version of the PolKit is < 0.106, you need to create a .pkla file (and not a .conf file). 

Checking on Ubuntu 18.04, using the command pkaction –version, we can clearly see that the version is 0.105 and thus we need to use correct syntax for this version  

FixCrash_12

Click on picture for better resolution

The solution

The solution is basically to create the proper file, with the proper file extension and proper syntax to be used so the system recognize fully the authorization rules and does not crash anymore.  Based on the documentation founded here, the following .pkla file has been generated.  This file tell the PolKit framework that any users can perform actions defined in the colord.xml policy file 

[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes

Save the file as 45-allow-colord.pkla and place it in the following directory (you need admin rights to copy files in this location !!)

 /etc/polkit-1/localauthority/50-local.d/

Before trying to connect remotely to your system, ensure that the /var/crash directory is empty. You can delete the content of the directory using the following command 

sudo rm /var/crash/*

 

When done, try to perform a remote connection and if everything works as expected, you should have access to your desktop with no Authentication Required Popups and no system crash popup. Double check that no crash report has been generated while using the new Polkit format file by checking the content of /var/crash directory.  It should be empty…. 

Final notes

After some much time, we have finally identified and fixed the issue related to this system crash popup.  Since we are aware of the issue, we have updated the Standard installation script (ver 0.2) so the script create the .pkla file and not the .conf file anymore.  Noboby never focused on this small issue.  The strange thing is this story is that the allow-colord.conf file seems to work as the Authentication required popups are gone but they indeed generate another annoyance.  

Voila ! The issue is solved and it’s time to go and relax 

Till next time 

See ya

 

 

 

8 thoughts on “xRDP – How to Fix the Infamous system crash popups in Ubuntu 18.04 (and previous versions)

  1. Thanks for the guide.
    I’m sure it works for Ubuntu as stated.

    Unfortunately it didn’t work for me on Xubuntu 18.04
    Both authentication & crash popups persist.

  2. @Spk,
    Thank you for the feedback… are you sure that the crash is still caused by the polkit configuration… if you check the /var/crash, do you see dump files, can you see one related to polkit ?
    Could you clean the /var/crash directory and try again and provide feedback
    Till next time
    see ya

  3. I figured it out. For me (on multiple machines with clean installs) the problem was NetworkManager firstly requiring authentication and then causing a crash. The problem did not occur if I logged in as root, but that’s not what I wanted. So to fix the issue I ran the following command which creates a different polkit over-ride;

    cat <<EOF | \
    sudo tee /etc/polkit-1/localauthority/50-local.d/xrdp-NetworkManager.pkla
    [NetworkManager]
    Identity=unix-group:sudo
    Action=org.freedesktop.NetworkManager.network-control
    ResultAny=yes
    ResultInactive=yes
    ResultActive=yes
    EOF

    Additionally I had problems with light-locker causing a crash in xrdp sessions so I completely purged it as it's not required for my headless, always-on machines;
    $ sudo apt purge light-locker

    Finally I also had to disable Bluetooth manager as it too caused an intermittent crash in xrdp sessions.
    – Settings, Settings Manager, Session & Startup, App Startup – disable Bluetooth manager (blueman).

    Now everything works fine when logged in as a sudo user

    Cheers

  4. @SSPK;

    Thank you for the feedback. We are happy to see that you have been able to fix the issue and that the pkla trick is working indeed as expected
    Thank for the visit
    Till next time
    See ya

  5. I’m on 16.04 and this has been chaffing my rear for months. I’m not a Linux guy but tinker cross platforms as an R&D developer for embedded systems. Plain dumb luck I put in the right Google search terms after several tries. Thank you for this solution!!!

  6. @ Bryan Pavlich

    🙂 , Super cool…. we also crashed our head for some time before finding out the issue and the solution of the problem…
    Thank for passing by and for your positive comments

    Till next time
    See ya

Leave a Reply