LinHES Forums http://forums.linhes.org/ |
|
Removing a symlink to self ? http://forums.linhes.org/viewtopic.php?f=5&t=19833 |
Page 1 of 2 |
Author: | chrisj [ Sat May 02, 2009 1:36 am ] |
Post subject: | Removing a symlink to self ? |
I messed up a symlink and now can't remove it rm -rf video dose not do it , any hints ? Code: video -> video
|
Author: | nigelpearson [ Sat May 02, 2009 3:15 am ] |
Post subject: | |
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! |
Author: | chrisj [ Sat May 02, 2009 7:07 am ] |
Post subject: | |
Still no luck with that |
Author: | tjc [ Sat May 02, 2009 9:18 am ] |
Post subject: | |
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. |
Author: | chrisj [ Sat May 02, 2009 4:16 pm ] |
Post subject: | |
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 |
Author: | tjc [ Sat May 02, 2009 9:35 pm ] |
Post subject: | |
Try this: Code: find . -name video -exec rm '{}' \;
Find will often let you do stuff with directory entries that defeat the usual shell semantics. |
Author: | alien [ Mon May 04, 2009 3:19 am ] |
Post subject: | |
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. |
Author: | chrisj [ Mon May 04, 2009 5:19 am ] |
Post subject: | |
Another two strikes ! Thanks for the things to try Who thought it would be hard to delete a file |
Author: | alien [ Mon May 04, 2009 6:07 am ] |
Post subject: | |
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. |
Author: | chrisj [ Mon May 04, 2009 6:16 am ] |
Post subject: | |
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 |
Author: | nigelpearson [ Mon May 04, 2009 6:31 am ] |
Post subject: | |
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? |
Author: | chrisj [ Mon May 04, 2009 6:44 am ] |
Post subject: | |
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 ! |
Author: | nigelpearson [ Mon May 04, 2009 6:56 am ] |
Post subject: | |
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. |
Author: | chrisj [ Mon May 04, 2009 7:02 am ] |
Post subject: | |
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 ! |
Author: | nigelpearson [ Tue May 05, 2009 5:38 am ] |
Post subject: | |
chrisj wrote: Thats the silly thing I just don't get an error ! I hadn't seen that error. Interesting.Code: [root@myth-master video]# mv video novideo mv: cannot move `video' to `novideo': Permission denied 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) |
Page 1 of 2 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |