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 <hfeltonad...@hfelton.com>
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 <schwa...@usta.de> 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 via email to