removing /var/empty on a non-system disk

Gary Aitken freebsd at
Mon May 28 19:05:33 UTC 2012

On 5/25/2012 4:01 PM, Polytropon wrote:
> On Fri, 25 May 2012 15:04:50 -0600, Gary Aitken wrote:
>> On 05/25/12 14:21, Polytropon wrote:
>>> On Fri, 25 May 2012 14:04:50 -0600, Gary Aitken wrote:
>>>> something I'm not seeing
>>>> I've got a disk previously used as a sys disk I'm trying to clean up.
>>>> What's the key to removing /var/empty?
>>>> 280 /hd1/var#sysctl kern.securelevel
>>>> kern.securelevel: -1
>>>> 281 /hd1/var#ls -l
>>>> total 4
>>>> dr-xr-xr-x  2 root  wheel  512 Jan  3 00:55 empty
>>>> 282 /hd1/var#chflags noschg empty
>>>> 283 /hd1/var#chmod 777 empty
>>>> chmod: empty: Operation not permitted
>>>> 284 /hd1/var#rmdir empty
>>>> rmdir: empty: Operation not permitted
>>> Interesting, I just tried this on my home system (FreeBSD 8.2-STABLE)
>>> and it worked as intended. I did use the exact commands,
>>> same securelevel.
>>> Use the -o option for ls (ls -lo) to check on the effect
>>> of chflags and chmod.
>> Just found it, something I forgot about a long time ago...
>> I was running under su logged in as my normal user.
>> Had to back all the way out and log in as root.
> I should have mentioned that I did the (successful) test
> logging in as root (real console login). If you use "su -"
> or "su root", the effect should be the same. You can always
> check the success of your operation with the "ls -lo" command.

Nope.  That was the problem.  I had logged in on the vty as normal user 
and done su root.  Had to back all the way out and log in on the vty as 
root to make it work.

More information about the freebsd-questions mailing list