Running snap in lxd container

Hi there!
I am more or less new to lxd/lxc and facing the follwing problem:
I installed snapd and tried to install the vlc snap.
after installation I tried to run the snap but got some permission error:

vlc --help
cannot perform operation: mount --make-rshared /snap: Permission denied

Any hints how to solve this, so that i can run snaps inside the lxd container?
Thx Benjamin.

I got it to work but its hacky as anything, hopefully someone can come along and correct with better instructions;

  1. Grab the x11 profile from simos blog
  2. Edit the x11 profile and change “PASocket1” listen to /home/ubuntu/pulse-native
  3. lxc launch ubuntu: vlc -p default -p x11
  4. lxc exec snap vlc
  5. snap install vlc
  6. su ubuntu
  7. vlc

I didn’t test audio.

The apt version of VLC didn’t work any better (but the likes of firefox still worked fine with X11 profile).

In the case of VLC, if your using the SNAP, you might be better of just installing it on the host.

Okay thank for the reply!
Hmm I am already running a similar profile (Kodi is already working audio- and videowise)
Here is the config of the container:

lxc config show --expanded kodicont1
architecture: x86_64
config:
  image.architecture: amd64
  image.description: ubuntu 20.04 LTS amd64 (release) (20220118)
  image.label: release
  image.os: ubuntu
  image.release: focal
  image.serial: "20220118"
  image.type: squashfs
  image.version: "20.04"
  limits.cpu: "8"
  limits.memory: 4GB
  raw.lxc: lxc.mount.auto=proc:rw sys:rw cgroup:rw:force
  security.privileged: "true"
  volatile.base_image: 44650bc10c092105a5695a240307f518b9f5a6f3a6c8094f340d663331191e48
  volatile.eth0.host_name: vethab552b6f
  volatile.eth0.hwaddr: 00:16:3e:d5:e2:50
  volatile.idmap.base: "0"
  volatile.idmap.current: '[]'
  volatile.idmap.next: '[]'
  volatile.last_state.idmap: '[]'
  volatile.last_state.power: RUNNING
  volatile.last_state.ready: "false"
  volatile.uuid: fa8ea563-cba4-4dbf-bb38-8733b5e3849b
devices:
  allusb:
    mode: "666"
    type: usb
  controlC0:
    gid: "29"
    path: /dev/snd/controlC0
    type: unix-char
    uid: "0"
  controlC1:
    gid: "29"
    path: /dev/snd/controlC1
    type: unix-char
    uid: "0"
  eth0:
    name: eth0
    network: lxdbr0
    type: nic
  event0:
    major: "13"
    minor: "64"
    mode: "0666"
    path: /dev/input/event0
    required: "false"
    source: /dev/input/event0
    type: unix-char
  event1:
    major: "13"
    minor: "65"
    mode: "0666"
    path: /dev/input/event1
    required: "false"
    source: /dev/input/event1
    type: unix-char
  event2:
    major: "13"
    minor: "66"
    mode: "0666"
    path: /dev/input/event2
    required: "false"
    source: /dev/input/event2
    type: unix-char
  event3:
    major: "13"
    minor: "67"
    mode: "0666"
    path: /dev/input/event3
    required: "false"
    source: /dev/input/event3
    type: unix-char
  event4:
    major: "13"
    minor: "68"
    mode: "0666"
    path: /dev/input/event4
    required: "false"
    source: /dev/input/event4
    type: unix-char
  event5:
    major: "13"
    minor: "69"
    mode: "0666"
    path: /dev/input/event5
    required: "false"
    source: /dev/input/event5
    type: unix-char
  event6:
    major: "13"
    minor: "70"
    mode: "0666"
    path: /dev/input/event6
    required: "false"
    source: /dev/input/event6
    type: unix-char
  event7:
    major: "13"
    minor: "71"
    mode: "0666"
    path: /dev/input/event7
    required: "false"
    source: /dev/input/event7
    type: unix-char
  event8:
    major: "13"
    minor: "72"
    mode: "0666"
    path: /dev/input/event8
    required: "false"
    source: /dev/input/event8
    type: unix-char
  event9:
    major: "13"
    minor: "73"
    mode: "0666"
    path: /dev/input/event9
    required: "false"
    source: /dev/input/event9
    type: unix-char
  event10:
    major: "13"
    minor: "74"
    mode: "0666"
    path: /dev/input/event10
    required: "false"
    source: /dev/input/event10
    type: unix-char
  event11:
    major: "13"
    minor: "75"
    mode: "0666"
    path: /dev/input/event11
    required: "false"
    source: /dev/input/event11
    type: unix-char
  event12:
    major: "13"
    minor: "76"
    mode: "0666"
    path: /dev/input/event12
    required: "false"
    source: /dev/input/event12
    type: unix-char
  event13:
    major: "13"
    minor: "77"
    mode: "0666"
    path: /dev/input/event13
    required: "false"
    source: /dev/input/event13
    type: unix-char
  event14:
    major: "13"
    minor: "78"
    mode: "0666"
    path: /dev/input/event14
    required: "false"
    source: /dev/input/event14
    type: unix-char
  event15:
    major: "13"
    minor: "79"
    mode: "0666"
    path: /dev/input/event15
    required: "false"
    source: /dev/input/event15
    type: unix-char
  event16:
    major: "13"
    minor: "80"
    mode: "0666"
    path: /dev/input/event16
    required: "false"
    source: /dev/input/event16
    type: unix-char
  event17:
    major: "13"
    minor: "81"
    mode: "0666"
    path: /dev/input/event17
    required: "false"
    source: /dev/input/event17
    type: unix-char
  event18:
    major: "13"
    minor: "82"
    mode: "0666"
    path: /dev/input/event18
    required: "false"
    source: /dev/input/event18
    type: unix-char
  event19:
    major: "13"
    minor: "83"
    mode: "0666"
    path: /dev/input/event19
    required: "false"
    source: /dev/input/event19
    type: unix-char
  event20:
    major: "13"
    minor: "84"
    mode: "0666"
    path: /dev/input/event20
    required: "false"
    source: /dev/input/event20
    type: unix-char
  gpu:
    type: gpu
  hdiraw0:
    mode: "0666"
    path: /dev/hdiraw0
    required: "false"
    source: /dev/hdiraw0
    type: unix-char
  hdiraw1:
    mode: "0666"
    path: /dev/hdiraw1
    required: "false"
    source: /dev/hdiraw0
    type: unix-char
  hwC0D0:
    gid: "29"
    path: /dev/snd/hwC0D0
    type: unix-char
    uid: "0"
  hwC0D2:
    gid: "29"
    path: /dev/snd/hwC0D2
    type: unix-char
    uid: "0"
  inp2:
    gid: "107"
    path: /dev/input/event1
    type: unix-char
    uid: "0"
  inp5:
    gid: "107"
    path: /dev/input/event4
    type: unix-char
    uid: "0"
  inp6:
    gid: "107"
    path: /dev/input/event5
    type: unix-char
    uid: "0"
  inp7:
    gid: "107"
    path: /dev/input/event6
    type: unix-char
    uid: "0"
  inp11:
    gid: "107"
    path: /dev/input/mice
    type: unix-char
    uid: "0"
  inp16:
    gid: "107"
    path: /dev/input/event0
    type: unix-char
    uid: "0"
  inpa:
    gid: "107"
    path: /dev/input/event2
    type: unix-char
    uid: "0"
  inpb:
    gid: "107"
    path: /dev/input/event3
    type: unix-char
    uid: "0"
  keyboard:
    productid: "8000"
    type: usb
    vendorid: 0c40
  mediadir:
    path: /home/ubuntu/media/
    source: /media/media/
    type: disk
  mice:
    mode: "0666"
    path: /dev/input/mice
    required: "false"
    source: /dev/input/mice
    type: unix-char
  mouse:
    mode: "0666"
    path: /dev/input/mouse0
    required: "false"
    source: /dev/input/mouse0
    type: unix-char
  myport8080:
    connect: tcp:127.0.0.1:8080
    listen: tcp:0.0.0.0:8080
    type: proxy
  pcmC0D0c:
    gid: "29"
    path: /dev/snd/pcmC0D0c
    type: unix-char
    uid: "0"
  pcmC0D0p:
    gid: "29"
    path: /dev/snd/pcmC0D0p
    type: unix-char
    uid: "0"
  pcmC0D3p:
    gid: "29"
    path: /dev/snd/pcmC0D3p
    type: unix-char
    uid: "0"
  pcmC0D7p:
    gid: "29"
    path: /dev/snd/pcmC0D7p
    type: unix-char
    uid: "0"
  pcmC0D8p:
    gid: "29"
    path: /dev/snd/pcmC0D8p
    type: unix-char
    uid: "0"
  pcmC0D9p:
    gid: "29"
    path: /dev/snd/pcmC0D9p
    type: unix-char
    uid: "0"
  pcmC0D10p:
    gid: "29"
    path: /dev/snd/pcmC0D10p
    type: unix-char
    uid: "0"
  pcmC1D0c:
    gid: "29"
    path: /dev/snd/pcmC1D0c
    type: unix-char
    uid: "0"
  pcmC1D0p:
    gid: "29"
    path: /dev/snd/pcmC1D0p
    type: unix-char
    uid: "0"
  rcv:
    gid: "126"
    mode: "0660"
    productid: "8000"
    type: unix-hotplug
    uid: "0"
    vendorid: 0c40
  root:
    path: /
    pool: lxcpool
    type: disk
  seq:
    gid: "29"
    path: /dev/snd/seq
    type: unix-char
    uid: "0"
  snd1:
    gid: "29"
    path: /dev/snd/controlC0
    type: unix-char
    uid: "0"
  snd2:
    gid: "29"
    path: /dev/snd/hwC0D0
    type: unix-char
    uid: "0"
  snd3:
    gid: "29"
    path: /dev/snd/hwC0D2
    type: unix-char
    uid: "0"
  snd4:
    gid: "29"
    path: /dev/snd/pcmC0D0c
    type: unix-char
    uid: "0"
  snd5:
    gid: "29"
    path: /dev/snd/pcmC0D0p
    type: unix-char
    uid: "0"
  snd7:
    gid: "29"
    path: /dev/snd/pcmC0D10p
    type: unix-char
    uid: "0"
  snd9:
    gid: "29"
    path: /dev/snd/pcmC0D3p
    type: unix-char
    uid: "0"
  snd11:
    gid: "29"
    path: /dev/snd/pcmC0D7p
    type: unix-char
    uid: "0"
  snd12:
    gid: "29"
    path: /dev/snd/pcmC0D8p
    type: unix-char
    uid: "0"
  snd13:
    gid: "29"
    path: /dev/snd/pcmC0D9p
    type: unix-char
    uid: "0"
  snd14:
    gid: "29"
    path: /dev/snd/seq
    type: unix-char
    uid: "0"
  snd15:
    gid: "29"
    path: /dev/snd/timer
    type: unix-char
    uid: "0"
  timer:
    gid: "29"
    path: /dev/snd/timer
    type: unix-char
    uid: "0"
  tty7:
    gid: "5"
    mode: "620"
    path: /dev/tty7
    source: /dev/tty7
    type: unix-char
    uid: "0"
  udev_data:
    path: /home/ubuntu/udev/data
    source: /run/udev/data
    type: disk
ephemeral: false
profiles:
- default
- cpu4-memory4
stateful: false
description: ""

Thing is that all snaps complain about the permissions…And I need to install also other snaps where there is no apt installation available…