UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [solved] "Capture failed" for camera app, Screenshots missing and gallery app malfunction

    Scheduled Pinned Locked Moved Support
    1 Posts 1 Posters 261 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • H Offline
        haveaniceday
        last edited by haveaniceday

        Hi,

        recently I had a problem where I could not take photos, screenshots and more.
        Found a fix, thought to share it here.

        Symptoms:

        • try to take photos with camera app - error Capture failed - Restarting your device might fix the problem. (It didn't)
        • Screenshots don't appear. After searching you will find them in ~/Screenshots instead of ~/Pictures/Screenshots
        • Gallery is empty
        • saving images via content hub, e.g. from the web browser, doesn't work

        What I did to break it:

        • connect phone via USB + MTP to a PC, backup content, delete Pictures and Videos folders to free storage
        • use phone and forget about it, maybe reboot once or twice

        Root of the problem:
        I deleted the Picture and Video folder via MTP, so they were gone. It did not suffice to simple recreate them with mkdir or via the Files app, it'd still not work.
        This was because the reboot has caused the respective entries in ~/.config/user-dirs.dirs to be changed. The entry on my device was XDG_PICTURES_DIR="$HOME/", which misses the trailing Pictures.
        This causes AppArmor violation for the camera app. The screenshots have permission to the home folder, which causes those images to be written to he wrong folder.
        This is known: https://askubuntu.com/questions/171263/where-can-i-find-the-pictures-music-downloads-folder-icons/171309#171309
        Note: the folders are french in this answer and might differ to yours.

        Fix:
        Make sure the content ~/.config/user-dirs.dirs has correct paths depending on your language / locale. For EN:

        XDG_DESKTOP_DIR="$HOME/Desktop"
        XDG_DOWNLOAD_DIR="$HOME/Downloads"
        XDG_TEMPLATES_DIR="$HOME/Templates"
        XDG_PUBLICSHARE_DIR="$HOME/Public"
        XDG_DOCUMENTS_DIR="$HOME/Documents"
        XDG_MUSIC_DIR="$HOME/Music"
        XDG_PICTURES_DIR="$HOME/Pictures"
        XDG_VIDEOS_DIR="$HOME/Videos"
        

        and then make sure that all those folder actually exists, e.g. with
        mkdir Videos Pictures Music Documents Public Templates Downloads Desktop && chmod 655 * && chown phablet:phablet * (untested command, should work)

        Permanent fix proposal:

        • The user should not be able to accidentally or unknowingly delete important folders, like me via MTP
        • Check sanity of ~/.config/user-dirs.dirs upon reboot and show a warning / reset it to default when broken

        Hope this helps somebody 🙂

        1 Reply Last reply Reply Quote 2
        • _ _Anna_ referenced this topic on
        • A aimar referenced this topic on
        • First post
          Last post