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

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 

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

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.  

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  

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

 

 

 

45 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

  7. @Stefan,

    Thanks for visiting our blog and providing feedback on this subject. nice to see that this is helping people out there 🙂

    Till next time
    See ya

  8. I’m running Ubuntu 19.04 and it has the same authentication problem. I also had the problem of terminal and nautilus file manager not starting in an RDP session. Your solution fixed everything. Nice work!

  9. @Henry,

    Thank you for the positive feedback and for visiting our blog.. Always happy to see that some tips and tricks are working for others
    till next time
    See ya

  10. For Xubuntu / xfce, see https://www.hiroom2.com/2018/05/07/ubuntu-1804-xrdp-xfce-en/

    Disable light-locker via XRDP
    The light-locker causes error when lightdm does not executed. This is because light-locker uses XDG_SESSION_PATH which is set by lightdm. XDG_SESSION_PATH is a dynamic value and cannot be set static.

    ** (light-locker:2769): ERROR **: 08:09:59.625: Environment variable
    XDG_SESSION_PATH not set. Is LightDM running?
    This article create a wrapper script which checks if XDG_SESSION_PATH is set or not.

    $ sudo cp /usr/bin/light-locker /usr/bin/light-locker.orig
    $ cat <<EOF | sudo tee /usr/bin/light-locker
    #!/bin/sh

    # The light-locker uses XDG_SESSION_PATH provided by lightdm.
    if [ ! -z "\${XDG_SESSION_PATH}" ]; then
    /usr/bin/light-locker.orig
    else
    # Disable light-locker in XRDP.
    true
    fi
    EOF
    $ sudo chmod a+x /usr/bin/light-locker

  11. @DD,

    Thank you for the visit and for sharing the information with our community.
    We have not tested this procedure because we are not focusing our efforts on xubuntu. However, this info would be really of value for others.
    Thanks for passing by
    Till next time
    See ya

  12. @Mr Koffee,

    Thank you for passing by and providing positive feedback about your experience with the provided info….

    Till next time
    See ya

  13. Thanks a lot.
    This polkit change now fixes all the remaining issues I had with xrdp on Ubuntu 18.04.04.
    Your various posts have been absolutely invaluable in resurrecting the completely broken xrdp in Ubuntu.
    The question remains as to why the Ubuntu developers aren’t fixing it themselves, as it’s now been broken for some considerable time!
    Keep up the great work.

  14. @Alan,

    Thank you for the visit and the positive feedback. Nice to see that our work can be useful to others 🙂
    We do not know why Ubuntu team is not providing more effort on this software….but at least it give us a chance to share our findings

    Till next time
    See ya

  15. Thank you for this series of articles on Ubuntu and xrdp.
    I followed your advice for Ubuntu 19.10 and created both 45-allow-colord.pkla and 45-allow-colord.pkla files in /etc/polkit-1/localauthority/50-local.d/ and I now have no more “Authentication required” popups.
    However I still get a crash popup (_usr_libexec_gnome-initial-setup.1001.crash) when I connect via RDP from Windows 10.
    Any suggestions?

  16. @Hassan,

    Do you have the latest updates running on your Ubuntu Operating system ? We never encountered the _usr_libxec_gnome-initial-setup.1001.crash)
    You might want to use the chsh command (change shell) and see if this could fix your issue…

    !!!!!! WARNING – PROCEED AT YOUR OWN RISK – PLEASE DO A BACKUP BEFORE DOING THIS !!!!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    sudo chsh <%yourUserAccount%> -s /bin/bash
    sudo apt-get install gnome-initial-setup

    I do not know if this can fix your issue…So, up to you to try it or not
    Hope this help
    Till next time
    See ya

  17. Thank you Griffon for you suggestions. I will try that later as I now have a more urgent problem. I installed the Nvidia driver on my Ubuntu 19.10 machine and now I can no longer rdp into it from Windows. The login credentials are accepted but then I get a black screen for a minute and am kicked back to the Windows RDP login.

  18. Had the same problem.
    This worked on ubuntu Ubuntu 20.04 LTS (Focal Fossa).
    Thank you.
    I am doing RDP from macOS on 1 or 2 screen.

  19. I’m running Ubuntu 20.4. I followed these instructions, and am not getting the authentication needed prompt or the crash message. However, now I cannot access my USB hard disk :(. How can I fix this?

  20. @Rohan,
    Thank you for visiting our blog and for your feedback. So, It might be caused by polkit policy again for removable storage. You will need to create a new exception for your disks within the remote session
    If you do that locally, we would assume that it’s working. if this is the case, then, you have to probably look into polkit issue
    Might be something like this (we do not know !!! – we have not test this))

    [udiskie]
    Identity=unix-group:plugdev
    Action=org.freedesktop.udisks.*
    ResultAny=yes

    Hope this help
    Till Next time
    See ya

  21. @Flavio,

    No problem, always happy to see that our work can help other people around
    Thanks for the visit and the feedback provided

    Till next time
    See ya

  22. Thanks for the tips and fixes, it works on Ubuntu 20.04.1, and in my own distro ubuntu based. But now it has a new not desirable behaviour: Inside a RDP sessión, before de fix, the session avoid the shuting down all the system with You are no allowed, but after the fix, the system simple crash with an error if the user try to shutdown the system. Another fix perhaps?

  23. @Guillermo,

    Not sure to understand fully the question/problem
    are you using xrdp on top of Ubuntu 20.04.X or another distribution ? Are you using Gnome Desktop ?
    The fix you are mentioning is simply there to prevent the authentication popup when accessing the desktop and should not change any other behavior on your desktop.
    We have developed a small script that automate most of the work when installing xRDP on Ubuntu machines. (see https://c-nergy.be/blog/?p=15733). We have recently installed and test it on ubuntu 20.04.1 and did not encountered the issue you are mentioning….

    Could it be a typo in the pkla file ?

    Hope this help
    Till next time
    See ya

  24. I had same problem on centos 7.5 using X2GO from windows to host machine. This seems to have solved this really annoying problem. Thanks a bunch!

  25. @pclausen,
    Thank for the feedback and for visiting our blog… cool to see that these tricks are also working for others using different technologies

    Till next time
    See ya

  26. Holly hell… I have been clicking on those stupid popups every time I RDPed into my Ubuntu system – it’s crazy! You helped me solve it (it works on Ubuntu 20.04).

    I also had another problem: black screen when logging in. Turned out, that one cannot log in with a user locally (create a local session) AND use the same user to log in over RDP at the same time. I’d either expect a meaningful error message – or for it to “take over” the local session into a remote one.

    Anyhow: thank you for helping me fix this mess. I simply prefer RDP, because it’s convenient. If I needed some video hardware acceleration, I’d be going with something else I guess. Cheers!

  27. @Igor,

    Thank you for the feedback and for visiting our blog. Always nice to see that information provided can be somehow useful. Concerning the black screen issue and local session and remote session using same user account, we are publishing quite soon a workaround…:-) If you are still interested in overcome this limitation, visit us again a in a few weeks…

    Till next time
    See ya

  28. Hello, I installed a ubantu20.04LTS subsystem on my win10 system, and used the remote connection xrdp connection, but after I connected the user password, the system went blank and immediately disconnected without any prompt . What is the reason for this?

  29. @yulong;

    We never tested the script against Ubuntu 20.04 LTS through WSL… However, based on your description, it seems that the same user account is already logged on locally on Ubuntu. Then you are trying to perform the remote session using exactly the same account (see https://c-nergy.be/blog/?cat=79)
    We assume that you are using Ubuntu Desktop edition

    Hope this help
    Till next time
    See ya

  30. OP, bless your soul. I have been working on linux system for the last decade and this one was getting on my nerves. All good now.

  31. @Francois;

    Thank you for visiting our blog and providing feedback. Happy that you have found useful information through our blog and that information sovled your issues
    Till next time
    See ya

  32. thank you very much for your solution.
    the prompt occured to me on a debian 11 vps, the admin of which has no password, so the interactive way was blocked.
    thanks to your solution, i am one step forward towards a decent machine in a window.

  33. @Alex,

    Thank you for visiting our blog and providing great feedback. For you info, we also have developed a small script that can help install xrdp and perform post configuration actions as well. The script should be working against Debian 11.. If you want to give it a try and provide feedback… that would be great

    Till next time
    See ya

  34. @Alexander,

    Thank you for visiting our blog and providing feedback…. Happy to see that information is still useful
    Till next time
    See ya

  35. @Seongho,
    Thank you for visiting our blog and providing feedback. Always happy to see that the information provided can help 🙂
    till next time
    See ya

Leave a Reply