Ubuntu – /etc/cron.daily/apt: Segmentation fault

aptcronsegmentation-faultUbuntuubuntu-10.10

I have a system that I set up with Maverick and the "automatically apply security updates" setting. It is now sending e-mail on a daily basis:

Subject: Anacron job 'cron.daily' on gwen

/etc/cron.daily/apt:
Segmentation fault

If I manually "apt-get update; apt-get dist-upgrade", it runs just fine. Also, if I login and run /etc/cron.daily/apt it also does not give the segfault.

I did some searches on google and most of the results seem to be from 2008 and related to "pam_mount", which is not on this system.

Best Answer

I'm betting your problem stems from insufficient environment variables in that apt script. (eg: $PATH or $LD_LIBRARY_PATH) Essentially, there's a difference between running things via cron and running them in an interactive shell. The latter gets your login environment from places like /etc/profile and ~/.bashrc. Try adding a line or two at the start /etc/cron.daily/apt to import those settings, like so:
. /etc/profile

I'll be totally honest, and point out that I'm not too familiar with Ubunto, so those file locations may not be perfect. If you're using a shell other than Bash, your personal login file may be ~/.profile, or ~/.cshrc, or even something completely different. But the concept is the same.

A related question can be found here.


--Christopher Karel