LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (http://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   /etc/cron.daily/apt apparently not working (http://www.linuxquestions.org/questions/linux-distributions-5/etc-cron-daily-apt-apparently-not-working-821448/)

doru 07-22-2010 06:55 AM

/etc/cron.daily/apt apparently not working
 
Ubuntu 8.04 LTS Server Hardy Heron
/etc/cron.daily/apt apparently does not work.
I do:
Code:

cd / && run-parts --report /etc/cron.daily
which I found in my /etc/crontab
and then:
Code:

apt-get update
apt-get upgrade

shows a large number of packages to be updated.
When I compared this with a Ubuntu 8.04 LTS Desktop (with GUI), I saw that the files in /etc/cron.daily are identical, the only difference is that anacron is installed on the Desktop, but this should not change the way /etc/cron.daily/apt works. On the Desktop, the system is updated well.

If anyone has experienced this strange behavior, please let me know.

AlucardZero 07-22-2010 07:31 AM

Is it configured to apply the packages it downloads?

doru 07-23-2010 03:36 AM

Quote:

Originally Posted by AlucardZero (Post 4041694)
Is it configured to apply the packages it downloads?

Please tell me how to check this. Of course, I considered that the default installation of a Ubuntu server should be configured to update the system every day.

AlucardZero 07-23-2010 07:23 AM

It may be configured to check for and download them but it is not configured to apply them. That would be silly.

Do you have apticron or cron-apt installed? /etc/cron.daily/apt belongs to apt and is less flexible, but does have this:

Quote:

# "APT::Periodic::Unattended-Upgrade"
# - Run the "unattended-upgrade" security upgrade script
# every n-days (0=disabled)
# Requires the package "unattended-upgrades" and will write
# a log in /var/log/unattended-upgrades

doru 07-24-2010 03:18 AM

Quote:

Originally Posted by AlucardZero (Post 4042895)
It may be configured to check for and download them but it is not configured to apply them. That would be silly.

Do you have apticron or cron-apt installed? /etc/cron.daily/apt belongs to apt and is less flexible, but does have this:

Thank you for your answer.

I don't have apticron or cron-apt installed, only cron.

Should I uncomment that in my /etc/cron.daily/apt? This file also has UnattendedUpgradeInterval=0, should I make it =1? Still, /etc/cron.daily/apt is the same with the one on my desktop.

AlucardZero 07-24-2010 08:06 AM

Ok, now compare /etc/apt/preferences and/or all the files in /etc/apt/preferences.d/* if they exist. You should find a difference there.

And no, don't uncomment it in /etc/cron.daily/apt; you're supposed to set apt config variables in /etc/apt/preferences.

doru 07-25-2010 07:06 AM

Quote:

Originally Posted by AlucardZero (Post 4043834)
Ok, now compare /etc/apt/preferences and/or all the files in /etc/apt/preferences.d/* if they exist. You should find a difference there.

This is the little hell which emerged.
apt is from Desktop (automatic update works) and /etc/apt is from server (automatic update does not work).
Seems to me that, apart from apt/apt.conf.d, there are no other important differences, only some comments and some depositories.

Quote:

sudo diff -r /etc/apt apt
[sudo] password for user:
Only in apt/apt.conf.d: 10periodic
Only in apt/apt.conf.d: 15update-stamp
Only in apt/apt.conf.d: 20archive
Only in apt/apt.conf.d: 50unattended-upgrades
Only in apt/apt.conf.d: 99update-notifier
diff -r /etc/apt/sources.list apt/sources.list
1,4c1
< #
< # deb cdrom:[Ubuntu-Server 8.04.3 _Hardy Heron_ - Release i386 (20090709)]/ hardy main restricted
<
< #deb cdrom:[Ubuntu-Server 8.04.3 _Hardy Heron_ - Release i386 (20090709)]/ hardy main restricted
---
> #deb cdrom:[Ubuntu 8.04.3 _Hardy Heron_ - Release i386 (20090713.1)]/ hardy main restricted
53,64c50,55
< # Line commented out by installer because it failed to verify:
< #deb http://security.ubuntu.com/ubuntu hardy-security main restricted
< # Line commented out by installer because it failed to verify:
< #deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted
< # Line commented out by installer because it failed to verify:
< #deb http://security.ubuntu.com/ubuntu hardy-security universe
< # Line commented out by installer because it failed to verify:
< #deb-src http://security.ubuntu.com/ubuntu hardy-security universe
< # Line commented out by installer because it failed to verify:
< #deb http://security.ubuntu.com/ubuntu hardy-security multiverse
< # Line commented out by installer because it failed to verify:
< #deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse
---
> deb http://security.ubuntu.com/ubuntu hardy-security main restricted
> deb-src http://security.ubuntu.com/ubuntu hardy-security main restricted
> deb http://security.ubuntu.com/ubuntu hardy-security universe
> deb-src http://security.ubuntu.com/ubuntu hardy-security universe
> deb http://security.ubuntu.com/ubuntu hardy-security multiverse
> deb-src http://security.ubuntu.com/ubuntu hardy-security multiverse
Only in /etc/apt: sources.list~
Only in apt/sources.list.d: hardy-partner.list
Binary files /etc/apt/trustdb.gpg and apt/trustdb.gpg differ
I notice that:
Quote:

cat apt/apt.conf.d/10periodic
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
and, unlike the server, the Desktop has the unattended-upgrades package installed.

AlucardZero 07-25-2010 09:22 AM

Well there you go.

doru 07-27-2010 04:17 AM

Quote:

Originally Posted by AlucardZero (Post 4044737)
Well there you go.

Thank you for your help.

The following pages also indicate that there is no default automatic update in Ubuntu Servers.

https://help.ubuntu.com/community/AutoWeeklyUpdateHowTo
https://help.ubuntu.com/community/Au...ecurityUpdates

I am confused about the function of /etc/cron.daily/apt, which also takes a long time to complete when I run it.

doru 08-31-2010 02:28 AM

The solution to automatic upgrades in Ubuntu 8.04 lts server:
I installed the unattended-upgrades and anacron packages (anacron because my server is not always up).
Following /usr/share/doc/unattended-upgrades/README, I put in /etc/apt/apt.conf:
Code:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

I created apt.conf with permissions: -rw-r--r-- 1 root root

According to the default settings in:
Code:

/etc/apt/apt.conf.d/50unattended-upgrades
which is also mentioned in:
Code:

/usr/share/doc/unattended-upgrades/README
only the security updates are performed automatically. For the others, you should uncomment the ...-updates line.
unattended-upgrades keeps a log in:
Code:

/var/log/unattended-upgrades/
See also:
https://help.ubuntu.com/community/Au...ecurityUpdates

https://help.ubuntu.com/community/AutoWeeklyUpdateHowTo

Thank you again for your time.

Now this looks better:
https://help.ubuntu.com/10.04/server...c-updates.html


All times are GMT -5. The time now is 08:40 AM.