Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Directory not empty' error

Status
Not open for further replies.

Wishdiak

Technical User
Mar 7, 2004
1,787
US
For some reason, the directory /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config/cpu seems to be 'stuck'. There are no files in it, and yet it can not be removed, even in single-user mode.

I've run fsck in single-user mode, but I still get the error

rm:/usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config/cpu: Directory not empty

when I try to delete it. Any ideas?

Wishdiak
A+, Network+, MCSA 2003 certified
 
I compiled on my AIX server using the IBM C compiler, but it should compile the same on gcc. Which compiler are you using?
 
How did you compile it, too?

cc -o remove_file remove_file.c
 
kHz,

Saving the code above to remove_file.c and compiling with
'cc -o remove_file remove_file.c' gave no errors, and no errors on execution. I still can't remove the offending directory, however.

Wishdiak
A+, Network+, Security+, MCSA 2003 certified
 
The unlink should have removed the directory even if there were files or subdirectories within ../cpu

I tested it by making a test directory with subdirectories and files in it and running the above C program and it removes it.

Does an 'ls -i' return an inode number for the cpu directory?
 
kHz,

Now, that's something I hadn't thought of.

# cd /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config
# ls -i
143672 cpu/

...so there is an inode for it.

Wishdiak
A+, Network+, Security+, MCSA 2003 certified
 
# cd /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config
# find ./ -inum 143672 | xargs rm -rf
 
What does an 'ls -idl /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config/cpu' show?

The number in the 3rd column will show the link count and name entries.
 
kHz,

You have been very helpful, so thank you again.

In the case of
# cd /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config
# find ./ -inum 143672 | xargs rm -rf

I get
rm: ./cpu: Directory not empty

For
# ls -idl /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config/cpu

I get
143672 drwxr-xr-x 6 root wheel 512 Nov 24 00:16 /usr/ports/lang/gcc34/work/gcc-3.4-20041112/libstdc++-v3/config/cpu/

Wishdiak
A+, Network+, Security+, MCSA 2003 certified
 
To continue this thread, I'm still having this problem, which only comes up when attempting to update the gcc34 port.

I did some googling today, and found
which suggests rebooting into single-user mode and running fsck -p. fsck found some soft update inconsistencies, and attempted to fix them, but the problem remains on reboot into normal multi-user mode.

Any help would be appreciated.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Solved at last!

Rebooting into single user, then 'fsck -p' failed due to /usr/lost+found being full. I have no idea what the quota for /usr/lost+found is, but I deleted all items there, rebooted single user, 'fsck -p', rebooted multi-user and I was able to remove the directory I was having issues with.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
I will remember that in case it ever pops up for me. Thanks.
 
I've gotten a few emails from others who have had this problem, so I've added faq93-5849 in this forum.

Please let me know if there's anything that I missed.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top