# Tag Info

89

59

58

you can use ldconfig, it recreates the symlink: # rm /lib/libc.so.6 rm: remove symbolic link /lib/libc.so.6'? y # ls -l /lib/libc* ls: error while loading shared libraries: libc.so.6: cannot open shared object file: # ldconfig # ls -l /lib/libc* [skip] lrwxrwxrwx. 1 root root 12 May 11 07:59 /lib/libc.so.6 -> libc-2.12.so just tested it, as you ...

44

Using -f with ln will overwrite any link that was already there, so as long as you have the correct permissions, it should work... It's always worked for me. What operating system are you using?

41

CentOS 6 generally comes with busybox, a statically-linked set of Unix tools, installed in /sbin. You can run it like this: /sbin/busybox ln -s libc-2.12.so /lib/libc.so.6

37

That works for me, what is the output of strace ln -f -s /var/www/html/releases/build1390 app-current ? Oh, since it is a directory you need to add -n for no dereference and this should solve the issue. -f is really more of a convenience since adding the -f just causes it to unlink anyways. Although I guess it would probably happen a few hundred ms faster ...

37

The -L flag to rsync will sync the contents of files or directories linked to, rather than the symbolic link.

29

On Windows XP you can use fsutil (built into the OS) to create a hardlink fsutil hardlink create c:\foo.txt c:\bar.txt Keep in mind fsutil will only work if both are on same drive

28

just use namei: $namei d f: d l d -> c l c -> b l b -> a d a 24 Hell yes. If you execute the ln -s you create a symbolic link, which is an inode pointing to a certain filesystem object, which is why symlinks can traverse filesystems and hard links cannot: hard links do not have their own inode. If you mount a filesystem with --bind, you create a second mountpoint for a device or filesystem. If you envision a symlink as ... 23 Set LD_PRELOAD to preload the relevant library. I tried it out with libpthread and it seems to work: root@spirit:~# mv /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libpthread.so.0-bak root@spirit:~# chattr chattr: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory root@spirit:~# ... 20 sln serves exactly that purpose: to fix symbolic links when you can't use regular ln because you broke an essential symlink. To quote its man page: DESCRIPTION The sln program creates symbolic links. Unlike the ln(1) program, it is statically linked. This means that if for some reason the dynamic linker is not working, sln can be used ... 17 Use with some caution. It will take a while. find / -type l 15 Ok, I found where my error is: one should not put the first / in path. In other words, the commands in my questions should be: Creation -> ln -s {path/to/file-name} {link-name} Update -> ln -sfn {path/to/file-name} {link-name} instead of Creation -> ln -s {/path/to/file-name} {link-name} Update -> ln -sfn {/path/to/file-name} {link-name} ... 14 The pwd command is both a shell builtin and /bin/pwd. Under normal circumstances, the builtin will be run in preference to /bin/pwd. The pwd command can be called as pwd -L or pwd -P Both the builtin and /bin/pwd default to pwd -L from the man page -L, --logical use PWD from environment, even if it contains symlinks so when you run pwd ... 13 perheps: pwd -P from help: "-P : The pathname printed will not contain symbolic links. " 13 There's only one kind of symbolic link. The issue you're seeing with FTP is probably that the FTP server is restricted to a subtree of the filesystem (this is called a chroot jail), and a symbolic link pointing outside that subtree won't work. That's by design: the chroot jail is for security, and you mustn't be able to escape the jail by following a ... 13 GNU find's manpage says that all POSIX finds are supposed to detect filesystem loops and emit error messages in these cases, and I have tested find . -follow -printf "" on GNU find, which was able to find loops of the form ./a -> ./b and ./b -> ./a printing the error find: ./a': Too many levels of symbolic links find: `./b': Too many levels of ... 12 Use -a option with rsync. It will copy the broken symlinks too. Something like this: # rsync -av source host:destination 11 readlink is the command you want. You should look at the man page for the command. Because if you want to follow a chain of symbolic links to the actual file, then you need the -e or -f switch:$ ln -s foooooo zipzip # fooooo doesn't actually exist $ln -s zipzip zapzap$ # Follows it, but doesn't let you know the file doesn't actually exist $readlink ... 10 I know this has been answered a while ago, but I was wondering the same thing and found this answer. The accepted answer is actually not quite correct. There are symbolic links to files and directories. There are hard links to files. "Hard links" to directories are called junctions. The thing is, they are not quite hard links. Microsoft calls them Soft ... 10 It's likely the SFTP is being chrooted, so that the directory /var/www is not available to the user in the chroot jail. Look in /etc/ssh/sshd_config and examine the sftp directives. Do you see something like: Match group sftp ChrootDirectory /home/%u AllowTcpForwarding no ForceCommand internal-sftp The sshd_config man page is here. Basically, ... 9 readlink -e <link> readlink [OPTION]... FILE -e, --canonicalize-existing canonicalize by following every symlink in every component of the given name recursively, all components must exist$ mkdir testlink $cd testlink pjb@pjb-desktop:~/testlink$ ln -s c b pjb@pjb-desktop:~/testlink$ln -s b a pjb@pjb-desktop:~/testlink$ ls -l ...

9

Are you talking about MS-DOS or Windows XP? Since it's likely that you're just talking about doing this from a command-prompt on Windows XP I'll answer for that case first... >smile< On an NTFS volume under Windows XP you can use the "fsutil" tool to create a hard link: fsutil hardlink create <destination filename> <source filename> ...

8

Windows 2000 and later allows for symbolic linking but refers to symbolic links as junctions. I do not believe you can make them easily without an additional tool, but you can find free tools for creating them. Free tool: http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx KB Article on Junctions: http://support.microsoft.com/?kbid=205524

8

You cannot use hard links across file systems like that. You need to use ln -s to create a symbolic link. ln -s /mnt/storage/sourcefile.txt /var/www/myweb/linkedfile.txt

8

Two options: 1) Use Hard symlinks. Rsync doesn't need special flags to traverse these, because they look like part of the filesystem. - Of course, this only works on the same filesystem, which doesn't apply. 2) A bind mount. sudo mount -o bind /source /dest.

8

You can set LD_LIBRARY_PATH variable to include the directory where real libc.so.6 is: export LD_LIBRARY_PATH="/dir/for/libc.so.6/:\$LD_LIBRARY_PATH" Also, execute ldconfig for it to recreate the links. This should make the commands work so you can then use ln commands to fix your system. Another way would be to boot via LiveCD and link file there.

7

If you type set -P in bash all commands such as cd, pwd will follow the physical path. Else you can use cd -P and pwd -P for temporary changes to the default behavior. From the manpage of bash: -P If set, the shell does not follow symbolic links when executing commands such as cd that change the cur- rent working ...

7

You can simply shut down Postgres, move the folder over and change the init scripts to point to the correct location for the data directory. Double-check the configuration files under data/ for references to the old path before restarting the server. You probably don't want to do this. Really. It's a BAD idea. NFS's other name is the Network Failure ...

Only top voted, non community-wiki answers of a minimum length are eligible