Unable to delete files

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
GS3
Level 8
Level 8
Posts: 2385
Joined: Fri Jan 06, 2017 7:51 am

Re: Unable to delete files

Post by GS3 »

Tgatim wrote: Sat May 08, 2021 12:32 pm I tried that and got the following result:

Code: Select all

The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), 
There is your answer right there.
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
Tgatim
Level 1
Level 1
Posts: 14
Joined: Thu May 07, 2020 1:02 pm

Re: Unable to delete files

Post by Tgatim »

[/c]
spamegg wrote: Sat May 08, 2021 2:03 pm This is total overkill but try

Code: Select all

sudo chmod -R o+rwx /dev/sdb2
sudo chmod -R o+rwx /dev/sdb3
sudo chmod -R o+rwx /dev/sdb4
This is what Happened

[code]lynntim@lynntim-DH61CR:~$ sudo umount /dev/sdb2
umount: /dev/sdb2: not mounted.
lynntim@lynntim-DH61CR:~$ sudo umount /dev/sdb4
umount: /dev/sdb4: not mounted.
lynntim@lynntim-DH61CR:~$ sudo ntfs-3g -o remove_hiberfile /dev/sdb2 /mnt
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sdb2': Operation not permitted
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.

lynntim@lynntim-DH61CR:~$ sudo chmod -R o+rwx /dev/sdb2
lynntim@lynntim-DH61CR:~$ sudo chmod -R o+rwx /dev/sdb3
lynntim@lynntim-DH61CR:~$ sudo chmod -R o+rwx /dev/sdb4
lynntim@lynntim-DH61CR:~$
[/code]


I'll re-boot and see what had happened
Tgatim
Level 1
Level 1
Posts: 14
Joined: Thu May 07, 2020 1:02 pm

Re: Unable to delete files

Post by Tgatim »

spamegg wrote: Sat May 08, 2021 2:03 pm This is total overkill but try

Code: Select all

sudo chmod -R o+rwx /dev/sdb2
sudo chmod -R o+rwx /dev/sdb3
sudo chmod -R o+rwx /dev/sdb4
I'm sorry to report that that did not work either.
This problem is obviously a lot more complex than I first expected.
I will give up and just keep the drive as it is until I'm sure I have copied all the files I need and then I'll re-format.
Thanks for your help.
Tgatim
Level 1
Level 1
Posts: 14
Joined: Thu May 07, 2020 1:02 pm

Re: Unable to delete files

Post by Tgatim »

GS3 wrote: Sat May 08, 2021 6:06 pm
Tgatim wrote: Sat May 08, 2021 12:32 pm I tried that and got the following result:

Code: Select all

The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), 
There is your answer right there.

This problem is obviously a lot more complex than I first expected. Windows was shut down correctly before I installed the new drive for Linux.
I will give up and just keep the drive as it is until I'm sure I have copied all the files I need and then I'll re-format.
Thanks for your help.
RIH
Level 9
Level 9
Posts: 2834
Joined: Sat Aug 22, 2015 3:47 am

Re: Unable to delete files

Post by RIH »

Your issue is still the same - it is because Windows left the disk in a suspended state due to fast startup.

You could try this...
For example, if you no longer have Windows 10 or 8 installed, but a NTFS partition was left in a hibernated state. In such cases, you could use sudo ntfsfix /dev/NTFS_partition (for example /dev/sdb1) to get the partition to mount with full read/write access.

Code: Select all

sudo ntfsfix /dev/sdX
where you replace sdX with the actual drive reference.

That might work, although the only sure cure is to re-mount it in Windows & exit Windows with fast startup disabled..
Last edited by RIH on Sun May 09, 2021 4:16 am, edited 1 time in total.
Image
Tgatim
Level 1
Level 1
Posts: 14
Joined: Thu May 07, 2020 1:02 pm

Re: Unable to delete files

Post by Tgatim »

rene wrote: Sat May 08, 2021 2:16 pm Yah, sorry. I only butted in due to feeling it unlikely that it wasn't just a normal permission issue rather than fast-startup --- but it was fast-startup so I might as well have shut up. Thought I'd then at least instruct how to fix that issue only to then run into some undocumented issue of remove_hiberfile no longer working, or not always, or not on Ubuntu, or...

<sigh>

I suggest that direct ntfs-3g -o remove_hiberfile variant that I edited in. And if that also doesn't work, I dunno.
I'm sorry to report that that did not work either.
This problem is obviously a lot more complex than I first expected. Windows was shut down correctly before I installed the new drive for Linux.
I will give up and just keep the drive as it is until I'm sure I have copied all the files I need and then I'll re-format.
Thanks for your help.
User avatar
GS3
Level 8
Level 8
Posts: 2385
Joined: Fri Jan 06, 2017 7:51 am

Re: Unable to delete files

Post by GS3 »

Tgatim wrote: Sun May 09, 2021 4:13 amThis problem is obviously a lot more complex than I first expected. Windows was shut down correctly before I installed the new drive for Linux.
I think you are missing something here. In Windows, if Fast Boot is enabled, even if you "shut down" it does not do a true, complete shut down, rather it does a "pretend, incomplete shutdown" and that is the whole reason it marks the disk as locked, in use, because it relies in the disk not changing for the next fast boot. I think many people are mislead by this Windows behavior and the safest thing to do with Windows is to disable the fast boot "feature". There are many threads with issues caused by this Windows thing. People thought they had completely shut down their computers when they really had not.

I believe it is possible to override the lock but my advice would be to copy what you need and then format and start again with a clean disk,
Please do not use animated GIFs in avatars because many of us find them distracting and obnoxious. Thank you.
rene
Level 20
Level 20
Posts: 12240
Joined: Sun Mar 27, 2016 6:58 pm

Re: Unable to delete files

Post by rene »

Tgatim wrote: Sun May 09, 2021 4:15 am
rene wrote: Sat May 08, 2021 2:16 pm I suggest that direct ntfs-3g -o remove_hiberfile variant that I edited in. And if that also doesn't work, I dunno.
I'm sorry to report that that did not work either.
Thanks for reporting back. Well darn it. Good to know that it does not always but still it definitely should have. If you e.g. read man ntfs-3g,
remove_hiberfile

When the NTFS volume is hibernated, a read-write mount is denied
and a read-only mount is forced. One needs either to resume Win‐
dows and shutdown it properly, or use this option which will
remove the Windows hibernation file. Please note, this means
that the saved Windows session will be completely lost. Use this
option under your own responsibility.
That is, that option exists for this exact reason. So let's document this not doing so (always?) at least here for future queries but frankly it's not all that complex and was correctly diagnosed from the start even if not by me: yes, you undoubtedly shut down Windows correctly last time but with its fast-startup feature enabled (you disable it easiest from an admin-level command prompt in Windows with powercfg -h off) that caused it to hibernate rather than fully-fully shutdown. Linux then finds the filesystem in potentially inconsistent state and refuses by default to potentially muck it up by not having the information from said hibernation file.

And supplies that remove_hiberfile option to have you say "it's fine, go ahead anyway". Only it doesn't work it seems. Or in this particular case. But in that sense, if you're stlll interested, I'd myself try booting with a Live USB from a different and new-ish distribution such as the last Fedora release and do that ntfs-3g command from there. Would be sort of cool to know if it fails across the board these days...

If not interested (enough) anymore for that though, GS3's advise of backing it up and reformatting it would work.
Locked

Return to “Beginner Questions”