Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Unable to delete file (need gvfs-trash) #1237

Open

Description

@wyqydsyq

When trying to delete a file, I get an error about gvfs-trash, I have gvfs installed, but there is no gvfs-trash on my distro:

$ sudo zypper search gvfs
Loading repository data...
Reading installed packages...

S  | Name               | Summary                                             | Type   
---+--------------------+-----------------------------------------------------+--------
i+ | gvfs               | Virtual File System functionality for GLib          | package
   | gvfs-32bit         | Virtual File System functionality for GLib          | package
i+ | gvfs-backend-afc   | VFS functionality for GLib -- iPod / iPhone Support | package
i+ | gvfs-backend-samba | VFS functionality for GLib -- Samba Support         | package
i+ | gvfs-backends      | VFS functionality for GLib                          | package
   | gvfs-devel         | Development files for the GNOME Virtual file system | package
i+ | gvfs-fuse          | VFS functionality for GLib                          | package
i+ | gvfs-lang          | Translations for package gvfs                       | package
   | xmms2-plugin-gvfs  | Gnome VFS support for xmms2                         | package

There should really be a fallback for this, say, using the standard rm command to delete files if gvfs-trash is not available.

Activity

  1. fmujakitz commented on Jun 7, 2018

    @fmujakitz

    Had the same issue. Fixed by setting env var for ELECTRON_TRASH=gio.

  2. lefuturiste commented on Jun 26, 2018

    @lefuturiste

    Same issue on antergos archlinux
    How I can set the env var forever ? What is the command @fmujakitz ?

    I have the env variables :

    $ printenv | grep ELECTRON
    ELECTRON_TRASH=gio
    

    but always the same problem

  3. wyqydsyq commented on Jun 27, 2018

    @wyqydsyq
    Author

    If you want to persist an env var you can add it to your shell's initialization script e.g. .bashrc

  4. lefuturiste commented on Jun 28, 2018

    @lefuturiste

    Don't work also

  5. rsese commented on Jun 28, 2018

    @rsese

    @lefuturiste does gio trash work ok from the command line?

    echo hello > delete-me.txt
    gio trash delete-me.txt
    
  6. lefuturiste commented on Jun 29, 2018

    @lefuturiste
    echo hello > delete-me.txt
    
    gio trash delete-me.txt
    

    work well

  7. rsese commented on Jul 3, 2018

    @rsese

    @lefuturiste what version of Atom are you running (atom -v)?

    @wyqydsyq do you have gio installed on your system? If so, does setting ELECTRON_TRASH work for you?

  8. lefuturiste commented on Jul 4, 2018

    @lefuturiste

    @rsese

    Atom : 1.28.0
    Electron: 2.0.3
    Chrome : 61.0.3163.100
    Node : 8.9.3

  9. Dzordzu commented on Sep 21, 2018

    @Dzordzu

    @rsese
    Same here. The issue appeared after last arch update
    gio is installed and works like a charm
    Files are placed on the same partition, where the atom is

    Atom : 1.30.0
    Electron: 2.0.9
    Chrome : 61.0.3163.100
    Node : 8.9.3

  10. AlynxZhou commented on Sep 23, 2018

    @AlynxZhou

    It seems that gvfs updates and dropped gvfs-trash, instead we should use gio trash now?

    Temp workaround is to create a script as a warpper:

    sudo vim /usr/bin/gvfs-trash
    

    Fill it with content:

    #!/bin/bash
    # GVFS updated and dropped gvfs-trash to gio, but Atom didn't update.
    /usr/bin/gio trash "$@"
    

    and then:

    sudo chmod +x /usr/bin/gvfs-trash
    
  11. pzmarzly commented on Oct 28, 2018

    @pzmarzly

    This is an Electron issue: electron/electron#15011

  12. kebertxela commented on Oct 30, 2018

    @kebertxela

    It seems that gvfs updates and dropped gvfs-trash, instead we should use gio trash now?
    Temp workaround is to create a script as a warpper:

    sudo vim /usr/bin/gvfs-trash
    #!/bin/bash
    # GVFS updated and dropped gvfs-trash to gio, but Atom didn't update.
    /usr/bin/gio trash "$@"
    sudo chmod +x /usr/bin/gvfs-trash
    

    perhaps this is a slight improvement and a little more copy pasta friendly:

    echo '#!/usr/bin/env bash
    # GVFS updated and dropped gvfs-trash to gio, but Atom didnt update.
    # https://github.com/atom/tree-view/issues/1237
    /usr/bin/gio trash "$@"
    ' | sudo tee /usr/local/bin/gvfs-trash && sudo chmod +x /usr/local/bin/gvfs-trash
    
  13. growlnx commented on Nov 18, 2018

    @growlnx

    Had the same issue. Fixed by setting env var for ELECTRON_TRASH=gio.

    I had the same problem in my MANJARO, this worked for me too

  14. vmvwebworks commented on Jan 8, 2019

    @vmvwebworks
  15. c-benko commented on Mar 29, 2019

    @c-benko

    @vmvwebworks this solution worked for me. If atom won't let you throw things in the trash, it might be a permission issues.

    I used

    sudo chown -R "$USER" ~/.local/share/Trash
    

    and now there is no issue.

  16. memeplex commented on May 14, 2019

    @memeplex

    Shouldn't this be closed? Correctly setting an environment variable fixes it completely. Moreover, if you wanted this to be the default behavior, for the user disliking direct manipulation of the environment, it's an upstream issue in any case.

  17. wyqydsyq commented on May 17, 2019

    @wyqydsyq
    Author

    I don't think requiring users to set env vars so this functionality works on common operating systems is reasonable. If this extension is capable of returning an error when the current default value doesn't work, it should also be capable of attempting to set the env var suggested here automatically as a fallback. Additionally, the gvfs-trash package has clearly been deprecated in favour of gio, so realistically this extension should be updated to use the new de facto, otherwise Linux users will all start seeing this feature break as they upgrade their distros to newer versions using gio instead of gvfs-trash

  18. Songworks commented on Jul 26, 2019

    @Songworks

    I'm having this issue since Atom 1.39.0, however it's the other way around for me.
    Unfortunately I'm also on a Ubuntu 16.04 based distribution and can't install the necessary glib2.0 version which contains gio.
    So for those of us who have this issues that way around, you can also use the env variable to use gvfs-trash again:
    ELECTRON_TRASH=gvfs-trash atom

  19. vilian commented on Aug 2, 2019

    @vilian

    ELECTRON_TRASH=gvfs-trash atom worked for me on ubuntu 16 and

    Atom : 1.39.1
    Electron: 3.1.10
    Chrome : 66.0.3359.181
    Node : 10.2.0

    What would be a more long-term solution? (The other solutions did not work)

  20. zacwitte commented on Aug 23, 2019

    @zacwitte

    Same issue. Since the recent atom upgrade running on ubuntu 16.04 it complains about missing gvfs-trash, even though the file does in fact exist. I used the ELECTRON_TRASH=gvfs-trash atom trick to fix it, but this feels like something electron needs to handle automatically. Can't expect people to research this and add the hack to their environment.

  21. dotnetspec commented on Jan 20, 2020

    @dotnetspec

    Linux Mint 18.3 x64
    Atom 1.43

    I have noted all the comments above (which have been apt) and particularly tried/noted the ones detailed below:

    It seems that gvfs updates and dropped gvfs-trash, instead we should use gio trash now?
    Temp workaround is to create a script as a warpper:

    sudo vim /usr/bin/gvfs-trash
    

    Fill it with content:

    #!/bin/bash
    # GVFS updated and dropped gvfs-trash to gio, but Atom didn't update.
    /usr/bin/gio trash "$@"
    

    and then:

    sudo chmod +x /usr/bin/gvfs-trash
    

    I don't think requiring users to set env vars so this functionality works on common operating systems is reasonable. If this extension is capable of returning an error when the current default value doesn't work, it should also be capable of attempting to set the env var suggested here automatically as a fallback. Additionally, the gvfs-trash package has clearly been deprecated in favour of gio, so realistically this extension should be updated to use the new de facto, otherwise Linux users will all start seeing this feature break as they upgrade their distros to newer versions using gio instead of gvfs-trash

    sudo chown -R "$USER" ~/.local/share/Trash

    This issue has been surprisingly difficult to resolve.
    Is there anything else I can try?

  22. wyqydsyq commented on Jan 24, 2020

    @wyqydsyq
    Author

    This issue has been surprisingly difficult to resolve.
    Is there anything else I can try?

    Uninstall Atom and use VSCode instead

  23. luisbrandao commented on Feb 27, 2020

    @luisbrandao

    Why this is STILL an issue?
    The workaround stopped working for me.

  24. gaetanquentin commented on Mar 19, 2020

    @gaetanquentin

    ubuntu 19.10
    atom (snap) 1.45.0
    gvfs-trash is installed

    editing files on a sshfs mount

    trying to delete directory (move to trash) on a local filesystem (~/home/XX) : OK

    trying to delete directory (move to trash) on a mount filesystem (sshfs): KO

    The following file couldn't be moved to the trash. blahblah Is gvfs-trash installed?

    outside atom:
    strace -e trace=file gio trash MyFile

    it finds the trash but...
    lstat("/mnt/XX/ssh/myhome_elitebook/.Trash", {st_mode=S_IFDIR|0775, st_size=34, ...}) = 0
    lstat("/mnt/XX/ssh/myhome_elitebook/.Trash-1008", {st_mode=S_IFDIR|0775, st_size=0, ...}) = 0
    gio: file:///mnt/XX/ssh/myhome_elitebook/T%C3%A9l%C3%A9chargements/terraform-provider-libvirt-0.6.1+git.1578064534.db13b678.Ubuntu_18.04.amd64.tar.gz: Unable to find or create trash directory for MyFile

    the pb seems to be gio

  25. kryptus36 commented on Jun 22, 2020

    @kryptus36

    For any googlers looking:
    I just ran into this on my Gentoo box.
    export ELECTRON_TRASH=gio fixed it.

  26. aurovrata commented on Jun 29, 2020

    @aurovrata

    There is an other issue that hasn't been addressed here, if you are working from the default apache installation, /var/www/html/, then gvfs-trash will complain:

     >gvfs-trash /var/www/html/wp/wp-content/themes/twentyfifteen/js/test.js
    This tool has been deprecated, use 'gio trash' instead.
    See 'gio help trash' for more info.
    
    gio: file:///var/www/html/wp/wp-content/themes/twentyfifteen/js/test.js: Trashing on system internal mounts is not supported
    
    

    NOTE: Trashing on system internal mounts is not supported

    so I created a new script for /usr/bin/gvfs-trash

    #!/bin/bash
    # GVFS updated and dropped gvfs-trash to gio, but Atom didn't update.
    /bin/rm -f "$@"
    
    

    Probably not the best idea, but given that gvfs-trash is deprecated, I am assuming it should be ok.
    Now it works, along with setting the env,

    export ELECTRON_TRASH=gvfs-trash atom

  27. kin-allan commented on Jul 13, 2021

    @kin-allan

    I had the same issue and none of the solutions above had worked.
    If you are like me that has your projects under /var/www/ atom will not be able to delete, aparently the delete action does not works under the filesystem mount, so I manage it doing the following:
    Created a folder www under my user, moved the files there, and then created a sysmlink from /var/www/ to my home mounted
    When the files are on the ~/www I am able to delete correctly. Hope it helps

  28. the0neWhoKnocks commented on Oct 26, 2021

    @the0neWhoKnocks

    Seeing the same error when trying to delete a folder while running Atom via Flatpak on Arch Linux. I've tried

    ELECTRON_TRASH=gio atom .
    export ELECTRON_TRASH=gio && atom .
    flatpak override --user --env="ELECTRON_TRASH=gio" io.atom.Atom

    no luck with any of the above.

    The odd thing is, I'm able to delete individual files within a folder.

    Also, I'm using Flatpak because I use n for my Node version manager, otherwise the official/AUR installs cause issues due to Node conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions