Linux.com

Home Linux Community Forums New to Linux Getting Started with Linux aptitude via cron job generates path errors

aptitude via cron job generates path errors

Link to this post 06 Jun 10

I'm running aptitude in a cron job to update and perform safe upgrades every 6 hours. The cron command I am running is this:

(/usr/bin/aptitude -y update && /usr/bin/aptitude -y safe-upgrade) 2>&1 >> /var/log/auto_update.log

My mail box is filling up with this:

debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install. Trying to recover:
dpkg: `ldconfig' not found on PATH.
dpkg: `start-stop-daemon' not found on PATH.
dpkg: `install-info' not found on PATH.
dpkg: `update-rc.d' not found on PATH.
dpkg: 4 expected program(s) not found on PATH.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.


I have checked my PATH and it appears fine:

mike@DRAKE:~$ whoami
mike
mike@DRAKE:~$ $PATH
-bash: /usr/local/bin:/usr/bin:/bin:/usr/games: No such file or directory
mike@DRAKE:~$ su
Password:
DRAKE:/home/mike# whoami
root
DRAKE:/home/mike# $PATH
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin:/usr/local/sbin:/usr/sbin:/sbin: No such file or directory

Any help, thanks. BTW, running Debian 5

Link to this post 06 Jun 10

Also, should add that the command runs fine from the command line as root, and fails as user (which is what I expected)

Link to this post 06 Jun 10

I see no replies, so . . .

I'm no expert, but it looks like debconf wants to prompt you for some system task, but you won't let it with the -y flag.
I would look into PERL -- simple script may be all you need. (I'm no expert here, either, I would have to study on it).

Link to this post 07 Jun 10

No, I don't think that's it, as mentioned, it runs fine at the command line with no user prompts.

Link to this post 08 Jun 10

01 2 * * sun root /usr/bin/apt-get update ; /usr/bin/apt-get -q -d -y -u dist-upgrade ; /usr/bin/apt-get autoclean

I used to use something like this, download but don't unpack. The y will answer prompts.
Now I use Synaptic with automatic notifier. Runs in system tray, you can set it to check every hour, every day, etc.

Auto upgrades are way to dangerous as once in a while a package will slip in that wants to yank out half of your operating system.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board