Desktop icons keep rearranging whenever I refresh the desktop or boot the system

5,736

Open a terminal and enter the following commands:

cd ~/.local/share/gvfs-metadata  
sudo chown $USER home  
chmod 755 home

This allows your desktop software to change/save the icon configuration.
(Thanks to the community for correcting spelling and syntax errors.)

Share:
5,736

Related videos on Youtube

Milad
Author by

Milad

At first I was just a web developer. Now I decided to do different stuff.

Updated on September 18, 2022

Comments

  • Milad
    Milad over 1 year

    Desktop icons keep rearranging whenever I refresh the desktop or boot the system.
    When I arrange the icons by moving them with the mouse and refresh it, it'd be undone and rearranged by name. What's the solution?
    I use Ubuntu 16.04.
    I think this is a bug. How should I report it?

    • pHeLiOn
      pHeLiOn almost 8 years
      If you right-click on an empty part of the desktop it will open a menu. One of the options is 'Sort Desktop icons by Name'. Is that ticked? Try ticking the other option 'Align Desktop icons'. Does that stop this behaviour?
    • Milad
      Milad almost 8 years
      @pHeLiOn I can't tick it. It's not tickable.
    • pHeLiOn
      pHeLiOn almost 8 years
      I'm using Ubuntu 16.04 with the default Unity desktop & it's not rearranging them on reboot for me. If I select the 'Sort Desktop icons by Name' then it behaves like yours, but I have to select it - it doesn't just do it automatically. Did you do anything like install another desktop (Gnome, XFCE, LXDE etc)? Having multiple desktops installed can sometimes mess with the behaviour. Not sure why it's rearranging your icons automatically but you could try sudo apt-get install --reinstall ubuntu-desktop and see if it behaves better after that?
    • Milad
      Milad almost 8 years
      @pHeLiOn I had this problem in Ubuntu 15 too. But it didn't happened all the time. Just randomly when I refreshed the desktop. Until in Ubuntu 16 that was OK at first but eventually it became worse. Now it happens every time that I refresh the desktop.
    • pHeLiOn
      pHeLiOn almost 8 years
      Did you upgrade to 16.04? I'm curious as to whether a fresh installation of 16.04 will have the same behaviour. i.e it's possible that some sort of bug occurred during your 15.04/15.10 installation and then it has carried forward into your upgraded version. It's not really getting to the root of your problem, but in my 16.04 installation the desktop doesn't rearrange them like that, so if you don't get a better answer/suggestion from someone else then it might be worth trying.
    • Milad
      Milad almost 8 years
      @pHeLiOn No, I didn't upgrade. I deleted the 15 version and then installed the 16 version. It's just weird.
    • pHeLiOn
      pHeLiOn almost 8 years
      Okay, Ask Ubuntu is telling me to avoid extended discussions in comments. If no better answer comes, try making a new live USB and reinstalling 16.04 to see if it the problem persists.
  • ankit7540
    ankit7540 about 7 years
    Hello, It seems like your answer does not answer the question. Could you give more details why it would work
  • Thomas Bodrey
    Thomas Bodrey about 7 years
    This worked for me because the desktop program runs as whatever user you log in as. If that user doesn't own the configuration file or have write access to it, then every time you refresh the desktop or reboot, because the old file couldn't be overwritten, it reloads the old configuration. By running those commands, you give yourself ownership and complete control over the file, and because the desktop program runs as your user, not root, it will also be able to overwrite, do what it needs to do with that file. And if I'm not mistaken, there's more than 1 config file, so this gets all of them.
  • ankit7540
    ankit7540 about 7 years
    Please elaborate your answer to include this information.
  • Thomas Bodrey
    Thomas Bodrey about 7 years
    Also if it can't write to the directory and that file doesn't exist, you may notice a randomly generated desktop with all the icons reorganized, because there is no configuration file to load from... This was my issue because all my icons were moving around, all sorted in alphabetical order and such. Giving ownership and write privileges to your home directory and sub directories for your user ensures the desktop program can create that file and save your desktop. At least it worked for me anyways.
  • terdon
    terdon almost 7 years
    You just made every file and directory under /home/username world-writeable, world-readable and world-executable. Why? This is like using a tank to open your front door. While it will probably let you enter the house, it will also let anyone else come in and rearrange your furniture.
  • Thomas Bodrey
    Thomas Bodrey almost 7 years
    I did this because I didn't know what files exactly were used to store the desktop configuration and settings, and I'm just lazy. It's no big deal if you use a single user computer, like a laptop, like me, but if you use a multi user computer, simply reapply permissions or restrict access to whatever files/directories you don't want to give anyone access to. If you make yourself the owner of everything in your home folder, maybe a 600 or 644 might work instead of 777? You can try those if you want.
  • Charles Green
    Charles Green about 5 years
    I think generally root is both the owner and group of /home. Mine, for example shows drwxr-xr-x 7 root root 4096 Dec 15 13:52 home. Perhaps you meant the users directory, which on my system looks like drwxrwxr-x 65 chick chick 4096 Feb 9 16:19 /home/chick