From nobody Mon Aug 16 13:26:48 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D4C731766228 for ; Mon, 16 Aug 2021 13:26:48 +0000 (UTC) (envelope-from mike@sentex.net) Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [IPv6:2607:f3e0:0:3::19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "pyroxene.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpFLb6qfHz4Scs; Mon, 16 Aug 2021 13:26:47 +0000 (UTC) (envelope-from mike@sentex.net) Received: from [IPv6:2607:f3e0:0:4:78b5:30bb:2779:eae2] ([IPv6:2607:f3e0:0:4:78b5:30bb:2779:eae2]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 17GDQkpS046050 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 16 Aug 2021 09:26:47 -0400 (EDT) (envelope-from mike@sentex.net) To: FreeBSD-STABLE Mailing List From: mike tancsa Subject: ipmi0: Watchdog set returned 0xc0 (releng_13) Message-ID: Date: Mon, 16 Aug 2021 09:26:48 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Rspamd-Queue-Id: 4GpFLb6qfHz4Scs X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mike@sentex.net designates 2607:f3e0:0:3::19 as permitted sender) smtp.mailfrom=mike@sentex.net X-Spamd-Result: default: False [1.90 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[mike]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f3e0::/32]; MIME_GOOD(-0.10)[text/plain]; HFILTER_HELO_IP_A(1.00)[pyroxene2a.sentex.ca]; HFILTER_HELO_NORES_A_OR_MX(0.30)[pyroxene2a.sentex.ca]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[sentex.net]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.999]; NEURAL_SPAM_LONG(1.00)[1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11647, ipnet:2607:f3e0::/32, country:CA]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[2607:f3e0:0:3::19:from] X-ThisMailContainsUnwantedMimeParts: N Hi All, =C2=A0=C2=A0=C2=A0 I updated a box from about a month ago, and noticed th= at the console is full of ipmi0: Watchdog set returned 0xc0 It fires every 30 seconds which is what I have the timer set to.=C2=A0 It= seems to be related to the ipmi watchdog as another box I have which uses ichwd doesnt spew a similar message. The only commit seems to be commit b41b86b65f10ccaa8cce8cc11a030ad464b654c0 Author: Alexander Motin Date:=C2=A0=C2=A0 Thu Jul 29 23:39:04 2021 -0400 Board is a Super Micro X11SCH-F. Bios 1.5 from 11/17/2020 My kernel is not that different from GENERIC. If I do a killall -9 watchdogd it reboots as expected. > device=C2=A0 cxgbe > device=C2=A0 cryptodev > options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 TCP_SIGNATURE > options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPSEC > options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = #firewall > options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL_VERB= OSE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #enable logging to syslogd(8) > options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL_VERB= OSE_LIMIT=3D9100=C2=A0=C2=A0=C2=A0 #limit verbosity > options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL_DEFA= ULT_TO_ACCEPT=C2=A0=C2=A0=C2=A0 #allow everything by default > > #options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ROUTETABLES=3D= 2 > option FIB_ALGO sysctl.conf is vfs.zfs.min_auto_ashift=3D12 net.inet.ip.redirect=3D0 net.inet6.ip6.redirect=3D0 kern.ipc.maxsockbuf=3D16777216 net.inet.tcp.blackhole=3D1 and loader.conf zfs_load=3D"YES" comconsole_speed=3D"115200"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # Set the= current serial console speed boot_multicons=3D"YES" boot_serial=3D"YES" console=3D"efi" ipmi_load=3D"YES" cpu_microcode_load=3D"YES" cpu_microcode_name=3D"/boot/firmware/intel-ucode.bin" comconsole_port=3D"0x2f8" if_disc_load=3D"YES" hw.cxgbe.toecaps_allowed=3D"0" hw.cxgbe.rdmacaps_allowed=3D"0" hw.cxgbe.iscsicaps_allowed=3D"0" hw.cxgbe.fcoecaps_allowed=3D"0" hw.cxgbe.pause_settings=3D"0" hw.cxgbe.attack_filter=3D"1" hw.cxgbe.drop_pkts_with_l3_errors=3D"1" vm.pmap.pti=3D0 net.inet.ip.fw.default_to_accept=3D1 contigmem_load=3D"YES" nic_uio_load=3D"YES" #hw.nic_uio.bdfs=3D"2:0:0,2:0:1" hw.nic_uio.bdfs=3D"2:0:0,2:0:1,2:0:2,2:0:3" hw.contigmem.num_buffers=3D2 hw.contigmem.buffer_size=3D1073741824 dpdk_lpm4_load=3D"YES" dpdk_lpm6_load=3D"YES" From nobody Mon Aug 16 14:09:31 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 770041769834 for ; Mon, 16 Aug 2021 14:09:34 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpGHy2W9mz4Y0D for ; Mon, 16 Aug 2021 14:09:34 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x82c.google.com with SMTP id t16so14275456qta.9 for ; Mon, 16 Aug 2021 07:09:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4qGAXoWx+FV/fs1Xx5n3ugrcoXWcNscNEH/tWQBdouE=; b=M8O9b8PVuH5ycsM8IfViyuya+ot2HPq8u/FffwB4vEV9n2viTIzNrRLM9H1rXFEn7a gas2GiQloD1doHk22lBBetg5qY5PGOhaKCCY1M6n/WjhTuKdtkI3XIoV3U7x8VoViL3l KB2E79jvcWJSMjH09EkxNPImwXqtoTD1NoWr1CzZthoz8J7T3OZ7ytfol96NQVBsBZGR Pu1mFKV6bbclgcmhM51S5W/X6VhZ/XxsoarRtL1c5D/QCZm+peyBH4Fa0TfDrHiqAO1a xBfXoUqS9J3Md/B8DqwDhsvEUvCvysyes/fMvU4otf6m1OryleB5NfbR2T5qRdXFC93J K8FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=4qGAXoWx+FV/fs1Xx5n3ugrcoXWcNscNEH/tWQBdouE=; b=E/Nwm/Lbn3O4StRqo2TT+3kCQ+u/bes8lfLrp1ePgArd65PhNbuMEW199r2KjozFiV T1Wr1xU0ztIHuZ0h4FAcW7OrV7iYTOzRLbBB7W6xbvZ+j2rRX9pgD6IM2a6E5HHYESHn NxNJ8cYfyh8IRMCEOIOiRStBNJqDIslLF6J4J4ePTeQCbWr/Sn/8ydV+ntzmVBgocbsa tfO0m+zw3tIZQz35an4L/WZzUqWr96vV8DnjAWXvRY7fikPznM1qkb1T/R1bO+T3IQWJ qGf+ghHpSHoswmNb1+YAsG7f4h7i2cTJmDEbLaK9hcTEvro7Xo9dHOJKBALTInf6mIVn RNyQ== X-Gm-Message-State: AOAM5311V9z8ZPg51kmMnQm7L3x37i2As7DNMFOiPCh7KoZYbBsSdo+O 97z8QdD06K+9em9xZ0Co3TbFmRn/tpo= X-Google-Smtp-Source: ABdhPJzYM/fQDzOHx7vKaAOVMsSZSvLVu9CbErsGTMScS+qbSfVKW/Ew38taBAlZMyhlgeOGxDIsAg== X-Received: by 2002:ac8:730b:: with SMTP id x11mr9236187qto.146.1629122973309; Mon, 16 Aug 2021 07:09:33 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id l1sm4749556qtk.63.2021.08.16.07.09.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Aug 2021 07:09:32 -0700 (PDT) Subject: Re: ipmi0: Watchdog set returned 0xc0 (releng_13) To: mike tancsa , FreeBSD-STABLE Mailing List References: From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raQ= Message-ID: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> Date: Mon, 16 Aug 2021 10:09:31 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4GpGHy2W9mz4Y0D X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi Mike, According to IPMI specification 0xc0 means: "Node Busy. Command could not be processed because command processing resources are temporarily unavailable." I have no idea what it means for the driver, but I suspect that you always have it inside, just before the mentioned commit it was quietly ignored. I can't propose much other that hide it again if errors like that get too widespread. I haven't seen errors like that on X11DPI-NT boards I've tested this. I saw 0xc9 if I set watchdog timeout below about a minute, for which I have no explanation either, but you may try to experiment with the different timeouts or pat intervals. The errors period of 30s seems interesting, considering default pat period in watchdogd of 10s. On 16.08.2021 09:26, mike tancsa wrote: > Hi All, > >     I updated a box from about a month ago, and noticed that the console > is full of > > ipmi0: Watchdog set returned 0xc0 > > It fires every 30 seconds which is what I have the timer set to.  It > seems to be related to the ipmi watchdog as another box I have which > uses ichwd doesnt spew a similar message. > > The only commit seems to be > > commit b41b86b65f10ccaa8cce8cc11a030ad464b654c0 > Author: Alexander Motin > Date:   Thu Jul 29 23:39:04 2021 -0400 > > Board is a Super Micro X11SCH-F. Bios 1.5 from 11/17/2020 > > My kernel is not that different from GENERIC. If I do a killall -9 > watchdogd it reboots as expected. > > >> device  cxgbe >> device  cryptodev >> options         TCP_SIGNATURE >> options         IPSEC >> options         IPFIREWALL              #firewall >> options         IPFIREWALL_VERBOSE      #enable logging to syslogd(8) >> options         IPFIREWALL_VERBOSE_LIMIT=9100    #limit verbosity >> options         IPFIREWALL_DEFAULT_TO_ACCEPT    #allow everything by > default >> >> #options         ROUTETABLES=2 >> option FIB_ALGO > > sysctl.conf is > > vfs.zfs.min_auto_ashift=12 > net.inet.ip.redirect=0 > net.inet6.ip6.redirect=0 > kern.ipc.maxsockbuf=16777216 > net.inet.tcp.blackhole=1 > > and loader.conf > > zfs_load="YES" > comconsole_speed="115200"       # Set the current serial console speed > boot_multicons="YES" > boot_serial="YES" > console="efi" > ipmi_load="YES" > cpu_microcode_load="YES" > cpu_microcode_name="/boot/firmware/intel-ucode.bin" > comconsole_port="0x2f8" > > if_disc_load="YES" > > hw.cxgbe.toecaps_allowed="0" > hw.cxgbe.rdmacaps_allowed="0" > hw.cxgbe.iscsicaps_allowed="0" > hw.cxgbe.fcoecaps_allowed="0" > hw.cxgbe.pause_settings="0" > hw.cxgbe.attack_filter="1" > hw.cxgbe.drop_pkts_with_l3_errors="1" > > vm.pmap.pti=0 > > net.inet.ip.fw.default_to_accept=1 > > > contigmem_load="YES" > nic_uio_load="YES" > #hw.nic_uio.bdfs="2:0:0,2:0:1" > hw.nic_uio.bdfs="2:0:0,2:0:1,2:0:2,2:0:3" > > hw.contigmem.num_buffers=2 > hw.contigmem.buffer_size=1073741824 > > dpdk_lpm4_load="YES" > dpdk_lpm6_load="YES" -- Alexander Motin From nobody Mon Aug 16 14:53:00 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E89F1176C565 for ; Mon, 16 Aug 2021 14:52:59 +0000 (UTC) (envelope-from mike@sentex.net) Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [IPv6:2607:f3e0:0:3::19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "pyroxene.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpHG35xySz4cqh; Mon, 16 Aug 2021 14:52:59 +0000 (UTC) (envelope-from mike@sentex.net) Received: from [IPv6:2607:f3e0:0:4:78b5:30bb:2779:eae2] ([IPv6:2607:f3e0:0:4:78b5:30bb:2779:eae2]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 17GEqx4P075269 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 16 Aug 2021 10:52:59 -0400 (EDT) (envelope-from mike@sentex.net) To: Alexander Motin , FreeBSD-STABLE Mailing List References: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> From: mike tancsa Subject: Re: ipmi0: Watchdog set returned 0xc0 (releng_13) Message-ID: <2c1ad9db-b92a-d0a8-b2ae-b3ffafc04604@sentex.net> Date: Mon, 16 Aug 2021 10:53:00 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Rspamd-Queue-Id: 4GpHG35xySz4cqh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi Alexander, =C2=A0=C2=A0=C2=A0 Thanks for the reply and info. Yes, you are right. I h= ad the timer set to -t 30, but it actually is printing every 10 seconds.=C2=A0 I had a= look in the BIOS, and other than the one Watchdog setting in the BIOS Enable or disable to turn on 5-minute watch dog timer. Upon timeout, JWD1 jumper determines system behavior.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 I dont see any other places to tweak the hardware watchdog. If I enable that, the box does indeed reboot after 5min, even though I have watchdogd running. I am not 100% sure, but on other Supermicro boards this used to work I think I dont have any other RELENG13 boxes on Supermicro boards to test just ye= t. One other thing I noticed was that if I boot up without ipmi loaded, /dev/fido is there. Does it still see a hardware watchdog somehow, or is that pointing to something else ? If I load the kld 0{r}# kldload ipmi ipmi0: port 0xca2,0xca3 on acpi0 ipmi0: KCS mode found at io 0xca2 on acpi ipmi0: IPMI device rev. 1, firmware rev. 1.23, version 2.0, device support mask 0xbf ipmi0: Number of channels 2 ipmi0: Attached watchdog ipmi0: Establishing power cycle handler 0{r}#=C2=A0 0{r}# watchdogd ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 0{r}# ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 I am going to look around for a BIOS update to see if there is some fix =C2=A0=C2=A0=C2=A0 ---Mike On 8/16/2021 10:09 AM, Alexander Motin wrote: > Hi Mike, > > According to IPMI specification 0xc0 means: "Node Busy. Command could > not be processed because command processing resources are temporarily > unavailable." I have no idea what it means for the driver, but I > suspect that you always have it inside, just before the mentioned commi= t > it was quietly ignored. I can't propose much other that hide it again > if errors like that get too widespread. I haven't seen errors like tha= t > on X11DPI-NT boards I've tested this. I saw 0xc9 if I set watchdog > timeout below about a minute, for which I have no explanation either, > but you may try to experiment with the different timeouts or pat > intervals. The errors period of 30s seems interesting, considering > default pat period in watchdogd of 10s. > > On 16.08.2021 09:26, mike tancsa wrote: >> Hi All, >> >> =C2=A0=C2=A0=C2=A0 I updated a box from about a month ago, and noticed= that the console >> is full of >> >> ipmi0: Watchdog set returned 0xc0 >> >> It fires every 30 seconds which is what I have the timer set to.=C2=A0= It >> seems to be related to the ipmi watchdog as another box I have which >> uses ichwd doesnt spew a similar message. >> >> The only commit seems to be >> >> commit b41b86b65f10ccaa8cce8cc11a030ad464b654c0 >> Author: Alexander Motin >> Date:=C2=A0=C2=A0 Thu Jul 29 23:39:04 2021 -0400 >> >> Board is a Super Micro X11SCH-F. Bios 1.5 from 11/17/2020 >> >> My kernel is not that different from GENERIC. If I do a killall -9 >> watchdogd it reboots as expected. >> >> >>> device=C2=A0 cxgbe >>> device=C2=A0 cryptodev >>> options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 TCP_SIGNATURE= >>> options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPSEC >>> options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= #firewall >>> options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL_VE= RBOSE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #enable logging to syslogd(8) >>> options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL_VE= RBOSE_LIMIT=3D9100=C2=A0=C2=A0=C2=A0 #limit verbosity >>> options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 IPFIREWALL_DE= FAULT_TO_ACCEPT=C2=A0=C2=A0=C2=A0 #allow everything by >> default >>> #options=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ROUTETABLES=3D= 2 >>> option FIB_ALGO >> sysctl.conf is >> >> vfs.zfs.min_auto_ashift=3D12 >> net.inet.ip.redirect=3D0 >> net.inet6.ip6.redirect=3D0 >> kern.ipc.maxsockbuf=3D16777216 >> net.inet.tcp.blackhole=3D1 >> >> and loader.conf >> >> zfs_load=3D"YES" >> comconsole_speed=3D"115200"=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # Set = the current serial console speed >> boot_multicons=3D"YES" >> boot_serial=3D"YES" >> console=3D"efi" >> ipmi_load=3D"YES" >> cpu_microcode_load=3D"YES" >> cpu_microcode_name=3D"/boot/firmware/intel-ucode.bin" >> comconsole_port=3D"0x2f8" >> >> if_disc_load=3D"YES" >> >> hw.cxgbe.toecaps_allowed=3D"0" >> hw.cxgbe.rdmacaps_allowed=3D"0" >> hw.cxgbe.iscsicaps_allowed=3D"0" >> hw.cxgbe.fcoecaps_allowed=3D"0" >> hw.cxgbe.pause_settings=3D"0" >> hw.cxgbe.attack_filter=3D"1" >> hw.cxgbe.drop_pkts_with_l3_errors=3D"1" >> >> vm.pmap.pti=3D0 >> >> net.inet.ip.fw.default_to_accept=3D1 >> >> >> contigmem_load=3D"YES" >> nic_uio_load=3D"YES" >> #hw.nic_uio.bdfs=3D"2:0:0,2:0:1" >> hw.nic_uio.bdfs=3D"2:0:0,2:0:1,2:0:2,2:0:3" >> >> hw.contigmem.num_buffers=3D2 >> hw.contigmem.buffer_size=3D1073741824 >> >> dpdk_lpm4_load=3D"YES" >> dpdk_lpm6_load=3D"YES" From nobody Mon Aug 16 23:45:29 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E9B3B176E139 for ; Mon, 16 Aug 2021 23:45:31 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpW4W5mSpz3v3B for ; Mon, 16 Aug 2021 23:45:31 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x829.google.com with SMTP id e15so15735328qtx.1 for ; Mon, 16 Aug 2021 16:45:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=buBvtFOW51EnRkv2v5p5orY5vNuH6aJCQATcUgXrcYQ=; b=AW0oZ3o1edpnwXo6HSHGE8fHBSFnlXGxXWjk4atcgLaV5V7VWubCiJ1yz/FjWciOGq mMue6ILRxB13vJra48vKkdw1Nw2nZ/g8uXFSasgQ2YKL6EnORywZOqPNw3W8J50SNxld VEluSDdnLuBwz+x4x+6DPjLGZKeoJbzdttCn/NTVpEdvzV8uKYz6k9vAjJCbWiw+l17c qolJx+5sDK7qAhRahbaoryyTornztSde1AcgRfsQIwN4tuVNO/Wp+L8ECYW+1SDuzAaJ LLZNizulYp/3di8+Fz/9onKx2LCprC63Pv6s0RvHm+hJug4st45/qZDvo2W8vWp7WAkG xdKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=buBvtFOW51EnRkv2v5p5orY5vNuH6aJCQATcUgXrcYQ=; b=YDLLbjyonFz4Fsb+4f+zVQF2wGG+rLE0BM+oiUvEXp7Tz2nNWYnAVja70yZAELp6mY TdrnzWKeoe/sHB3h59/hhtiTy/ydsQV+CEo8YjHDJDqkONzVe9QXBslx29wRfHXbWq6D 1qQf4I8TrKYdwe7CoTK4Hua06RNAldJvjUuHVdRjlLwN4IEiLP8sCSUoX5UQZB9Rgs0G pJqKaqwZMB6RxgDWiEfcU/CtJAonBxFGpX+bema4rMpgc5KAZuIWGZ487GsYHvpnDU8k 51oQe3a7VxYjjyITbfIcf8ZGzwAQx1xfpiV/pY6ppOcowlxmz6pPSpU4KZGdCd6JK6Rv VzDA== X-Gm-Message-State: AOAM531rx2CdNDCJ0PIeN4dbLCSKlqn8nXwwX0qkLWEZdeAjFxxK3G9O t2MIW6GteOuZpur4RF1FPsMfKf9j+Jw= X-Google-Smtp-Source: ABdhPJxkGDaNfzkh/4d1O/BxalUtbWuVAKobdzAAf/6g/mAhYFtzmjNZm1MhgRHISzJwqGq9d5hgdg== X-Received: by 2002:ac8:a0a:: with SMTP id b10mr526961qti.164.1629157530847; Mon, 16 Aug 2021 16:45:30 -0700 (PDT) Received: from spectre.mavhome.dp.ua (104-55-12-234.lightspeed.knvltn.sbcglobal.net. [104.55.12.234]) by smtp.gmail.com with ESMTPSA id d10sm253612qkk.0.2021.08.16.16.45.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Aug 2021 16:45:30 -0700 (PDT) Subject: Re: ipmi0: Watchdog set returned 0xc0 (releng_13) To: mike tancsa , FreeBSD-STABLE Mailing List References: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> <2c1ad9db-b92a-d0a8-b2ae-b3ffafc04604@sentex.net> From: Alexander Motin Message-ID: Date: Mon, 16 Aug 2021 19:45:29 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: <2c1ad9db-b92a-d0a8-b2ae-b3ffafc04604@sentex.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GpW4W5mSpz3v3B X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 16.08.2021 10:53, mike tancsa wrote: > One other thing I noticed was that if I boot up without ipmi loaded, > /dev/fido is there. Does it still see a hardware watchdog somehow, or is > that pointing to something else ? As I see in the watchdog driver code, the device is created just on module load, whenever the hardware present or not. Actually, if there is no hardware watchdog, modern kernel should attach a software one. It is obviously less reliable, but we successfully use that one in some of our products. > I am going to look around for a BIOS update to see if there is some fix I'd look more for BMC firmware update, not BIOS. Or both, if available. -- Alexander Motin From nobody Tue Aug 17 15:01:22 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 46F54176DEEB for ; Tue, 17 Aug 2021 15:01:23 +0000 (UTC) (envelope-from mike@sentex.net) Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [IPv6:2607:f3e0:0:3::19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "pyroxene.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GpvPH1KP0z4trD; Tue, 17 Aug 2021 15:01:23 +0000 (UTC) (envelope-from mike@sentex.net) Received: from [IPv6:2607:f3e0:0:4:e057:1f87:9b0b:1ac0] ([IPv6:2607:f3e0:0:4:e057:1f87:9b0b:1ac0]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 17HF1MM1049959 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Tue, 17 Aug 2021 11:01:22 -0400 (EDT) (envelope-from mike@sentex.net) To: Alexander Motin , FreeBSD-STABLE Mailing List References: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> <2c1ad9db-b92a-d0a8-b2ae-b3ffafc04604@sentex.net> From: mike tancsa Subject: Re: ipmi0: Watchdog set returned 0xc0 (releng_13) Message-ID: <2ebdf18a-159f-4e14-99d8-283183d5216e@sentex.net> Date: Tue, 17 Aug 2021 11:01:22 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Rspamd-Queue-Id: 4GpvPH1KP0z4trD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 8/16/2021 7:45 PM, Alexander Motin wrote: > >> I am going to look around for a BIOS update to see if there is some fi= x > I'd look more for BMC firmware update, not BIOS. Or both, if available= =2E Unfortunately no luck with the updates. I had the latest BIOS and I just updated the BMC code to the latest as well and I am still seeing the error messages. Actually, should the time interval not be more consistent with me running=C2=A0 "watchdogd -t 30" ? (I am running syslogd with -cc). It eventually seems to settle down into the expected 30 second interval, but it seems to be doing something extra at first ? Aug 17 10:54:00 r kernel: ipmi0: port 0xca2,0xca3 on acpi0 Aug 17 10:54:00 r kernel: ipmi0: KCS mode found at io 0xca2 on acpi Aug 17 10:54:00 r kernel: ipmi0: IPMI device rev. 1, firmware rev. 1.23, version 2.0, device support mask 0xbf Aug 17 10:54:00 r kernel: ipmi0: Number of channels 2 Aug 17 10:54:00 r kernel: ipmi0: Attached watchdog Aug 17 10:54:00 r kernel: ipmi0: Establishing power cycle handler Aug 17 10:54:17 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:54:17 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:54:17 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:54:33 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:54:33 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:54:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:55:00 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:55:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:55:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:55:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:55:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:55:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:56:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:56:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:56:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:56:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:56:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:56:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:57:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:57:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:57:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:57:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:57:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:57:48 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:58:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:58:18 r kernel: ipmi0: Watchdog set returned 0xcc Aug 17 10:58:18 r kernel: ipmi0: Watchdog set returned 0xcc =C2=A0=C2=A0=C2=A0 ---Mike From nobody Tue Aug 17 17:44:33 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F3AF317774F4 for ; Tue, 17 Aug 2021 17:44:33 +0000 (UTC) (envelope-from mike@sentex.net) Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [IPv6:2607:f3e0:0:3::19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "pyroxene.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gpz1Y61wZz3PkF; Tue, 17 Aug 2021 17:44:33 +0000 (UTC) (envelope-from mike@sentex.net) Received: from [IPv6:2607:f3e0:0:4:e057:1f87:9b0b:1ac0] ([IPv6:2607:f3e0:0:4:e057:1f87:9b0b:1ac0]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 17HHiXse000826 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Tue, 17 Aug 2021 13:44:33 -0400 (EDT) (envelope-from mike@sentex.net) Subject: Re: ipmi0: Watchdog set returned 0xc0 (releng_13) To: Alexander Motin , FreeBSD-STABLE Mailing List References: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> <2c1ad9db-b92a-d0a8-b2ae-b3ffafc04604@sentex.net> From: mike tancsa Message-ID: Date: Tue, 17 Aug 2021 13:44:33 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 4Gpz1Y61wZz3PkF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 8/16/2021 7:45 PM, Alexander Motin wrote: > > I'd look more for BMC firmware update, not BIOS. Or both, if available. FYI, I updated a RELENG_12 box which has a different SuperMicro board Handle 0x0002, DMI type 2, 15 bytes Base Board Information         Manufacturer: Supermicro         Product Name: X11SCL-F         Version: 1.01 and same issue ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0 ipmi0: Watchdog set returned 0xc0     ---Mike From nobody Tue Aug 17 19:31:42 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8123F174E391 for ; Tue, 17 Aug 2021 19:31:43 +0000 (UTC) (envelope-from mike@sentex.net) Received: from pyroxene2a.sentex.ca (pyroxene19.sentex.ca [IPv6:2607:f3e0:0:3::19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "pyroxene.sentex.ca", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gq1PB39Lwz3nYf; Tue, 17 Aug 2021 19:31:42 +0000 (UTC) (envelope-from mike@sentex.net) Received: from [IPv6:2607:f3e0:0:4:e057:1f87:9b0b:1ac0] ([IPv6:2607:f3e0:0:4:e057:1f87:9b0b:1ac0]) by pyroxene2a.sentex.ca (8.16.1/8.15.2) with ESMTPS id 17HJVfnW034225 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Tue, 17 Aug 2021 15:31:41 -0400 (EDT) (envelope-from mike@sentex.net) From: mike tancsa To: Alexander Motin , FreeBSD-STABLE Mailing List References: <51e58d7a-1b33-f7e3-13aa-3be5fee5c826@FreeBSD.org> <2c1ad9db-b92a-d0a8-b2ae-b3ffafc04604@sentex.net> Subject: Re: ipmi0: Watchdog set returned 0xc0 (releng_13) Message-ID: <1f0d32e1-e907-080f-1669-65148c245dd8@sentex.net> Date: Tue, 17 Aug 2021 15:31:42 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 Content-Language: en-US X-Rspamd-Queue-Id: 4Gq1PB39Lwz3nYf X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mike@sentex.net designates 2607:f3e0:0:3::19 as permitted sender) smtp.mailfrom=mike@sentex.net X-Spamd-Result: default: False [-0.79 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[mike]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f3e0::/32]; MIME_GOOD(-0.10)[text/plain]; HFILTER_HELO_IP_A(1.00)[pyroxene2a.sentex.ca]; HFILTER_HELO_NORES_A_OR_MX(0.30)[pyroxene2a.sentex.ca]; DMARC_NA(0.00)[sentex.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_DN_ALL(0.00)[]; MIME_BASE64_TEXT(0.10)[]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_SPAM_SHORT(0.21)[0.209]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11647, ipnet:2607:f3e0::/32, country:CA]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[2607:f3e0:0:3::19:from] X-ThisMailContainsUnwantedMimeParts: N QWN0dWFsbHksIGV2ZW4gc3RyYW5nZXIgbm93LCBJIHVwZGF0ZWQgdGhlIGJhc2Ugc3JjIGFu ZCBhbSBubyBsb25nZXINCmFibGUgdG8gcmVib290IHZpYSB3YXRjaGRvZw0KDQpJbnN0ZWFk LCBkbWVzZyBoYXMgdGhpcyBwb3AgdXANCg0KaXBtaTA6IFdhdGNoZG9nIHNldCByZXR1cm5l ZCAweGMwDQppcG1pMDogV2F0Y2hkb2cgc2V0IHJldHVybmVkIDB4YzANCmlwbWkwOiBXYXRj aGRvZyBzZXQgcmV0dXJuZWQgMHhjMA0KaXBtaTA6IFdhdGNoZG9nIHNldCByZXR1cm5lZCAw eGMwDQppcG1pMDogV2F0Y2hkb2cgc2V0IHJldHVybmVkIDB4YzANCmlwbWkwOiBXYXRjaGRv ZyBzZXQgcmV0dXJuZWQgMHhjMA0KaXBtaTA6IFdhdGNoZG9nIHNldCByZXR1cm5lZCAweGMw DQppcG1pMDogV2F0Y2hkb2cgc2V0IHJldHVybmVkIDB4YzANCmlwbWkwOiBXYXRjaGRvZyBz ZXQgcmV0dXJuZWQgMHhjMA0KaXBtaTA6IFdhdGNoZG9nIHNldCByZXR1cm5lZCAweGMwDQpp bnRlcnJ1cHTCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgdG90YWwNCmly cTQ6IHVhcnQwwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgIDQNCmNwdTA6dGltZXLCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoCA1NzI2DQpjcHUxOnRpbWVywqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgNDY5NA0KY3B1Mjp0aW1lcsKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDYwMDcNCmNw dTM6dGltZXLCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoCA0NDQ5DQppcnE0MjogeGhjaTDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqAgMzQ3DQppcnE0MzogYWhjaTDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDY0NDgNCmlycTQ0OiBpZ2IwOnJ4cTDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDEzMw0KaXJxNDU6IGlnYjA6 cnhxMcKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDE4MjUNCmlycTQ2 OiBpZ2IwOnJ4cTLCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oCA1DQppcnE0NzogaWdiMDpyeHEzwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqAgNA0KaXJxNDg6IGlnYjA6YXHCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgMg0KVG90YWzCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAyOTY0NA0KS0RCOiBzdGFjayBiYWNrdHJhY2U6DQoj MCAweGZmZmZmZmZmODBjNmFkNjUgYXQga2RiX2JhY2t0cmFjZSsweDY1DQojMSAweGZmZmZm ZmZmODBiYWY3NGQgYXQgaGFyZGNsb2NrKzB4MWJkDQojMiAweGZmZmZmZmZmODBiYjA3YzQg YXQgaGFuZGxlZXZlbnRzKzB4YjQNCiMzIDB4ZmZmZmZmZmY4MGJiMTUyZSBhdCB0aW1lcmNi KzB4MjRlDQojNCAweGZmZmZmZmZmODExNjVlZmIgYXQgbGFwaWNfaGFuZGxlX3RpbWVyKzB4 OWINCiM1IDB4ZmZmZmZmZmY4MTA3ZTdjMSBhdCBYdGltZXJpbnQrMHhiMQ0KIzYgMHhmZmZm ZmZmZjgxMDY4ZjBlIGF0IGNwdV9pZGxlX2FjcGkrMHgzZQ0KIzcgMHhmZmZmZmZmZjgxMDY4 ZmJmIGF0IGNwdV9pZGxlKzB4OWYNCiM4IDB4ZmZmZmZmZmY4MGM1Mjg2NCBhdCBzY2hlZF9p ZGxldGQrMHgyZTQNCiM5IDB4ZmZmZmZmZmY4MGJkYWZjZSBhdCBmb3JrX2V4aXQrMHg3ZQ0K IzEwIDB4ZmZmZmZmZmY4MTA3ZGFmZSBhdCBmb3JrX3RyYW1wb2xpbmUrMHhlDQoNCkEga2Vy bmVsIGZyb20gSnVsIDIyIGRvZXMgaW5kZWVkIHdvcmsuIExvb2tpbmcgYXQgdGhlIHNlbCBp bmZvIEkgYW0gYWJsZQ0KdG8gcmVib290IGl0IHdpdGggYSBraWxsYWxswqAgLTkgd2F0Y2hk b2dkLg0KDQpyb290QHIxM2F1ZzIxOi9ib290ICMgaXBtaXRvb2wgc2VsIGxpc3QgfCB0YWls IC0zDQrCoDFlZiB8IDA4LzE3LzIwMjEgfCAxNzo1MTo0OSB8IFNlc3Npb24gQXVkaXQgIzB4 ZmYgfMKgIHwgQXNzZXJ0ZWQNCsKgMWYwIHwgMDgvMTcvMjAyMSB8IDE4OjUyOjExIHwgV2F0 Y2hkb2cyICMweGNhIHwgVGltZXIgaW50ZXJydXB0ICgpIHwNCkFzc2VydGVkDQrCoDFmMSB8 IDA4LzE3LzIwMjEgfCAxODo1Mjo0NiB8IFdhdGNoZG9nMiAjMHhjYSB8IFBvd2VyIGN5Y2xl ICgpIHwgQXNzZXJ0ZWQNCnJvb3RAcjEzYXVnMjE6L2Jvb3QgIw0KDQoNCg0KDQo= From nobody Thu Aug 19 05:31:29 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 76FD6177051F for ; Thu, 19 Aug 2021 05:31:37 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (mail.ish.com.au [203.29.62.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqtfv4cVlz3FjR for ; Thu, 19 Aug 2021 05:31:35 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=Subject:From:To:MIME-Version:Date:Message-ID:Content-Type:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Y/eyL9NkeDe2dJ97Le1OhYBpepJssZ2rMdB9CdqvwVI=; b=tvKMgEu/mNjPW5Q9tPGL71yd8V o8s/8cBPNZKvTXjrPmF8OUNCakzSAZMpYrx3/OBDwu9m0lx6o/aQQFqwyb/k5HbDJk7oniVlXEzj2 /4sgG4VD8nfO9gkQlA+vQVcKebVGzIWISpzyyHwZ0wkoa2FPRPYLHnCZTWpDA6BK7iYLP05Y9mZ4V cxA6RtGPOZZui9PDUHyktWGxINBHmzR7/z0UrhI6+3WOCzFsMJP4cz0PFFMthoO0kq0Sfjtx2hF15 HlAW5DSrzrPEMlwIBTWg9Cme0SkRA2Fyl7khj0l8B5xlynXhWZuJHBs6TFvepFMkqhRHVnhrOCz0G AJcUxCMA==; Received: from [10.242.2.3] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1mGaeH-000GNl-UB for freebsd-stable@freebsd.org; Thu, 19 Aug 2021 15:31:29 +1000 Content-Type: multipart/alternative; boundary="------------3I5dazuS4QtlY0107pPjQxYY" Message-ID: Date: Thu, 19 Aug 2021 15:31:29 +1000 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Thunderbird/92.0 To: freebsd-stable Content-Language: en-AU Subject: Run script as root without sudo X-Rspamd-Queue-Id: 4Gqtfv4cVlz3FjR X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ish.com.au header.s=mail header.b="tvKMgEu/"; dmarc=pass (policy=quarantine) header.from=ish.com.au; spf=pass (mx1.freebsd.org: domain of ari@ish.com.au designates 203.29.62.212 as permitted sender) smtp.mailfrom=ari@ish.com.au X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ish.com.au:s=mail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:203.29.62.0/24]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[ish.com.au:+]; DMARC_POLICY_ALLOW(-0.50)[ish.com.au,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:7545, ipnet:203.29.62.0/24, country:AU]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Reply-To: ari@ish.com.au From: Aristedes Maniatis via freebsd-stable X-Original-From: Aristedes Maniatis X-ThisMailContainsUnwantedMimeParts: Y This is a multi-part message in MIME format. --------------3I5dazuS4QtlY0107pPjQxYY Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I've got some scripts which are intended to run on a new EC2 instance right after it is created. Since the script needs to install packages it need to run as root. But because I don't have sudo installed at this point (it is a brand new instance), I've only got 'su' to get root. The script itself is launched over SSH with the ec2-user account and there is no root password at this point in the startup. My first attempt was to put this inside the script itself: if ["$($whoami)" !="root" ];thenexec su -c"$0" exit1 fi But su complains that I'm not allowed to execute a command using the -c option as root. How else can I get this script running as root remotely in a completely unattended way? Cheers Ari Maniatis --------------3I5dazuS4QtlY0107pPjQxYY-- From nobody Thu Aug 19 06:16:32 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2DF1E17730CF for ; Thu, 19 Aug 2021 06:16:47 +0000 (UTC) (envelope-from jonc@chen.org.nz) Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqvg30g1mz3J6F for ; Thu, 19 Aug 2021 06:16:46 +0000 (UTC) (envelope-from jonc@chen.org.nz) Received: by mail-ot1-x32c.google.com with SMTP id 61-20020a9d0d430000b02903eabfc221a9so7452410oti.0 for ; Wed, 18 Aug 2021 23:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chen-org-nz.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2lTr2Dkm8Tj3MMhwewE2Avh47cZgqaur2mzSKopqCcc=; b=D0JK6qbjCWqmhxehjh7GyJty6JiIiv7UpaxhowMBSRbDrdEpgPvmXclTMm13hz9rtv zFfns80tezi+dgpTt8KArpx1IP6q49SHzuDzWWuTx8/Izej9aopRhz7tOXeSqwXIc8pt VorDBnsn7vIuBAyuFOpK32LTg2HKEtCYllQp7ay8rslo2DtJbIOrIfHDkSbTWyXyUIUV F8xjMM32zrJFpyTDY7Dn0YI3eRYf2/bycDaMNaFlnPn9CiC106HMt9g2KGKdBjJUOnyB 6iGs349s0+CGajRBHWVAmehmOpjm+BQkWqqyfmnP4XPpKUz5eEmx9vBDbPVZ6pJIHvSj GlWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2lTr2Dkm8Tj3MMhwewE2Avh47cZgqaur2mzSKopqCcc=; b=Jc9frpimXXJ3P3ufinnIM9xO7donPOoGz2jCvHuNSD9GA8V+B4Hf2OO7id160Fil6G o2ju+lk4urVQ2zFgmrF900HKh+UAZujKWEqFhGlQ0DHnGuy6b51WvrXSuSS5lb9oyCAm 5YKu7mAwFAQzsX31j0W/lqcg8408tQrLvfsoFEzxe2QOgQt7o87mhEkrdReYj0YtX++j 19ZzawdmdBdskokrOLD8jVFuz/TFscaxWwh1z7326Iw6fAe4WlUUnLbpdfR4OO5EU6L3 9F31VDCQmlGc3h2s2d9ZNzwA2DJEWXLWq9Xx1F9MvcMZkbxjJSD/84hY5K0naXr+TfuA /Qvg== X-Gm-Message-State: AOAM533UuJ2FgT2VcW6ej42QYWTMqWE9mSQajjxhhuV/ekrewtH6us6l AioB4m6ZUFrsJBcrwmzTGBgdrLojLZkkeze6r5CLecno/DU= X-Google-Smtp-Source: ABdhPJwrWC7YleX71taJkEMB0yNiiF3HW6FBmRu9MW6xECUHDd7OrF6DVbQKUZaR7jdrqEB1Ds+Nl+KN15oBa0LPOmg= X-Received: by 2002:a9d:4c89:: with SMTP id m9mr10918873otf.255.1629353806230; Wed, 18 Aug 2021 23:16:46 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Chen Date: Thu, 19 Aug 2021 18:16:32 +1200 Message-ID: Subject: Re: Run script as root without sudo To: ari@ish.com.au Cc: freebsd-stable Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Gqvg30g1mz3J6F X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, 19 Aug 2021 at 17:33, Aristedes Maniatis via freebsd-stable wrote: [...] > How else can I get this script running as root remotely in a completely > unattended way? The way it's usually done is with an rc script in /usr/local/etc/rc.d, eg: /usr/local/etc/rc.d/myscript and add the entry into /etc/rc.conf: myscript_enable="YES" The FreeBSD AWS instances uses this method to auto-install required packages. Cheers. -- Jonathan Chen From nobody Thu Aug 19 06:25:11 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1FB43177424B for ; Thu, 19 Aug 2021 06:25:15 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (mail.ish.com.au [203.29.62.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqvrq0Mtyz3LdB for ; Thu, 19 Aug 2021 06:25:14 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References: Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=12Z9gCx0zqWSdaW2fuFNM8mo4R4mtUXYYIOeoh8crDM=; b=2SOq+DYWXlo58xZYkZKbPJn3mh pKiXYW7Nnq+MsawQCYocTwFQOaPtBeBiSheG/QWUfWMKi2zOrNTffL0OwoSenL+D1JHVvZK/zBrWO 7KmT0/tvsPkDZSm+RAn3ZEPxZIOQKcnNNAv+JqqKsjofidWmcBRqQbUqwESCw3RLd4Dde3ngwwzxq o+n8WwtbuzuUZPkJFr3tj2d31pPH10Dd910+iuQ6t/hHIn3EbmV3qDGcpp27QzkDC2WcCIcr4MxHU PzXdj1rUDgb58HVqvh1eZFLXWrIj8F+iHHtlrol44+Acv7TrKbOqaZSNsANmFpHCulmGL8z96kFmf up1iqtNw==; Received: from [10.242.2.3] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1mGbUF-000JW8-Np; Thu, 19 Aug 2021 16:25:11 +1000 Message-ID: Date: Thu, 19 Aug 2021 16:25:11 +1000 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Thunderbird/92.0 Subject: Re: Run script as root without sudo Content-Language: en-AU To: Jonathan Chen Cc: freebsd-stable References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Gqvrq0Mtyz3LdB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: ari@ish.com.au From: Aristedes Maniatis via freebsd-stable X-Original-From: Aristedes Maniatis X-ThisMailContainsUnwantedMimeParts: N That would require root to put the file there and then to reboot the machine. Ari On 19/8/21 4:16pm, Jonathan Chen wrote: > On Thu, 19 Aug 2021 at 17:33, Aristedes Maniatis via freebsd-stable > wrote: > [...] >> How else can I get this script running as root remotely in a completely >> unattended way? > The way it's usually done is with an rc script in /usr/local/etc/rc.d, eg: > /usr/local/etc/rc.d/myscript > > and add the entry into /etc/rc.conf: > myscript_enable="YES" > > The FreeBSD AWS instances uses this method to auto-install required packages. > > Cheers. From nobody Thu Aug 19 06:34:43 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 65F5817754F0 for ; Thu, 19 Aug 2021 06:34:58 +0000 (UTC) (envelope-from jonc@chen.org.nz) Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqw422GRLz3N8F for ; Thu, 19 Aug 2021 06:34:58 +0000 (UTC) (envelope-from jonc@chen.org.nz) Received: by mail-ot1-x32a.google.com with SMTP id c19-20020a9d6153000000b0051829acbfc7so7405452otk.9 for ; Wed, 18 Aug 2021 23:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chen-org-nz.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=53TJV/In+NXoxLAIaWa8E352CmK896lGH6cXuD1TQ8Q=; b=x870XN9zObs1Fg5tkzN9S/fB+ZfZ0oPiG/VE6/mWt3VE2T8mKBjnpx0tVCF1oLJpeO 7/TK3VpyUqvljh2uuGFROZalb2Z1qMGmjVJ/elzU9mTfUOQ1BWVbmgEX+MBvIAD4LWKz ylkrpJCkDT3x8hifa0bsDh3vZM6bHHZNMk+X4hpHk48WdFGdbPuchfFBBkWMOzM9on0v miGaTkWaGJpwfvIBsrfWpfsTq8/LSByv8TzGH1dtKO49xKId2Ac8FDonhQO1aDZUnAXj z6jMaioBScCKfBMHNF7f67S3vsf2lzvTy8z30JK/Byh63kvvUFI6q35Xr5+5aWWc3nzQ DqYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=53TJV/In+NXoxLAIaWa8E352CmK896lGH6cXuD1TQ8Q=; b=sQBCUTIhbSBMYW1hThj3bd+9MMCC+YpOIXUkObn+uwzH9AIZ7hBXaITFv8sPuTT35V qnIzWHqXbi31tb22u/qAFtHS+SMGimM0ilt8Okduufwj2T2dIEotLx7LDyejdsAWHjll cK+AQiY/NMv0eppwiYFh6hPYkyJ3uchKIOV0cYUCPvosFe2UGIkdGpNXx+ZWINSfcZiZ L0duUmk8stcF8pRj8XcFyzILnBv7ykFG3lSajD59PhnMVFupgLbjgpgFTsJqNnJNJ9Dq 0VIKNRsDIxzvUgp2UqHFfxTssFHvWoSv4dQ1iEHT5pXJoNmKi8alFt3YD1/ZNbU0UNEO xf4g== X-Gm-Message-State: AOAM530sUgIpW08GcGaEq3PCkhxMbtXZ9oAIIKPz995n8TFPCGa3bC+E E6oiosvh1YeMEBfH6mDsoqGZuSraz7FW6VdWZjrMf2brAjw= X-Google-Smtp-Source: ABdhPJxo4KwYBQ3B2MZeLe7AJN4Zy20sbhiH0U5NqYaEE75cqhufQccdBgIgzkzAi5S9GoZ/rLyVkqYqTWQqZ4o/q6U= X-Received: by 2002:a05:6830:314b:: with SMTP id c11mr10923519ots.169.1629354897647; Wed, 18 Aug 2021 23:34:57 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Chen Date: Thu, 19 Aug 2021 18:34:43 +1200 Message-ID: Subject: Re: Run script as root without sudo To: Aristedes Maniatis Cc: freebsd-stable Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Gqw422GRLz3N8F X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, 19 Aug 2021 at 18:25, Aristedes Maniatis wrote: > > That would require root to put the file there and then to reboot the > machine. In which case, wouldn't it be simpler to just start a new instance, install your packages by hand, and then take a snapshot of the volume and convert it to a custom AMI instead? That way all new instances from your custom AMI will be preconfigured with the required packages. Cheers. -- Jonathan Chen From nobody Thu Aug 19 06:41:39 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 22F8F1776BEB for ; Thu, 19 Aug 2021 06:41:50 +0000 (UTC) (envelope-from matt.garber@gmail.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqwCy0MWDz3QXM for ; Thu, 19 Aug 2021 06:41:50 +0000 (UTC) (envelope-from matt.garber@gmail.com) Received: by mail-qk1-x72d.google.com with SMTP id p22so6031865qki.10 for ; Wed, 18 Aug 2021 23:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bDXDGhlC0IE9mUt1XMh3yhc7Prh52hDVvFyrh6GTpac=; b=EyfD1Kxks66XFDn/bW0vq1EEyBgU3XlfQakqlm4kN0poXbdN5uJxCv41x+lws/DCyg 3dh91LlI/gtUjLwIg2auOJFBQlpuDx8PXDh6QlhE31lwbRLdXtictUSU+wb9kB1LsclS qYp7OoxgHMdorWapoCiSx0cxTepApJ5Li6HLSvonZTlXRIbTyDC/ZPVXIlksLFwoKgUv QFPc9XQTTtFLj9JQOO+QmT6gwWz5d8Tvh61ll9zGpKTb9XxDVloLpLCffpOveysZKwOD zTOph7hdvp31Z27xKVYO2CbphEgxBXdvEUquAa6GNTMXpb3ivkr+G/8dBjKM0cf/Wl4G ZcFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bDXDGhlC0IE9mUt1XMh3yhc7Prh52hDVvFyrh6GTpac=; b=BLdWtkvgArXP8bs5YVQ5jccdzmfV5joIqtrDmFygUkoMw2M9Z2TpJk7n947/+c4jw2 NjkZE3ZU3Ez49N1WqReKYyZwHe8F7Lisnn+B9xOEs/qe3nTzNFYDrGO+wOPKswrQMNY6 JhKX/L0VMzrrP+xDIGEo3KrFD7JaDCNI/LmOuv1TufVy0jS2vzXCuVHaDRyq4HRxGiMi LKWGG7iSg8QlbOUD2VzgLN6lc8+Irgx/lgsjmIXiZ2lHxq2vGwcLnyiIUNs5zwqdltoN PEUU6upq/A4Ik1nSGnUe6dh3Kp7DJp+mnMucS1gkBi/Y9CincABCyrWQnEGyrVUoHi1v LVHQ== X-Gm-Message-State: AOAM531dFrCkqoc1wjwGxYoxqwrExX3dxfmdU0zTC1IzhWlynHaymtgO gq5s8abPs7vyxhcdqzjjOwB6QDCaRh9Pck7f2Y2XDagT X-Google-Smtp-Source: ABdhPJxEWcnm28BOYRs/WDg8FgINc8RVHi5dj1TaHq6pY0Vg9TtkS6i2ZaG5Op0CWwKRPBRf3KU+FCzMwGOzh594D0c= X-Received: by 2002:a37:6317:: with SMTP id x23mr2270592qkb.432.1629355309732; Wed, 18 Aug 2021 23:41:49 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Matt Garber Date: Thu, 19 Aug 2021 02:41:39 -0400 Message-ID: Subject: Re: Run script as root without sudo To: ari@ish.com.au Cc: freebsd-stable Content-Type: multipart/alternative; boundary="00000000000073197805c9e3d8f7" X-Rspamd-Queue-Id: 4GqwCy0MWDz3QXM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: Y --00000000000073197805c9e3d8f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > That would require root to put the file there and then to reboot the > machine. > > Ari As these are EC2 instances, you should be able to use user-data provided to the instance=E2=80=99s configinit (like cloud-init) with firstboot_pkgs_lis= t=3D=E2=80=9Csudo=E2=80=9D similar to Colin=E2=80=99s example here[1], and then run your script(s) usi= ng sudo like you originally expected to. [1]: https://www.daemonology.net/blog/2013-12-09-FreeBSD-EC2-configinit.htm= l Thanks, =E2=80=94Matt > --00000000000073197805c9e3d8f7-- From nobody Thu Aug 19 06:46:56 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 31B601758124 for ; Thu, 19 Aug 2021 06:47:10 +0000 (UTC) (envelope-from walterp@gmail.com) Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqwL51lH4z3hm6 for ; Thu, 19 Aug 2021 06:47:09 +0000 (UTC) (envelope-from walterp@gmail.com) Received: by mail-pj1-x102b.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so10666663pjr.1 for ; Wed, 18 Aug 2021 23:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=m1NMaKm5lbkVaLh/VJoGfAVu+NMVv2S0mfJZNLhIsAA=; b=sSuO/8BQFnQ6iUYykNdyQqZxVLGPCQxH1Ln3OrkHJZWXvdCl22uqvj9e+7136MkT/L Vnboy24OVlelWB06iEsGpeortZQLq1kMOTf8W+N4h5+hRuMAjyLEq5xMgg3ergTpMRu+ W3S9VS+xLaALcL3yneVam1Wku49TvvLLtXrxXrQAfTN361co6uv/lXNPggAjWcvXoDV3 JT4jFtg67iY6MX/nXAS+aU7jcbiLjp0cndmBJwy197NcyOMwlQ1KvtzGYUXK7HXIWW4o xniIKK+SZMbp0XMWhrfTph17z4F/8m8ooex8Szs4MBS72sgr877bj288fLRR8xpfTEAe eRjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=m1NMaKm5lbkVaLh/VJoGfAVu+NMVv2S0mfJZNLhIsAA=; b=B9IpoDTlg/S5ei3DLGz5xH1wTojVDbHkQpwg+axBCpsKl5VA17gCZyv1BNSage2HZC 89ouaXe1nHMsAh/M1n9BBugrUeRzJv41/P2TNHX50wBqS4bfITHkk0YDPmxBj2GYieEv if17jOHwkV2zW+7WR+9kF1Wb+yn3tRw2IZPdj6eoN/onTHYMhBQZzuENAnWPJo8Vnef6 IE641RGW42nNMqevZbSaN59nf+wxZHlEQLxumFMk9XI3vUcMYmsF6yX7PS3o++8m64hH jIOGhBc6W5k7f4RYyzh7ibcjVRjd8x+/NU+SMCbftkIVHwObZn7Nl16Va08zJBwy9+gi vH9Q== X-Gm-Message-State: AOAM531hk7TeikNN/BRaJK9NliW4RAUo963Urmlkc20oa/vlQ7Txhb42 eydoAX/3ZRz8XmKNQ8NfZlSWc3jkCqIzbEJf/2Znv8fhTzo= X-Google-Smtp-Source: ABdhPJwi6AvG5iWMT54azl/KiahISMEeWd2xRiwCIiN5qtRzEN04ACb0ijBaVG88PNiIcR5WyGW/15j5uhLcw4/2j+E= X-Received: by 2002:a17:90a:3d4d:: with SMTP id o13mr13885404pjf.34.1629355627967; Wed, 18 Aug 2021 23:47:07 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Walter Parker Date: Wed, 18 Aug 2021 23:46:56 -0700 Message-ID: Subject: Re: Run script as root without sudo To: freebsd-stable Content-Type: multipart/alternative; boundary="0000000000006af91b05c9e3eb1d" X-Rspamd-Queue-Id: 4GqwL51lH4z3hm6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b="sSuO/8BQ"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of walterp@gmail.com designates 2607:f8b0:4864:20::102b as permitted sender) smtp.mailfrom=walterp@gmail.com X-Spamd-Result: default: False [-2.55 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-stable@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::102b:from]; NEURAL_SPAM_SHORT(0.45)[0.448]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-ThisMailContainsUnwantedMimeParts: Y --0000000000006af91b05c9e3eb1d Content-Type: text/plain; charset="UTF-8" On Wed, Aug 18, 2021 at 11:36 PM Jonathan Chen wrote: > On Thu, 19 Aug 2021 at 18:25, Aristedes Maniatis wrote: > > > > That would require root to put the file there and then to reboot the > > machine. > > In which case, wouldn't it be simpler to just start a new instance, > install your packages by hand, and then take a snapshot of the volume > and convert it to a custom AMI instead? That way all new instances > from your custom AMI will be preconfigured with the required packages. > > Cheers. > -- > Jonathan Chen > > With the recent AWS work that I've done, I've used CloudFormation Templates to set up the EC2 instances. If you do that, you can add set up commands to the CF template that the EC23 will run as root when the system boots. That is how I've been installing software on new EC2 instances. It works pretty slick. It makes things very repeatable. Walter -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis --0000000000006af91b05c9e3eb1d-- From nobody Thu Aug 19 08:21:04 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7AD98175E375 for ; Thu, 19 Aug 2021 08:21:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqyQf2490z3qxg for ; Thu, 19 Aug 2021 08:21:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: (Authenticated sender: andriy.gapon@uabsd.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 61DA9240009; Thu, 19 Aug 2021 08:21:06 +0000 (UTC) Subject: Re: Run script as root without sudo To: ari@ish.com.au, freebsd-stable References: From: Andriy Gapon Message-ID: <50738b08-8179-46d6-24fe-b2674e4f6c67@FreeBSD.org> Date: Thu, 19 Aug 2021 11:21:04 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GqyQf2490z3qxg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 2021-08-19 08:31, Aristedes Maniatis via freebsd-stable wrote: > I've got some scripts which are intended to run on a new EC2 instance > right after it is created. Since the script needs to install packages it > need to run as root. But because I don't have sudo installed at this > point (it is a brand new instance), I've only got 'su' to get root. > > The script itself is launched over SSH with the ec2-user account and > there is no root password at this point in the startup. > > My first attempt was to put this inside the script itself: > > if ["$($whoami)" !="root" ];thenexec su -c"$0" exit1 fi > > > But su complains that I'm not allowed to execute a command using the -c > option as root. -c option seems to be so confusing for some reason that it should bein some FAQ document. >From the man page: -c class Use the settings of the specified login class. The login class must be defined in login.conf(5). Only allowed for the super- user. You surely though that it did something else, right? >From the man page again: If the optional args are provided on the command line, they are passed to the login shell of the target login. Note that all command line arguments before the target login name are processed by su itself, everything after the target login name gets passed to the login shell. > How else can I get this script running as root remotely in a completely > unattended way? -- Andriy Gapon From nobody Thu Aug 19 08:33:17 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 95D9F175F8A3 for ; Thu, 19 Aug 2021 08:33:26 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (mail.ish.com.au [203.29.62.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqyhk3qm1z3shg; Thu, 19 Aug 2021 08:33:26 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References: To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=SB1yAlj+mtINpHeP2YNq5vbNII5xJg5L8iy+1KFKmfc=; b=jCiLeDHAoQTuOk8APxSrQR8XtL lQ0P3I+SVjhR7DUoZoa65AjUdtGxzMJJcKuALULWZ4EXpXA52/Ug2xWks7L/BmA85e52Q3rZ3MAPN YdBlOENjYSz7JW/6Y4t409HRvi6CdzZm+6rPEMeEgD3SUy6CMSWB6D4hS4Frx6knS33c1erjaADsN 6cTkU+CSPhzOkZCiFWnLgs1Mb5K1uzN9g7eBMWkkyPCm9nNMeJUa1ro1JmX9yB9eRatolNgL71tku Xj8f3CJPkaJPbnei5tpYl6ZV+dUbBQFq0+22advGcBG1jVzH+NsXtUYfGUuqHMmdLx7/ssyLAc0N+ zYNsn2DA==; Received: from [10.242.2.3] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1mGdUE-0001ni-MN; Thu, 19 Aug 2021 18:33:18 +1000 Message-ID: Date: Thu, 19 Aug 2021 18:33:17 +1000 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Thunderbird/92.0 Subject: Re: Run script as root without sudo Content-Language: en-AU To: Andriy Gapon , freebsd-stable References: <50738b08-8179-46d6-24fe-b2674e4f6c67@FreeBSD.org> In-Reply-To: <50738b08-8179-46d6-24fe-b2674e4f6c67@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Gqyhk3qm1z3shg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: ari@ish.com.au From: Aristedes Maniatis via freebsd-stable X-Original-From: Aristedes Maniatis X-ThisMailContainsUnwantedMimeParts: N The man page is very confusing. Yes, it says -c is class. But it also has examples like this:  su -m operator -c 'shutdown -p now' In my testing, this works: $ su - root -c 'date' Thu Aug 19 08:31:53 UTC 2021 and this does not: $ su - root 'date' date: No such file or directory. What is -c supposed to do? Ari On 19/8/21 6:21pm, Andriy Gapon wrote: > On 2021-08-19 08:31, Aristedes Maniatis via freebsd-stable wrote: >> I've got some scripts which are intended to run on a new EC2 instance >> right after it is created. Since the script needs to install packages it >> need to run as root. But because I don't have sudo installed at this >> point (it is a brand new instance), I've only got 'su' to get root. >> >> The script itself is launched over SSH with the ec2-user account and >> there is no root password at this point in the startup. >> >> My first attempt was to put this inside the script itself: >> >> if ["$($whoami)" !="root" ];thenexec su -c"$0" exit1 fi >> >> >> But su complains that I'm not allowed to execute a command using the -c >> option as root. > -c option seems to be so confusing for some reason that it should bein > some FAQ document. > > From the man page: > -c class > Use the settings of the specified login class. The login class > must be defined in login.conf(5). Only allowed for the super- > user. > > You surely though that it did something else, right? > From the man page again: > If the optional args are provided on the command line, they are > passed to > the login shell of the target login. Note that all command line > arguments before the target login name are processed by su itself, > everything after the target login name gets passed to the login shell. > >> How else can I get this script running as root remotely in a completely >> unattended way? > From nobody Thu Aug 19 08:35:54 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 308BE17687B9 for ; Thu, 19 Aug 2021 08:35:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqyld6R6Rz3th9 for ; Thu, 19 Aug 2021 08:35:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: (Authenticated sender: andriy.gapon@uabsd.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id A92E54000B; Thu, 19 Aug 2021 08:35:55 +0000 (UTC) Subject: Re: Run script as root without sudo To: Aristedes Maniatis , freebsd-stable References: <50738b08-8179-46d6-24fe-b2674e4f6c67@FreeBSD.org> From: Andriy Gapon Message-ID: Date: Thu, 19 Aug 2021 11:35:54 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Gqyld6R6Rz3th9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 2021-08-19 11:33, Aristedes Maniatis wrote: > The man page is very confusing. Yes, it says -c is class. But it also > has examples like this: > >  su -m operator -c 'shutdown -p now' > > > > In my testing, this works: > > $ su - root -c 'date' > Thu Aug 19 08:31:53 UTC 2021 > > and this does not: > > $ su - root 'date' > date: No such file or directory. > > > What is -c supposed to do? I thought that I answered that question, even before you asked, with the second quote from the manual page. > > On 19/8/21 6:21pm, Andriy Gapon wrote: >> On 2021-08-19 08:31, Aristedes Maniatis via freebsd-stable wrote: >>> I've got some scripts which are intended to run on a new EC2 instance >>> right after it is created. Since the script needs to install packages it >>> need to run as root. But because I don't have sudo installed at this >>> point (it is a brand new instance), I've only got 'su' to get root. >>> >>> The script itself is launched over SSH with the ec2-user account and >>> there is no root password at this point in the startup. >>> >>> My first attempt was to put this inside the script itself: >>> >>> if ["$($whoami)" !="root" ];thenexec su -c"$0" exit1 fi >>> >>> >>> But su complains that I'm not allowed to execute a command using the -c >>> option as root. >> -c option seems to be so confusing for some reason that it should bein >> some FAQ document. >> >>  From the man page: >>       -c class >>               Use the settings of the specified login class.  The >> login class >>               must be defined in login.conf(5).  Only allowed for the >> super- >>               user. >> >> You surely though that it did something else, right? >>  From the man page again: >>       If the optional args are provided on the command line, they are >> passed to >>       the login shell of the target login.  Note that all command line >>       arguments before the target login name are processed by su itself, >>       everything after the target login name gets passed to the login >> shell. >> >>> How else can I get this script running as root remotely in a completely >>> unattended way? >> > -- Andriy Gapon From nobody Thu Aug 19 08:41:37 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DA5ED17699C3 for ; Thu, 19 Aug 2021 08:41:47 +0000 (UTC) (envelope-from hausen@punkt.de) Received: from mail.punkt.de (mail.punkt.de [IPv6:2a00:b580:8000:11:1c6b:7032:35e9:5616]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqytM54J8z3vjJ for ; Thu, 19 Aug 2021 08:41:47 +0000 (UTC) (envelope-from hausen@punkt.de) Received: from smtpclient.apple (kagate.punkt.de [217.29.33.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.punkt.de (Postfix) with ESMTPSA id 0076F203FE; Thu, 19 Aug 2021 10:41:38 +0200 (CEST) Content-Type: text/plain; charset=utf-8 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Run script as root without sudo From: "Patrick M. Hausen" In-Reply-To: Date: Thu, 19 Aug 2021 10:41:37 +0200 Cc: freebsd-stable Content-Transfer-Encoding: quoted-printable Message-Id: References: <50738b08-8179-46d6-24fe-b2674e4f6c67@FreeBSD.org> To: ari@ish.com.au X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4GqytM54J8z3vjJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi Ari, > Am 19.08.2021 um 10:33 schrieb Aristedes Maniatis via freebsd-stable = : >=20 > The man page is very confusing. Yes, it says -c is class. But it also = has examples like this: > [...] > What is -c supposed to do? Everything after the user name is handed to /bin/sh. So it's executing sh -c command ... That's why it doesn't work without -c in most cases. Kind regards, Patrick --=20 punkt.de GmbH Patrick M. Hausen .infrastructure Kaiserallee 13a 76133 Karlsruhe Tel. +49 721 9109500 https://infrastructure.punkt.de info@punkt.de AG Mannheim 108285 Gesch=C3=A4ftsf=C3=BChrer: J=C3=BCrgen Egeling, Daniel Lienert, Fabian = Stein From nobody Thu Aug 19 08:46:55 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CBCC9176AFB5 for ; Thu, 19 Aug 2021 08:47:02 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (mail.ish.com.au [203.29.62.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gqz0Q51Hwz4RK9; Thu, 19 Aug 2021 08:47:02 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=In-Reply-To:From:References:To:Subject:MIME-Version:Date:Message-ID :Content-Type:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7uMlozfrt5+QzFzpZlwJuUXP2cTdyyQOlSTUrIKgEWA=; b=C7NUjtsqp93dFpsmmRgqnFyeyj V5xw64xgFOnJV9JwIIjEunCnl/baarwMtO6UqH3P0vWTOSLTFZDDN05nMYCAXVVr9xbPuwdkvZXDQ /ZMnYY6ap3Xh9Kbg6asOkeF/SJlL7xTwIPC54ZeHzhrKOPaKsiu6IHGt0TJYzMttDQwCzlMbOwsNw SPtijZvsux/KkN9wyTvTeBAsp7qhhKJiG7t+ecSVmvFbab/RQgdNM29I+udkTp9T1xxwXIl8Ev6i3 K0eo25uVWnOVbVboCCwnLC8sEwrlKC/ZClsf9YTPGQkvjhMFpuEIqgq/A3wjOsZfiTIJ2qZvxOF6d tZIh2eVg==; Received: from [10.242.2.3] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1mGdhQ-0002bu-LB; Thu, 19 Aug 2021 18:46:56 +1000 Content-Type: multipart/alternative; boundary="------------EanryzOwFEHnvyX2gb6DxPJ8" Message-ID: <5e990c53-2dbc-48ab-749f-2478d96620ae@ish.com.au> Date: Thu, 19 Aug 2021 18:46:55 +1000 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Thunderbird/92.0 Subject: Re: Run script as root without sudo Content-Language: en-AU To: Andriy Gapon , freebsd-stable References: <50738b08-8179-46d6-24fe-b2674e4f6c67@FreeBSD.org> In-Reply-To: X-Rspamd-Queue-Id: 4Gqz0Q51Hwz4RK9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: ari@ish.com.au From: Aristedes Maniatis via freebsd-stable X-Original-From: Aristedes Maniatis X-ThisMailContainsUnwantedMimeParts: Y This is a multi-part message in MIME format. --------------EanryzOwFEHnvyX2gb6DxPJ8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Oh!!! -c is a csh option.... Someone had to have created that command structure as a practical joke on a co-worker back in about 1975... Let's make the login user optional, but if you opt not to use it the next argument works completely differently. Now that I understand it, I see which parts of the man page I didn't read clearly. And then on top of that the linux su command actually has a -c option, so of course all those docs out there are leading in the wrong direction. Thanks for your help. Ari On 19/8/21 6:35pm, Andriy Gapon wrote: >> What is -c supposed to do? > I thought that I answered that question, even before you asked, with the > second quote from the manual page. > --------------EanryzOwFEHnvyX2gb6DxPJ8-- From nobody Fri Aug 20 03:15:59 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2B43E1758ED3 for ; Fri, 20 Aug 2021 03:16:15 +0000 (UTC) (envelope-from mil@milshop.ru) Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrRcG1m0Mz4hRb for ; Fri, 20 Aug 2021 03:16:14 +0000 (UTC) (envelope-from mil@milshop.ru) Received: by mail-lf1-x141.google.com with SMTP id r9so17437917lfn.3 for ; Thu, 19 Aug 2021 20:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=milshop-ru.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=sUZDBFoaoJnAjX+zkc07+r3B9VEjxwLsee0HFF9JzoA=; b=KWNlnGaiFfG3SnSPrFq5+kIvJVXRWbF4HJsZia8fY82SauY9gw/cXLlQq6jsjqXslK 0eicZNoSoeuLgdx9g0iE5TYRm9x7l+9kwbLbac+U1l7dj/gMFYBxWyBkIgR1mVDzS+YU 02wzpZPPQogeMYDwCc6aJXVEY4zzl9wXNSTDCDoBUCRpFYs1eg64u4ZRxWiIPVJIvd+V pkmpcxIHnQcnZWJdcHvzIE2VfHPOa0rO59+jmn15HBSuqhQRsW9VqkIW28HOQ4Z6OK56 /Kn4R5MV2KJjOfXj5O+47R2rlxOZyH+Pio3S6uWKx3nORfZ+W75nYBzejFcibAmih1zz tAEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=sUZDBFoaoJnAjX+zkc07+r3B9VEjxwLsee0HFF9JzoA=; b=rz9M6G9gfeC2sj2JJDQfrAFlAx7XQizvPFQySDXX4QHVtIiqUSDTVdix+lkmFkRhE7 l03oGBH5pZmafSjDW+Qgu9KOJgFo/WB+qtqz7M+m5tTU97OZIRbi+3tmnpPT7YAXuayu lm8VSsZ3XZn+S3UwZLF6yfn7Ck961n0thkdU2w1bB5t2FXJZ4wPYjzScgvfytDBM3UGp lQeso7wyje78oR1/2KkBCniM17UaV1uyMGd658k4S7pvjPyRqzfsFP7lys0tTJnHfbyZ jvVRl4b0e0r/NyTiSpZl2ADt0rVtUIZ/N+WWkjLWD3hFnK2NR/ZIi9MPU0ypEKUCUG3L GSGw== X-Gm-Message-State: AOAM533phSioakXC/SC9vNt4fiur8o/Bj7MLCXiAWTYJE238Mdb2Y2hu zVgric6pStq6VqwKb97bw8D8hiiIbguEPN0iyTuB7vQcQhW1JHR8deXMJg== X-Google-Smtp-Source: ABdhPJzCKVGxrMxOSf7FzIKbO+JV0XewiPEa8LDcVATro9UvhdZo0ruT0YVWg6I8UXvUneXMqB43YfnI2KTFn4A2llo= X-Received: by 2002:a05:6512:2017:: with SMTP id a23mr12956758lfb.27.1629429371241; Thu, 19 Aug 2021 20:16:11 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 From: Eugene Kazarinov Date: Thu, 19 Aug 2021 22:15:59 -0500 Message-ID: Subject: FreeBSD nullfs jail To: freebsd-stable Content-Type: multipart/alternative; boundary="000000000000dc184605c9f516af" X-Rspamd-Queue-Id: 4GrRcG1m0Mz4hRb X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=milshop-ru.20150623.gappssmtp.com header.s=20150623 header.b=KWNlnGai; dmarc=none; spf=none (mx1.freebsd.org: domain of mil@milshop.ru has no SPF policy when checking 2a00:1450:4864:20::141) smtp.mailfrom=mil@milshop.ru X-Spamd-Result: default: False [-2.70 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[milshop-ru.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.70)[-0.696]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-stable@freebsd.org]; DMARC_NA(0.00)[milshop.ru]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[milshop-ru.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::141:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[kamuzon@milshop.ru,mil@milshop.ru]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[kamuzon@milshop.ru,mil@milshop.ru]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: Y --000000000000dc184605c9f516af Content-Type: text/plain; charset="UTF-8" Information I made this script a few year ago for FreeBSD 9.0 After that it works on 10 with fixes, on 11 and on 12 versions of FreeBSD. Now I am testing on 13 version. It makes nullfs links for jailed FreeBSD with different php.ini, apache.conf, postfix config, etc. It does not copy any system bin files. Only configs. You can use it with NFS directories. I used so on 9-10 versions of FreeBSD, then FreeBSD runs on hardware computers. After that I use the whole system on NAS-mounted drives, because FreeBSD runs in a virtual machine on vmWare. Download https://bsd.kmd.ru/files/nullfsjail.zip Install 1. make a directory for hosted sites. I use /usr/home/ 2. make a directory for jail files, links and configs. I use /usr/jail/ 3. copy files from nullfsjail.zip archive to /usr/jail/ 4. edit nano "config" in .makejail..sh 5. run ./.makejail..sh 6. you got some files in /usr/jail/your.domain/ file with lines to add in rc.conf of 9 and 10+ FreeBSD version. and sh files to start, stop, mount, unmount jail. --000000000000dc184605c9f516af-- From nobody Fri Aug 20 09:03:26 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id E3CF11775E27 for ; Fri, 20 Aug 2021 09:03:37 +0000 (UTC) (envelope-from freebsd@oldach.net) Received: from nuc.oldach.net (hmo.in-vpn.de [IPv6:2001:67c:1407:60::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "nuc.oldach.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrbK463tpz53sK for ; Fri, 20 Aug 2021 09:03:36 +0000 (UTC) (envelope-from freebsd@oldach.net) Received: from nuc.oldach.net (localhost [127.0.0.1]) by nuc.oldach.net (8.17.1/8.17.1/hmo17dec20) with ESMTPS id 17K93Qmi091127 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Fri, 20 Aug 2021 11:03:26 +0200 (CEST) (envelope-from freebsd@oldach.net) Received: (from hmo@localhost) by nuc.oldach.net (8.17.1/8.17.1/Submit) id 17K93QN3091126 for stable@freebsd.org; Fri, 20 Aug 2021 11:03:26 +0200 (CEST) (envelope-from freebsd@oldach.net) Message-Id: <202108200903.17K93QN3091126@nuc.oldach.net> Subject: Confusion with grep & locale? To: stable@freebsd.org Date: Fri, 20 Aug 2021 11:03:26 +0200 (CEST) From: freebsd@oldach.net (Helge Oldach) X-No-Archive: Yes List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: inspected by milter-greylist-4.6.4 (nuc.oldach.net [0.0.0.0]); Fri, 20 Aug 2021 11:03:26 +0200 (CEST) for IP:127.0.0.1 DOMAIN:localhost HELO:nuc.oldach.net FROM:freebsd@oldach.net RCPT: X-Rspamd-Queue-Id: 4GrbK463tpz53sK X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@oldach.net designates 2001:67c:1407:60::1 as permitted sender) smtp.mailfrom=freebsd@oldach.net X-Spamd-Result: default: False [-2.30 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[stable@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_NO_DN(0.00)[]; DMARC_NA(0.00)[oldach.net]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:29670, ipnet:2001:67c:1400::/45, country:DE]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi all, I'm confused about the FreeBSD behaviour with respect to locale's and grep - specifically, it seems case sensitivity is not handled consistently when grepping character ranges. It looks to me like 11 and 13 are not behaving consistently however I'm unclear why. # uname -a FreeBSD 11STABLE 11.4-STABLE FreeBSD 11.4-STABLE #1059 r368289M: Thu Dec 3 01:48:30 UTC 2020 root@XXX amd64 # export LANG=en_US.ISO8859-1 # (echo bla; echo Bla) | grep '[A-Z]' Bla # export LANG=C # (echo bla; echo Bla) | grep '[A-Z]' Bla # export LANG=en_US.UTF-8 # (echo bla; echo Bla) | grep '[A-Z]' bla Bla # # uname -a FreeBSD 13STABLE 13.0-STABLE FreeBSD 13.0-STABLE #49 stable/13-n246779-64085efb677-dirty: Mon Aug 16 08:42:53 CEST 2021 root@XXX amd64 # export LANG=en_US.ISO8859-1 # (echo bla; echo Bla) | grep '[A-Z]' bla Bla # export LANG=C # (echo bla; echo Bla) | grep '[A-Z]' Bla # export LANG=en_US.UTF-8 # (echo bla; echo Bla) | grep '[A-Z]' Bla # For comparison, a Linux RHEL box delivers the expected results: # uname -a Linux rhel.local 3.10.0-1062.9.1.el7.x86_64 #1 SMP Mon Dec 2 08:31:54 EST 2019 x86_64 x86_64 x86_64 GNU/Linux # export LANG=en_US.ISO8859-1 # (echo bla; echo Bla) | grep '[A-Z]' Bla # export LANG=C # (echo bla; echo Bla) | grep '[A-Z]' Bla # export LANG=en_US.UTF-8 # (echo bla; echo Bla) | grep '[A-Z]' Bla # There is nothing special in the environment, specifically no LC_xxx nor MM_CHARSET in either case. Any guidance is appreciated... Thanks! Kind regards Helge From eugen@grosbein.net Fri Aug 20 09:18:40 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 40C9F17771E9 for ; Fri, 20 Aug 2021 09:18:56 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:c2c:26d8::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grbfl6yX4z55s3 for ; Fri, 20 Aug 2021 09:18:55 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id 17K9IkR9091642 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Aug 2021 09:18:47 GMT (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: freebsd@oldach.net Received: from [10.58.0.10] (dadv@dadvw [10.58.0.10]) by eg.sd.rdtc.ru (8.16.1/8.16.1) with ESMTPS id 17K9Ij4x006424 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 20 Aug 2021 16:18:45 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: Confusion with grep & locale? To: Helge Oldach , stable@freebsd.org References: <202108200903.17K93QN3091126@nuc.oldach.net> From: Eugene Grosbein Message-ID: <175c9c3d-5b40-c2bc-0587-efa02c862a9d@grosbein.net> Date: Fri, 20 Aug 2021 16:18:40 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 In-Reply-To: <202108200903.17K93QN3091126@nuc.oldach.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT autolearn=disabled version=3.4.2 X-Spam-Report: * -0.0 SHORTCIRCUIT No description available. * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hz.grosbein.net X-Rspamd-Queue-Id: 4Grbfl6yX4z55s3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N 20.08.2021 16:03, Helge Oldach wrote: > Hi all, > > I'm confused about the FreeBSD behaviour with respect to locale's > and grep - specifically, it seems case sensitivity is not handled > consistently when grepping character ranges. It looks to me like 11 and > 13 are not behaving consistently however I'm unclear why. FreeBSD 11 uses GNU grep by default but newer version switched to using bsdgrep as grep. From nobody Fri Aug 20 09:33:52 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B111F17789FD for ; Fri, 20 Aug 2021 09:33:55 +0000 (UTC) (envelope-from freebsd@oldach.net) Received: from nuc.oldach.net (hmo.in-vpn.de [IPv6:2001:67c:1407:60::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "nuc.oldach.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grc023jbkz58B2 for ; Fri, 20 Aug 2021 09:33:54 +0000 (UTC) (envelope-from freebsd@oldach.net) Received: from nuc.oldach.net (localhost [127.0.0.1]) by nuc.oldach.net (8.17.1/8.17.1/hmo17dec20) with ESMTPS id 17K9XqpS094292 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 20 Aug 2021 11:33:53 +0200 (CEST) (envelope-from freebsd@oldach.net) Received: (from hmo@localhost) by nuc.oldach.net (8.17.1/8.17.1/Submit) id 17K9XqhY094291; Fri, 20 Aug 2021 11:33:52 +0200 (CEST) (envelope-from freebsd@oldach.net) Message-Id: <202108200933.17K9XqhY094291@nuc.oldach.net> Subject: Re: Confusion with grep & locale? In-Reply-To: <175c9c3d-5b40-c2bc-0587-efa02c862a9d@grosbein.net> from Eugene Grosbein at "20 Aug 2021 16:18:40" To: eugen@grosbein.net (Eugene Grosbein) Date: Fri, 20 Aug 2021 11:33:52 +0200 (CEST) Cc: stable@freebsd.org From: freebsd@oldach.net (Helge Oldach) X-No-Archive: Yes List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: inspected by milter-greylist-4.6.4 (nuc.oldach.net [0.0.0.0]); Fri, 20 Aug 2021 11:33:53 +0200 (CEST) for IP:127.0.0.1 DOMAIN:localhost HELO:nuc.oldach.net FROM:freebsd@oldach.net RCPT: X-Rspamd-Queue-Id: 4Grc023jbkz58B2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@oldach.net designates 2001:67c:1407:60::1 as permitted sender) smtp.mailfrom=freebsd@oldach.net X-Spamd-Result: default: False [-2.30 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[oldach.net]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.998]; RCPT_COUNT_TWO(0.00)[2]; FROM_NO_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:29670, ipnet:2001:67c:1400::/45, country:DE]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N Hi EUgene, Eugene Grosbein wrote on Fri, 20 Aug 2021 11:18:40 +0200 (CEST): > 20.08.2021 16:03, Helge Oldach wrote: > > I'm confused about the FreeBSD behaviour with respect to locale's > > and grep - specifically, it seems case sensitivity is not handled > > consistently when grepping character ranges. It looks to me like 11 and > > 13 are not behaving consistently however I'm unclear why. > > FreeBSD 11 uses GNU grep by default but newer version switched to using bsdgrep as grep. Thanks, that might explain the 11 oddity. However 13 is also exposing strange behaviour (note the ISO8859 case): # export LANG=en_US.ISO8859-1 # (echo bla; echo Bla) | grep '[A-Z]' bla Bla # export LANG=C # (echo bla; echo Bla) | grep '[A-Z]' Bla # export LANG=en_US.UTF-8 # (echo bla; echo Bla) | grep '[A-Z]' Bla # Kind regards Helge From nobody Fri Aug 20 09:36:25 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 5AD7617798D5 for ; Fri, 20 Aug 2021 09:37:54 +0000 (UTC) (envelope-from parv.0zero9@gmail.com) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grc4f1sTTz59GJ for ; Fri, 20 Aug 2021 09:37:54 +0000 (UTC) (envelope-from parv.0zero9@gmail.com) Received: by mail-wr1-x42a.google.com with SMTP id q10so13308338wro.2 for ; Fri, 20 Aug 2021 02:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aGGgXyv54Iyw1p8O2JQ4BLKCDYidN9Nf0fGguCW3e8w=; b=Fo0vq+LQD7Ax2dqYJgCKgeFY6MQK262W0cwdB+s/J47WpW/2UIfWDhodiaPU/xp9iD gFIms1t/5jrKF/GS4WcmRZGu7azSJEHNjKUxXBte302BE4CjSS1TdAPZ3bQaFP5OT8V4 GQ4GyIOhuLpggsHf8rwQapFShBcYZVv/TJICfcjuuMp4ANiowTAn6lybAilE2WPZGhNB HQdGGZfwGKHkhB1CaOhhAEsTFOP+tJzEULgObSY9KNEVoU16ZDE9NDRsCHjOr1Ub2lbC MiKfrvJe6dlbJ42reu7Pr0VupuOULn6YXZYv/OhC4gya9DUTZpMhBSnXABHjYn4HvM99 Dzug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aGGgXyv54Iyw1p8O2JQ4BLKCDYidN9Nf0fGguCW3e8w=; b=rt86OYhkpNhcDCZdS3KIfC+7vSRfZSVEU9ZZgMs8R7ptLYAXA+n1+AXjgyh9ppP4uf 5j9KEosTPprfj/hDBzFeh6/fJ5X5xx7Hy8SpJobb2mv57LopZqZr+cBLlX9Vre9p9HLf Gft/B4sC6Z9+yQ1KvQiP+CkozhBSZjgUlhTrSq+wLAw/ibjDqHsUIofzMIZtNoPd6Tw3 HzNqZu0pVUU6U4wH7A+Ec4WGNKVYdgWLXzqEbFfWjD8Kbtyk2A1KGkCZ9kI93bMZE9mc KValKg6rdl2d+ykPe5pYpSAoGBm3rdRtX1l3t6E6k99MCRKKFqm436nTUju7+eBnIR9s W74Q== X-Gm-Message-State: AOAM533eFFIKLIVdS4Wye63ksraEvto7D/rwnKw8vcJCzAlnITazeZhV jm0N+0Gdk5lzJ3vFfmYPI/86wjbvim9oTMQ3GM48hWL6 X-Google-Smtp-Source: ABdhPJwmJGPK6nOLP5IuQYbmskNNz+qYbNisIrPc7K6Zuw49qucAiJlp4O9wBJ9HWBg4k02uavJKo9oTU3oPlcvmO7s= X-Received: by 2002:adf:dd92:: with SMTP id x18mr9092874wrl.123.1629452267588; Fri, 20 Aug 2021 02:37:47 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: <202108200903.17K93QN3091126@nuc.oldach.net> In-Reply-To: <202108200903.17K93QN3091126@nuc.oldach.net> From: "parv/freebsd" Date: Thu, 19 Aug 2021 23:36:25 -1000 Message-ID: Subject: Re: Confusion with grep & locale? To: Helge Oldach Cc: stable@freebsd.org Content-Type: multipart/alternative; boundary="000000000000968ffe05c9fa6b2b" X-Rspamd-Queue-Id: 4Grc4f1sTTz59GJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[freebsd] X-ThisMailContainsUnwantedMimeParts: Y --000000000000968ffe05c9fa6b2b Content-Type: text/plain; charset="UTF-8" On Thu, Aug 19, 2021 at 11:04 PM Helge Oldach wrote: ... > # uname -a > FreeBSD 13STABLE 13.0-STABLE FreeBSD 13.0-STABLE #49 > stable/13-n246779-64085efb677-dirty: Mon Aug 16 08:42:53 CEST 2021 > root@XXX amd64 > # export LANG=en_US.ISO8859-1 > # (echo bla; echo Bla) | grep '[A-Z]' > bla > Bla > # export LANG=C > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=en_US.UTF-8 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # > > For comparison, a Linux RHEL box delivers the expected results: > > # uname -a > Linux rhel.local 3.10.0-1062.9.1.el7.x86_64 #1 SMP Mon Dec 2 08:31:54 EST > 2019 x86_64 x86_64 x86_64 GNU/Linux > # export LANG=en_US.ISO8859-1 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=C > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=en_US.UTF-8 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # > > There is nothing special in the environment, specifically no LC_xxx nor > MM_CHARSET in either case. > > Any guidance is appreciated... Thanks! > Please file a PR, if one does not already exist, about FreeBSD grep(1) producing unexpected result under some locale(s). If desired, as workarounds instead of FreeBSD grep built with base regex(3) library ... - compile base grep with gnugrep library from ports; - or, use gnugrep (installed as /usr/local/bin/grep ;-<), ack, the_silver_surfer, among others until regex(3) would be fixed (does not look like would be by 13.1 release). - parv --000000000000968ffe05c9fa6b2b-- From nobody Fri Aug 20 10:04:26 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A6B2F177BD20 for ; Fri, 20 Aug 2021 10:04:44 +0000 (UTC) (envelope-from shoesoft@gmx.net) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grcgc288cz3FL2 for ; Fri, 20 Aug 2021 10:04:44 +0000 (UTC) (envelope-from shoesoft@gmx.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1629453869; bh=5Q1VOrdpV0amvku208khJAl53vEWWRzusQWi07z6G2Q=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Gol5XYKz/SwK2xl0g4lVnuh+xPfSO3KPF95fML6WmuIzoO3jgZLyvSskBJGjkB9UG 2IiPM7SYH8lVxubK3bMtLpfIpC5iILBu4m8S9CwVed+H6+uhxyE9CdW/E+4A90k210 2gDKD67Q2+zLaBgpuPcddszmBsSy1xRgLoSby4XY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from walrus.pepperland ([81.217.72.171]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MMofW-1mXRo92FCm-00Io50; Fri, 20 Aug 2021 12:04:29 +0200 From: Stefan Ehmann To: stable@freebsd.org Cc: Helge Oldach Subject: Re: Confusion with grep & locale? Date: Fri, 20 Aug 2021 12:04:26 +0200 Message-ID: <3924915.BRNeRiNLvY@walrus.pepperland> In-Reply-To: <202108200903.17K93QN3091126@nuc.oldach.net> References: <202108200903.17K93QN3091126@nuc.oldach.net> List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K1:7kG85dHEc0+n0uZ0yjnRVax2+t5uVsLQgC0Q5PQ+0YsJcNZ9F3o 2LW2+OvsR9nBiFwhOaGEOnjlxICs062+Xl9ViTkEWC6xG2eZN4WTOhFInzTSWyxVIwBZV0P RAnWACbXEGglIvzM89KcOvGqgjSGxYU2rR+nX90kutMhdS1nOZYdl585WGoPWTTFp/fWaBt 64UD3zHhtJEiaoqIoT2ow== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Zn4F0FzLll0=:DMYv8eFW5esg1Ol00Ph7n4 urSlqU4ZAIyl5enTpeA6ZoSw1HudxxkmEBU6u96ae3rdmcd2bBrkguRYBHMaHcpkj+j/tMt/G sXX8ROCNnO/Few1d8JPoJqd6pvsk13QH2zGskA/UgWx8DbYFh9RnJERNcODiPT1tyYUgY81Lh DcbvsCtXNxu4Wuisoq5zkpeTpWY/IT8wHiZDlMPDLKanW+rPX1N+548td9jLAkbSIYccI2v4A e6C/2cPH7+W4qv+hkpQVN25D0FiSENxRgwBrDjq/Jy7RCqw0taG2TpDc1LZDvZfI6p2B+ncCB WmMGFnCY0lHZaAJicR1qCSSESmoRsBIZUHYaaimfJ+fPey+XS6pPEQFeZlmG08oUv4Z3K2EZ1 V0fFwypawY6IOqCE/J2VPpF8F4IPtCnEAkSttW7T02Nw26wYq6FsLB/E86g9D02DfaE0uMpuG CPvLIJ99nt4jkkl96SE7dbmsAhI1f6WUCn8Xh8odVoWS6ZMaezXmLuYfLBRRiAfP7VeVhfKWX qglSqMmz7H0ziDXPwpre2UEvHmgo0piYuBsv6X864bagto+MkZeX2K6pTFzsHOETrmM8PghGd FMW5h9ItGHcX3Xi6JOhcECi5MDqKAuW1KfpF8p/PUMW6S04GJBiRIKklJjR56cK6nuxhxrNXP e/Nb5NeKEc1Mwz8M3eOae3x2wqXAUMuxoCaeuIZKEtR1Keg6smGRNqmYQCm/7aanOfLJiW/pR vJvNyysiixF4hPk6jGyU+MYWt/AZ4N9xMziP2vc0u5eGOj/xYyn6aYm+/x3ZVqLF5vfdofchb dNyAXPb/64AhL51ZWtn01KeZpRNSFm7XJ3wWXjTxdy1d8AxnBckGXg/mQixqN+EBD1oA0h0/I EPIe7jV1scnaIOe2QZT/7aYlwH4PExyiLYonBZGr5RCAwNcsUTI1bY7oYKHlRnyzum0Rd7nMq nKoKALkJAqsuHOM+py/Rytlqb9UI2LoC0O/BFNyt2l99MPJnZUz7rHL8y0uEsEKeaZHO7Vca9 EIzctAHSEsmdR7dqB02+Ceq5MSKJxsPovagl4qO6oC0DJGad3Wh9UzkLP7BwLGBdeuvIJLJSe 0bPkd82gZl8vFEm0kwpEa35ZTEmKOW7dGV0euJ28lesVqifvKAur6wHHg== X-Rspamd-Queue-Id: 4Grcgc288cz3FL2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Friday, August 20, 2021 11:03:26 AM CEST Helge Oldach wrote: > Hi all, > > I'm confused about the FreeBSD behaviour with respect to locale's > and grep - specifically, it seems case sensitivity is not handled > consistently when grepping character ranges. It looks to me like 11 and > 13 are not behaving consistently however I'm unclear why. It's not necessarily a bug, see here: "[...] that the 2008 standard had changed the definition of ranges, such t= hat outside the "C" and "POSIX" locales, the meaning of range expressions was undefined." From nobody Fri Aug 20 12:47:11 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with UTF8SMTP id 6183A1277D87 for ; Fri, 20 Aug 2021 12:47:15 +0000 (UTC) (envelope-from se@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with UTF8SMTPS id 4GrhH72Cv0z3lTt; Fri, 20 Aug 2021 12:47:15 +0000 (UTC) (envelope-from se@freebsd.org) Received: from [IPV6:2003:cd:5f13:3300:6567:e0a6:327b:6323] (p200300cd5f1333006567e0a6327b6323.dip0.t-ipconnect.de [IPv6:2003:cd:5f13:3300:6567:e0a6:327b:6323]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with UTF8SMTPSA id C29C594EA; Fri, 20 Aug 2021 12:47:14 +0000 (UTC) (envelope-from se@freebsd.org) Message-ID: Date: Fri, 20 Aug 2021 14:47:11 +0200 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.0 Subject: Re: Confusion with grep & locale? Content-Language: en-US To: Helge Oldach References: <202108200903.17K93QN3091126@nuc.oldach.net> From: Stefan Esser Cc: stable@freebsd.org In-Reply-To: <202108200903.17K93QN3091126@nuc.oldach.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------18jB9Ydxf8aW8KSkGkkvmKAj" X-ThisMailContainsUnwantedMimeParts: N This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------18jB9Ydxf8aW8KSkGkkvmKAj Content-Type: multipart/mixed; boundary="------------1iywUki4V779x0zq1bdTqmUH"; protected-headers="v1" From: Stefan Esser To: Helge Oldach Cc: stable@freebsd.org Message-ID: Subject: Re: Confusion with grep & locale? References: <202108200903.17K93QN3091126@nuc.oldach.net> In-Reply-To: <202108200903.17K93QN3091126@nuc.oldach.net> --------------1iywUki4V779x0zq1bdTqmUH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 20.08.21 um 11:03 schrieb Helge Oldach: > Hi all, >=20 > I'm confused about the FreeBSD behaviour with respect to locale's > and grep - specifically, it seems case sensitivity is not handled > consistently when grepping character ranges. It looks to me like 11 and= > 13 are not behaving consistently however I'm unclear why. >=20 > # uname -a > FreeBSD 11STABLE 11.4-STABLE FreeBSD 11.4-STABLE #1059 r368289M: Thu De= c 3 01:48:30 UTC 2020 root@XXX amd64 > # export LANG=3Den_US.ISO8859-1 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=3DC > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=3Den_US.UTF-8 > # (echo bla; echo Bla) | grep '[A-Z]' > bla > Bla This is not unexpected, since the default collating sequence for many UTF= -8 locales is to have lower case letters precede their upper case versions i= n the sequence, i.e.: "aAbBcC..." https://developer.mimer.com/services/sql-unicode-collation-charts/ Here is a collation chart for English: https://download.mimer.com/pub/developer/charts/english.htm But POSIX makes no guarantees for locales other than POSIX or C. > # uname -a > FreeBSD 13STABLE 13.0-STABLE FreeBSD 13.0-STABLE #49 stable/13-n246779-= 64085efb677-dirty: Mon Aug 16 08:42:53 CEST 2021 root@XXX amd64 > # export LANG=3Den_US.ISO8859-1 > # (echo bla; echo Bla) | grep '[A-Z]' > bla > Bla This one is unexpected, the upper case should be a range of its own and should not include any lower case letters. > # export LANG=3DC > # (echo bla; echo Bla) | grep '[A-Z]' > Bla Correct. > # export LANG=3Den_US.UTF-8 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla Here I had expected the result you got with en_US.ISO8859-1 ... > For comparison, a Linux RHEL box delivers the expected results: >=20 > # uname -a > Linux rhel.local 3.10.0-1062.9.1.el7.x86_64 #1 SMP Mon Dec 2 08:31:54 E= ST 2019 x86_64 x86_64 x86_64 GNU/Linux > # export LANG=3Den_US.ISO8859-1 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=3DC > # (echo bla; echo Bla) | grep '[A-Z]' > Bla > # export LANG=3Den_US.UTF-8 > # (echo bla; echo Bla) | grep '[A-Z]' > Bla Seems that this version uses a POSIX style collating sequence for UTF-8. It would be interesting to test with ranges that contain accented characters or German Umlaut characters. > There is nothing special in the environment, specifically no LC_xxx nor= > MM_CHARSET in either case. LANG defines LC_COLLATE, unless overridden. > Any guidance is appreciated... Thanks! Definitely a bug in the definition of the collating sequences. And I have just verified that de_DE.ISO8859-1 wrongly considers "=C3=B6" to be within [a-z], while de_DE.UTF-8 does not (but should). Seems that the correct collating sequences for ISO8859-1 and UTF-8 are each assigned to the other one. Some platforms have switched to use the POSIX style collating sequence to support traditional style [A-Z] for [[:upper:]], since a lot of shell script have been written with that assumption for decades. BTW, character classes work for your examples and more: # (echo bla; echo Bla) | LANG=3Den_US.ISO8859-1 grep '[[:upper:]]' Bla # (echo bla; echo Bla) | LANG=3Den_US.UTF-8 grep '[[:upper:]]' Bla # (echo "o"; echo "=C3=B6") | LANG=3Dde_DE.ISO8859-1 grep '[[:lower:]]' o # (echo "o"; echo "=C3=B6") | LANG=3Dde_DE.UTF-8 grep '[[:lower:]]' o =C3=B6 Regards, STefan --------------1iywUki4V779x0zq1bdTqmUH-- --------------18jB9Ydxf8aW8KSkGkkvmKAj Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmEfpE8FAwAAAAAACgkQR+u171r99UTO hggAk5XoY2QUdXgVfXYzJ8MI/lO3WTXIMln8MHp2f8EXQYW0gEMUzTZmKNZ0PJW9WAm90xbVe24l T3ovu4uNex+Be37fZoH9Aa4+qTBv8F/UUsqpPnj37yU2Z/D+RZ+p2CCaMhqXtqsl80YInaK838Jb m43eWZwzKIBkHNPcRKxJu5YrdUwtLv72CfzWRKmufAw+OzzL9K80WaOaHqGNSlxbGgAqadRChXzY ACxs5zyWAlW+9zi3pDWojMtGOEGxiF/0HKfAO/gT9cKWCzAewdM+ZbW8G1SSVht9uXU6DEtl8h8/ g6nThumj6wUZElH8qjatUa28G1VGw4DqTHiImV7kdg== =I8Wm -----END PGP SIGNATURE----- --------------18jB9Ydxf8aW8KSkGkkvmKAj-- From nobody Fri Aug 20 14:17:55 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 40D43175FA1B for ; Fri, 20 Aug 2021 14:18:01 +0000 (UTC) (envelope-from freebsd@oldach.net) Received: from nuc.oldach.net (hmo.in-vpn.de [IPv6:2001:67c:1407:60::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "nuc.oldach.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrkHr1yGVz3t58; Fri, 20 Aug 2021 14:17:59 +0000 (UTC) (envelope-from freebsd@oldach.net) Received: from nuc.oldach.net (localhost [127.0.0.1]) by nuc.oldach.net (8.17.1/8.17.1/hmo17dec20) with ESMTPS id 17KEHtAB022451 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 20 Aug 2021 16:17:55 +0200 (CEST) (envelope-from freebsd@oldach.net) Received: (from hmo@localhost) by nuc.oldach.net (8.17.1/8.17.1/Submit) id 17KEHt0w022450; Fri, 20 Aug 2021 16:17:55 +0200 (CEST) (envelope-from freebsd@oldach.net) Message-Id: <202108201417.17KEHt0w022450@nuc.oldach.net> Subject: Re: Confusion with grep & locale? In-Reply-To: from Stefan Esser at "20 Aug 2021 14:47:11" To: se@freebsd.org (Stefan =?ISO-8859-1?Q?E=DFer?=) Date: Fri, 20 Aug 2021 16:17:55 +0200 (CEST) Cc: stable@freebsd.org From: freebsd@oldach.net (Helge Oldach) X-No-Archive: Yes List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: inspected by milter-greylist-4.6.4 (nuc.oldach.net [0.0.0.0]); Fri, 20 Aug 2021 16:17:56 +0200 (CEST) for IP:127.0.0.1 DOMAIN:localhost HELO:nuc.oldach.net FROM:freebsd@oldach.net RCPT: X-Rspamd-Queue-Id: 4GrkHr1yGVz3t58 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@oldach.net designates 2001:67c:1407:60::1 as permitted sender) smtp.mailfrom=freebsd@oldach.net X-Spamd-Result: default: False [-2.30 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[oldach.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_MATCH_FROMTLD(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.997]; RCPT_COUNT_TWO(0.00)[2]; FROM_NO_DN(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:29670, ipnet:2001:67c:1400::/45, country:DE]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N Stefan Esser wrote on Fri, 20 Aug 2021 14:47:11 +0200 (CEST): > Am 20.08.21 um 11:03 schrieb Helge Oldach: > But POSIX makes no guarantees for locales other than POSIX or C. OK, thanks for the explanation. That clarifies a lot for me. Although it's not really POLA. :-) Thanks a lot also to Stefan Ehmann for the pointer to gawk oddities. > > # export LANG=en_US.ISO8859-1 > > # (echo bla; echo Bla) | grep '[A-Z]' > > bla > > Bla > > This one is unexpected, the upper case should be a range of its own > and should not include any lower case letters. > > > # export LANG=en_US.UTF-8 > > # (echo bla; echo Bla) | grep '[A-Z]' > > Bla > > Here I had expected the result you got with en_US.ISO8859-1 ... > Definitely a bug in the definition of the collating sequences. > > And I have just verified that de_DE.ISO8859-1 wrongly considers "ö" > to be within [a-z], while de_DE.UTF-8 does not (but should). > > Seems that the correct collating sequences for ISO8859-1 and UTF-8 are > each assigned to the other one. PR 257972 raised. > > There is nothing special in the environment, specifically no LC_xxx nor > > MM_CHARSET in either case. > > LANG defines LC_COLLATE, unless overridden. Indeed. I just explicitly mentioned *no* LC_xxx to clarify that it's not overriden. :-) > BTW, character classes work for your examples and more: Certainly they do. But they harder to type... :-) Kind regards Helge From nobody Fri Aug 20 15:09:03 2021 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 57673176CDEF for ; Fri, 20 Aug 2021 15:09:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrlQz1hkSz4TYb for ; Fri, 20 Aug 2021 15:09:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x836.google.com with SMTP id g11so7700266qtk.5 for ; Fri, 20 Aug 2021 08:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=T7LSYZo9DhX6za9ZEZNzAjqCZViQ+wvB8wYilrFraUQ=; b=OFpbShA2KxWD84IzJ1B1X+mn5NcmhBQNtc7CujYFrKb1OLhsDNUxT/ibNhGjLgjMS2 ubgPxeKqQlUCARkWHWQK799f9mMmVThFE07iVTvmlO80kOJSStRwAKdAFNiQp++xfxjB 3OIuDpsDY/SKMJ/gF5JRtXxqEnGq7WIHSAUR6BxmANLzVU1tp72ZnBE2Ifgom6p+AISM gS5EfcVmRzCWgxSbBMMGMSlBMX6NzJyWxzXhT91s7CGckE30wYRuKsrbUphbBVcLS2Bx M3H9iOULoczDivsOBYJ7dLoTv3o68Z5bzqiNjt38Suxnt3rxjfkKcxiH8gAyjQvycz3z Pqzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=T7LSYZo9DhX6za9ZEZNzAjqCZViQ+wvB8wYilrFraUQ=; b=TYRDVmhefYH/OyLKmmZq6bYgEDUrPXcxxmcMnVHH4Z5FanknNpWlF2ybvydsIfedP+ dXqp/ZrIka8TMJPXjVxQDYBRwr327YKvGaxoABaYfmkeO4tgahZjt7LGKVZMzaLW4J9H g+qg0DovbGSvwPI063BStD5H4Mrt1EsBi42rFcOa9UmAfoieGy9pdm6xrqvhg5qLTdPC nsM9IlILhzHKUjlnXbIDTrQkeT3lTzKQBwbwriHj93ofro1QnCG7XlM1VdwUy7evs5ej Zsn6Si/OZoOP2rO3r2DaaTobtOh/hOMCeRzkpoHJSeL8KkoluAXiGVmqmgL8XXOmmTFI lX5w== X-Gm-Message-State: AOAM533TU/xdOaVT267szx8vUtHJfWuf+9DF4kRknYbbFcKwt+s3QupZ 4pnNTrhCFAFnSsqC5u9xgkkNUOQxIop63+mdsC95QkoINGbULg== X-Google-Smtp-Source: ABdhPJyZ43fNzfOksSnK3mfyxDTGLY1gXTChfI15kWHN6bu0+Pt+99dwJ1vKaS5x8ju6+HivVjNy6oaKOUprSHnYKp4= X-Received: by 2002:ac8:47d7:: with SMTP id d23mr17267961qtr.73.1629472154694; Fri, 20 Aug 2021 08:09:14 -0700 (PDT) List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 References: <202108201417.17KEHt0w022450@nuc.oldach.net> In-Reply-To: <202108201417.17KEHt0w022450@nuc.oldach.net> From: Warner Losh Date: Fri, 20 Aug 2021 09:09:03 -0600 Message-ID: Subject: Re: Confusion with grep & locale? To: Helge Oldach Cc: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= , FreeBSD Stable ML Content-Type: multipart/alternative; boundary="000000000000f3c9a505c9ff0ced" X-Rspamd-Queue-Id: 4GrlQz1hkSz4TYb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: Y --000000000000f3c9a505c9ff0ced Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Aug 20, 2021 at 8:19 AM Helge Oldach wrote: > Stefan Esser wrote on Fri, 20 Aug 2021 14:47:11 +0200 (CEST): > > Am 20.08.21 um 11:03 schrieb Helge Oldach: > > But POSIX makes no guarantees for locales other than POSIX or C. > > OK, thanks for the explanation. That clarifies a lot for me. Although > it's not really POLA. :-) > > Thanks a lot also to Stefan Ehmann for the pointer to gawk oddities. > > > > # export LANG=3Den_US.ISO8859-1 > > > # (echo bla; echo Bla) | grep '[A-Z]' > > > bla > > > Bla > > > > This one is unexpected, the upper case should be a range of its own > > and should not include any lower case letters. > > > > > # export LANG=3Den_US.UTF-8 > > > # (echo bla; echo Bla) | grep '[A-Z]' > > > Bla > > > > Here I had expected the result you got with en_US.ISO8859-1 ... > > > Definitely a bug in the definition of the collating sequences. > > > > And I have just verified that de_DE.ISO8859-1 wrongly considers "=C3=B6= " > > to be within [a-z], while de_DE.UTF-8 does not (but should). > > > > Seems that the correct collating sequences for ISO8859-1 and UTF-8 are > > each assigned to the other one. > > PR 257972 raised. > I've looked at that, and I don't think it's a bug since posix says it's undefined behavior. > > > There is nothing special in the environment, specifically no LC_xxx n= or > > > MM_CHARSET in either case. > > > > LANG defines LC_COLLATE, unless overridden. > > Indeed. I just explicitly mentioned *no* LC_xxx to clarify that it's not > overriden. :-) > > > BTW, character classes work for your examples and more: > > Certainly they do. But they harder to type... :-) > I think that A-Za-z is undefined, but :letter: is well defined. Most shell scripts use the 'C' locale for this very reason. Warner --000000000000f3c9a505c9ff0ced-- From nobody Fri Aug 20 20:03:54 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8FBF4177ED56 for ; Fri, 20 Aug 2021 20:04:04 +0000 (UTC) (envelope-from rollingbits@gmail.com) Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Grsz73hmWz4t2G for ; Fri, 20 Aug 2021 20:04:03 +0000 (UTC) (envelope-from rollingbits@gmail.com) Received: by mail-pl1-x629.google.com with SMTP id w6so6561113plg.9 for ; Fri, 20 Aug 2021 13:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:in-reply-to:to; bh=Begmknfa9lgHCcY8Yi4zjzk0PqJ+BsQ7HxllPXyUCWY=; b=S0OqQtp2NBFi71n1C3ANoEuRh9dWZPMVdYYK21CfoFUliJIxEqgpViayWohV7z4EsG Rgq7WqR4jGIm5AnafbIlb0HGC+zxonRDQKYxUhCZ5grEvf8FczIaXo5bhOxFcZ3of8wi mjIzRq41jfe2e2JYB4CGtopUpqpYWhsdgN16UFgeEHSHkhIm4UG5XDKC2VdhBRnGcqcJ i/cxm54H9s3pp3WaxjqZTOAjwO1PUpSHYK2rgPqYUJ7TDRmn+PhQJxn0rfpYKGwfPOg1 jz6bJ31CGeiaaRvNNfMlu+wir3sbHKzGY1t3hTU0d09DDz/TPo8BizYqW/MdxxUJSJD1 AA3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:in-reply-to:to; bh=Begmknfa9lgHCcY8Yi4zjzk0PqJ+BsQ7HxllPXyUCWY=; b=ahbfMO5dQrHKFEbtKBpIFhXstOSKnx1n8L3/ssSoJYmyRwHjUFYNyC+b1ycYyzGO27 OLk6Min3pT2YYCKOMSNnUDUYUVaw3AZmuYwc4Hv5t5tEBPu9G/GpDO6vraZh9c0de/H6 BJ2xnk5d42Cebx2JfutwuhJzn0DkQ50iS9dvklvYqa4cP8o+8UsYiQhJhJfD5YZh79ZH dt0DVZE4C0yxzUcupXtmwNaCXC/G/MKw/Dmf5Fqca4fh8ozbL4lbfXSxStwR7SlUSqWx dTyN7thTp7kIl3U/B6CqeImatZmmRIr/kQgE1mG9dJJPP0h8cEGw0TsT/Y6l+eKlwPnf lhUw== X-Gm-Message-State: AOAM530X6FrMu7xkY7RF1rsuB8Ul47bh9yGsWZuKOgKLc4dMctpqCsa2 e7LSbgMI2i/tcECfjhON4n3hdu2GlShk4A== X-Google-Smtp-Source: ABdhPJwNBc9eXJsmPVdvKY0KYKYdExXOISUC1fiKNLbjjp6f3ZkmYPJWfQ9vZxHRCDwmrrTJXzj0Xg== X-Received: by 2002:a17:90a:6303:: with SMTP id e3mr6317292pjj.190.1629489836397; Fri, 20 Aug 2021 13:03:56 -0700 (PDT) Received: from smtpclient.apple ([2804:389:2023:254f:2c44:9f50:8a92:ee73]) by smtp.gmail.com with ESMTPSA id b6sm8028866pfr.158.2021.08.20.13.03.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Aug 2021 13:03:56 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-9C96CEC6-8368-4A1A-B2D6-18268EE884D5 Content-Transfer-Encoding: 7bit From: =?utf-8?Q?Lucas_Nali_de_Magalh=C3=A3es?= List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org Mime-Version: 1.0 (1.0) Subject: Re: FreeBSD nullfs jail Date: Fri, 20 Aug 2021 17:03:54 -0300 Message-Id: References: In-Reply-To: To: freebsd-stable X-Mailer: iPhone Mail (18G82) X-Rspamd-Queue-Id: 4Grsz73hmWz4t2G X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=S0OqQtp2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rollingbits@gmail.com designates 2607:f8b0:4864:20::629 as permitted sender) smtp.mailfrom=rollingbits@gmail.com X-Spamd-Result: default: False [-2.87 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-0.999]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; R_MIXED_CHARSET(0.62)[subject]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-stable@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::629:from]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: Y --Apple-Mail-9C96CEC6-8368-4A1A-B2D6-18268EE884D5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Aug 20, 2021, at 12:17 AM, Eugene Kazarinov wrote:= >=20 > =EF=BB=BFInformation >=20 > I made this script a few year ago for FreeBSD 9.0 > (=E2=80=A6) Sorry, I'm lost in this discussion. What is the problem supposed to be? --=20 rollingbits =E2=80=94 =F0=9F=93=A7 rollingbits@icloud.com =F0=9F=93=A7 rolli= ngbits@gmail.com =F0=9F=93=A7 rollingbits@yahoo.com =F0=9F=93=A7 rollingbits= @terra.com.br =F0=9F=93=A7 rollingbits@globo.com From nobody Sun Aug 22 01:26:15 2021 X-Original-To: freebsd-stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 073E1177FDAD for ; Sun, 22 Aug 2021 01:26:32 +0000 (UTC) (envelope-from ari@ish.com.au) Received: from mail.ish.com.au (mail.ish.com.au [203.29.62.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gsd4j3ctlz4Ybx for ; Sun, 22 Aug 2021 01:26:29 +0000 (UTC) (envelope-from ari@ish.com.au) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ish.com.au; s=mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References: Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=EWeIDznoHruPFjl1b/SNqVJoAsshU5DnaW48Jk7NPBI=; b=q7L1mRb4n0/qhxydreIjDilOYs pM3viUKwF754vvE4Jcg0+XkDPlncV3HO5zUz4HZ8ZTuMBpkExTh1Y+LEDgf42X6n2i/QoWypRuJ9Z mt5TdWoHIVxLu95FPMZuyR4FotxgXIhPJy5pmWvLckkqkW5LAGixL1H3pj8R+1lnHFJRV6XAxbPTc 1j8p60fcMrkBo56DFhf0NwTRymTmRPjA5irl5BX+lv6bKwBsGK1Uk9AKwiL/YV9iQ4zrsQg1QIGLB y0ikE3O01fHy+pZVltwtirNWLdotZLMDhuLzV1Q9DMl1v4h13GPFbBpE82n94cfg9PhD4o6FFC1oB obwuaJ2g==; Received: from [10.242.2.2] by mail.ish.com.au with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1mHcFc-0008Ot-4i; Sun, 22 Aug 2021 11:26:16 +1000 Message-ID: Date: Sun, 22 Aug 2021 11:26:15 +1000 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Thunderbird/92.0 Subject: Re: Run script as root without sudo Content-Language: en-AU To: Jonathan Chen Cc: freebsd-stable References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Gsd4j3ctlz4Ybx X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ish.com.au header.s=mail header.b=q7L1mRb4; dmarc=pass (policy=quarantine) header.from=ish.com.au; spf=pass (mx1.freebsd.org: domain of ari@ish.com.au designates 203.29.62.212 as permitted sender) smtp.mailfrom=ari@ish.com.au X-Spamd-Result: default: False [-3.85 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ish.com.au:s=mail]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:203.29.62.0/24]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[ish.com.au:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[ish.com.au,quarantine]; NEURAL_HAM_SHORT(-0.85)[-0.848]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7545, ipnet:203.29.62.0/24, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Reply-To: ari@ish.com.au From: Aristedes Maniatis via freebsd-stable X-Original-From: Aristedes Maniatis X-ThisMailContainsUnwantedMimeParts: N My goal is to use standard AMI so that upgrading to new FreeBSD releases is easy without a manual process to build a new custom AMI each time. I've submitted a patch to saltstack which allows the bootstrap process to work without sudo on a clean FreeBSD AMI. On Linux the bootstrap script is run with sudo and obviously that doesn't work on a fresh FreeBSD install. https://github.com/saltstack/salt-bootstrap/pull/1581 Thanks for everyone's help, especially Andriy who pointed out that I was missing the fundamental difference between: $ su - -c bootstrap.sh $ su -l root -c bootstrap.sh The first one uses the fact that root is the default, but then -c is an su command which specifies the user class and so will fail. The second actually passes "-c bootstrap.sh" to the shell because an explicit username effectively ends the 'su' command and everything after passed to the shell. On Linux, the -c is an su command which passes the next param to the shell so the -c is never itself passed to the shell and so both variations work over there although inn fundamentally different ways. I just hope that in 5 years from now I can find this mailing list post when I completely forgot the whole thing and can't figure how to make it work... Ari On 19/8/21 4:34pm, Jonathan Chen wrote: > On Thu, 19 Aug 2021 at 18:25, Aristedes Maniatis wrote: >> That would require root to put the file there and then to reboot the >> machine. > In which case, wouldn't it be simpler to just start a new instance, > install your packages by hand, and then take a snapshot of the volume > and convert it to a custom AMI instead? That way all new instances > from your custom AMI will be preconfigured with the required packages. > > Cheers.