Duplicate welcome message in motd (caused by postinst script creating motd.tail file)

Bug #659738 reported by Paul van Genderen
326
This bug affects 102 people
Affects Status Importance Assigned to Milestone
sysvinit (Debian)
Fix Released
Unknown
sysvinit (Ubuntu)
Fix Released
Medium
Kees Cook
Lucid
Fix Released
Medium
Barry Warsaw
Maverick
Fix Released
Medium
Kees Cook
Natty
Fix Released
Medium
Kees Cook

Bug Description

Binary package hint: landscape-client

e.g.:
Linux ubuntu 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:26:05 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

  System information as of Wed Oct 13 09:57:20 CEST 2010

  System load: 0.26 Processes: 172
  Usage of /home: 82.7% of 50.60GB Users logged in: 1
  Memory usage: 42% IP address for eth0: 192.168.1.1
  Swap usage: 0%

  Graph this data and manage this system at https://landscape.canonical.com/

Ubuntu 10.04.1 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

  System information as of Mon Oct 11 10:13:53 CEST 2010

  System load: 0.85 Processes: 246
  Usage of /home: 82.5% of 50.60GB Users logged in: 1
  Memory usage: 37% IP address for eth0: 192.168.1.1
  Swap usage: 0%

  => There are 4 zombie processes.

  Graph this data and manage this system at https://landscape.canonical.com/

*** System restart required ***

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Can you please list the contents of the /etc/update-motd.d directory?

ls -la /etc/update-motd.d/

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I just did an upgrade from lucid to maverick without landscape-common installed and I'm also seeing the duplication.

This it my first login after the upgraded machine rebooted:

andreas@nsn2:~$ ssh duo
Linux duo 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:24:00 UTC 2010 i686 GNU/Linux
Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

Ubuntu 10.04.1 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

Last login: Thu Oct 14 09:36:58 2010 from nsn2.local

andreas@duo:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10"

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

It's probably a bug in pam_motd

affects: landscape-client (Ubuntu) → pam (Ubuntu)
summary: - landscape-common: Duplicate welcome message in motd after upgrade
- 10.04>10.10
+ Duplicate welcome message in motd after upgrade 10.04>10.10
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Re: Duplicate welcome message in motd after upgrade 10.04>10.10

andreas@duo:~$ ls -la /etc/update-motd.d/
total 48
drwxr-xr-x 2 root root 4096 2010-10-14 10:46 .
drwxr-xr-x 155 root root 12288 2010-10-14 12:46 ..
-rwxr-xr-x 1 root root 57 2010-04-23 06:45 00-header
-rwxr-xr-x 1 root root 248 2010-04-23 06:45 10-help-text
-rw-r--r-- 1 root root 623 2010-06-30 08:10 15-eucalyptus-url
-rwxr-xr-x 1 root root 65 2010-04-13 17:45 20-cpu-checker
-rwxr-xr-x 1 root root 71 2010-04-13 17:45 90-updates-available
-rwxr-xr-x 1 root root 61 2010-04-23 16:13 91-release-upgrade
-rwxr-xr-x 1 root root 69 2010-04-13 17:45 98-reboot-required
-rwxr-xr-x 1 root root 261 2010-04-23 06:45 99-footer

andreas@duo:~$ cat /var/run/motd
Linux duo 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:24:00 UTC 2010 i686 GNU/Linux
Ubuntu 10.10

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

Ubuntu 10.04.1 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

andreas@duo:~$

andreas@duo:~$ ls -la /var/run/motd
-rw-r--r-- 1 root root 249 2010-10-14 17:39 /var/run/motd

andreas@duo:~$ date
Thu Oct 14 17:39:17 BRT 2010
andreas@duo:~$

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Sorry for the multiple postings, I think this is the last one ;)

The duplication seems to be coming from the tail file:

andreas@duo:~$ ls -la /etc/motd*
lrwxrwxrwx 1 root root 13 2010-07-10 21:34 /etc/motd -> /var/run/motd
-rw-r--r-- 1 root root 84 2010-10-14 10:30 /etc/motd.tail

andreas@duo:~$ cat /etc/motd.tail
Ubuntu 10.04.1 LTS

Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/

andreas@duo:~$

If I remove the /etc/update-motd.d/99-footer script (or the /etc/motd.tail file), then there is no duplication.

Revision history for this message
Chris Jones (cjones-gmail) wrote :

Looks like upgrade process inexplicably copies /etc/motd to /etc/motd.tail. /etc/motd.tail gets appended to the generated motd file. Just remove it. The rc.d script only appends it if the file exists.

Changed in pam (Ubuntu):
status: New → Confirmed
Revision history for this message
Paul van Genderen (paulvg) wrote :

Yup, the old motd was copied to /etc/motd.tail. No idea which upgrade script did that, though.

Revision history for this message
Kees Cook (kees) wrote :

initscripts.postinst does this:

if [ ! -f /etc/motd.tail ]
then
        if [ -f /etc/motd ]
        then
                sed 1d /etc/motd > /etc/motd.tail
                [ -s /etc/motd.tail ] || rm -f /etc/motd.tail
        fi
fi

affects: pam (Ubuntu) → base-files (Ubuntu)
affects: base-files (Ubuntu) → sysvinit (Ubuntu)
Changed in sysvinit (Ubuntu Maverick):
status: New → Confirmed
milestone: none → maverick-updates
Changed in sysvinit (Ubuntu Natty):
milestone: none → natty-alpha-2
importance: Undecided → Medium
Changed in sysvinit (Ubuntu Maverick):
importance: Undecided → Medium
Kees Cook (kees)
Changed in sysvinit (Ubuntu Maverick):
assignee: nobody → Kees Cook (kees)
Changed in sysvinit (Ubuntu Natty):
assignee: nobody → Kees Cook (kees)
Revision history for this message
Kees Cook (kees) wrote :
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

+1, Kees. Looks good, thanks for the smart analysis.

Revision history for this message
Jamie Bennett (jamiebennett) wrote :

Looks fine. Please go ahead and upload.

Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Accepted into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Steve Langasek (vorlon) wrote : Re: Duplicate welcome message in motd after upgrade 10.04>10.10

I have confirmed that upgrading the initscripts package fixes the /etc/motd on my system to not include duplicate information about 10.04. Marking verification-done.

tags: added: verification-done
removed: verification-needed
Kees Cook (kees)
Changed in sysvinit (Ubuntu Maverick):
status: Confirmed → Fix Committed
Changed in sysvinit (Ubuntu Natty):
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysvinit - 2.87dsf-4ubuntu19

---------------
sysvinit (2.87dsf-4ubuntu19) maverick-proposed; urgency=low

  * debian/initscripts.postinst (LP: #659738):
    - do not create motd.tail from motd on systems using update-motd.
    - clean up incorrectly created motd.tail from upgrade to Maverick.
 -- Kees Cook <email address hidden> Thu, 28 Oct 2010 20:30:54 -0700

Changed in sysvinit (Ubuntu Maverick):
status: Fix Committed → Fix Released
Kees Cook (kees)
Changed in sysvinit (Ubuntu Natty):
status: In Progress → Fix Released
Revision history for this message
Michael Lueck (mlueck) wrote :

I am still on 10.04 LTS Lucid servers and I have been seeing this reported behavior for a couple of days. Evidently it does not only affect upgrades to 10.10.

I see one comment about lucid-proposed, but at the top Lucid is not included in the affects list.

Oh, #13 did not include the word Lucid... evidently the fix is forthcoming to Lucid. Excellent!

Thus "subscribe" and wait... :-)

Kees Cook (kees)
summary: - Duplicate welcome message in motd after upgrade 10.04>10.10
+ Duplicate welcome message in motd
Changed in sysvinit (Ubuntu Lucid):
status: New → Triaged
importance: Undecided → Medium
milestone: none → lucid-updates
Revision history for this message
Ron McOuat (rmcouat) wrote : Re: Duplicate welcome message in motd

The motd message was somehow placed into /etc/motd.tail which is added to the end of /etc/motd with a cat append command if the /etc/motd.tail file exists. This duplicates the bulk of the standard message and in my case a second erroneous message saying updates are waiting to be installed.

Revision history for this message
Luca Lorenzetto (lorenzetto-luca) wrote :

I can confirm the message of Ron McOuat on lucid server. I have to delete the motd.tail file to have the correct message.

Revision history for this message
BenRifkah Begsten-Buret (benrifkah) wrote :

@Kees: I can think of a possible reason why initscripts.postinst copies the /etc/motd to /etc/motd.tail. Consider someone using their own custom motd in /etc/motd. Upgrading would cause initscripts to clobber this. The postinst keeps this from happening by preserving it as /etc/motd.tail. Perhaps it just needs to be smarter about only doing this if the file doesn't seem to be a stock motd?

Revision history for this message
wdeurholt (wdeurholt) wrote :

Oke, with a fully updated system 10.04.2 LTS: the only thing to do is to delete /etc/motd.tail.
Thanks. Works again.

Revision history for this message
Pontus Öhman (nifelheim) wrote :

Hey folks!

This MOTD's is from my brand new install of 10.04.2 LTS server:

Linux Gibson 2.6.32-28-server #55-Ubuntu SMP Mon Jan 10 23:57:16 UTC 2011 x86_64 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to the Ubuntu Server!
 * Documentation: http://www.ubuntu.com/server/doc

  System information as of Sat Jun 4 09:23:30 CEST 2011

  System load: 0.0 Processes: 88
  Usage of /: 0.4% of 219.90GB Users logged in: 0
  Memory usage: 1% IP address for eth0: 10.0.0.3
  Swap usage: 0%

  Graph this data and manage this system at https://landscape.canonical.com/

Ubuntu 10.04.2 LTS

Welcome to the Ubuntu Server!
 * Documentation: http://www.ubuntu.com/server/doc

  System information as of Fri Jun 3 17:51:50 CEST 2011

  System load: 0.72 Processes: 103
  Usage of /: 0.4% of 219.90GB Users logged in: 0
  Memory usage: 0% IP address for eth0: 10.0.0.3
  Swap usage: 0%

  Graph this data and manage this system at https://landscape.canonical.com/

54 packages can be updated.
37 updates are security updates.

Last login: Sat Jun 4 09:06:58 2011 from XXXXXXXXXX
kirill@Gibson:~$

The system is only 1 day old, and I got dual MOTD's... And this is no upgrade to 10.10, this is only 10.04.2 LTS version!

Cheers
Kirill

Revision history for this message
Chris Woollard (cwoollard) wrote :

Do you know when this will be fixed in Lucid?

Revision history for this message
Barry Warsaw (barry) wrote :

Bug 634387 has some additional information regarding the bug in Lucid, with a proposed, simpler patch. I've uploaded a package with just that change to my ppa:barry/experimental. Since this is annoying lots of people, it would be good to have a definitive decision on a fix. I don't really care which fix is chosen, but I'm happy to upload mine to lucid-proposed if that's the way to go. It fixes the problem for me.

I'll mark bug 634387 as a duplicate of this one.

Revision history for this message
Barry Warsaw (barry) wrote :

My debdiff from bug 634387

summary: - Duplicate welcome message in motd
+ Duplicate welcome message in motd (caused by postinst script creating
+ motd.tail file)
Revision history for this message
Barry Warsaw (barry) wrote :

After chatting with slangasek on irc, we've agreed that the approach in the debdiff I attached here in comment #23 is the safest way to go. I'll upload that to lucid-proposed soon.

Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

> that the approach in the debdiff I attached here in
> comment #23 is the safest way to go.

In that case, you might want to add a brief mention in the changelog entry that people who are already seeing the "doubled" messages can fix them by removing/emptying the motd.tail file manually....

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 659738] Re: Duplicate welcome message in motd (caused by postinst script creating motd.tail file)

On Wed, Jun 08, 2011 at 04:51:58PM -0000, Nathan Stratton Treadway wrote:
> > that the approach in the debdiff I attached here in
> > comment #23 is the safest way to go.

> In that case, you might want to add a brief mention in the changelog
> entry that people who are already seeing the "doubled" messages can fix
> them by removing/emptying the motd.tail file manually....

We had code once before to fix up the doubled messages; we should apply that
code in this SRU as well. I think it's just changing a version check in the
postinst.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>

Revision history for this message
Barry Warsaw (barry) wrote :

@Steve: that code is in the Oneiric version of initscripts.postinst. I'll attach a debdiff that includes this too, and will test it on my lucid VM before uploading to lucid-proposed (via ppa:barry/experimental).

Revision history for this message
Barry Warsaw (barry) wrote :
Revision history for this message
Barry Warsaw (barry) wrote :

Verified that the patch works as intended on a Lucid VM. If the bogus /etc/motd.tail file exists, it gets removed, and no new bogus /etc/motd.tail file is created. Uploaded to lucid-proposed.

Changed in sysvinit (Ubuntu Lucid):
status: Triaged → In Progress
assignee: nobody → Barry Warsaw (barry)
tags: added: verification-needed
removed: verification-done
Revision history for this message
Barry Warsaw (barry) wrote :

For the Lucid SRU:

Impact of bug: upon ssh'ing in or otherwise logging into a machine and being presented with the motd banner, you will see a double banner. One comes from /etc/motd symlinked to /var/run/motd, which is normal. The other comes from a bogus copy put into /etc/motd.tail.

Package uploaded to lucid-proposed fixes this in two ways. First, it does not copy /etc/motd into /etc/motd.tail if the former is a symlink. Second, it backports a stanza from the oneiric debian/initscripts.postinst file to remove the bogus /etc/motd.tail when it recognizes it contains the double banner.

For the patch, see the diff in comment #28 above.

TEST CASE:
* If you already have a Lucid machine that exhibits the double banner, install 2.87dsf-4ubuntu17.4 from lucid-proposed and you should see /etc/motd.tail being removed.
* If you do not see the double banner, consider yourself lucky! But to reproduce it just execute this as root:
$ sed 1d /etc/motd > /etc/motd.tail
then install the new version and you should see /etc/motd.tail removed
* To verify that /etc/motd.tail does not return after it's been removed either:
** before you install 2.87dsf-4ubuntu17.4, manually rm -f /etc/motd.tail, then upgrade, and motd.tail will not return
** if you've already installed the new version, just `apt-get install --reinstall` and see that motd.tail does not return

Regression potential:
* Someone with a valid /etc/motd.tail could get it accidentally removed.

Revision history for this message
Michael Lueck (mlueck) wrote :

How's progress getting this fixed in stable distribution? I just had to "sudo rm /etc/motd.tail" on Lucid servers again. So I guess doing so is not a one time manual fix. :-(

Revision history for this message
Tim Cutts (timc) wrote :

On 9 Jun 2011, at 12:27, Michael Lueck wrote:

> How's progress getting this fixed in stable distribution? I just had to
> "sudo rm /etc/motd.tail" on Lucid servers again. So I guess doing so is
> not a one time manual fix. :-(

I use cfengine2 on our systems, and the following hideous runes are keeping it under control:

groups:
  ubuntu_lucid::
    have_motd_tail = ( FileExists("/etc/motd.tail") )
  have_motd_tail::
    broken_motd_tail = ( ReturnsZeroShell("/bin/grep -q ${quote}Welcome to Ubuntu!${quote} /etc/motd.tail") )

tidy:
  broken_motd_tail::
    /etc pat=motd.tail age=0

Regards,

Tim

Revision history for this message
Barry Warsaw (barry) wrote :

A patch was uploaded to lucid-proposed. See this link for how to help test it:

https://wiki.ubuntu.com/QATeam/PerformingSRUVerification

Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

On Thu, Jun 09, 2011 at 11:27:14 -0000, Michael Lueck wrote:
> How's progress getting this fixed in stable distribution? I just had to
> "sudo rm /etc/motd.tail" on Lucid servers again. So I guess doing so is
> not a one time manual fix. :-(

The patch that Barry uploaded probably makes this info
obsolete, but just in case something delays that
package from being released (or whatever), I'll
mention that the troublesome section of the
sysvinit.postinst script only runs if motd.tail does
not exist.

So, you can get a "one time manual fix" by emptying
out the motd.tail file but leaving that empty file
there (rather than deleting it completely).

     Nathan

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Accepted into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in sysvinit (Ubuntu Lucid):
status: In Progress → Fix Committed
Revision history for this message
Nathan Stratton Treadway (nathanst) wrote :

I installed initscripts 2.87dsf-4ubuntu17.4 out of lucid-proposed onto two different Lucid VMs.

On the first there was no /etc/motd.tail file, and the installation of v17.4 did not create one.

On the second I had left a copy of the bogus motd.tail file generated by the 2.87dsf-4ubuntu17.3 upgrade, and the installation of v17.4 did delete the file as expected.

Afterwards I rebooted both VMs, and they appear to have run all the startup scripts properly as they came back up....

(I actually installed all three packages generated from this source [initscripts, sysv-rc, and sysvinit-utils].)

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sysvinit - 2.87dsf-4ubuntu17.4

---------------
sysvinit (2.87dsf-4ubuntu17.4) lucid-proposed; urgency=low

  * debian/initscripts.postinst
    Do not tail /etc/motd to /etc/motd.tail if the former is a symlink.
    This prevents double motd banners on login. Also, take from the
    Oneiric version of the file, a stanza to remove /etc/motd.tail if it
    appears to be a double banner. If this does not get automatically
    cleaned up for you and you're still seeing the double banner, just
    remove /etc/motd.tail manually. It won't come back. (LP: #659738)
 -- Barry Warsaw <email address hidden> Wed, 08 Jun 2011 14:56:58 -0400

Changed in sysvinit (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
nutznboltz (nutznboltz-deactivatedaccount) wrote :

Thanks, Barry. :)

Changed in sysvinit (Debian):
status: Unknown → New
Revision history for this message
Tekin Ozbek (tekinozbek) wrote :

This problem persists for me, even after installing 2.87dsf-4ubuntu17.4.

I have Ubuntu 10.04.1.

motd.tail does not exist, but I still get duplicate MOTD. Even when I set PrintMotd no, in sshd_config, it prints the MOTD, twice.

Revision history for this message
Tekin Ozbek (tekinozbek) wrote :

No worries. I'm downgrading to 10.04. Now I have to re-install and re-configure my system this evening (hopefully, it'll end this evening). And this will be my last Ubuntu installation.

Revision history for this message
nutznboltz (nutznboltz-deactivatedaccount) wrote :

@tekinozbek Applying a new sysvinit (2.87dsf-4ubuntu17.4) on an ancient Ubuntu 10.04.1 when Ubuntu 10.04.3 is the current one will only accomplish creating a system that no one else (hopefully) in the world is using and does things no person could possibly predict.

If you want to apply the fix:
sudo apt-get update
sudo apt-get dist-upgrade

Changed in sysvinit (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.