boot -s shutdown q.?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

boot -s shutdown q.?

harold felton
howdee,

just need a confirmation that there is something wrong
with my system since i dont have a spare running atm...

> boot -s
# shutdown now

i get an error message about "unveil" missing ?

tia, h.

ps - i would rather reinstall than try to debug but can
provide dmesg if nec.  (running 6.5-syspatch of amd64
from usb-sdcard on bare-metal zotac-id89 machine)
Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

Otto Moerbeek
On Fri, Jul 05, 2019 at 10:39:55PM +0000, harold felton wrote:

> howdee,
>
> just need a confirmation that there is something wrong
> with my system since i dont have a spare running atm...
>
> > boot -s
> # shutdown now
>
> i get an error message about "unveil" missing ?
>
> tia, h.
>
> ps - i would rather reinstall than try to debug but can
> provide dmesg if nec.  (running 6.5-syspatch of amd64
> from usb-sdcard on bare-metal zotac-id89 machine)

Why make life harder than needed for people who might want help you?
Give the exact error message.

        -Otto

Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

harold felton
uh - ok, but i had gone into single-user to run/fix some fsck-stuff
so i had assumed that somehow i mightve borked something...

shutdown: unveil: No such file or directory

is the exact message...

in-case-it-matters i hit RETURN for default sh ... since i was in
single-user
mode i wasnt able to run 'locate' and am basically assuming that i should
just recreate another sdcard (from cd) to start over...  basically, we had
an
earthquake here in socal yesterday and power got wonky...   also, i use a
kvm-switch between that-machine and this-one to write the email, so i needed
to go rerun the command-sequence just now...

should i reboot into full-multi-user and grab a dmesg as well ?  guess so...

brb, h.

On Sat, Jul 6, 2019 at 1:45 PM Otto Moerbeek <[hidden email]> wrote:

> On Fri, Jul 05, 2019 at 10:39:55PM +0000, harold felton wrote:
>
> > howdee,
> >
> > just need a confirmation that there is something wrong
> > with my system since i dont have a spare running atm...
> >
> > > boot -s
> > # shutdown now
> >
> > i get an error message about "unveil" missing ?
> >
> > tia, h.
> >
> > ps - i would rather reinstall than try to debug but can
> > provide dmesg if nec.  (running 6.5-syspatch of amd64
> > from usb-sdcard on bare-metal zotac-id89 machine)
>
> Why make life harder than needed for people who might want help you?
> Give the exact error message.
>
>         -Otto
>


--
harold at hfelton.com
Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

harold felton
adding dmesg/hw-sensors...
hth, h.

On Fri, Jul 5, 2019 at 11:16 PM harold felton <[hidden email]>
wrote:

> uh - ok, but i had gone into single-user to run/fix some fsck-stuff
> so i had assumed that somehow i mightve borked something...
>
> shutdown: unveil: No such file or directory
>
> is the exact message...
>
> in-case-it-matters i hit RETURN for default sh ... since i was in
> single-user
> mode i wasnt able to run 'locate' and am basically assuming that i should
> just recreate another sdcard (from cd) to start over...  basically, we had
> an
> earthquake here in socal yesterday and power got wonky...   also, i use a
> kvm-switch between that-machine and this-one to write the email, so i
> needed
> to go rerun the command-sequence just now...
>
> should i reboot into full-multi-user and grab a dmesg as well ?  guess
> so...
>
> brb, h.
>
> On Sat, Jul 6, 2019 at 1:45 PM Otto Moerbeek <[hidden email]> wrote:
>
>> On Fri, Jul 05, 2019 at 10:39:55PM +0000, harold felton wrote:
>>
>> > howdee,
>> >
>> > just need a confirmation that there is something wrong
>> > with my system since i dont have a spare running atm...
>> >
>> > > boot -s
>> > # shutdown now
>> >
>> > i get an error message about "unveil" missing ?
>> >
>> > tia, h.
>> >
>> > ps - i would rather reinstall than try to debug but can
>> > provide dmesg if nec.  (running 6.5-syspatch of amd64
>> > from usb-sdcard on bare-metal zotac-id89 machine)
>>
>> Why make life harder than needed for people who might want help you?
>> Give the exact error message.
>>
>>         -Otto
>>
>
>
> --
> harold at hfelton.com
>

--
harold at hfelton.com

dmesg-20190706-0717.txt (8K) Download Attachment
hw-sensors-20190706-0717.txt (727 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

Ingo Schwarze
In reply to this post by harold felton
Hi Harold,

harold felton wrote on Fri, Jul 05, 2019 at 11:16:01PM +0000:
> On Fri, Jul 05, 2019 at 10:39:55PM +0000, harold felton wrote:

>> boot -s

Did you mount(8) /usr between the above and the below?

>> # shutdown now

> shutdown: unveil: No such file or directory

If the answer to the above question is "no", then i suspect from
code inspection that the following patch may help (untested).

The point of the patch is tolerating unveil(2) failure if /usr/bin/
does not exist.  Later, trying to execle(3) _PATH_WALL will of
course fail, too, but that's harmless because it merely results in
the child dying with a syslog message.

All that said, in single user mode, it may be more reliable to
use halt(8) directly rather than trying to fire up a bloated
monster application suite like shutdown(8).

> ps - i would rather reinstall than try to debug

If the patch below helps, reinstalling is most likely not needed.

Does it help?
  Ingo

P.S.
If some crazy person deletes /etc or /sbin or runs shutdown(8)
from a directory that was deleted after changing into it,
similar failures look likely - but while that might want fixing,
too, and while printing the unveil argument in case of failure
might also make sense, the case of _PATH_WALL is probably the
most important one because not having /usr mounted wouldn't
seem all that unusual.


Index: shutdown.c
===================================================================
RCS file: /cvs/src/sbin/shutdown/shutdown.c,v
retrieving revision 1.52
diff -u -p -r1.52 shutdown.c
--- shutdown.c 3 Aug 2018 17:09:22 -0000 1.52
+++ shutdown.c 6 Jul 2019 14:32:10 -0000
@@ -169,7 +169,7 @@ main(int argc, char *argv[])
  err(1, "unveil");
  if (unveil(_PATH_RC, "r") == -1)
  err(1, "unveil");
- if (unveil(_PATH_WALL, "x") == -1)
+ if (unveil(_PATH_WALL, "x") == -1 && errno != ENOENT)
  err(1, "unveil");
  if (unveil(_PATH_FASTBOOT, "wc") == -1)
  err(1, "unveil");

Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

harold felton
thanx ingo,

correct - it did not occur to me to mount /usr since my single-user
skills are minimal, at best...  "halt" should have been my correct response
(rather than power-button 4-sec) and i will need to go spend a bit more
time to be able to try your untested-patch...  (ie - i need to do the
compile)

i WILL test it in a day or two and report back...  thank you for the
help and explanations...  apologies for being unclear at-the-start...

sincerely, harold felton.

On Sat, Jul 6, 2019 at 2:44 PM Ingo Schwarze <[hidden email]> wrote:

> Hi Harold,
>
> harold felton wrote on Fri, Jul 05, 2019 at 11:16:01PM +0000:
> > On Fri, Jul 05, 2019 at 10:39:55PM +0000, harold felton wrote:
>
> >> boot -s
>
> Did you mount(8) /usr between the above and the below?
>
> >> # shutdown now
>
> > shutdown: unveil: No such file or directory
>
> If the answer to the above question is "no", then i suspect from
> code inspection that the following patch may help (untested).
>
> The point of the patch is tolerating unveil(2) failure if /usr/bin/
> does not exist.  Later, trying to execle(3) _PATH_WALL will of
> course fail, too, but that's harmless because it merely results in
> the child dying with a syslog message.
>
> All that said, in single user mode, it may be more reliable to
> use halt(8) directly rather than trying to fire up a bloated
> monster application suite like shutdown(8).
>
> > ps - i would rather reinstall than try to debug
>
> If the patch below helps, reinstalling is most likely not needed.
>
> Does it help?
>   Ingo
>
> P.S.
> If some crazy person deletes /etc or /sbin or runs shutdown(8)
> from a directory that was deleted after changing into it,
> similar failures look likely - but while that might want fixing,
> too, and while printing the unveil argument in case of failure
> might also make sense, the case of _PATH_WALL is probably the
> most important one because not having /usr mounted wouldn't
> seem all that unusual.
>
>
> Index: shutdown.c
> ===================================================================
> RCS file: /cvs/src/sbin/shutdown/shutdown.c,v
> retrieving revision 1.52
> diff -u -p -r1.52 shutdown.c
> --- shutdown.c  3 Aug 2018 17:09:22 -0000       1.52
> +++ shutdown.c  6 Jul 2019 14:32:10 -0000
> @@ -169,7 +169,7 @@ main(int argc, char *argv[])
>                 err(1, "unveil");
>         if (unveil(_PATH_RC, "r") == -1)
>                 err(1, "unveil");
> -       if (unveil(_PATH_WALL, "x") == -1)
> +       if (unveil(_PATH_WALL, "x") == -1 && errno != ENOENT)
>                 err(1, "unveil");
>         if (unveil(_PATH_FASTBOOT, "wc") == -1)
>                 err(1, "unveil");
>


--
harold at hfelton.com
Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

harold felton
update: re-patch...

> boot -s
(only / mounted ro, other filesystems [/usr,..] not-mounted)
# shutdown now
shutdown: unveil: No such file or directory
(original version, and recompiled-default-version same-msg)

# shutdown.patch now
shutdown: unveil: Read-only file system

i started to try and look thru the code and was trying to
figure out how/whether i could help further...  i believe
the correct-answer, as mentioned before, is to just use
the correct command 'halt'...  (followed by 4-sec pwr-btn)

afaict, the 'die...()' routine is not actually getting run and
even if it did - the syslog() would fail also...

as part of this incarnation of this box - i have some oddities
in my file-system - so recompiling the kernel has been a bit
of a challenge...  for now, _I_ am no longer worried about the
problem of using /sbin/shutdown during a 'boot -s' session...

i will continue using everything as-is since i believe that
the system is basically running as normally as ever...

thank you, again, for all of your help...  :-)
sincerely, harold felton.

On Sat, Jul 6, 2019 at 12:04 AM harold felton <[hidden email]>
wrote:

> thanx ingo,
>
> correct - it did not occur to me to mount /usr since my single-user
> skills are minimal, at best...  "halt" should have been my correct response
> (rather than power-button 4-sec) and i will need to go spend a bit more
> time to be able to try your untested-patch...  (ie - i need to do the
> compile)
>
> i WILL test it in a day or two and report back...  thank you for the
> help and explanations...  apologies for being unclear at-the-start...
>
> sincerely, harold felton.
>
> On Sat, Jul 6, 2019 at 2:44 PM Ingo Schwarze <[hidden email]> wrote:
>
>> Hi Harold,
>>
>> harold felton wrote on Fri, Jul 05, 2019 at 11:16:01PM +0000:
>> > On Fri, Jul 05, 2019 at 10:39:55PM +0000, harold felton wrote:
>>
>> >> boot -s
>>
>> Did you mount(8) /usr between the above and the below?
>>
>> >> # shutdown now
>>
>> > shutdown: unveil: No such file or directory
>>
>> If the answer to the above question is "no", then i suspect from
>> code inspection that the following patch may help (untested).
>>
>> The point of the patch is tolerating unveil(2) failure if /usr/bin/
>> does not exist.  Later, trying to execle(3) _PATH_WALL will of
>> course fail, too, but that's harmless because it merely results in
>> the child dying with a syslog message.
>>
>> All that said, in single user mode, it may be more reliable to
>> use halt(8) directly rather than trying to fire up a bloated
>> monster application suite like shutdown(8).
>>
>> > ps - i would rather reinstall than try to debug
>>
>> If the patch below helps, reinstalling is most likely not needed.
>>
>> Does it help?
>>   Ingo
>>
>> P.S.
>> If some crazy person deletes /etc or /sbin or runs shutdown(8)
>> from a directory that was deleted after changing into it,
>> similar failures look likely - but while that might want fixing,
>> too, and while printing the unveil argument in case of failure
>> might also make sense, the case of _PATH_WALL is probably the
>> most important one because not having /usr mounted wouldn't
>> seem all that unusual.
>>
>>
>> Index: shutdown.c
>> ===================================================================
>> RCS file: /cvs/src/sbin/shutdown/shutdown.c,v
>> retrieving revision 1.52
>> diff -u -p -r1.52 shutdown.c
>> --- shutdown.c  3 Aug 2018 17:09:22 -0000       1.52
>> +++ shutdown.c  6 Jul 2019 14:32:10 -0000
>> @@ -169,7 +169,7 @@ main(int argc, char *argv[])
>>                 err(1, "unveil");
>>         if (unveil(_PATH_RC, "r") == -1)
>>                 err(1, "unveil");
>> -       if (unveil(_PATH_WALL, "x") == -1)
>> +       if (unveil(_PATH_WALL, "x") == -1 && errno != ENOENT)
>>                 err(1, "unveil");
>>         if (unveil(_PATH_FASTBOOT, "wc") == -1)
>>                 err(1, "unveil");
>>
>
>
> --
> harold at hfelton.com
>


--
harold at hfelton.com
Reply | Threaded
Open this post in threaded view
|

Re: boot -s shutdown q.?

Ingo Schwarze
Hi Harold,

harold felton wrote on Sat, Jul 06, 2019 at 12:52:12PM +0000:

> > boot -s
> (only / mounted ro, other filesystems [/usr,..] not-mounted)
> # shutdown now
> shutdown: unveil: No such file or directory
> (original version, and recompiled-default-version same-msg)
>
> # shutdown.patch now
> shutdown: unveil: Read-only file system

Yes, Bob Beck@ decided that's a bug in the kernel in the implementation
of the unveil(2) syscall, and he is working on a fix.

> i started to try and look thru the code and was trying to
> figure out how/whether i could help further...  i believe
> the correct-answer, as mentioned before, is to just use
> the correct command 'halt'...  (followed by 4-sec pwr-btn)

Yes, that's a workaround for now.
To reboot instead of halt, you can also use reboot(8).

[...]
> as part of this incarnation of this box - i have some oddities
> in my file-system - so recompiling the kernel has been a bit
> of a challenge...

Sure, compiling a kernel may not be convenient on every machine.

> for now, _I_ am no longer worried about the
> problem of using /sbin/shutdown during a 'boot -s' session...

Eventually, it will be fixed anyway, thanks for reporting.

> i will continue using everything as-is since i believe that
> the system is basically running as normally as ever...

Yes, from what you said, i see no indication either that you hosed
your box.  (Obviously, i can't vouch for it being OK either.)

Yours,
  Ingo