Atom needs root access to remember my session


#1

Whenever I open Atom, it remembers my Project Folders but doesn’t remember the files I had open. If I use the project manager to save or open sessions, again it remembers the correct Project Folders but doesn’t remember the files that I had open during the session.

However, when I launch from terminal with sudo atom, both of the above do work! I can save and open projects just fine and my previous session is also remembered and restored without issue.

My guess is that some kind of file permission has gone wonky? Any idea where I could find the file(s) where sessions are remembered?

I don’t exactly remember when this started happening. I was using a Mac until a couple months ago and never had any trouble. I think it was fine for my first few months on Linux. My suspicion is that this only started happening when I updated to Atom 1.15.0, but I’m not 100% sure.

Any help would be appreciated, thanks!


Atom won't save my default file tree
#2

The session information is stored in ~/.atom /cc Session saved when sudo. How to when not sudo?

Can you check the permissions of that directory and see if it matches your user account?

whoami
ls -ld ~/.atom

Small side question - when you say:

If I use the project manager to save or open sessions

Are you referring to a particular package you installed?


#3

Thanks for the reply. The ~/.atom gives read and write access to my username, and I verified that it’s the same name returned by whoami.

For the project manager bit: that’s my mistake, I thought that was a built-in function! It’s a package called “project-manager”.


#4

Ohhhh - just to clarify then, when you said:

Is this behavior all functionality of the project-manager package?


#5

Yeah, that functionality is Project Manager.

But without that package, Atom on its own should still reopen your most recent session, right?


#6

Yeah, that functionality is Project Manager.

Ahh ok thanks for clarifying :+1:

Yeah if you have the Restore Previous Windows on Start setting enabled in Settings > Core, then Atom will restore the last project you had opened if you quit and restart.


#7

OK, so I have that enabled and I’ve verified that ~/.atom gives read/write access to my username, and still Atom doesn’t remember my session unless I’ve launched with sudo… Any ideas what else I can check?


#8

Can you check if the files and directories under ~/.atom are also owned by your user rather than root?

ls -l ~/.atom

#9

There’s an empty folder called recovery that is owned by root


#10

I wonder if that’s causing the problem, that directory is owned by my user account on my installation. Can you change the ownership of that directory and see if that helps?

sudo chown -R USER:GROUP ~/.atom/recovery

Where USER and GROUP are your user and group settings (i.e. it should match the other directories under ~/.atom.


#11

Hey sorry for the delay and thanks for sticking with me. I’ve modified the directory ownership, ls -l ~/.atom shows that I own everything, and still Atom doesn’t remember my session unless I launch from terminal with sudo.

At this point it’s not really a big deal, I’ve gotten used to opening from terminal, but if you have any other ideas send them my way!


#12

Hmmm, just to catch everything, how about just changing ownership for all files and directories:

sudo chown -R USER:GROUP ~/.atom

Then one more thing you could try is to temporarily move your ~/.atom directory:

mv ~/.atom ~/.atom-backup

A fresh directory will be created when you launch Atom though any settings and packages will be missing (still in the backup directory though).


#13

Hello!
I have the same problem on Ubuntu 16.04.
I tried to reinstall Atom and delete config folder ~/.atom, have no success.
Also Atom cant’t save sidebar width and sidebar visibility setting.


#14

Thanks, glad it’s not just me!

For the record I’m running Elementary which is based on Ubuntu 16.04


#15

@superko - curious if you tried temporarily moving your ~/.atom directory?

@Nikomtis - just to confirm, you’re seeing the same behavior where your settings aren’t getting saved unless you start with sudo atom?


#16

Yep, that’s it.


#17

@Nikomtis can you share your Atom version details (atom -v)? Also, after you removed ~/.atcom, can you confirm whether you’ve checked the file/directory ownership of ~/.atom and its subdirectories?

I’ll give things a try on my Ubuntu VM.


#18

Yep, I moved ~/.atom and then opened Atom. Added a project folder, opened a couple of tabs. Closed it, reopened it, project folder was remembered but the tabs were not.


#19

Hmmm, that’s interesting that your project folders are remembered but your open tabs aren’t - if you have the time, would you be up for recording a GIF or screencast of this behavior?

  1. Move ~/.atom again to back up your settings.
  2. Start Atom with atom --safe.
  3. Add a project folder ctrl-shift-a.
  4. Double click on a file from that project to open it in a tab.
  5. Close Atom with ctrl-q
  6. Start Atom again with atom --safe

#20

Hey! It’s been awhile. I was just living with this for awhile but now I have some work that would make this a huge QOL improvement if I could get this to remember sessions.

I don’t have any screen capture software but I did your steps and took screenshots.

(OK I’m only allowed to post 1 screenshot. But I definitely followed every instruction to the letter!)

  1. Moved ~/.atom
  2. Started atom --safe
  3. Added a project folder and opened some files
  4. Quit Atom with ctrl-q
  5. Started Atom again with atom --safe

You can see that the project folder was remembered but not the open files.

This is on Atom 1.19.4

Let me know if you need anything else.