Unable to take screenshot

I developed an application. This application takes screenshots and record videos. There are few issues with the one after installing with Snap Store.

snapcraft.yaml
name: mindrecorder
icon: snap/gui/mindrecorder.png
version: '1.5.2'
summary: Open Source Password Manager with Keepass file support.
description: |
  Easily and securely keep track of all your Passwords!

base: core22
adopt-info: mindrecorder
grade: stable
confinement: strict
parts:
  mindrecorder:
    plugin: flutter
    source: .
    flutter-channel: stable
    flutter-target: lib/main.dart
    override-pull: |
      craftctl default
      craftctl set version=1.5.2
    build-packages:
      - libsecret-1-dev
      - libjsoncpp-dev
      - clang
      - cmake
      - ninja-build
      - pkg-config
      - libgtk-3-dev
      - liblzma-dev
      - libglu1-mesa
      - libkeybinder-3.0-dev
      - libayatana-appindicator3-dev
      - libvlc-dev
    stage-packages:
      - libnotify4
      - libkeybinder-3.0-0
      - libjsoncpp25
      - libsecret-1-0
      - libslang2
      - libayatana-appindicator3-1
      - libayatana-ido3-0.4-0
      - libvlc-bin
      - freeglut3
      - libgtk-3-0
      - liblzma5
      - gnome-screenshot
      - gnome-terminal
      - pulseaudio-utils
      - ffmpeg
      - v4l-utils
      - psmisc
      # - pacmd

apps:
  mindrecorder:
    command: mindrecorder
    extensions: [ gnome ]
    plugs:
      - camera
      - desktop
      - desktop-legacy
      - home
      - network
      - audio-playback
      - audio-record
      - browser-support
      - process-control
      - screencast-legacy
      - wayland
      - pulseaudio
      - x11

Here the set permissions for app:

Summary

  1. Application cannot take screenshot. When an error occur, app shows notification “The screenshot was not captureed”. In fact, the gnome-screenshot didn’t work or, maybme, problem with permissions, idk. There are no any errors in terminal.
  2. Why I choose “Screen recording”, app call the command xrandr --listmonitors, but an error occurs:
Error

As I far as I know xrandr is a part of x11-server-utils package, but when I try to build a snap using this package in stage-packages the snap building is fail:

snapcraft-...log
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.908 Marking x11-server-utils (and its dependencies) to be fetched
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.910 Stage package not found in part 'mindrecorder': x11-server-utils.
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926 Traceback (most recent call last):
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926   File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 891, in _fetch_stage_packages
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926     fetched_packages = packages.Repository.fetch_stage_packages(
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926   File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 588, in fetch_stage_packages
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926     return cls._fetch_stage_debs(
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926   File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 262, in wrapped
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926     return method(*args, **kwargs)
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926   File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/packages/deb.py", line 627, in _fetch_stage_debs
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926     apt_cache.mark_packages(set(package_names))
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926   File "/snap/snapcraft/8931/lib/python3.8/site-packages/craft_parts/packages/apt_cache.py", line 302, in mark_packages
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926     raise errors.PackageNotFound(name_arch)
2023-03-21 15:32:53.868 :: 2023-03-21 13:32:52.926 craft_parts.packages.errors.PackageNotFound: Package not found: x11-server-utils.

I know exactly that this package exists in apt package manager, otherwise I am not able to use it

It’s x11-xserver-utils, there’s an “x” missing there.

1 Like

Oh really, I missed the one :sweat_smile:

I discovered that screenshots are not taking in strict confinmnet :thinking:

@ogra hello! Could you help me please to find out how to fix this issue?

My application does not take the screenshots in confinment: strict, but if is set on devmode it works (but application does not update automatically in snap store in devmode). In this case, may I require the classic confinement or this no makes sense?

What makes you think it is a confinement issue, what are the specific denials related to screenshotting you get ?

Classic confinement is only granted for applications fitting the list on:

I save a screenshot in a specific folder with specific file name. After taking screenshot there is no any file. Is it possible that snap blocks taking screenshots?

Again… what are the exact denials you see that make you think it is related to confinement, please provide the error messages…

There is no any system error messages

Then it is not related to confinement… all confinement issues will properly log denials …

1 Like

Hm. :thinking: Ok.

Thanks a lot!