When running commands like date or ls -l I always get a multiple repetition of the following lines to the standard error:

__bionic_open_tzdata_path: ANDROID_DATA not set!
__bionic_open_tzdata_path: ANDROID_ROOT not set!

I used to consider it acceptable, until I created a script running date in a loop, causing an awful endless stream of the same repeated lines.
I couldn't find any documentation about it, yet the problem seems to be common.
Any idea how to fix this?
Thanks in advance

  • 2
    Well, it seems that your terminal environment lacks two variables: ANDROID_DATA (usually /data) and ANDROID_ROOT (/system). Try to assign these values to said variables and run the commands again.
    – Grimoire
    Commented Nov 3, 2016 at 20:39
  • 1
    Thank you @DeathMaskSalesman, I've just realised that the problem occurs only in ssh shell, not in AndroidTerminalEmulator. I was looking for an answer far away while the answer was just in front of my eyes.
    – Claudio
    Commented Nov 4, 2016 at 11:13

2 Answers 2


For ssh users, following up on @Death Mask Salesman's comment. sshd allows setting up ENV via proper config (from man --pager='less -p ^ENVIRONMENT' ssh):

[...] Additionally, ssh reads ~/.ssh/environment, and adds lines of the format “VARNAME=value” to the environment if the file exists and users are allowed to change their environment. For more information, see the PermitUserEnvironment option in sshd_config(5).

However I couldn't succeed to set it up on my phone (Sony Xperia "Tsubasa" / LineageOS 14.1). Thus I resorted to adding in /etc/bash/bashrc:

export ANDROID_DATA=/data ANDROID_ROOT=/system

then logging in...

$ ssh root@... -t bash
tsubasa / # env | grep ANDROID_



I had the same problem and found a solution, fixing the issues that sphakka had in his answer.

Create these 2 files:


With the following content:


You might need to set permissions for these 2 files chmod 755 environment

Very important: Enable PermitUserEnvironment yes in /data/ssh/sshd_config

Restart the sshd with /sbin/.magisk/modules/ssh/opensshd.init restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .