The IT Community
log in/create account

The free IT knowledge base with tips and tricks from the community



The IT Community

The free IT knowledge base with tips and tricks from the community

The 30 latest articles from our users:
  1. Get the Exchange Powershell Modul in Powershell ISE
  2. Enable Mailbox with Powershell
  3. Add AD-User to Group with Powershell
  4. Create a new User in AD with Powershell
  5. Globally disable GNOME's Trash in Debian-based distributions
  6. Fix the lag in certain areas in Diablo 3
  7. Get a list of all drivers from a SCCM driver package
  8. Check sitemap xml file for invalid links
  9. Change the URL of a website file
  10. Upgrade legendary gems in Diablo 3
  11. Complete the blood marsh bounty in Diablo 3
  12. Get white ascended items in Diablo 3
  13. Get a level 70 hellfire ring
  14. Turn off spell checker in Windows 8
  15. Redirect between www and non-www with apache and htaccess
  16. All quests in Reaper of Souls
  17. Recreate a auto increment column in mysql
  18. Disable Android app notifications
  19. Do the dragon shout on South Park The Stick of Truth
  20. HP Port Replicator previous uninstall not yet complete
  21. A quick tip for the catapult quest in Diablo 3
  22. Get the keywords of a site using php
  23. Disable the language settings in elgg
  24. Get the name of the current file with php
  25. Get rid of the libgcc s.so.1 error with MediaWiki
  26. Change the volume of a mp3 file
  27. Disable the server signature in Apache
  28. Silently launch a Windows process in the background
  29. Sleep in CMD
  30. Call the Device Manager in SCCM
Search The IT Community:

Fewer words bring better search results!


Follow The IT Community:
Follow us on Twitter , Tumblr
or on Facebook to recieve the latest updates.


Partner Links:

Jan Sutter

Sparmaus

If you want to become a partner of The IT Community, please send an email to juergen@theitcommunity.com.

One of the many articles by the community:

Globally disable GNOME's Trash in Debian-based distributions

GNOME's built-in Trash has one particularly annoying feature: every time one deletes a file on a mounted drive, a ".Trash-<UID>" folder is created. This happens regardless of whether the storage device in question is formatted with a Linux filesystem, or not (e.g. USB flash drives or Windows shared folders).

If you are like me and want the Trash gone for good, here is a solution that will disable this "feature" globally, system-wide for everyone:


  1. BEWARE: this guide proposes to replace GNOME's libgio with a custom-compiled version which re-routes all calls of g_file_trash() to its pendant g_file_delete().
    Modifying system libraries is not without risks – I cannot accept any responsibility for any loss, disruption or damage to your data or computer system which may occur as a result of following the steps provided in this guide!
    Also, the following procedure will need to be repeated every time a system update causes a new libglib to be installed:

    $ sudo apt-get dist-upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages will be upgraded:
    libglib2.0-0


  2. Before getting started, make sure the latest updates are installed:

    $ sudo apt-get dist-upgrade

    Also, it would be wise to get answers to some basic questions first:
    • Which package contains GIO?

      $ apt-file search -x 'libgio-.*?\.so'
      libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
      libglib2.0-0: /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1

      See also: Glib
    • Where are these files located?

      $ locate libgio-2.0.so.0.4200.1
      /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1

      Note: all commands given in the remainder of this guide will refer to this specific version of libgio – on other systems, some adjustments will be necessary!

  3. Download source package for libglib-2.0.0:

    $ sudo apt-get source libglib2.0-0
    $ ls -l
    drwxr-xr-x 14 root root 4096 2015-05-01 11:03 glib2.0-2.42.1
    -rw-r--r-- 1 root root 68072 2014-11-12 23:24 glib2.0_2.42.1-1.debian.tar.xz
    -rw-r--r-- 1 root root 3119 2014-11-12 23:24 glib2.0_2.42.1-1.dsc
    -rw-r--r-- 1 root root 6985120 2014-11-12 23:24 glib2.0_2.42.1.orig.tar.xz


  4. Install build dependencies for libglib-2.0.0:

    $ sudo apt-get build-dep libglib2.0-0


  5. Extract glib2.0_2.42.1.orig.tar.xz into a newly created subdirectory ./extr:

    $ mkdir -p extr && tar xf glib2.0_2.42.1.orig.tar.xz -C extr/ && cd extr


  6. Open the file „glib-2.42.1/gio/gfile.c“ in an editor of your choice, locate the function g_file_trash() and replace its body with a
    single return (g_file_delete (...)) statement, as shown below (any existing code code should be commented out with /* ... */):

    $ sudo gedit glib-2.42.1/gio/gfile.c

gboolean
g_file_trash (GFile         *file,
              GCancellable  *cancellable,
              GError       **error)
{
  /* (Unconditionally) bypass the trash: */
  return (g_file_delete (file, cancellable, error));

/*// Existing code commented out:
  GFileIface *iface;

  g_return_val_if_fail (G_IS_FILE (file), FALSE);

  if (g_cancellable_set_error_if_cancelled (cancellable, error))
    return FALSE;

  iface = G_FILE_GET_IFACE (file);

  if (iface->trash == NULL)
    {
      g_set_error_literal (error,
                          G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
                          _("Trash not supported"));
      return FALSE;
    }

  return (* iface->trash) (file, cancellable, error);
*/
}
    • A comparison of this (modified) gfile.c with the one in the glib2.0-2.42.1 directory downloaded in step 2 should now reveal a single change:

      $ diff -b glib-2.42.1/gio/gfile.c ../glib2.0-2.42.1/gio/gfile.c
      3991,3994d3990
      < /* (Unconditionally) bypass the trash: */
      < return (g_file_delete (file, cancellable, error));<
      < /*// Existing code commented out:
      4013d4008
      < */

    • If the comparison in the previous step checks out, we're ready to proceed:

      # Copy the modified gfile.c over the one extracted in step 2:
      $ sudo cp glib-2.42.1/gio/gfile.c ../glib2.0-2.42.1/gio/gfile.c

      # Repack the glib2.0_2.42.1.orig.tar.xz archive:
      $ sudo tar cJf ../glib2.0_2.42.1.orig.tar.xz . && cd ..
      $ ls -l glib2.0_2.42.1.orig.tar.xz
      -rw-r--r-- 1 root root 7312816 glib2.0_2.42.1.orig.tar.xz


      # Remove the temporary extr directory:
      sudo rm -rf extr/


  1. Change into the glib2.0-2.42.1 directory downloaded in step 2, log in as the root user and run dpkg-buildpackage:

    $ cd glib2.0-2.42.1/
    $ sudo su root
    # dpkg-buildpackage

    Notes:
    1. In some cases, one of GLib's automated tests may "hang", thus preventing dpkg-buildpackage from completing the build:

      PASS: gsettings 23 /gsettings/no-read-binding
      ^Cmake[9]: *** Deleting file 'gsettings.log'
      Makefile:4163: recipe for target 'gsettings.log' failed
      make[9]: *** [gsettings.log] Interrupt

    2. If one is willing to skip the test suite, it's possible to solve this by invoking dpkg-buildpackage with the nocheck option (after having aborted the hanging test with <Ctrl-C>):

      # DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage


  2. A successful run of dpkg-buildpackage will result in a set of newly created .DEB archives, which could be installed with dpkg:

    # exit
    $ ls -l ../*.deb
    -rw-r--r-- 1 root root 2400624 ../libglib2.0-0_2.42.1-1_amd64.deb
    -rw-r--r-- 1 root root 6827444 ../libglib2.0-0-dbg_2.42.1-1_amd64.deb
    -rw-r--r-- 1 root root 1674442 ../libglib2.0-0-refdbg_2.42.1-1_amd64.deb
    -rw-r--r-- 1 root root 1335798 ../libglib2.0-bin_2.42.1-1_amd64.deb
    -rw-r--r-- 1 root root 2172456 ../libglib2.0-data_2.42.1-1_all.deb
    -rw-r--r-- 1 root root 2645490 ../libglib2.0-dev_2.42.1-1_amd64.deb
    -rw-r--r-- 1 root root 2677670 ../libglib2.0-doc_2.42.1-1_all.deb
    -rw-r--r-- 1 root root 2256398 ../libglib2.0-tests_2.42.1-1_amd64.de


  3. For our purposes, however, it is better to simply replace the systems libgio-2.0.so.0.4200.1 with the newly compiled one (after making a backup copy):
    # Backup current `libgio':

    $ sudo cp /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1 /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1-installed
    $ sudo touch -r /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1 /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1-installed

    After that it's necessary to reboot the system into the recovery mode, as the last step won't work while the GUI is running:
    # Install libgio's replacement:

    root@deb:~# cd /home/<your user>/libglib2.0-0/glib2.0-2.42.1/
    root@deb:/.../glib2.0-2.42.1# find ./debian/libglib2.0-0/usr/lib/ -name 'libgio-2.0.so.0.*' | xargs ls -l
    -rw-r--r-- 1 root root 1541864 ./debian/libglib2.0-0/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1
    root@deb:/.../glib2.0-2.42.1# cp ./debian/libglib2.0-0/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1 /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4200.1

    Note:
    Please also make sure that all libgio-2.0.so* symlinks under /usr/lib/x86_64-linux-gnu actually point to this updated libgio-2.0.so.0.4200.1!


  4. Reboot your system - the Trash will now no longer be used!