I run the apt-get script everyday to check for, download and install any new updates on a daily basis. The commands i use for this are:
osmc@lab1:~$ sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get autoremove && sudo apt-get autoclean
I want to use crontab to do this on a daily basis so I don’t have to manually do this. My config for crontab is:
osmc@lab1:~$ sudo apt-get install cron
osmc@lab1:~$ sudo crontab -e
_osmc@lab1:~$ _
15 03 * * * echo “Starting nightly upgrade check process $(date)” 2>&1 >> /home/osmc/update.txt
_15 03 * * * apt-get update 2>&1 >> /home/osmc/update.txt _
_17 03 * * * apt-get dist-upgrade -y 2>&1 >> /home/osmc/update.txt _
_28 03 * * * apt-get autoremove 2>&1 >> /home/osmc/update.txt _
_30 03 * * * apt-get autoclean 2>&1 >> /home/osmc/update.txt _
35 03 * * * echo “Ending nightly upgrade check process $(date)” 2>&1 >> /home/osmc/update.txt
35 03 * * * echo “Initiating system nightly reboot” 2>&1 >> /home/osmc/update.txt
35 03 * * * /sbin/reboot
osmc@lab1:~$ Ctrl-O & Ctrl-X to save the file and exit the file
When I manually run the command, if there are any updates the same get downloaded, installed and unneeded updates get removed.
When the crontab job runs, it downloads the updates but fails to install any. This is the error I see in the update.txt file
Starting nightly upgrade check process Tue Dec 5 03:15:01 EST 2017
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Hit http://apt.osmc.tv jessie InRelease
Ign http://ftp.debian.org jessie InRelease
Get:2 http://ftp.debian.org jessie-updates InRelease [145 kB]
Get:3 http://apt.osmc.tv jessie/main armhf Packages/DiffIndex [2023 B]
Hit http://ftp.debian.org jessie Release.gpg
Hit http://security.debian.org jessie/updates/main armhf Packages
Hit http://ftp.debian.org jessie Release
Hit http://security.debian.org jessie/updates/contrib armhf Packages
Hit http://security.debian.org jessie/updates/non-free armhf Packages
Hit http://security.debian.org jessie/updates/contrib Translation-en
Hit http://security.debian.org jessie/updates/main Translation-en
Get:4 http://ftp.debian.org jessie-updates/main armhf Packages/DiffIndex [9376 B]
Hit http://security.debian.org jessie/updates/non-free Translation-en
Hit http://ftp.debian.org jessie-updates/contrib armhf Packages
Get:5 http://ftp.debian.org jessie-updates/non-free armhf Packages/DiffIndex [736 B]
Hit http://ftp.debian.org jessie-updates/contrib Translation-en
Get:6 http://ftp.debian.org jessie-updates/main Translation-en/DiffIndex [3688 B]
Get:7 http://ftp.debian.org jessie-updates/non-free Translation-en/DiffIndex [736 B]
Hit http://ftp.debian.org jessie/main armhf Packages
Ign http://apt.osmc.tv jessie/main Translation-en
Hit http://ftp.debian.org jessie/contrib armhf Packages
Hit http://ftp.debian.org jessie/non-free armhf Packages
Hit http://ftp.debian.org jessie/contrib Translation-en
Hit http://ftp.debian.org jessie/main Translation-en
Hit http://ftp.debian.org jessie/non-free Translation-en
Fetched 225 kB in 18s (12.0 kB/s)
Reading package lists…
Reading package lists…
Building dependency tree…
Reading state information…
The following packages will be upgraded:
_ curl libcurl3_
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/432 kB of archives.
After this operation, 0 B of additional disk space will be used.
**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_
Reading package lists…
Building dependency tree…
Reading state information…
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Reading package lists…
Building dependency tree…
Reading state information…
Initiating system nightly reboot
Ending nightly upgrade check process Tue Dec 5 03:35:01 EST 2017
I have verified that root’s path has /usr/local/sbin, /usr/sbin and /sbin
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path=“/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
I am kinda stuck and don’t know what path to go down to troubleshoot the error and fix it. Anyone have an idea or two as to where i should start looking?
Thanks,
G