Cannot remove files linux

Cannot delete file on Linux

After backuping with ‘rsync —archive —update’ my home directory from ext4 to btrfs, rsync reports errors like this:

rsync: readdir("/mnt/backup/home/me/.mozilla/firefox/qbdcaxwe.default/sessions/. . "): Not a directory (20) rsync: rename "/mnt/backup/home/me/.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN" -> +"home/me/.mutt/cache/bodies/imaps:myemaill@imap.gmail.com/INBOX/3-13228": Not a directory (20) 

When I try to delete these items with ‘rm’ — there is an error message, that this item is a directory. But ‘rm -d’ fails with a message «cannot remove . No such file or directory.». ‘btrfs check’ and ‘btrfs scrub’ haven’t found any filesystem errors. Here is the output for ‘file’, ‘rm’ and ‘rmdir’ commands:

$ file /. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN /. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN: SMTP mail, Non-ISO extended-ASCII text, with very long lines $ rm /. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN rm: remove regular file ‘/. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN’? y rm: cannot remove ‘/. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN’: Not a directory $ rmdir /. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN rmdir: failed to remove ‘/. /.mutt/cache/bodies/imaps:myemail@imap.gmail.com/INBOX/.3-13228.NMKGEN’: Not a directory 

Источник

Cannot remove file using rm

I’m working with BusyBox v1.1.2 (2008.07.18-08:25+0000). I’d like to create new file, i use
touch ModelInfo
But response is
touch: ModelInfo: No space left on device
So, i check free space:

/web/en $ df -h Filesystem Size Used Available Use% Mounted on /dev/root 14.0M 13.8M 236.0k 98% / none 256.0k 68.0k 188.0k 27% /syslog none 1.0M 0 1.0M 0% /tmp nome 7.0M 6.3M 728.0k 90% /onvif none 1.0M 0 1.0M 0% /mempic none 6.0M 0 6.0M 0% /memrec 

As I can see in Google, there is an issue with inodes. Ok, i run for i in /*; do echo $i; find $i | wc -l; done Output is the next:

/arm 14 /bin 81 /boot 1 /capture 2 /dev 310 /disk 9 /etc 57 /hisi-pci 13 /hisi-pci-wifi 12 /home 1 /komod 72 /lib 52 /lib64 1 /linuxrc 1 /lost+found 1 /mempic 5 /memrec 5 /mm.sh 1 /mnt 1 /nfsroot 1 /onvif 2 /opt 1 /param 10 /proc find: /proc/598/task/598/fd/56: No such file or directory 16957 /root 2 /sbin 56 /share 1 /sys 1350 /syslog 6 /tmp 1 /usr 171 /var 17 /web 522 

So, in proc directory i can see a lot of directories 42, 443, 454, 548. etc — only digits. If i go to any of this directories, i can see the same content there:

/proc/580 $ ls -l -r-------- 1 root root 0 Jul 14 17:51 auxv -r--r--r-- 1 root root 0 Jul 14 17:48 cmdline lrwxrwxrwx 1 root root 0 Jul 14 17:51 cwd -> /usr -r-------- 1 root root 0 Jul 14 17:51 environ lrwxrwxrwx 1 root root 0 Jul 14 17:51 exe -> /usr/hh580 dr-x------ 2 root root 0 Jul 14 17:51 fd -r--r--r-- 1 root root 0 Jul 14 17:51 maps -rw------- 1 root root 0 Jul 14 17:51 mem -r--r--r-- 1 root root 0 Jul 14 17:51 mounts -rw-r--r-- 1 root root 0 Jul 14 17:51 oom_adj -r--r--r-- 1 root root 0 Jul 14 17:51 oom_score lrwxrwxrwx 1 root root 0 Jul 14 17:51 root -> / -r--r--r-- 1 root root 0 Jul 14 17:51 smaps -r--r--r-- 1 root root 0 Jul 14 17:48 stat -r--r--r-- 1 root root 0 Jul 14 17:51 statm -r--r--r-- 1 root root 0 Jul 14 17:51 status dr-xr-xr-x 3 root root 0 Jul 14 17:51 task -r--r--r-- 1 root root 0 Jul 14 17:51 wchan 
/proc/580/task $ ls 580 /proc/580/task $ cd 580 /proc/580/task/580 $ ls auxv environ maps oom_adj smaps status cmdline exe mem oom_score stat wchan cwd fd mounts root statm /proc/580/task/580 $ ls -l -r-------- 1 root root 0 Jul 14 17:51 auxv -r--r--r-- 1 root root 0 Jul 14 17:51 cmdline lrwxrwxrwx 1 root root 0 Jul 14 17:51 cwd -> /usr -r-------- 1 root root 0 Jul 14 17:51 environ lrwxrwxrwx 1 root root 0 Jul 14 17:51 exe -> /usr/hh5800 dr-x------ 2 root root 0 Jul 14 17:51 fd -r--r--r-- 1 root root 0 Jul 14 17:51 maps -rw------- 1 root root 0 Jul 14 17:51 mem -r--r--r-- 1 root root 0 Jul 14 17:51 mounts -rw-r--r-- 1 root root 0 Jul 14 17:51 oom_adj -r--r--r-- 1 root root 0 Jul 14 17:51 oom_score lrwxrwxrwx 1 root root 0 Jul 14 17:51 root -> / -r--r--r-- 1 root root 0 Jul 14 17:51 smaps -r--r--r-- 1 root root 0 Jul 14 17:51 stat -r--r--r-- 1 root root 0 Jul 14 17:51 statm -r--r--r-- 1 root root 0 Jul 14 17:51 status -r--r--r-- 1 root root 0 Jul 14 17:51 wchan 

Is it possible delete any of these files (or links) to let system create new file? I really don’t know Linux and I’d like create file only.

Читайте также:  Awus1900 driver kali linux

Источник

Cannot remove : No such file or directory

I just ran some self-written program in which I make files and fill them with stuff. However, I did something wrong (or at least, not as intended) with the name generation and now there are four files stuck in the folder which cannot be removed as they ‘do not exist’. Outputs of commands: ls -li :

ls: cannot access één: No such file or directory ls: cannot access wetenschap­pen.: No such file or directory ls: cannot access verantwoor­delijk: No such file or directory ls: cannot access woord wordt: No such file or directory total 0 ? -. ? ? ? ? ? één ? -. ? ? ? ? ? woord wordt ? -. ? ? ? ? ? verantwoor­delijk ? -. ? ? ? ? ? wetenschap­pen. 
rm: remove regular file `één'? y rm: cannot remove `één': No such file or directory rm: remove regular file `woord wordt'? y rm: cannot remove `woord wordt': No such file or directory rm: remove regular file `verantwoor­delijk'? y rm: cannot remove `verantwoor­delijk': No such file or directory rm: remove regular file `wetenschap­pen.'? y rm: cannot remove `wetenschap­pen.': No such file or directory 
rm: cannot remove `folder': Directory not empty 
find: cannot delete `./één': No such file or directory find: cannot delete `./wetenschap­pen.': No such file or directory find: cannot delete `./verantwoor­delijk': No such file or directory find: cannot delete `./woord wordt': No such file or directory 

strace -o out rm -f — * : Contents of out How can I remove these files?
Important to note is that I do not have root access, so I would prefer an option which does not require that.

Источник

Unable to delete file — no such file or directory

I deleted it once, but it's ghost is still there :)How can I delete a file that is there but the system says is not there? Permissions tab - tried changing it, but it would reset itself automatically This is what happens when I click

Читайте также:  Mac games run on linux

Right click the file, choose Properties, open the Permissions tab. Please take a screenshot and post it here.

Can you move other files to the trash? Is the file you are deleting on the same file system as your home file system? Does the directory ~/.Trash/ exist?

11 Answers 11

I know this is old, but I had the same problem as yours, only with a folder, not with a file. None of the methods suggested here worked.

I managed to solve the problem by creating a folder in the same position and with the same name as the one I couldn’t delete. The folder was created correctly and it «replaced» the non existing one. Then I simply removed the new folder and the issue was gone. Simple as that.

I had the same problem. It was a problem in index entries of the partition. I solved it by start Windows if your system is dual boot or insert live CD of Windows XP or Windows 7, and then do the following steps:

  1. Search for COMMAND PROMPT that: is cmd right-click -> Run as administrator.
  2. chkdsk /f/x D: (where D is your drive letter).
  3. Press Y if it asks for Y/N
  4. Check your drive for the file that you want to delete. Maybe it is deleted or you can delete it.

Warning: These instructions will require one to use debugfs . They can cause data loss.

They are tailored to the original problem and may or may not be accurate for any future visitors on this page. Any data loss may be irreparable or even aggravated by fsck .

It may be a lost inode. Please run ls -li to get a list of inode numbers, then you can try to dump the referenced inode. For example, if your ls -li looks like the following:

rarkenin@ubuntu-alt-64-vbox-1:~$ ls -li total 58672 4980758 -rwxr-xr-x 2 rarkenin rarkenin 4096 Sep 23 18:45 panorama.jpg ---SNIP--- 

then the inode number is 4980758 as shown in the list as the first column.

Читайте также:  Разграничение прав пользователей linux

You can then try to dump the inode. Please read the entire post before doing anything.

rarkenin@ubuntu-alt-64-vbox-1:~$ sudo debugfs [sudo] password for rarkenin: debugfs 1.42 (29-Nov-2011) debugfs: 
debugfs: rm [filename] debugfs: unlink [filename] debugfs: kill_file [filename] debugfs: kill_file

Note that this can be done even if it turns out the file never had an inode. Try the commands one at a time, in the order shown above. Exit debugfs and check if the file exists. If not, begin again but follow the next instruction.

Make a backup if possible!

show us the terminal. do a ll | grep panorama and show us that; add it to your question.

My suggestion is to do as root rm -f panorama.jpg .

in the man of rm I found this:

-f, --force ignore nonexistent files, never prompt 

First log in as root with sudo -s

You can try doing rm -v and look out the verbose output to see whats going on while its trying to remove the file. Check out the options for the command below.

If that fails, you can use the force option like everyone else said. You can also try removing the entire directory by forcing a recursive removal: rm -rfv **full directory address here**

 rm removes each file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response is not affirmative, the file is skipped. 
 Remove (unlink) the FILE(s). -f, --force ignore nonexistent files, never prompt -i, --interactive prompt before any removal --no-preserve-root do not treat '/' specially (the default) --preserve-root fail to operate recursively on '/' -r, -R, --recursive remove directories and their contents recursively -v, --verbose explain what is being done --help display this help and exit --version output version information and exit By default, rm does not remove directories. Use the --recursive (-r or -R) option to remove each listed directory, too, along with all of its contents. To remove a file whose name starts with a '-', for example '-foo', use one of these commands: rm -- -foo rm ./-foo Note that if you use rm to remove a file, it is usually possible to recover the contents of that file. If you want more assurance that the contents are truly unrecoverable, consider using shred. 

Источник

Оцените статью
Adblock
detector