You are not logged in.

#1 2015-06-02 11:51:36

nbd
Member
Registered: 2014-08-04
Posts: 389

How to delete directories which are "not a directory"?

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. How such filesystem items can be removed?


bing different

Offline

#2 2015-06-02 11:54:37

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,718
Website

Re: How to delete directories which are "not a directory"?

Since you are using btrfs, they are probably subvolumes.

Try 'btrfs subvol delete /path/to/subvolume'


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2015-06-02 12:08:27

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

WorMzy:

'btrfs subvol delete' returns "ERROR: <item> is not a subvolume"

Actually those items are remains of temporary cache items. One of them, for example, is a mutt cache link to an imaps Gmail folder.


bing different

Offline

#4 2015-06-02 12:13:56

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: How to delete directories which are "not a directory"?

http://allanmcrae.com/2015/05/what-is-it/ ?
What's the output of 'file <that file>'?

Offline

#5 2015-06-02 12:29:19

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

karol:

'file' reports that the item is a directory.

P.S. In the linked post the item was reported as a symlink AFAIU.

P.P.S. My mistake, the 'directory' was reported for the item's parent directory. The item was reported by 'file' as:

SMTP mail, Non-ISO extended-ASCII text, with very long lines

Last edited by nbd (2015-06-02 13:38:21)


bing different

Offline

#6 2015-06-02 14:03:19

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

Here 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

bing different

Offline

#7 2015-06-03 10:04:59

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: How to delete directories which are "not a directory"?

Try removing it as root.

Offline

#8 2015-06-06 08:41:38

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

x33a:

[root@localhost sessions]# rm -d \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
rm: cannot remove ‘????????? ??????/’: Directory not empty
[root@localhost sessions]# rm -dr \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
rm: descend into directory ‘????????? ??????/’? y
rm: remove directory ‘????????? ??????/’? y
rm: cannot remove ‘????????? ??????/’: No such file or directory
[root@localhost sessions]# rm \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
rm: cannot remove ‘????????? ??????/’: Is a directory
[root@localhost sessions]# file \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
????????? ??????/: directory

Last edited by nbd (2015-06-06 09:46:14)


bing different

Offline

#9 2015-06-06 13:45:30

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,557

Re: How to delete directories which are "not a directory"?

nbd,

try using chmod to reset the directory flag on those files.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2015-06-06 14:01:09

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

Lone_Wolf:

is directory flag a "sticky bit" or "restricted deletion" flag?

[root@localhost sessions]# chmod -t \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
[root@localhost sessions]# rm \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
rm: cannot remove ‘????????? ??????/’: Is a directory
[root@localhost sessions]# chmod +t \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
[root@localhost sessions]# rm \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
rm: cannot remove ‘????????? ??????/’: Is a directory
[root@localhost sessions]# chmod 1700 \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
[root@localhost sessions]# rm \?\?\?\?\?\?\?\?\?\ \?\?\?\?\?\?/
rm: cannot remove ‘????????? ??????/’: Is a directory

bing different

Offline

#11 2015-06-06 14:26:14

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,557

Re: How to delete directories which are "not a directory"?

I think it's neither of those.

I haven't found a way to display permissions in octal format , but Midnight Commander does show them ( F9 , File , chmod ).

normal files  show something like this :   100755 , while directories look like 40755 .
(hopefully someone more experienced will come along to explain)

It does seem worth a try to use chmod 100755 on one of the problem files .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#12 2015-06-06 16:38:30

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

Lone_Wolf,

chmod returns "Invalid mode" for 100755


bing different

Offline

#13 2015-06-07 19:11:45

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,557

Re: How to delete directories which are "not a directory"?

Ok, so changing directory bit is not supported by chmod.
In theory, editing filesystem data directly might work. Apart from the fact i don't know tools that allow to do that, it seems way to risky.

Have you tried moving the problem files (like to an usb drive that you can re-partition later) instead of deleting ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#14 2015-06-07 23:11:18

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: How to delete directories which are "not a directory"?

Lone_Wolf:
apparently this problem can be solved one time, by moving, repartitioning, etc. But with everyday automatic backup of a system with running applications, which have temporary files and folders like that, it's probably not solution. Strangely that such cases with "strangely behaving filesystem objects" with widely used programs like mutt and session manager plugin for FireFox seems to be so rare, that there is no a quick standard solution.

Last edited by nbd (2015-06-07 23:12:09)


bing different

Offline

#15 2015-06-08 09:22:32

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: How to delete directories which are "not a directory"?

Have you tried to duplicate the problem with other filesystems like ext4? Given that you are using btrfs and it is still considered experimental, you might want to ask in their mailing list about this problem.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB