Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Upgrader

macrumors 6502
Original poster
Nov 23, 2014
359
53
Hi,

I upgraded to El Capitan and was left with a folder called ‘Previous System’ in the root of my SSD.

I deleted and emptied the trash but was left with a vm folder with a locked 'sleepimage’ file inside.

Dragged it to my desktop and tried to unlock but couldn’t.

Now I can’t delete immediately or even move to trash it. It’s 0kb in size.

I’ve restarted but still no luck.

Anyone know the solution to this?

Thanks.
 

JohnDS

macrumors 65816
Oct 25, 2015
1,183
249
Did you try to unlock it by right-clicking and choosing GetInfo?
Have you tried holding down the option key while selecting "Empty Trash".

If that fails, you may have disk directory corruption. Open Disk Utility and choose First Aid.

If you still can't delete the file try this:

  1. Open Terminal. It's located in /Applications/Utilities.

    Type:
    chflags -R nouchg


    Type one space (not pictured) after nouchg in the line above, so that it ends in "nouchg ". Do not press Return yet.
  2. Double-click the Trash icon in the Dock to reveal the contents of the Trash. If necessary, arrange the Finder window so that a portion of the Terminal window is still visible.
  3. Drag the file from the Trash to the Terminal window.
    Note: This automatically enters the pathname for each file.
  4. Press Return. No special text message will be shown indicating that the command was successful.
  5. Empty the Trash.
If the Trash does not empty or if you see a message in Terminal that says "usage: chflags [-R [-H | -L | -P]] flags file..." you most likely did not type the text in step 2 as indicated or did not leave a space. Repeat the steps if this happens.
 
  • Like
Reactions: Upgrader

Upgrader

macrumors 6502
Original poster
Nov 23, 2014
359
53
Hey both,

Thanks for those suggestions.

Tried Batchmod. Didn’t work unfortunately. Says it’s doing it but doesn’t actually affect the file.

Tried all your suggestions John but to no avail. The file refuses to be moved.

Any other suggestions? I think I’m gonna sign in as guest user and try the “chflags -R nouchg ” command.
That empties all trashes for all users whether logged in or not right?

Thanks.
 

\-V-/

Suspended
May 3, 2012
3,153
2,688
Have you tried booting into repair mode and repairing the drive?

Also ... with BatChmod you can try moving the file to the trash and then using the Force Empty Trash feature of BatChmod in the file menu options.
 
  • Like
Reactions: Upgrader

Upgrader

macrumors 6502
Original poster
Nov 23, 2014
359
53
Hey

Yes, sorry, was meant to mention, booted into the repair partition and ran first aid too.

I also tried the force empty trash via BatChmod but to no avail.

Also tried running the chflags -R nouchg command via the guest account but again, no good.

I also booted into safe mode (held shift whilst booting) but no good.

It’s sitting there in the trash still locked.

Screen Shot 2016-02-21 at 9.15.50 pm.PNG
Screen Shot 2016-02-21 at 9.15.35 pm.PNG
 

Attachments

  • Screen Shot 2016-02-21 at 9.15.35 pm.PNG
    Screen Shot 2016-02-21 at 9.15.35 pm.PNG
    13.2 KB · Views: 138

Upgrader

macrumors 6502
Original poster
Nov 23, 2014
359
53
Totally the file from hell!!

Yeah did see that but it didn’t help as this file is in the trash.

The regular location has the actual sleep image file in there as you’d expect.

I honestly cannot seem to find a solution to this.

Hoping a Terminal ninja will pass through.
 

JohnDS

macrumors 65816
Oct 25, 2015
1,183
249
From the get info window you posted, the only user with Read and Write permissions is System.

Try the terminal method in my earlier post, but use

sudo chflags -R nouchg

instead of

chflags -R nouchg
 

\-V-/

Suspended
May 3, 2012
3,153
2,688
Can you move it back to the location it's supposed to be in and then try that terminal command? [disk drive]/private/var/vm/sleepimage

Also this tells you how to remove it permanently after deleting it: http://www.techradar.com/us/how-to/...hogging-sleepimage-file-from-your-mac-1305738


I've run into files like this before and I ended up having to reformat just to get rid of the friggin' thing. I gave up on solutions after a while. Hopefully John can help you.
 
  • Like
Reactions: Upgrader

jbarley

macrumors 601
Jul 1, 2006
4,023
1,895
Vancouver Island
Maybe try opening a Terminal window and enter the following...

sudo rm -Rf

Enter a space after "-Rf" then drag the folder into the Terminal window. Press RETURN and see wha happens.
[doublepost=1456091281][/doublepost]
From the get info window you posted, the only user with Read and Write permissions is System.

Try the terminal method in my earlier post, but use

sudo chflags -R nouchg
This is good but I'd add the following...
sudo chflags -R nouchg(space) then drag the file to this terminal window and press return.
 
  • Like
Reactions: Upgrader

Upgrader

macrumors 6502
Original poster
Nov 23, 2014
359
53
chflags -R nouchg

Thanks John - tried this but Terminal comes back with “permission denied”

I also tried to change permissions with BatChmod but it refused.
[doublepost=1456091976][/doublepost]
Can you move it back to the location it's supposed to be in and then try that terminal command? [disk drive]/private/var/vm/sleepimage

Also this tells you how to remove it permanently after deleting it: http://www.techradar.com/us/how-to/...hogging-sleepimage-file-from-your-mac-1305738


I've run into files like this before and I ended up having to reformat just to get rid of the friggin' thing. I gave up on solutions after a while. Hopefully John can help you.

If I move it back to the desktop and try to drag it out of the folder I get a copy onto the desktop that I can then change permissions of and delete. The original file refuses to be moved from its folder.

The original location is now deleted. It was the “previous system” folder that upgrading to El Cap left me with.

I’ll look at the Techradar link - thanks!
[doublepost=1456092127][/doublepost]
Maybe try opening a Terminal window and enter the following...

sudo rm -Rf

Enter a space after "-Rf" then drag the folder into the Terminal window. Press RETURN and see wha happens.
[doublepost=1456091281][/doublepost]
This is good but I'd add the following...
sudo chflags -R nouchg(space) then drag the file to this terminal window and press return.

Thanks - tried both these options - no dice. Am I actually going to have to reformat to remove this beast?
[doublepost=1456092565][/doublepost]Ah ok - I think I may know what’s happened.

I use an app called Disk Sensei by Cindori.

It allows me to prevent the creation of a sleepimage.

It appears to lock an empty sleepimage file in the default location (private/var/vm) to prevent the creation of a new one.

I’m guessing that this troublesome file is a leftover file from the previous system.

I’ll email Cindori and ask him if he knows how to manually unlock this file - maybe some kind of reverse engineering?
[doublepost=1456093806][/doublepost]Wow - sorted it! Oskar at Cindori pointed me to a topic on the Cindori forums: https://www.cindori.org/?p=38255

It was to do with something called immutable flags.

The Terminal command that unlocked it was sudo chflags noschg /pathname

Thanks for the help everyone!!
 
Last edited:

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,289
4,986
Deleting locked files/folders, most times, can resort to command/shell level commands to remove. From a terminal:

rm -f <filename here minus brackets>
or for folders
rm -rf <folder name here minus brackets>

If item has special characters (eg. anything not alpha-numeric), escape the name with quotes or back-slashes. For example:

rm -f "my file to delete"
rm -f my\ file\ to\ delete
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.