I have several machines (running Ubuntu LTS 12.4 64-bit) which need to be configured in the same way, so I created a shell script which will run automatically the first time the machine boots. It works for the most part, but any call to apt-get fails. As an example, here are two commands I want to execute.debconf-set-selections ./files/ldap.preseedapt-get -y install ldap-auth-clientHere is the result if I type those lines directly:root@spare:/tmp/scripts# debconf-set-selections ./files/ldap.preseedroot@spare:/tmp/scripts# apt-get -y install ldap-auth-clientReading package lists... DoneBuilding dependency treeReading state information... DoneThe following packages will be installed:  ldap-auth-config libnss-ldap libpam-ldapThe following NEW packages will be installed:  ldap-auth-client ldap-auth-config libnss-ldap libpam-ldap0 upgraded, 4 newly installed, 0 to remove and 67 not upgraded.Need to get 0 B/200 kB of archives.After this operation, 877 kB of additional disk space will be used.Preconfiguring packages...[and so on...]But if I execute a shell script containing only those lines, this happens:root@spare:/tmp/scripts# ./ldap.crReading package lists... DoneBuilding dependency treeReading state information... DoneE: Unable to locate package ldap-auth-clientThe same thing occurs when I run the script using sudo, or chown it to root first. What is the difference, to the program, if it is being called directly or through a shell script? And is it possible to convince it otherwise?EDIT: More information:root@spare:/tmp/scripts# apt-cache policy ldap-auth-clientldap-auth-client:  Installed: (none)  Candidate: 0.5.3  Version table:    0.5.3.0       500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
Apt-get failing in bash script?
shell script;apt