LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-06-2009, 11:38 PM   #1
ripvtech
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Rep: Reputation: 0
Issues with the rm command


Hello,
I'm in the process of automating the deployment of my webapps, and I have noticed an issue with removing one of my directories.

I run rm -rfv /path/to/directory

It outputs the following:

removed directory: `mockstore//category'
removed `my_project//environment.pyc'
removed `my_project//environment.py~'
removed `my_project//manage.py'
removed `my_project//my_project.kpf'
removed `my_project//search/.DS_Store'
removed `my_project//search/._.DS_Store'
removed `my_project//search/models.py'
removed `my_project//search/models.pyc'
removed `my_project//search/services.py'
removed `my_project//search/services.pyc'
removed `my_project//search/urls.py'
removed `my_project//search/urls.pyc'
removed `my_project//search/views.py'
removed `my_project//search/views.pyc'
removed `my_project//search/__init__.py'
removed `my_project//search/__init__.pyc'

It seems any folder I try to delete the rm command freezes after deleting an __anyfile__.pyc file

Any ideas?

Thanks
 
Old 09-06-2009, 11:43 PM   #2
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
I'm unable to replicate your problem. I created a folder called tmp and added _anyfile__.pyc to it. rm -rvf tmp worked without any issues. Could you isolate your problem to smaller context?
 
Old 09-06-2009, 11:50 PM   #3
piratas
LQ Newbie
 
Registered: Oct 2007
Posts: 16

Rep: Reputation: 0
It works fine for me.
Have you checked the privileges?
 
Old 09-07-2009, 12:38 AM   #4
ripvtech
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Ok so this is extremely odd. If I do the following
cp -r /my_project /my_project_bak
rm -rvf /my_project_bak

The copied folder deletes without an issue.

If I try:

mv /my_project /my_project_moved
rm -rvf /my_project_moved

I still can't delete the moved folder.

For a little more context.

The lockup occurs after it deletes all the files within the directory, it seems it can't remove the directory itself.
If I then stop the command by pressing ctrl+c and run it again, the folder deletes just fine
 
Old 09-07-2009, 12:39 AM   #5
ripvtech
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Yes I have checked the permissions.
 
Old 09-07-2009, 01:13 AM   #6
windtalker10
Member
 
Registered: Nov 2007
Location: Kentucky
Distribution: Slackware13.1
Posts: 214

Rep: Reputation: 38
It sounds like you may have created a link with the directory somehow.
Try adding d to the rm command.
 
Old 09-07-2009, 01:44 AM   #7
ripvtech
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Adding d did not yield different results.


rm -rvfd /my_project

still fails on removing the directory. There are no symlinks inside this folder.
 
Old 09-07-2009, 09:37 AM   #8
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 675

Rep: Reputation: 136Reputation: 136
Quote:
Originally Posted by ripvtech View Post
Adding d did not yield different results.


rm -rvfd /my_project

still fails on removing the directory. There are no symlinks inside this folder.
Try run it under strace
Code:
strace rm -rvfd /my_project
It can shred a light to the problem
 
Old 09-07-2009, 09:50 PM   #9
ripvtech
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Original Poster
Rep: Reputation: 0
I ran strace -f -o strace.out rm -rf /django_projects

here is the output ( sorry for the dump I didn't see an attach file option):

3017 execve("/bin/rm", ["rm", "-rf", "/django_projects/"], [/* 36 vars */]) = 0
3017 brk(0) = 0x8b51000
3017 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
3017 open("/etc/ld.so.cache", O_RDONLY) = 3
3017 fstat64(3, {st_mode=S_IFREG|0644, st_size=41168, ...}) = 0
3017 mmap2(NULL, 41168, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7ef8000
3017 close(3) = 0
3017 open("/lib/libc.so.6", O_RDONLY) = 3
3017 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320\320\216\0004\0\0\0"..., 512) = 512
3017 fstat64(3, {st_mode=S_IFREG|0755, st_size=1673804, ...}) = 0
3017 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ef7000
3017 mmap2(0x8d7000, 1390032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x8d7000
3017 mmap2(0xa25000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14e) = 0xa25000
3017 mmap2(0xa28000, 9680, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xa28000
3017 close(3) = 0
3017 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ef6000
3017 set_thread_area({entry_number:-1 -> 6, base_addr:0xb7ef66c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
3017 mprotect(0xa25000, 8192, PROT_READ) = 0
3017 mprotect(0x8d3000, 4096, PROT_READ) = 0
3017 munmap(0xb7ef8000, 41168) = 0
3017 brk(0) = 0x8b51000
3017 brk(0x8b72000) = 0x8b72000
3017 open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE) = 3
3017 fstat64(3, {st_mode=S_IFREG|0644, st_size=65179696, ...}) = 0
3017 mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7cf6000
3017 close(3) = 0
3017 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
3017 lstat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
3017 fstatat64(AT_FDCWD, "/django_projects/", {st_mode=S_IFDIR|0777, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
3017 openat(AT_FDCWD, "/django_projects/", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW) = 3
3017 fstat64(3, {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
3017 fstat64(3, {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
3017 fcntl64(3, F_GETFL) = 0x28800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_NOFOLLOW)
3017 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0
3017 getdents64(3, /* 2 entries */, 4096) = 48
3017 getdents64(3, /* 0 entries */, 4096) = 0
3017 fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
3017 close(3) = 0
3017 unlinkat(AT_FDCWD, "/django_projects/", AT_REMOVEDIR) = -1 EBUSY (Device or resource busy)
3017 open("/usr/share/locale/locale.alias", O_RDONLY) = 3
3017 fstat64(3, {st_mode=S_IFREG|0644, st_size=2528, ...}) = 0
3017 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f02000
3017 read(3, "# Locale name alias data base.\n#"..., 4096) = 2528
3017 read(3, "", 4096) = 0
3017 close(3) = 0
3017 munmap(0xb7f02000, 4096) = 0
3017 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 write(2, "rm: ", 4) = 4
3017 write(2, "cannot remove directory `/django"..., 43) = 43
3017 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
3017 write(2, ": Device or resource busy", 25) = 25
3017 write(2, "\n", 1) = 1
3017 close(1) = 0
3017 close(2) = 0
3017 exit_group(1) = ?
 
Old 09-07-2009, 10:41 PM   #10
ripvtech
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Original Poster
Rep: Reputation: 0
So I figured it out. I'm a complete idiot! The parent folder was a mounted folder and hence causing all kinds of issues.

I have unmounted the folder and all my issues have gone away!

Thank you for all the help!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ATI Ain in Wonder 8500DV LINUX LIVE boot issues (and TV issues) Flashmahn Linux - Hardware 1 03-09-2009 07:40 AM
Password issues with useradd command mcaywood Linux - Newbie 2 11-27-2007 05:29 PM
CHMOD Command Issues ecko! Linux - Newbie 3 09-19-2006 12:22 PM
Command line network config issues gigi1234 Linux - Networking 4 08-25-2006 05:24 AM
Redhat 9.0 command issues (n00b) and not afraid to admit it! ACDII Red Hat 5 08-09-2006 02:00 PM


All times are GMT -5. The time now is 05:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration