A router runs firmware containing BusyBox and in addition to flash memory the device has secondary memory storage. That USB stick is mounted at both /media/Main and /opt:

# mount | grep sda
/dev/sda1 on /media/Main type ext4 (rw,noatime,data=ordered)
/dev/sda1 on /opt type ext4 (rw,noatime,data=ordered)

Duplicates in locate database

The issue is that locate updatedb indexes both /media and /opt. I wish to permanently remove these duplicates from /opt/var/locatedb without changing drive mounting. I do wish to use the updatedb command without adding options to that command from both cron and shell. An alias might be an option. Though my first search for "locate database exclude" did return a blog post that suggest to use an “/etc/updatedb.conf” for Arch Linux.


First try was to create a file /opt/etc/updatedb.conf containing:

# directories to execlude from the locate database
PRUNEPATHS="/media /mnt /tmp /var/tmp /var/cache /var/lock /var/run /var/spool"

# filesystems to exclude from the locate database:
PRUNEFS="afs auto autofs binfmt_misc cifs coda configfs cramfs debugfs devpts devtmpfs ftpfs iso9660 mqueue ncpfs
nfs nfs4 proc ramfs securityfs shfs smbfs sshfs sysfs tmpfs udf usbfs vboxsf"
export PRUNEFS

That is not enough to let updatedb use the desired configuration. Next was reading GNU locate documentation. GNU updatedb documentation states:

Typically, operating systems have a shell script that “exports” configurations for variable definitions and uses another shell script that “sources” the configuration file into the environment and then executes updatedb in the environment.

Does my embedded Linux export and source configuration variables?

This embedded Linux operating system might have the GNU suggested shell scripts that export configuration variables and also sources them back into the environment.

How can I verify that this OS exports and sources?

And when the OS doesn't, how to correctly export and source configuration variables here?


  • GNU locate was installed via opkg on this external storage medium
  • BusyBox v1.24.1 according to /bin/sh --version
  • locate (GNU findutils) 4.6.0
  • shell is -sh according to echo $0
  • /opt/home/admin/.ash_history exists

$ cat /opt/etc/profile

export PATH='/opt/usr/sbin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin'
export TMP='/opt/tmp'
export TEMP='/opt/tmp'

# This is for interactive sessions only
if [ "$PS1" ] ; then
  export TERM=xterm
  [ -d /opt/share/terminfo ] && export TERMINFO='/opt/share/terminfo'
  export LANG='en_US.UTF-8'
  export LC_ALL='en_US.UTF-8'

export TERMINFO=/opt/share/terminfo

Where to export

After having read https://bitbucket.org/padavan/rt-n56u/wiki/EN/UsingCron a good way to export configuration variables for both crontab and shell usage, is to insert the /opt related variables into /opt/etc/profile.

Where and how to source

To use ("source") the variables in cron it is suggested to:

  1. create a shell-wrapper script
  2. source /etc/profile in that wrapper script
    note: /etc/profile will also source /opt/etc/profile
  3. call that wrapper script by prepending the crontab configuration content with the line: SHELL=/etc/storage/cron/shell-wrapper.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.