Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Feb 2025 15:19:40 +0000
From:      Frank Leonhardt <freebsd-doc@fjl.co.uk>
To:        questions@freebsd.org
Subject:   Re: eval: startmsg: not found on FreeBSD 14.2-RELEASE-p1
Message-ID:  <72e87cd9-e439-420c-bede-804692275042@fjl.co.uk>
In-Reply-To: <CA%2B1FSiju2duHQ7suti53A6Z3MKLW0ztVgp%2B79HXq%2BMnG-P5A6A@mail.gmail.com>
References:  <CA%2B1FSijmdC7XQ0QtqOTVNzsETpOHNog-FfQDbaWSrrZN6aV7PQ@mail.gmail.com> <B12D5DC0-A068-4D3A-89B1-1E480C7BC15C@yahoo.com> <CA%2B1FSiju2duHQ7suti53A6Z3MKLW0ztVgp%2B79HXq%2BMnG-P5A6A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------eJjHiiyJiyeFs74lB6ngtDaE
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 19/02/2025 10:45, Mario Marietto wrote:
> Hello.
>
> Sorry for the mistake,I have /etc/rc.subr. This is the part of the 
> code that may be correlated with the error that I get. Should I modify 
> it ? How ?
>
> #
> # check_startmsgs
> # If rc_quiet is set (usually as a result of using faststart at
> # boot time) check if rc_startmsgs is enabled.
> #
> check_startmsgs()
> {
> if [ -n "$rc_quiet" ]; then
> checkyesno rc_startmsgs
> else
> return 0
> fi
> }
>
> This is the full code of rc.subr :
> <snip>
> -- 
> Mario.

I don't recognise this problem but as no one has answered I've spent a 
few minutes looking at it.

I've checked 14.2-RELEASE and "startmsg" exists in /etc/rc.subr so this 
probably isn't the same problem. I'm going to assume you don't do much 
in the way of shell scripts - apologies if you do.

startmsg() is a function that optionally prints out a message after 
checking to see if they’re suppressed. It's a wrapper around the 
standard shell echo.

The problem here is that something appears to be calling it but isn't 
finding it. I'd love to know what, but I can't figure it out. I've not 
looked deeply into the FreeBSD pkg system - I'm from a time when 
everything was compiled from source code and that's bad enough!

pkg itself isn't a script but I guess it's calling something that is, 
and this is failing to include /etc/rc.subr so startmsg() is never found.

Quick hack. From sh as root user.

# echo "#!/bin/sh" >/bin/startmsg
# echo 'echo "$@"' >>/bin/startmsg
# chmod a+x /bin/startmsg

This will make the startmsg function available to all scripts. Try 
again. After use get rid of it:

# rm /bin/startmsg

If you're in csh instead of sh you'll have to put a \ in front of the ! 
in the first line:  echo "#\!/bin/sh" >/bin/startmsg

I suspect that if the mystery script is failing to find startmsg() it 
will fail to find something else after it's been hacked but it's worth a 
shot.

Regards, Frank.




--------------eJjHiiyJiyeFs74lB6ngtDaE
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 19/02/2025 10:45, Mario Marietto
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+1FSiju2duHQ7suti53A6Z3MKLW0ztVgp+79HXq+MnG-P5A6A@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hello.</div>
        <div><br>
        </div>
        <div>Sorry for the mistake,I have /etc/rc.subr. This is the part
          of the code that may be correlated with the error that I get.
          Should I modify it ? How ?</div>
        <div><br>
        </div>
        <div>#<br>
          # check_startmsgs<br>
          # If rc_quiet is set (usually as a result of using faststart
          at<br>
          # boot time) check if rc_startmsgs is enabled.<br>
          #<br>
          check_startmsgs()<br>
          {<br>
          if [ -n "$rc_quiet" ]; then<br>
          checkyesno rc_startmsgs<br>
          else<br>
          return 0<br>
          fi<br>
          } <br>
        </div>
        <div><br>
        </div>
        <div>This is the full code of rc.subr :</div>
        &lt;snip&gt;<br>
      </div>
      <span class="gmail_signature_prefix">-- </span><br>
      <div dir="ltr" class="gmail_signature">Mario.<br>
      </div>
    </blockquote>
    <p>I don't recognise this problem but as no one has answered I've
      spent a few minutes looking at it.</p>
    <p>I've checked 14.2-RELEASE and "startmsg" exists in /etc/rc.subr
      so this probably isn't the same problem. I'm going to assume you
      don't do much in the way of shell scripts - apologies if you do.</p>
    <p>startmsg() is a function that optionally prints out a message
      after checking to see if they’re suppressed. It's a wrapper around
      the standard shell echo.</p>
    <p>The problem here is that something appears to be calling it but
      isn't finding it. I'd love to know what, but I can't figure it
      out. I've not looked deeply into the FreeBSD pkg system - I'm from
      a time when everything was compiled from source code and that's
      bad enough!</p>
    <p>pkg itself isn't a script but I guess it's calling something that
      is, and this is failing to include /etc/rc.subr so startmsg() is
      never found.</p>
    <p>Quick hack. From sh as root user.<br>
    </p>
    <p># echo "#!/bin/sh" &gt;/bin/startmsg<br>
      # echo 'echo "$@"' &gt;&gt;/bin/startmsg<br>
      # chmod a+x /bin/startmsg<br>
    </p>
    <p>This will make the startmsg function available to all scripts.
      Try again. After use get rid of it:<br>
    </p>
    <p># rm /bin/startmsg</p>
    <p>If you're in csh instead of sh you'll have to put a \ in front of
      the ! in the first line:  echo "#\!/bin/sh" &gt;/bin/startmsg</p>
    <p>I suspect that if the mystery script is failing to find
      startmsg() it will fail to find something else after it's been
      hacked but it's worth a shot.</p>
    <p>Regards, Frank.</p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
  </body>
</html>

--------------eJjHiiyJiyeFs74lB6ngtDaE--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?72e87cd9-e439-420c-bede-804692275042>