Re: I finally bricked my NetBSD system

2020-07-20 Thread Brett Lymn
On Thu, Jul 16, 2020 at 10:19:59PM +0200, Jrn Clausen wrote:
> If you actually bricked your root account: boot single user and chsh to
> /bin/sh or /bin/csh.
> 
> I always keep /bin/sh as my root shell and do
> 
> if [ -x /usr/pkg/bin/tcsh ]; then
> exec /usr/pkg/bin/tcsh
> fi
> 
> in /root/.profile. I know why, and now you do too...
> 

Which works fine right up until you either decide to put /usr/pkg/bin on a 
remote
filesystem that becomes unavailable or some system problem such as a missing 
shared
library stops tcsh from running then you understand why this also is not a good
idea.

It would be safer to either create a shell alias so you can save keystrokes when
you log in or use another account with uid 0 as the favoured login.  I set the 
toor
account shell to bash and use that and leave root's shell as default.
 
-- 
Brett Lymn
--
Sent from my NetBSD device.

"We are were wolves",
"You mean werewolves?",
"No we were wolves, now we are something else entirely",
"Oh"


Re: I finally bricked my NetBSD system

2020-07-17 Thread Hisashi T Fujinaka

On Fri, 17 Jul 2020, Martin Husemann wrote:


On Thu, Jul 16, 2020 at 09:54:06PM -0700, Andy Ruhl wrote:

What about booting from install media and dropping /rescue/sh into
whatever the defined shell path is? Isn't that a statically linked
binary that should work pretty much anywhere? Isn't that kinda what
it's for?


Yes, that works too.

It mostly is intended for when you have really bricked your base install,
like broken libc.so or ld.elf_so - then you can still "boot -a" and ask
for /rescue/sh as shell.

I like the "cp some other shell to /usr/pkg/bin/tcsh" way as that allows
me to fully go multiuser and do all additional recover steps over the
network.


I do this from time-to-time. More often than I'd like to admit, because
one of my machines runs -current all the time.

Download the USB-compatible image. Burn it to a stick. Boot from the
stick into single-user mode (or drop into single-user mode from an
install image). Edit /etc/passwd using "ed".

I have to do something similar on my work machines when my Linux
updates break from time-to-time.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE + BSChem + BAEnglish + MSCS + $2.50 = coffee


Re: I finally bricked my NetBSD system

2020-07-17 Thread Niels Dettenbach



> Am 16.07.2020 um 22:16 schrieb Bob Bernstein :
> 
> Is there a work-around?

hmm,
you may mount the filesystem from another os or live system and untar the sets 
you‘ve used for installation again over it. This should give you at least a 
working base system back from where you may reinstall the packages

Re: I finally bricked my NetBSD system

2020-07-16 Thread Martin Husemann
On Thu, Jul 16, 2020 at 09:54:06PM -0700, Andy Ruhl wrote:
> What about booting from install media and dropping /rescue/sh into
> whatever the defined shell path is? Isn't that a statically linked
> binary that should work pretty much anywhere? Isn't that kinda what
> it's for?

Yes, that works too.

It mostly is intended for when you have really bricked your base install,
like broken libc.so or ld.elf_so - then you can still "boot -a" and ask
for /rescue/sh as shell.

I like the "cp some other shell to /usr/pkg/bin/tcsh" way as that allows
me to fully go multiuser and do all additional recover steps over the
network.

Martin


Re: I finally bricked my NetBSD system

2020-07-16 Thread Bob Bernstein

On Thu, 16 Jul 2020, Greg Troxel wrote:


What I would do is



export EDITOR=ed
export VISUAL=ed



Perhaps also "export TERM=cons25" would help.


I think that last one was the one that got me past having to 
learn a bit of ed for the first time in probably thirty years. 
vipw worked fine once it had a TERM.



The install cd/chroot suggestion is wise, btw.


Didn't see that one.

AS USUAL, thank you People of Planet NetBSD! May the Schwarz be 
with you!



--
 A test of right and wrong must be the means, one would
 think, of ascertaining what is right or wrong, and not a
 consequence of having already ascertained it.

   J. S. Mill


Re: I finally bricked my NetBSD system

2020-07-16 Thread Andy Ruhl
On Thu, Jul 16, 2020 at 9:28 PM Martin Husemann  wrote:
> Either set TERM and export it, or instead of chsh do some simple hack
> like:
>
> cp /bin/csh /usr/pkg/bin/tcsh

I'm not claiming this will work, just looking for feedback.

What about booting from install media and dropping /rescue/sh into
whatever the defined shell path is? Isn't that a statically linked
binary that should work pretty much anywhere? Isn't that kinda what
it's for?

Andy


Re: I finally bricked my NetBSD system

2020-07-16 Thread Martin Husemann
On Thu, Jul 16, 2020 at 06:21:57PM -0400, Bob Bernstein wrote:
> On Thu, 16 Jul 2020, Greg Troxel wrote:
> 
> > 2) boot single user, by hitting space during the countdown and "boot
> > -s".  hit return for sh.  Once there, type "fsck -p" to fix any issues.
> > Then "mount -a".  Then put back the shell with pkg_add, or use vipw to
> > change your shell back to /bin/sh.
> 
> vipw complains of no TERM being set, and /usr/bin/vi of an "undefined error:
> 0" after I enter 'chsh' at the root prompt I am now able to get back to.

Either set TERM and export it, or instead of chsh do some simple hack
like:

cp /bin/csh /usr/pkg/bin/tcsh

Martin


Re: I finally bricked my NetBSD system

2020-07-16 Thread Jörn Clausen
If you actually bricked your root account: boot single user and chsh to
/bin/sh or /bin/csh.

I always keep /bin/sh as my root shell and do

if [ -x /usr/pkg/bin/tcsh ]; then
exec /usr/pkg/bin/tcsh
fi

in /root/.profile. I know why, and now you do too...

On Thu, Jul 16, 2020 at 10:16 PM Bob Bernstein 
wrote:

> There's a long back-story to this event, but it's not important.
>
> Suffice to say that I removed all the packages from my system,
> including the shell I like at /usr/pkg/bin/tcsh, and now all my
> attempts to login are rejected because the shell cannot be
> found.
>
> Is there a work-around?
>
> Thank you
>
> --
>   A test of right and wrong must be the means, one would
>   think, of ascertaining what is right or wrong, and not a
>   consequence of having already ascertained it.
>
>J. S. Mill
>


-- 
Joern Clausen
https://www.oe-files.de/photography/


Re: I finally bricked my NetBSD system

2020-07-16 Thread Greg Troxel
Bob Bernstein  writes:

> On Thu, 16 Jul 2020, Greg Troxel wrote:
>
>> 2) boot single user, by hitting space during the countdown and "boot
>> -s".  hit return for sh.  Once there, type "fsck -p" to fix any
>> issues. Then "mount -a".  Then put back the shell with pkg_add, or
>> use vipw to change your shell back to /bin/sh.
>
> vipw complains of no TERM being set, and /usr/bin/vi of an "undefined
> error: 0" after I enter 'chsh' at the root prompt I am now able to get
> back to.

What I would do is

export EDITOR=ed
export VISUAL=ed

and try again.  For normals, read the ed(1) man page.  In all
seriousness, this is the first editor I learned, under Sixth Edition,
and it asssumes very little.

Perhaps also "export TERM=cons25" would help.

The install cd/chroot suggestion is wise, btw.


Re: I finally bricked my NetBSD system

2020-07-16 Thread Bob Bernstein

On Thu, 16 Jul 2020, Greg Troxel wrote:

2) boot single user, by hitting space during the countdown and 
"boot -s".  hit return for sh.  Once there, type "fsck -p" to 
fix any issues. Then "mount -a".  Then put back the shell with 
pkg_add, or use vipw to change your shell back to /bin/sh.


vipw complains of no TERM being set, and /usr/bin/vi of an 
"undefined error: 0" after I enter 'chsh' at the root prompt I 
am now able to get back to.


--
Bob B.


Re: I finally bricked my NetBSD system

2020-07-16 Thread Ottavio Caruso
On Thu, 16 Jul 2020 at 21:16, Bob Bernstein  wrote:
>
> There's a long back-story to this event, but it's not important.
>
> Suffice to say that I removed all the packages from my system,
> including the shell I like at /usr/pkg/bin/tcsh, and now all my
> attempts to login are rejected because the shell cannot be
> found.
>
> Is there a work-around?
>
> Thank you

Boot from the installation media, chroot and fix.


-- 
Ottavio Caruso


Re: I finally bricked my NetBSD system

2020-07-16 Thread Greg Troxel
Bob Bernstein  writes:

> There's a long back-story to this event, but it's not important.
>
> Suffice to say that I removed all the packages from my system,
> including the shell I like at /usr/pkg/bin/tcsh, and now all my
> attempts to login are rejected because the shell cannot be found.
>
> Is there a work-around?

1) remember the root password and log in as root on the console.  If you
changed the root shell away from /bin/sh, see step 2 but do not change
it ever again.

2) boot single user, by hitting space during the countdown and "boot
-s".  hit return for sh.  Once there, type "fsck -p" to fix any issues.
Then  "mount -a".   Then put back the shell with pkg_add, or use vipw to
change your shell back to /bin/sh.


I finally bricked my NetBSD system

2020-07-16 Thread Bob Bernstein

There's a long back-story to this event, but it's not important.

Suffice to say that I removed all the packages from my system, 
including the shell I like at /usr/pkg/bin/tcsh, and now all my 
attempts to login are rejected because the shell cannot be 
found.


Is there a work-around?

Thank you

--
 A test of right and wrong must be the means, one would
 think, of ascertaining what is right or wrong, and not a
 consequence of having already ascertained it.

  J. S. Mill