Announcement

Collapse
No announcement yet.

CherryTree and the deal I made with the Flatpak Devil

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    CherryTree and the deal I made with the Flatpak Devil

    Hey, everyone. I ran across a problem of some applications being unable to access any files that I have on external media such as a thumb drive. This is a problem for me because I do all my work on external media. For example, I have one thumb drive for writing and another identical one for backing that one up. I don't store any of my work files on my PC?s external hard drive for a few reasons. First, if Kubuntu ever gets buggy or crashes, I can just boot to my Kubuntu thumb drive and reinstall everything. I don't have to take any time out backing up my files. They?re already in external media, and I have two copies.

    So that?s why it was a bit of a frustration when I installed a simple text editor I like named ?Leafpad? and I got this:



    I don?t know why Leafpad has a problem with my external media, but I found a solution. I simply installed a fork program named Mousepad, which is the same program, except it?s able to access my external media, no problem.

    However, the no access to external media bug hit me again. CherryTree is maybe the most important application that I run under Kubuntu. It's my note-taking program. I have numerous CT databases containing all of my Kubuntu install notes, notes on how to do things in applications like Gimp, outlines of story plots that I'm writing, etc., in CT. So to have this app unable to access my media would be a major problem, and this is an app I cannot replace with a fork. So I uninstalled CT from Discovery and reinstalled it via Flatpak. Problem solved! I don't understand why the Flatpak package gave CT the ability to access my media files while the other one didn't, but that's the case.

    However, solving this problem this way caused another problem. For each of my applications that I use a lot, I install a keyboard hot key for it. It's really easy in Kubuntu by doing this:

    System Settings ==> Shortcuts ==> Custom Shortcuts.

    For most apps, I can simply put the name of the app under "Action" and that app then runs with whatever hot key I put in. For example, for the text editor, Kate, I simply put in:

    kate

    For LibreOffice writer, it?s slightly more complicated with:

    libreoffice --writer

    But with a Flatpak-based install, no way would it be that simple. I put a CherryTree shortcut on my desktop so that I could right click and choose "Properties" and see what command Flatpak set up for CherryTree. This is what I got:

    /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=cherrytree --file-forwarding com.giuspen.cherrytree @@ %f @@

    However, when I put that into Action and specify my hot key, it does not work. I get a "no host name specified" error. Once again, installing via Flatpak is a little bit like making a deal with the Devil. It does a great job getting an app installed and guaranteeing it has all its dependencies and runs flawlessly, but there always seems to be a gotcha. For example, I then don't know where an app's config files are. They're not where the would be with a standard install. And now here I can't seem to get a simple hot key for CherryTree set up.

    So it would seem I need to do one of two things:
    1. Somehow figure out how to put in Flatpak's version of CherryTree's command into Custom Shortcuts.
    2. Uninstall the Flatpak-based CherryTree and install it once again from the repository, but then figure out why it won't access my external media.

    Either way, it would be nice to know why some apps have such a problem accessing my external media right out of the box.

    Edit: Update
    I found a PPA for CherryTree. Then I uninstalled the Flatpak one and replaced it with the PPA one from this code:
    Code:
    sudo add-apt-repository ppa:giuspen/ppa
    sudo apt-get update
    sudo apt-get install cherrytree
    Now it both accesses my external media and the simple hot key command "cherrytree" works.

    Thus, this has solved my problem, though I am still stumped as to why two installs from the Discover repository have yielded programs that run, but cannot access my external media. Any ideas?
    Last edited by Tom_ZeCat; Jun 04, 2021, 10:42 PM. Reason: update
    Kubuntu 22.04 (desktop & laptop), Windows 7 &2K (via VirtualBox on desktop PC)
    ================================

    #2
    Originally posted by Tom_ZeCat View Post
    Any ideas?
    How were you mounting the external media?

    Dolphin automatically does a mount using the "udisks" subsystem (or something like that) and not all software knows to do that. An approach that works well with your use case is to put meaningful labels on the media and use the "removable storage" screen in system settings to set up an automatic mount.

    What file systems are on the media?
    Regards, John Little

    Comment


      #3
      Flatpaks are sandboxed by default, and depending on who created the package, can restrict access to locations outside of /home etc.

      This can be overridden, and maybe a noisy bug report to the creator, maybe? Flatpak as a system imo still has bug about it, in regards to these permissions
      I could swear Discover had a way to edit this, but I am not finding it, and it may not have existed in Kubuntu 20.04 if there actually were a way. But the program Flatseal can be used to change this


      However, as jlittle (aka the night crew ) mentions, I have no issue accessing my non-system and external drives with the cherrytree flatpak, and I do have automatic mounting enabled with some custom options to reduce my Dolphin's sidebar from becoming too full

      Click image for larger version

Name:	Screenshot_20210605_070140.jpg
Views:	1
Size:	57.2 KB
ID:	645160

      Comment


        #4
        But poking around:

        Code:
        $ flatpak list
        Name                           Application ID                 Version Branch Installation
        CherryTree                     [B]com.giuspen.cherrytree [/B]        0.99.37 stable system
        Mesa                           ?eedesktop.Platform.GL.default 21.1.1  20.08  system
        openh264                       ?freedesktop.Platform.openh264 2.1.0   2.0    system
        GNOME Application Platform ve? org.gnome.Platform                     3.38   system
        Breeze Gtk theme               org.gtk.Gtk3theme.Breeze               3.22   system
        Code:
        $ flatpak info --show-permissions com.giuspen.cherrytree
        [Context]
        shared=network;ipc;
        sockets=x11;wayland;
        [B]filesystems=host;xdg-run/gvfs;[/B]
        
        [Session Bus Policy]
        org.gtk.vfs.*=talk
        org.gtk.vfs=talk
        So the flatpak does have full filesystem access (user permission permitting for already-mounted dirs), but my guess is you don't have the other drives mounted, and the file picker part of the flatpak can't hook in to KDE's KIO and/or its automount system. Note that on a Gnome system (gvfs) it probably would work as expected

        On my system, I tried a USB drive that was not autmounted, and It Just Worked, but for me Cherry Tree used the KDE file picker. I will guess that though my KDE Neon system is still using a 20.04 basse, it's flatpak/snap integration via xdg-desktop-portal-kde is much newer/better than Kubuntu's version in 20.04.

        Comment


          #5
          The Flatpak install of CherryTree was not the one having problems accessing the external media. That part of that install worked great. The Flatpak-installed CherryTree only had the problem of creating a shortcut to run it in System Settings ==> Shortcuts ==> Custom Shortcuts. When I looked in [right click on K button] ==> Edit Applications and then found the command used to run CherryTree, it was this big, long, bizarre one:

          Code:
          /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=cherrytree --file-forwarding com.giuspen.cherrytree @@ %f @@
          It did not run if I put it into Kubuntu's shortcut system. That problem is now solved. I found the PPA for installing CherryTree, and that one both accesses external media fine and has a command that works in Kubuntu's shortcut system.

          So I think I'm going to just avoid installing via Flatpak if at all possible. It always seems to have a gotcha. For Leafpad, my solution to switch to the Mousepad fork has solved the problem, but it would be interesting to know why the install of some apps have this problem accessing external media.

          I still have Leafpad installed. I went to:

          System Settings ==> Removable Storage ==> Removable Devices ==> Enable Automatic Mounting of Removable Media

          It made my OS always auto-mount external media. That didn't help. In Dolphin, I clicked on all my thumb drives to make sure they were mounted. That didn't help.

          In short, it's been some installs from the repository that have resulted in applications that can't access external media. I've solved CherryTree's problem with that by using the PPA. For Leafpad,I solved it by using its fork. It just remains a mystery as to why. You would think the repository would be the safest way to install anything.
          Kubuntu 22.04 (desktop & laptop), Windows 7 &2K (via VirtualBox on desktop PC)
          ================================

          Comment

          Working...
          X