Re: boot -s shutdown q.?

2019-07-07 Thread Ingo Schwarze
Hi Harold,

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

> > 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



Re: boot -s shutdown q.?

2019-07-06 Thread 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 
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  wrote:
>
>> Hi Harold,
>>
>> harold felton wrote on Fri, Jul 05, 2019 at 11:16:01PM +:
>> > On Fri, Jul 05, 2019 at 10:39:55PM +, 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 -   1.52
>> +++ shutdown.c  6 Jul 2019 14:32:10 -
>> @@ -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


Re: boot -s shutdown q.?

2019-07-06 Thread 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  wrote:

> Hi Harold,
>
> harold felton wrote on Fri, Jul 05, 2019 at 11:16:01PM +:
> > On Fri, Jul 05, 2019 at 10:39:55PM +, 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 -   1.52
> +++ shutdown.c  6 Jul 2019 14:32:10 -
> @@ -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


Re: boot -s shutdown q.?

2019-07-06 Thread Ingo Schwarze
Hi Harold,

harold felton wrote on Fri, Jul 05, 2019 at 11:16:01PM +:
> On Fri, Jul 05, 2019 at 10:39:55PM +, 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 -   1.52
+++ shutdown.c  6 Jul 2019 14:32:10 -
@@ -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");



Re: boot -s shutdown q.?

2019-07-06 Thread harold felton
adding dmesg/hw-sensors...
hth, h.

On Fri, Jul 5, 2019 at 11:16 PM harold felton 
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  wrote:
>
>> On Fri, Jul 05, 2019 at 10:39:55PM +, 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
OpenBSD 6.5 (GENERIC.MP) #1: Mon May 27 18:27:59 CEST 2019

r...@syspatch-65-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 9604997120 (9160MB)
avail mem = 9304276992 (8873MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xe96e0 (74 entries)
bios0: vendor American Megatrends Inc. version "4.6.5" date 05/22/2014
bios0: ZOTAC ZBOX-ID88/ID89/ID90
acpi0 at bios0: rev 2
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT MCFG MSDM HPET SSDT SSDT SSDT BGRT
acpi0: wakeup devices P0P1(S4) USB1(S3) USB2(S3) USB3(S3) USB4(S3) USB5(S3) 
USB6(S3) USB7(S3) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) 
PXSX(S4) RP04(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i3-3220T CPU @ 2.80GHz, 2794.08 MHz, 06-3a-09
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,DEADLINE,XSAVE,AVX,F16C,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i3-3220T CPU @ 2.80GHz, 2793.65 MHz, 06-3a-09
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,DEADLINE,XSAVE,AVX,F16C,NXE,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0
acpimcfg0: addr 0xf800, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus 2 (RP01)
acpiprt3 at acpi0: bus 3 (RP02)
acpiprt4 at acpi0: bus 4 (RP03)
acpiprt5 at acpi0: bus -1 (RP04)
acpiprt6 at acpi0: bus 5 (RP05)
acpiprt7 at acpi0: bus -1 (RP06)
acpiprt8 at acpi0: bus -1 (RP07)
acpiprt9 at acpi0: bus -1 (RP08)
acpiprt10 at acpi0: bus 1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiprt13 at acpi0: bus -1 (PEG3)
acpiec0 at acpi0: not present
acpicpu0 at acpi0: C3(350@80 mwait.1@0x20), C2(500@59 mwait.1@0x10), C1(1000@1 
mwait.1), PSS
acpicpu1 at acpi0: C3(350@80 mwait.1@0x20), C2(500@59 mwait.1@0x10), C1(1000@1 
mwait.1), PSS
acpipwrres0 at acpi0: FN00, resource for FAN0
acpipwrres1 at acpi0: FN01, resource for FAN1
acpipwrres2 at acpi0: FN02, resource for FAN2
acpipwrres3 at acpi0: FN03, resource for FAN3
acpipwrres4 at acpi0: FN04, resource for FAN4
acpitz0 at acpi0: critical temperature is 92 degC
acpitz1 at acpi0: critical temperature is 92 degC
acpipci0 at acpi0 PCI0: 0x0010 0x0011 0x
acpicmos0 at acpi0
acpibtn0 at acpi0: PWRB
"PNP0C0B" at acpi0 not configured
"PNP0C0B" at acpi0 not configured
"PNP0C0B" at acpi0 not conf

Re: boot -s shutdown q.?

2019-07-06 Thread 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  wrote:

> On Fri, Jul 05, 2019 at 10:39:55PM +, 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


Re: boot -s shutdown q.?

2019-07-06 Thread Otto Moerbeek
On Fri, Jul 05, 2019 at 10:39:55PM +, 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