I'm using crontab to schedule the apt-get upgrade, the 'ldconfig' and start-stop-daemon' are missing. But when I upgrade in the terminal everything is fine. Any suggestions?

this is my crontab script

0 4 * * * apt-get upgrade -y

Error message below:

Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following packages were automatically installed and are no longer required:
  libncursesw5 libtinfo5 linux-headers-4.18.0-10
  linux-headers-4.18.0-10-generic linux-image-4.18.0-10-generic
  linux-modules-4.18.0-10-generic linux-modules-extra-4.18.0-10-generic
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
  apport apport-gtk e2fsprogs libcom-err2 libext2fs2 libgnutls30 libss2
  python3-apport python3-problem-report thermald
10 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,841 kB of archives.
After this operation, 45.1 kB disk space will be freed.
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin

marked as duplicate by GAD3R, Christopher, Jeff Schaller, jimmij, Archemar Feb 7 at 9:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It's likely because cron's default PATH does not include /sbin – steeldriver Feb 5 at 2:14

Browse other questions tagged or ask your own question.