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?

share|improve this question
    
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? – pHeLiOn Jun 1 '16 at 2:04
    
@pHeLiOn I can't tick it. It's not tickable. – Milad Jun 1 '16 at 3:42
    
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? – pHeLiOn Jun 1 '16 at 4:31
    
@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. – Milad Jun 1 '16 at 8:00
    
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. – pHeLiOn Jun 1 '16 at 16:37

A better way might be: Open a terminal from the desktop then 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|improve this answer

EDIT (August 30th, 2017):
Before trying the solution below and if the other answers didn't work, try this:

$ sudo chown -R (UserName) /home/(UserName)/.local/

For some reason, I have had this issue again after updating Ubuntu 17.04, so I've considered and tried the other answers and they actually didn't work (not because they forgot the "." in "~/.local/..."(again, I'm using 17.04) but because changing the mode and ownership of "./local/share/gvfs-metadata/home" didn't work, most likely it wasn't the right file.) I put this here instead of editing their answer because it may be different on the earlier versions of Ubuntu, and unfortunately, I am not yet allowed to comment. I have decided to chown and chmod all of the "~/.config" directory to no avail, then, after considering the other answers and comments, I tried to chown and chmod the whole "~/.local" directory, testing the result after each step, and I noticed it worked immediately just as I chowned it. No chmod necessary. It could just be my weird setup, but try it anyway because if it works, you're not weakening your security or altering your whole home directory, and it'll fix whatever other configuration files are needed by the desktop client, if any. I hope this helps.
==END OF EDIT.==


I did this,

$ sudo chown -R (UserName) /home/(UserName)
$ sudo chmod -R 766 /home/(UserName)

The first command ensures that the mentioned username (in this case, you) owns all the files in the /home/(UserName) directory.

The second command ensures you, the owner, have full permissions (read, write, execute) on those files, and everyone else has read and write, which allows the desktop program to write to the configuration file. It doesn't have to be 777, or 766 (read the edit at the bottom). It can be 666 if you want it that way, 766 just gives you execute permissions, just to make sure the configuration files can be overwritten and read.

The reason this works is because the desktop program runs as whatever user you log in as, not root. If that user doesn't own the configuration files or have write access to them, then every time you refresh the desktop or reboot, because the old files couldn't be overwritten, it reloads the old configuration (like the desktop settings, location of the desktop icons, etc.). By running these commands, you give yourself ownership and complete control over those files, and because the desktop program runs as your user, it will also be able to overwrite, do what it needs to do with those files.

Also these commands gives the user's home directory (/home/(UserName)) and all the subdirectories write/create privileges also, enabling the user and the desktop program to create those files should they not exist. If those files don't exist and aren't created, the desktop program will generate a new layout every time it is refreshed or restarted. These commands should ensure you full access to all the subdirectories and the desktop program should now be able to create these files and save your layout.

Edit: When you use the chmod command, you don't have to make them world readable/writable/executable (777), infact, you really shouldn't unless you have to, especially if you have a multi-user machine. It was my mistake for originally suggesting 777, and therefore, I have edited my answer to read 766, not 777. You can use whatever you wish, but you only need to ensure you can write to and read any and all of your configuration files needed for the desktop program and any other software to work.

Something to remember... Security and convenience (or functionality) usually don't mix.

share|improve this answer
    
Hello, It seems like your answer does not answer the question. Could you give more details why it would work – ankit7540 Feb 21 '17 at 5:15
    
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. – Thomas Bodrey Feb 21 '17 at 5:33
    
Please elaborate your answer to include this information. – ankit7540 Feb 21 '17 at 5:34
    
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. – Thomas Bodrey Feb 21 '17 at 5:39
1  
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. – terdon May 18 '17 at 12:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.