I had installed flatpak to run an application. Since it didn't quite work, I removed it using the following command:

sudo apt remove flatpak

On restart, I'm getting the error below. There is an OK button, but I can't hit it and can't even get to the desktop. The mouse isn't working and neither is the keyboard.

I am running Ubuntu 19.04. Here is the error:

Error found when loading /etc/profile:

/etc/profile.d/flatpak.sh: line25: flatpak: command not found

As a result the session will not be configured correctly. 
You should fix the problem as soon as feasibile.

To fix this situation you have to remove or comment out that line in your profile file the steps are:

  1. Switch to the login console Ctrl + Alt + F1, then

  2. Locate that file and remove that line that is causing the boot issue:

    sudo sed -i.bak '25d' /etc/profile
  3. Remove any remnants

    sudo rm -rf /etc/profile.d/flatpak.sh
    sudo rm -rf /etc/X11/Xsession.d/20flatpak
  4. Reboot the system

  • Thanks this helped me in to console mode, since the GUI was not loading at all. I couldnt even get to the login screen. I had to purge as @Norbert0 suggested above. – ubuntububuntu Jun 1 '19 at 20:45

You can try to remove it again by purging

sudo apt-get purge flatpak

or remove its leftovers with

sudo rm /etc/profile.d/flatpak.sh
sudo rm /etc/X11/Xsession.d/20flatpak

and then reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.