Re: removing /var/empty on a non-system disk

2012-05-29 Thread Robert Bonomi
> From owner-freebsd-questi...@freebsd.org  Mon May 28 20:22:58 2012
> Date: Mon, 28 May 2012 19:17:38 -0600
> From: Gary Aitken 
> To: freebsd-questions@freebsd.org
> Subject: Re: removing /var/empty on a non-system disk
>
> On 05/28/12 15:08, Robert Bonomi wrote:
>
> > I'm going to guess that you did 'su root', not 'su - root'.  The two 
> > commands are *NOT* identical.   'su root' does not run the root 'login'
> > scripts; thus environment variables (including path, user, logname etc.)
> > are *not* set as they are on root login -- this causes some 'am i root'
> > tests to fail.  OTOH, 'su - root' should be equivalent to a root login 
> > in all respects.
>
> Thank you.  That explains a number of problems I've been having.  doh.

To misquote Mae West: "When confronted with the choice between two mistakes,
I try to choose the one I haven't made before."

I've been doing this kind of stuff long enough that, under that philosophy,
I've seen things that hardly anybody else has ever experienced.  Luckily,
at least for me, I _do_ remember virtually all the mistakes I've made.




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-29 Thread Robert Bonomi
> From owner-freebsd-questi...@freebsd.org  Mon May 28 20:22:58 2012
> Date: Mon, 28 May 2012 19:17:38 -0600
> From: Gary Aitken 
> To: freebsd-questions@freebsd.org
> Subject: Re: removing /var/empty on a non-system disk
>
> On 05/28/12 15:08, Robert Bonomi wrote:
>
> >>  From owner-freebsd-questi...@freebsd.org  Mon May 28 14:10:55 2012
> >> Date: Mon, 28 May 2012 13:05:45 -0600
> >> From: Gary Aitken
> >> To: Polytropon
> >> Cc: freebsd-questions@freebsd.org
> >> Subject: Re: removing /var/empty on a non-system disk
> >>
> >> On 5/25/2012 4:01 PM, Polytropon wrote:
> >>>
> >>> 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.
> > 
> > I'm going to guess that you did 'su root', not 'su - root'.  The two 
> > commands
> > are *NOT* identical.   'su root' does not run the root 'login' scripts; thus
> > environment variables (including path, user, logname etc.) are *not* set as
> > they are on root login -- this causes some 'am i root' tests to fail.  OTOH,
> > 'su - root' should be equivalent to a root login in all respects.
>
> Thank you.  That explains a number of problems I've been having.  doh.
>
> > NOTE; there will be issues if the 'working directory' of a parent process is
> > the directory you are trying to delete.
>
> knew about that part
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-28 Thread Gary Aitken
On 05/28/12 15:08, Robert Bonomi wrote:

>>  From owner-freebsd-questi...@freebsd.org  Mon May 28 14:10:55 2012
>> Date: Mon, 28 May 2012 13:05:45 -0600
>> From: Gary Aitken
>> To: Polytropon
>> Cc: freebsd-questions@freebsd.org
>> Subject: Re: removing /var/empty on a non-system disk
>>
>> On 5/25/2012 4:01 PM, Polytropon wrote:
>>>
>>> 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.
> 
> I'm going to guess that you did 'su root', not 'su - root'.  The two commands
> are *NOT* identical.   'su root' does not run the root 'login' scripts; thus
> environment variables (including path, user, logname etc.) are *not* set as
> they are on root login -- this causes some 'am i root' tests to fail.  OTOH,
> 'su - root' should be equivalent to a root login in all respects.

Thank you.  That explains a number of problems I've been having.  doh.

> NOTE; there will be issues if the 'working directory' of a parent process is
> the directory you are trying to delete.

knew about that part
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-28 Thread Gary Aitken

On 5/28/2012 3:08 PM, Robert Bonomi wrote:


On 5/25/2012 4:01 PM, Polytropon wrote:


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.


I'm going to guess that you did 'su root', not 'su - root'.  The two commands
are *NOT* identical.   'su root' does not run the root 'login' scripts; thus
environment variables (including path, user, logname etc.) are *not* set as
they are on root login -- this causes some 'am i root' tests to fail.  OTOH,
'su - root' should be equivalent to a root login in all respects.


ahhh.. Thank you.  That explains a number of things.

Gary
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-28 Thread Robert Bonomi
h
> From owner-freebsd-questi...@freebsd.org  Mon May 28 14:10:55 2012
> Date: Mon, 28 May 2012 13:05:45 -0600
> From: Gary Aitken 
> To: Polytropon 
> Cc: freebsd-questions@freebsd.org
> Subject: Re: removing /var/empty on a non-system disk
>
> On 5/25/2012 4:01 PM, Polytropon wrote:
> >
> > 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.

I'm going to guess that you did 'su root', not 'su - root'.  The two commands
are *NOT* identical.   'su root' does not run the root 'login' scripts; thus
environment variables (including path, user, logname etc.) are *not* set as
they are on root login -- this causes some 'am i root' tests to fail.  OTOH,
'su - root' should be equivalent to a root login in all respects.

NOTE; there will be issues if the 'working directory' of a parent process is 
the directory you are trying to delete.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-28 Thread Gary Aitken

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.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Wojciech Puchar

what ls -lod empty says?

On Fri, 25 May 2012, Gary Aitken wrote:


On 05/25/12 14:38, Wojciech Puchar wrote:

chflags noschg is your friend.


Not in this case.
If you look at the commands attempted, that was already tried (line 282)
Topmost login had to be as root.


On Fri, 25 May 2012, 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



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Polytropon
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.



> > Without eexamining this behaviour in more detail, how about
> > this approach? Unmount the former system disk and newfs it?
> > That should "solve" the problem. :-)
> 
> Thought about that, but I wanted to understand what was going on.
> Ignorance is never a good excuse. :-)

True: IGNORANCE IS STRENGTH. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Gary Aitken
On 05/25/12 14:38, Wojciech Puchar wrote:
> chflags noschg is your friend.

Not in this case.
If you look at the commands attempted, that was already tried (line 282)
Topmost login had to be as root.
 
> On Fri, 25 May 2012, 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


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Gary Aitken
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.

> Without eexamining this behaviour in more detail, how about
> this approach? Unmount the former system disk and newfs it?
> That should "solve" the problem. :-)

Thought about that, but I wanted to understand what was going on.
Ignorance is never a good excuse. :-)

Gary
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Wojciech Puchar

chflags noschg is your friend.


On Fri, 25 May 2012, 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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Matthew Seaman
On 25/05/2012 22:04, Gary Aitken wrote:
> 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?

# chflags 0 /var/empty
# rm -rf /var/empty

is the usual idiom.

Cheers,

Matthew 

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey




signature.asc
Description: OpenPGP digital signature


Re: removing /var/empty on a non-system disk

2012-05-25 Thread Polytropon
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.

Without eexamining this behaviour in more detail, how about
this approach? Unmount the former system disk and newfs it?
That should "solve" the problem. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"


removing /var/empty on a non-system disk

2012-05-25 Thread Gary Aitken
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"