when mounting an .img via fstab, it shows duplicate in caja file manager

Bug #1945228 reported by mrvst
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MATE Desktop
New
Unknown
caja (Ubuntu)
New
Undecided
Unassigned
nemo (Ubuntu)
New
Undecided
Unassigned
thunar (Ubuntu)
New
Undecided
Unassigned

Bug Description

I have done [these procedures][1] to mount my .img file in `/etc/fstab` (for ubuntu mate 20.04 x64)

[Create `.img` file][2]:

```
dd if=/dev/zero of=filename.img bs=1024 count=2M
sudo mkfs.ext4 filename.img
```
Note: also be done with gparted with [this method][3]

**The problem:**

[Mount `/etc/fstab`][4] in `/mount/point`:

```
/home/user/filename.img /home/user/vdisk ext4 defaults 0 0
# or
/home/user/filename.img /home/user/vdisk ext4 loop 0 0
# or
/home/user/filename.img /home/user/vdisk auto loop 0 0
```
But always show 2 units: vdisk (mount) and loop (not mount) (see image)

[![enter image description here][5]][5]

if i try to click on this other drive showing unmounted i get the following message:

[![enter image description here][6]][6]

Why doesn't it just show the fileimage.img image mounted in the vdisk folder?

if I run any of the following commands:

```
sudo mount -a
# or
sudo mount /home/user/vdisk
```

The same thing that I describe in my post appears.

My fstab (I have altered the UUID for security reasons):

```
# / was on /dev/sda2 during installation
UUID=9f92d1aa-458d-441a-b349-abcdefghijkl / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=F798-ABCD /boot/efi vfat umask=0077 0 1
/swapfile none swap sw 0 0
/home/user/filename.img /home/user/vdisk ext4 defaults 0 0
```

List:
```
sudo losetup --list | grep filename.img
/dev/loop8 0 0 1 0 /home/user/filename.img 0 512
```

But, if I remove the `/etc/fstab` line, delete `/dev/loop8` and mount `.img` image manually (with the followings commands), the described error does not appear

```
sudo mount -o loop /home/user/filename.img /home/user/disk
# or
sudo mount -t ext4 -o loop /home/user/filename.img /home/user/disk
```

**Workaround:**

mount `.img` manually to `/dev/loopXX` available:

```
losetup -f
/dev/loop8
sudo losetup -P /dev/loop8 filename.img
sudo losetup -l
/dev/loop8 0 0 0 0 /home/user/filename.img 0 512
```
edit `/etc/fstab` and put the line:
```
# /path/to/loop/device /path/to/mount/point auto loop 0 0
# example:
/dev/loop8 /home/user/disk ext4 defaults 0 0
```
and:
`sudo mount -a`

But this method is not permanent and i should do what it explain in [this post][7]. But I consider that if all those steps are necessary to make a permanent loop, it is better not to use `fstab` and replace it with bash script that mounts `.img` and program it in the `crontab`.

**Summary:**
- There is no error
- The image is mounted (manually and with fstab)

**About mount:**

When mounting the `.img` in `fstab`, it appears **duplicated** (one is mounted and the other is not). This does not happen when mounting the `.img` manually or `/dev/loopXX` in `fstab`

Only Ubuntu Mate 20.04.3

This appears to be a bug in Ubuntu Mate 20.04.3. In Ubuntu version 20.04.3 this problem is not present

[![enter image description here][8]][8]

Link: https://unix.stackexchange.com/questions/670369/what-is-the-correct-way-to-mount-an-img-in-fstab

  [1]: https://unixcop.com/how-to-create-a-virtual-hard-disk-in-ubuntu/
  [2]: https://unix.stackexchange.com/a/182938/266428
  [3]: https://askubuntu.com/a/672860/828892
  [4]: https://unix.stackexchange.com/a/326537/266428
  [5]: https://i.stack.imgur.com/Zfkow.png
  [6]: https://i.stack.imgur.com/cdIEU.png
  [7]: https://askubuntu.com/a/81225/828892
  [8]: https://i.stack.imgur.com/DqvEB.png

Tags: focal
mrvst (maravento)
tags: added: fstab
removed: fs
mrvst (maravento)
summary: - duplicate image when mounting .img format image in fstab
+ when mounting an .img via fstab, it shows duplicate in caja file manager
Revision history for this message
Norbert (nrbrtx) wrote :

Please report your bug upstream at https://github.com/mate-desktop/caja/issues and then share link here.

Revision history for this message
mrvst (maravento) wrote :

I already did and I suppose they will tell me "report the bug in Gnome" ... And the Gnome people will tell me "report the bug in Mate" and so on from one place to another.
Why don't you first check if it's an Ubuntu Mate problem before sending me elsewhere?

Revision history for this message
Norbert (nrbrtx) wrote :
tags: added: focal
removed: fstab image mount
Changed in mate-desktop:
status: Unknown → New
no longer affects: ubuntu-mate
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.