termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
742 stars 162 forks source link

Caja and Nautilus throws "This destination is read-only" error when performing file operations. #294

Closed zavocc closed 2 months ago

zavocc commented 3 months ago

Problem description When using caja (MATE's file manager) or nautilus (GNOME files app), performing file operations such as creating new folder or file, moving or copying files, causes an error "This destination is read only" despite directories are read-writable (home directory in my case). However, other file managers like thunar works correctly.

Video attachment showing error when copying/moving, creating new directories in Caja

error

Screenshots, both Caja and Nautilus attempting to copy nohup.out file from Desktop to home directory through drag n drop

error error

Steps to reproduce

  1. Install caja and/or nautilus
  2. Perform simple file operations (e.g. create a new folder/file, move/copy files) whether if its drag n drop or manual

Expected behavior It should work.

Additional information Additionally, there are no terminal logs related to this problem when I launched either with a Terminal and perform file operations, it doesn't show relevant logs. Though everytime file IO is done causing an error, it prints Could not inhibit power management; org.gnome.SessionManager or No such method "Inhibit" warnings though it's kinda unrelated.

Android 11, aarch64

fish4terrisa-MSDSM commented 3 months ago

Also got that on my Android 10,aarch64 with Arch Linux in proot. That problem really lasted for a long period of time. (maybe from the early of 2023 it already existed) And also, it will also fail if you want to copy files to desktop, with the same error.

zavocc commented 3 months ago

this actually happened 5 years ago since I use these but nobody had bothered reporting it, as some people say Use Terminal for that

zavocc commented 3 months ago

Interestingly, when using clipboard to cut or copy files into another writable location (e.g. Documents folder), the paste option in the caja context menu was grayed out.

fish4terrisa-MSDSM commented 3 months ago

Interestingly, when using clipboard to cut or copy files into another writable location (e.g. Documents folder), the paste option in the caja context menu was grayed out.

That's becauce caja detected that it doesn't have premission to copy to there(althrough it actually have). Maybe someone can find out the method caja used to detect the premission.(Maybe caja is using an old syscall or other methods which are not supported by proot...)

michalbednarski commented 3 months ago

Looks like this is checked through inspecting /proc/self/mountinfo

9974 9973 254:10 / / ro,noatime master:1 - ext4 /dev/block/dm-10 ro,seclabel

In this case however, you cannot use --bind to override because /proc/self is symlink and resolution happens before applying bind mounts, I'll need to see how to fix this nicely

Repro (by using Gio which is used by Caja, Gio uses libmount)

// apt install libglib2.0-dev
// gcc $(pkg-config --cflags gio-2.0) example.c $(pkg-config --libs gio-2.0)
#include <stdio.h>
#include <gio/gio.h>

int main() {
        GFile *dest;
        GFileInfo *fsinfo;
        dest = g_file_new_for_path("/home");
        fsinfo = g_file_query_filesystem_info (dest,
                        G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
                        0,
                        NULL);

        gboolean ret = g_file_info_get_attribute_boolean (fsinfo, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
        printf("readonly=%d\n", ret);
}
michalbednarski commented 2 months ago

The issue should be fixed after pkg up to proot 5.1.107-63