[solved]: unlink a directory

Darrel levitch at iglou.com
Thu Nov 28 10:50:14 UTC 2013


>> I can not recall how to unlink a directory.  Installed a FreeBSD10 system
>> from memory and when making the kernel link went to /root/kernels and
>> linked rather than /usr/src/sys/amd64.
>>
>> Now I have this:
>>
>> (120) @ 4:01:40> ls -L conf
>> conf
>> (121) @ 4:01:43> ls -P conf
>> conf
>> (122) @ 4:01:56> ll conf
>> lrwxr-xr-x  1 root  wheel    24B Nov 24 22:57 conf@ ->
>> /usr/src/sys/amd64/conf/
>> (123) @ 4:02:09> pwd
>> /usr/src/sys/amd64
>> (124) @ 4:04:22> cd conf
>> conf: Too many levels of symbolic links.
>
> If I understand this correctly, you have:
>
> 	/usr/src/sys/amd64/conf -> /usr/src/sys/amd64/conf/
>
> So
>
> 	/usr/src/sys/amd64> cd conf
>
> will result in an attempt to cd to
>
> 	/usr/src/sys/amd64/(conf=/usr/src/sys/amd64/)(conf=/usr/src/sys/amd64/)...
>
> This obviously looks wrong. :-)
>
>
>
> Probably you should try to remove the conf@ symlink (note:
> just a symbolic link, not a "real" directory!) by invoking
>
> 	/usr/src/sys/amd64> rm conf
>
> or
>
> 	/usr/src/sys/amd64> unlink conf
>
> With "man unlink" you'll see that the rm and unlink commands
> can easily remove a symbolik link. :-)
>
>
>
> If this _fails_, you can try the following, which is a little bit
> dangerous and you should know what you're doing: Use a live system
> or single user mode (/usr partition _not_ mounted), and call
>
> 	# fdsb <device>
>
> Then in this program, navigate to /usr/src/sys/amd64 (or to
> /src/sys/amd64 if /usr is on its own parition), for example by
>
> 	cd /src/sys/amd64
>
> and then use the
>
> 	del conf
>
> command. When the change has been writte to the file system,
> perform a file system check
>
> 	# fsck <device>
>
> Then you should be able to mount it again.
>
> Note again: This is an extremely dirty method! See "man fsdb"
> for details.
>
> But I assume you won't have to do this.
>

Thank you- great information!

The rm command solved it.  I ran 'man un' and 'man ul'- probably should 
have ran 'apropos unlink'.

I have a couple of systems up running ZFS.  This time I noticed that the 
developers had put an "experimental" 'ZFS Root' into the system install. 
I chose 'mirror'.  Other than my typing problem to make a kernel, so far I 
had to create a directory- seems like the systeminstall did not account 
entirely for ZFS mirror:

# cd bootpool
(162) @ 5:37:39> mkdir -p boot/kernel

Then the kernel installed.

Darrel


More information about the freebsd-questions mailing list