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



  • 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 🙂


Log in to reply