Quantcast

update-motd not updating /etc/motd after LTS upgrade

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
Hi,

I have a few scripts within /etc/update-motd.d/, e.g.

#!/bin/sh
unset PATH
/usr/bin/printf "%s\n%s\n\n" "Uptime/Load:" "$(/usr/bin/uptime)"

While on 10.04 and on a fresh installation of 12.04 this script works
fine, on two upgraded machines from 10.04 to 12.04 /etc/motd is not
updated. If I remove /etc/motd (/var/run/motd) it is not even
re-created at all.

What can I futher check?

Thanks, Helmut


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: update-motd not updating /etc/motd after LTS upgrade

compdoc
Is there is a script in either /etc/update-motd.d/   or
/usr/lib/update-notifier/     with 'cpu' in the name?




--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
compdoc wrote:

> Is there is a script in either /etc/update-motd.d/   or
> /usr/lib/update-notifier/     with 'cpu' in the name?

No:

helmut@mail:~$ sudo ls -la /etc/update-motd.d/
total 32
drwxr-xr-x  2 root root 4096 May 25 10:21 .
drwxr-xr-x 90 root root 4096 May 29 19:43 ..
-rwxr-xr-x  1 root root 1220 Jul 15  2011 00-header
-rwxr-xr-x  1 root root 1358 Jul 15  2011 10-help-text
-rwxr-xr-x  1 root root  129 May  2  2011 91-release-upgrade
-rwxr-xr-x  1 root root   85 Sep 28  2011 92-w
-rwxr-xr-x  1 root root 1158 Oct 21  2010 99-footer
helmut@mail:~$ sudo ls -la /usr/lib/update-manager/
total 20
drwxr-xr-x  2 root root  4096 May 24 14:19 .
drwxr-xr-x 60 root root 12288 May 24 14:45 ..
lrwxrwxrwx  1 root root    28 May 16 22:19 check-new-release ->
../../bin/do-release-upgrade
-rwxr-xr-x  1 root root  1476 Sep 30  2011 release-upgrade-motd
helmut@mail:~$


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: update-motd not updating /etc/motd after LTS upgrade

compdoc
Try the following command and see if you are getting any errors:

sudo run-parts /etc/update-motd.d

There was a file named /etc/update-motd.d/20-cpu-checker   that was causing
my error and preventing the motd update. I had to delete the file.

Here are the scripts in my /etc/update-motd.d/  on a fresh install of 12.04:

$ sudo ls -la /etc/update-motd.d/
total 44
drwxr-xr-x   2 root root  4096 Jun  6 11:41 .
drwxr-xr-x 140 root root 12288 Jun  7 14:26 ..
-rwxr-xr-x   1 root root  1220 Apr 19 03:15 00-header
-rwxr-xr-x   1 root root  1358 Apr 19 03:15 10-help-text
lrwxrwxrwx   1 root root    46 May 21 17:11 50-landscape-sysinfo ->
/usr/share/landscape/landscape-sysinfo.wrapper
-rwxr-xr-x   1 root root   149 Aug 22  2011 90-updates-available
-rwxr-xr-x   1 root root   129 Sep 30  2011 91-release-upgrade
-rwxr-xr-x   1 root root   142 Aug 22  2011 98-fsck-at-reboot
-rwxr-xr-x   1 root root   144 Aug 22  2011 98-reboot-required
-rwxr-xr-x   1 root root  1158 Apr 19 03:15 99-footer


I have landscape-common installed because it gives system information at ssh
logon like system load and the number of processes, etc.



--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
compdoc wrote:

> Try the following command and see if you are getting any errors:
>
> sudo run-parts /etc/update-motd.d

Thanks. Command runs fine:

helmut@mail:~$ sudo run-parts /etc/update-motd.d
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-24-generic i686)

 * Documentation:  https://help.ubuntu.com/

System load and logged-in users:
 23:10:09 up 9 days,  4:16,  1 user,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
helmut   pts/0    p5dcd6cfd.dip.t- 23:08    0.00s  0.39s  0.02s sshd:
helmut [priv]

helmut@mail:~

But after deleting /etc/motd and logging in again, the file is not
recreated:

helmut@mail:~$ ls -la /var/run/motd
ls: cannot access /var/run/motd: No such file or directory
helmut@mail:~$ ls -la /etc/motd
ls: cannot access /etc/motd: No such file or directory
helmut@mail:~$


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: update-motd not updating /etc/motd after LTS upgrade

compdoc
> But after deleting /etc/motd and logging in again, the file is not
>recreated:

/etc/motd is a link and should not be deleted:

lrwxrwxrwx   1 root root       13 Apr 28 10:40 motd -> /var/run/motd

Also, if there is a file named /etc/motd.tail, it can prevent the file from
being generated.

By the way, these files are owned by root, so use sudo when working with
them...




--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
compdoc wrote:

> > But after deleting /etc/motd and logging in again, the file is not
> > recreated:
>
> /etc/motd is a link and should not be deleted:
>
> lrwxrwxrwx   1 root root       13 Apr 28 10:40 motd -> /var/run/motd

I removed both.

> Also, if there is a file named /etc/motd.tail, it can prevent the
> file from being generated.

I know, but the file does not exist as /etc/motd* doesn't.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: update-motd not updating /etc/motd after LTS upgrade

compdoc
You have to recreate the link for /etc/motd and then find out why
/var/run/motd is not being generated, since this is the actual file.

 And I don't understand why you are missing most of the scripts in
/ect/update-motd.d/   ?

 You should have by default:

00-header
10-help-text
90-updates-available
91-release-upgrade
98-fsck-at-reboot
98-reboot-required
99-footer



--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
compdoc wrote:

> and then find out why /var/run/motd is not being generated

That's why I'm here. ;)


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Tom H-4
On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider <[hidden email]> wrote:
> compdoc wrote:
>
>> and then find out why /var/run/motd is not being generated
>
> That's why I'm here. ;)

Did you see that someone pointed out in an earlier post that you have
to run "ln -s /var/run/motd /etc/motd" and that you shouldn't
re-delete "/etc/motd" for motd to be displayed at boot?

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Marius Gedminas-2
In reply to this post by Helmut Schneider
On Thu, Jun 07, 2012 at 07:18:06PM +0000, Helmut Schneider wrote:

> Hi,
>
> I have a few scripts within /etc/update-motd.d/, e.g.
>
> #!/bin/sh
> unset PATH
> /usr/bin/printf "%s\n%s\n\n" "Uptime/Load:" "$(/usr/bin/uptime)"
>
> While on 10.04 and on a fresh installation of 12.04 this script works
> fine, on two upgraded machines from 10.04 to 12.04 /etc/motd is not
> updated. If I remove /etc/motd (/var/run/motd) it is not even
> re-created at all.
>
> What can I futher check?
Your PAM configuration?

       Executable scripts in /etc/update-motd.d/* are executed by
       pam_motd(8) as the root user at each login, and this information
       is concatenated in /var/run/motd.  The order of script
       execution is determined by the run-parts(8) --lsbsysinit option
       (basically  alphabetical order, with a few caveats).

    -- http://manpages.ubuntu.com/manpages/precise/en/man5/update-motd.5.html

Marius Gedminas
--
I'll maintain that XML should never be used for something that is written by
humans, just as you shouldn't try to use it as a programming language, although
people have been so in love with XML that they've tried to do both.
        -- Bruce Eckel

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (197 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
In reply to this post by Tom H-4
Tom H wrote:

> On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider <[hidden email]>
> wrote:
> > compdoc wrote:
> >
> >> and then find out why /var/run/motd is not being generated
> >
> > That's why I'm here. ;)
>
> Did you see that someone pointed out in an earlier post that you have
> to run "ln -s /var/run/motd /etc/motd" and that you shouldn't
> re-delete "/etc/motd" for motd to be displayed at boot?

Yes, sorry that I did not make that clear.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Ric Moore
In reply to this post by Tom H-4
On 06/07/2012 06:13 PM, Tom H wrote:

> On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider<[hidden email]>  wrote:
>> compdoc wrote:
>>
>>> and then find out why /var/run/motd is not being generated
>>
>> That's why I'm here. ;)
>
> Did you see that someone pointed out in an earlier post that you have
> to run "ln -s /var/run/motd /etc/motd" and that you shouldn't
> re-delete "/etc/motd" for motd to be displayed at boot?
>

Heh, there you go. Another simple old text file to give system news to
login users made all complicated. Someone must hate us. Ric



--
My father, Victor Moore (Vic) used to say:
"There are two Great Sins in the world...
..the Sin of Ignorance, and the Sin of Stupidity.
Only the former may be overcome." R.I.P. Dad.
http://linuxcounter.net/user/44256.html

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
In reply to this post by Tom H-4
Tom H wrote:

> On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider <[hidden email]>
> wrote:
> > compdoc wrote:
> >
> >> and then find out why /var/run/motd is not being generated
> >
> > That's why I'm here. ;)
>
> for motd to be displayed at boot?

Hm, only at boot?! No. Or?! Because I meanwhile found out that
/var/run/motd *is* created after a reboot but *is not* after a
(remote-)login (via ssh):

helmut@mail:~$ ls -la /var/run/motd
-rw-r--r-- 1 root root 1736 Jun  8 00:32 /var/run/motd
helmut@mail:~$ last -6R
helmut   pts/0        Fri Jun  8 00:41   still logged in
root     pts/0        Fri Jun  8 00:41 - 00:41  (00:00)
root     pts/0        Fri Jun  8 00:40 - 00:41  (00:00)
helmut   pts/0        Fri Jun  8 00:39 - 00:40  (00:01)
helmut   pts/0        Fri Jun  8 00:34 - 00:37  (00:03)
reboot   system boot  Fri Jun  8 00:32 - 00:43  (00:10)

wtmp begins Tue Jan  3 13:29:48 2012
helmut@mail:~$

At least on 10.04 /var/run/motd is created upon each logon.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
In reply to this post by Marius Gedminas-2
Marius Gedminas wrote:

>> What can I futher check?
>
> Your PAM configuration?
>
>        Executable scripts in /etc/update-motd.d/* are executed by
>        pam_motd(8) as the root user at each login, and this
> information        is concatenated in /var/run/motd.  The order of
> script        execution is determined by the run-parts(8)
> --lsbsysinit option        (basically  alphabetical order, with a few
> caveats).
>
>     --
> http://manpages.ubuntu.com/manpages/precise/en/man5/update-motd.5.html

Already checked that but did not find any difference to a freshly
installed system:

helmut@mail:~$ sudo grep -ir pam_motd /etc/
/etc/pam.d/login:session    optional   pam_motd.so
/etc/pam.d/sshd:session    optional     pam_motd.so # [1]
helmut@mail:~$


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Tom H-4
In reply to this post by Helmut Schneider
On Thu, Jun 7, 2012 at 6:47 PM, Helmut Schneider <[hidden email]> wrote:

> Tom H wrote:
>> On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider <[hidden email]>
>> wrote:
>> > compdoc wrote:
>> >
>> >> and then find out why /var/run/motd is not being generated
>> >
>> > That's why I'm here. ;)
>>
>> for motd to be displayed at boot?
>
> Hm, only at boot?! No. Or?! Because I meanwhile found out that
> /var/run/motd *is* created after a reboot but *is not* after a
> (remote-)login (via ssh):
>
> helmut@mail:~$ ls -la /var/run/motd
> -rw-r--r-- 1 root root 1736 Jun  8 00:32 /var/run/motd
> helmut@mail:~$ last -6R
> helmut   pts/0        Fri Jun  8 00:41   still logged in
> root     pts/0        Fri Jun  8 00:41 - 00:41  (00:00)
> root     pts/0        Fri Jun  8 00:40 - 00:41  (00:00)
> helmut   pts/0        Fri Jun  8 00:39 - 00:40  (00:01)
> helmut   pts/0        Fri Jun  8 00:34 - 00:37  (00:03)
> reboot   system boot  Fri Jun  8 00:32 - 00:43  (00:10)
>
> wtmp begins Tue Jan  3 13:29:48 2012
> helmut@mail:~$
>
> At least on 10.04 /var/run/motd is created upon each logon.

Sorry. "/var/run/motd" is created at boot and motd's displayed at every login.

If you have a symlink from "/etc/motd" to "/var/run/motd" and, as
someone else pointed out, if you have a pam_motd line for login and
sshd, you should have your script displayed as the motd.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: update-motd not updating /etc/motd after LTS upgrade

compdoc
In reply to this post by compdoc
Is the connection using openssh? There's a setting for motd, but if I enable
mine I get twin infos at logon.




--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
In reply to this post by Tom H-4
Tom H wrote:

> On Thu, Jun 7, 2012 at 6:47 PM, Helmut Schneider <[hidden email]>
> wrote:
> > Tom H wrote:
> >> On Thu, Jun 7, 2012 at 6:05 PM, Helmut Schneider <[hidden email]>
> >> wrote:
> >> > compdoc wrote:
> >> >
> >> >> and then find out why /var/run/motd is not being generated
> >> >
> >> > That's why I'm here. ;)
> > >
> >> for motd to be displayed at boot?
> >
> > Hm, only at boot?! No. Or?! Because I meanwhile found out that
> > /var/run/motd is created after a reboot but *is not* after a
> > (remote-)login (via ssh):
> >
> > helmut@mail:~$ ls -la /var/run/motd
> > -rw-r--r-- 1 root root 1736 Jun  8 00:32 /var/run/motd
> > helmut@mail:~$ last -6R
> > helmut   pts/0        Fri Jun  8 00:41   still logged in
> > root     pts/0        Fri Jun  8 00:41 - 00:41  (00:00)
> > root     pts/0        Fri Jun  8 00:40 - 00:41  (00:00)
> > helmut   pts/0        Fri Jun  8 00:39 - 00:40  (00:01)
> > helmut   pts/0        Fri Jun  8 00:34 - 00:37  (00:03)
> > reboot   system boot  Fri Jun  8 00:32 - 00:43  (00:10)
> >
> > wtmp begins Tue Jan  3 13:29:48 2012
> > helmut@mail:~$
> >
> > At least on 10.04 /var/run/motd is created upon each logon.
>
> Sorry. "/var/run/motd" is created at boot and motd's displayed at
> every login.
>
> If you have a symlink from "/etc/motd" to "/var/run/motd" and, as
> someone else pointed out, if you have a pam_motd line for login and
> sshd, you should have your script displayed as the motd.

Put this into /etc/update-motd/:

---code
#!/bin/sh
printf "\n%s\n" "The current date:"
/bin/date
printf "\n"
---code

fresh 10.04 or 12.04: The logon time is displayed.
After upgrade from 10.04 to 12.04: The time the machine was rebooted
last is displayed.

pam_motd ist active:
helmut@mail:~$ sudo grep -ir pam_motd /etc/
/etc/pam.d/login:session    optional   pam_motd.so
/etc/pam.d/sshd:session    optional     pam_motd.so # [1]
helmut@mail:~$

Clear? :)


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Helmut Schneider
In reply to this post by Marius Gedminas-2
Marius Gedminas wrote:

> > I have a few scripts within /etc/update-motd.d/, e.g.
> >
> > #!/bin/sh
> > unset PATH
> > /usr/bin/printf "%s\n%s\n\n" "Uptime/Load:" "$(/usr/bin/uptime)"
> >
> > While on 10.04 and on a fresh installation of 12.04 this script
> > works fine, on two upgraded machines from 10.04 to 12.04 /etc/motd
> > is not updated. If I remove /etc/motd (/var/run/motd) it is not even
> > re-created at all.
> >
> > What can I futher check?
>
> Your PAM configuration?

Thanks. That helps^Wexplains. Being a conscientious administrator
allowing only certificates to logon via ssh I set "UsePAM no" in
sshd_config. So if I want (useful) information at logon I need to lower
shields?!


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: update-motd not updating /etc/motd after LTS upgrade

Marius Gedminas-2
On Fri, Jun 08, 2012 at 05:28:53PM +0000, Helmut Schneider wrote:
> Marius Gedminas wrote:
> > > I have a few scripts within /etc/update-motd.d/, e.g.
...

> > > While on 10.04 and on a fresh installation of 12.04 this script
> > > works fine, on two upgraded machines from 10.04 to 12.04 /etc/motd
> > > is not updated. If I remove /etc/motd (/var/run/motd) it is not even
> > > re-created at all.
> > >
> > > What can I futher check?
> >
> > Your PAM configuration?
>
> Thanks. That helps^Wexplains. Being a conscientious administrator
> allowing only certificates to logon via ssh I set "UsePAM no" in
> sshd_config. So if I want (useful) information at logon I need to lower
> shields?!
Hm.  Can you configure ssh to use PAM for sessions, but not for auth?
I mean, wouldn't

  PasswordAuthentication no
  ChallengeResponseAuthentication no  # already set to no by default on Ubuntu
 
be sufficient to implement your security policy?

Marius Gedminas
--
"Learning Perl" is actually a very well-written book for beginning
programmers.  The only thing wrong with it is it's about Perl...
                -- Paul Rubin

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (197 bytes) Download Attachment
12
Loading...