mount under /mnt made by snap apps is invisible outside snap

Bug #1949653 reported by Woodrow Shen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Confirmed
Wishlist
Unassigned

Bug Description

There is a test case regarding automount when inserting sd card. I did something like `mount -t ext4 -o $mopts /dev/mmcblk1 /mnt/sdcard` inside the test snap command, triggered by udev rule, for example, put a new rule as below:

$ cat /etc/udev/rules.d/11-sd-cards-auto-mount-linuxrc.rules
KERNEL=="mmcblk[0-9]p[0-9]", GOTO="sd_cards_start_mount"
KERNEL!="mmcblk[0-9]", GOTO="sd_cards_auto_mount_end"

LABEL="sd_cards_start_mount"
ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
ACTION=="add", ENV{ID_FS_TYPE}=="", GOTO="sd_cards_auto_mount_end"
ACTION=="add", RUN+="/usr/bin/snap run test-snap.media-automount %k"
ACTION=="remove", RUN+="/usr/bin/snap run test-snap.media-automount %k"
KERNEL=="mmcblk[0-9]", ACTION=="change", RUN+="/usr/bin/snap run test-snap.media-automount %k"
LABEL="sd_cards_auto_mount_end"

So when the sd card is detected, the script media-automount tries to mount it into /mnt/sdcard in the snap namespace, but it's invisible in the system:

$ mountpoint /mnt/sdcard
/mnt/sdcard is not a mountpoint

Ian's comment: /mnt should be shared such that mounts to /mnt made inside the snap mount namespace will propagate to the root mount namespace

Note:the test snap I did was installed with devmode.

description: updated
summary: - mountpoint made by snap apps is invisble outside snap
+ mountpoint made by snap apps is invisible outside snap
Revision history for this message
Maciej Borzecki (maciek-borzecki) wrote : Re: mountpoint made by snap apps is invisible outside snap

/media is set up with shared propagation, so mount events done under /media within the snap mount namespace will be visible outside. /mnt is not. Can the rule be updated to use a path under /media instead?

Changed in snapd:
status: New → Incomplete
status: Incomplete → Confirmed
summary: - mountpoint made by snap apps is invisible outside snap
+ mount under /mnt made by snap apps is invisible outside snap
Changed in snapd:
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.