From owner-freebsd-questions@freebsd.org Wed Dec 23 07:18:09 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BDBE4B5BB7 for ; Wed, 23 Dec 2020 07:18:09 +0000 (UTC) (envelope-from rahulbharadwajpromos@gmail.com) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (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 4D14L80V72z4SBn for ; Wed, 23 Dec 2020 07:18:07 +0000 (UTC) (envelope-from rahulbharadwajpromos@gmail.com) Received: by mail-io1-xd2f.google.com with SMTP id t8so14266578iov.8 for ; Tue, 22 Dec 2020 23:18:07 -0800 (PST) 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=7coR/VX6bamGXGk+KYKg+8xVkyRWDixAdaaCQuhKxUM=; b=kZUJLL7HlNTXE8gOrK3bQbAjhycU44CqG4PZIP2MLLjVxlUWOoLaD+8p6FXRVvLuUs 5re2wgzaaA4Xc/Fs2OqHiYAi79chUQ+0fZpgrYSSmVRMl9Sgub20u+p+JuYQEsbrULae dwNprbpFfsxVDnGo8+u8eq8afrUMomosqg3RoI3rLu+i7fJFROZ94AhUsTe74wUtmNCB ZuSNaKmKahyQrucb/X6KoUzo1YmRgoN3giCJjkHuPFmf61cSEtDv94zFzZYcI0ArafYN xJ8Y9oWsKdgh70k5SawEBOHkYeZBUxrtN1LfbbjV0/Agv1m0G8NBad6aSdkOLwkTzZdk wpNw== 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=7coR/VX6bamGXGk+KYKg+8xVkyRWDixAdaaCQuhKxUM=; b=rl1YoPlSs7GHo2DGtuJbGXTBn8JQKoU64NspV8MRiAqVZzv582OA6h+drTPOGO1Jf6 jnj3po5mXpZwCVByGHSPKQD3xejeTGlWxx4r/osh6PNENby9WIKVuynv3PGQfp4SLWXi vuj0+cMTGsORuOkOSavdjjqz9VEG2wy2MPD/MCPYTLDF5eqfjYUxze/2sVlLP3oe2MSl kdic+vYJgMrfjBhaNeta4AUI6RKmUx1afkDoek/+gOTAHABlU3ZzTDex4Z1BkJgZFnOq o5GRdHR0lwLuYTy5wsnWeuw0s5ScozygBxMQKaapiYMjxr5JAst+1xdZ8jOSToYBvNHD 75Ag== X-Gm-Message-State: AOAM531LcXtu5zNVvZ9g/sMYl0fYMz4pBsfME8kJc54l4SxmtlxMgqaU KsNxjo4JrXHgpRrh1Z3JLscu2velq5bffXIMqtODojb8FnlPQw== X-Google-Smtp-Source: ABdhPJxYxGYclJ4eD7JqUSx0HfST6Kpi85YEG88tEBvlk8oL6CFnJLNP49eWPjjWaN6yYf0AGi3Rtcjtcfceei+zcsw= X-Received: by 2002:a6b:b8d6:: with SMTP id i205mr20658660iof.135.1608707886328; Tue, 22 Dec 2020 23:18:06 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Rahul Bharadwaj Date: Wed, 23 Dec 2020 12:47:56 +0530 Message-ID: Subject: Re: Potential BUG: update_motd="YES" is prepending same text on ever reboot To: freebsd-questions@freebsd.org X-Rspamd-Queue-Id: 4D14L80V72z4SBn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=kZUJLL7H; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rahulbharadwajpromos@gmail.com designates 2607:f8b0:4864:20::d2f as permitted sender) smtp.mailfrom=rahulbharadwajpromos@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::d2f:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; 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-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::d2f:from:127.0.2.255]; NEURAL_SPAM_SHORT(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d2f:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2020 07:18:09 -0000 Ok after a bit more debugging I found the issue. The kernel has a different uname output (i.e. "uname -v" does not return "FreeBSD" in its output). So when /etc/motd is run , the following awk command runs (inside of /etc/rc.d/motd): awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} In this, the check is done only for "FreeBSD" and thus for this non-standard BSD kernel, we were seeing the same line being appended to the file. On Wed, Dec 16, 2020 at 12:04 PM Rahul Bharadwaj < rahulbharadwajpromos@gmail.com> wrote: > Hi, > > Can anyone please see if they face the same issue with their FreeBSD > machines. It is really annoying to see the same line printed several times > on every restart. > > Thanks and Regards. > > On Tue, Dec 8, 2020 at 8:17 PM Rahul Bharadwaj < > rahulbharadwajpromos@gmail.com> wrote: > >> Hi, >> >> My FreeBSD details are: >> FreeBSD 11.3 >> >> I have the following option in my /etc/rc.conf: >> *update_motd="YES"* >> >> Every time I reboot, the output from the "uname" command is prepended to >> the previous reboot in the /etc/motd file. So on 3 restarts, it prints like >> this: >> >> *$ ssh user@ip* >> >> *FreeBSD user 11.3 ...* >> *FreeBSD user 11.3 ...* >> *FreeBSD user 11.3 ...* >> >> ** >> >> >> Here's what I have tried already: >> - Searched the mailing list for any mention of "motd" or "update_motd". >> None match my issue. >> - Searched the FreeBSD bugzilla for "motd", there are 2 bugs, none of >> which match my issue. >> - Read the man page for rc.conf and motd, they don't give any hints on >> bugs. >> >> So I'm not sure if this is even a bug. Can someone please help out on >> this. >> >> Thanks and Regards. >> >>