View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 18 posts ] 
Go to page 1, 2  Next

Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sat May 02, 2009 1:36 am 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
I messed up a symlink and now can't remove it

rm -rf video dose not do it , any hints ?


Code:
video -> video


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 02, 2009 3:15 am 
Offline
Joined: Wed Mar 03, 2004 7:43 pm
Posts: 748
Location: Sydney, Australia
Try 'rm ./video'


P.S. Never use -rf unless you are sure you want to silently empty the contents of a directory. If you weren't careful, this could have deleted all your videos!

_________________
| Nigel Pearson, nigel.pearson.au@gmail.com
| "Things you own end up owning you" - Tyler, Fight Club


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 02, 2009 7:07 am 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
Still no luck with that


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 02, 2009 9:18 am 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
What error message(s) are you getting? Do you own or have write permissions to the link and the directory it's in? Are you sure that there aren't any funny characters embedded in the name? (hint: try ls --quoting-style=shell *video*), there are a couple other tricks for files with really funky names but lets start with those basics.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 02, 2009 4:16 pm 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
I've been looking onnthe net and not found anything that works , but I'm sure there is an answer for it


Code:
[root@myth-master video]# ls -la video
lrwxrwxrwx  1    504    504    5 2009-04-09 08:50 video -> video

[root@myth-master video]#  ls --quoting-style=shell *video*
ls: cannot access video: Too many levels of symbolic links


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 02, 2009 9:35 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Try this:
Code:
find . -name video -exec rm '{}' \;

Find will often let you do stuff with directory entries that defeat the usual shell semantics.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 3:19 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
Strange. rm should work on this. I just tried it on a non-myth box and it worked.

You might try "unlink <File>". It is a lower level file/link deletion command.

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 5:19 am 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
Another two strikes !

Thanks for the things to try :)

Who thought it would be hard to delete a file


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 6:07 am 
Offline
Joined: Mon Jun 21, 2004 5:28 am
Posts: 700
Location: Germany
A few more things to try:

1. mv the link to a different name, then delete it.

2. It might be a bash bug, so try using sh (type "sh" to get a sh shell and then try rm or unlink.

3. Try using the unlink command as root.

If all that fails, I suggest you post the error message.

_________________
ASUS AT3N7A-I (Atom 330)
TBS 8922 PCI (DVB-S2)


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 6:16 am 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
Thats the silly thing I just don't get an error !

Code:
[root@myth-master video]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),19(log)
[root@myth-master video]# ls -la
total 0
drwxrwxrwx  3 501 501 0 2009-05-03 07:39 .
drwxrwxrwx 34 502 702 0 2009-05-04 21:22 ..
drwxr-xr-x  3 504 504 0 2009-03-27 13:18 motion
lrwxrwxrwx  1 504 504 5 2009-04-09 08:50 video -> video
[root@myth-master video]# rm ./video
[root@myth-master video]# find . -name video -exec rm '{}' \;
[root@myth-master video]# unlink video
[root@myth-master video]# ls -la
total 0
drwxrwxrwx  3 501 501 0 2009-05-03 07:39 .
drwxrwxrwx 34 502 702 0 2009-05-04 21:22 ..
drwxr-xr-x  3 504 504 0 2009-03-27 13:18 motion
lrwxrwxrwx  1 504 504 5 2009-04-09 08:50 video -> video
[root@myth-master video]# sh
[root@myth-master video]# find . -name video -exec rm '{}' \;
[root@myth-master video]# ls -la
total 0
drwxrwxrwx  3 501 501 0 2009-05-03 07:39 .
drwxrwxrwx 34 502 702 0 2009-05-04 21:22 ..
drwxr-xr-x  3 504 504 0 2009-03-27 13:18 motion
lrwxrwxrwx  1 504 504 5 2009-04-09 08:50 video -> video
[root@myth-master video]# mv video novideo
mv: cannot move `video' to `novideo': Permission denied
[root@myth-master video]# ls -la
total 0
drwxrwxrwx  3 501 501 0 2009-05-03 07:39 .
drwxrwxrwx 34 502 702 0 2009-05-04 21:22 ..
drwxr-xr-x  3 504 504 0 2009-03-27 13:18 motion
lrwxrwxrwx  1 504 504 5 2009-05-02 16:36 test -> video
lrwxrwxrwx  1 504 504 5 2009-04-09 08:50 video -> video
[root@myth-master video]#  ls --quoting-style=shell *video*
ls: cannot access video: Too many levels of symbolic links


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 6:31 am 
Offline
Joined: Wed Mar 03, 2004 7:43 pm
Posts: 748
Location: Sydney, Australia
Well, on a KM5.5 box, no problem:
Code:
nigel@mythtv-server:~$ ls -la video
lrwxrwxrwx 1 nigel nigel 5 May  4 21:21 video -> video
nigel@mythtv-server:~$ rm -f ./video
nigel@mythtv-server:~$ ls -la video
ls: video: No such file or directory


Diagnostic questions:

1) When you do the rm, does it output any error?

2) What does 'unlink ./video' output?

3) Does dmesg list any error?

4) What OS is this? (e.g. what KnoppMyth version)

5) What userid created the file (e.g. who is id 504 in your /etc/passwd file)

6) What filesystem is this symlink on? Local ext2/ext3? Something more exotic? Is this filesystem exported to other machines? Is this actually mounted from a Remote machine?

_________________
| Nigel Pearson, nigel.pearson.au@gmail.com
| "Things you own end up owning you" - Tyler, Fight Club


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 6:44 am 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
1) No error

2) No output at all

3) Nothing in dmesg

4) LinHES R6.00.07 (Scale preview)

5) 504 would have been my wife's accont ( she has been using samba to put video's on and off her iPhone/Pod) the user is now removed as the drive was moved from my old system to the new one

6) ext3 , Sabma has been used to share in the past but not on new install for this path. It is on a local mount.

Thanks for the thoughts, starting to think that
a) move 211G of files to new location and wipe the old drive
b) move the files to new location on the same drive and try not to think about this anymore !


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 6:56 am 
Offline
Joined: Wed Mar 03, 2004 7:43 pm
Posts: 748
Location: Sydney, Australia
My only idea right now if to run a 'fsck -V' on the filesystem to see what it finds.

If you are game and the machine is on the Internet, create an account, and I (or someone with more time) could ssh in and run some diagnostic programs (I would write a program to do a stat() on the file and to see what it reports.

But, if you are in a hurry, copy the files off and do a newfs.

_________________
| Nigel Pearson, nigel.pearson.au@gmail.com
| "Things you own end up owning you" - Tyler, Fight Club


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 04, 2009 7:02 am 
Offline
Joined: Tue Jan 17, 2006 7:34 am
Posts: 126
Location: Australia
I've started to move the files to my NAS , and will then remove this drive from my main backend where it is at the moment .

Then I'll place it back in the system it came from and see if it comes good there.

If that dose not work I might take up you offer and open it up for a play !


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 05, 2009 5:38 am 
Offline
Joined: Wed Mar 03, 2004 7:43 pm
Posts: 748
Location: Sydney, Australia
chrisj wrote:
Thats the silly thing I just don't get an error !

Code:
[root@myth-master video]# mv video novideo
mv: cannot move `video' to `novideo': Permission denied
I hadn't seen that error. Interesting.

You seem to be running that as root, so the only thing I can think of is a filesystem that is mounted read-only (like when it fails the fsck at boot time).
Code:
nigel@mythtv-server:/myth/mythburn/temp/logs$ head -4 /etc/fstab
# /etc/fstab: filesystem table.
#
# filesystem  mountpoint  type  options  dump  pass
/dev/hda1     /           ext3  defaults,errors=remount-ro  0  1


Can you create files at that level of the filesystem (e.g. touch video2)

_________________
| Nigel Pearson, nigel.pearson.au@gmail.com
| "Things you own end up owning you" - Tyler, Fight Club


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ] 
Go to page 1, 2  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu