3

I get error when trying to set time:

$ sudo timedatectl set-timezone America/New_York   
Failed to set time zone: Access denied   

This is on an almost pristine stretch lite image. I noticed

$ ls -lad /etc  
drwxr-xr-x 92 pi pi 4096 Mar 12 12:16 /etc  

Shouldn't /etc be owned by root?
Is there something that changed ownership to pi?

I tried

sudo chown root /etc   

and that seemed to fix this issue, but did I break something else?
Is this a bug with the original OS image?

Ingo
  • 42,961
  • 20
  • 87
  • 207

2 Answers2

2

Minutes after starting the new image, I used

cd /  
sudo tar -xf /home/pi/files.tar.gz   

to put a few files at needed places. I should have used

sudo tar --no-same-owner -xf /home/pi/files.tar.gz   

since tar changed ownership of directories it did not create.

--same-owner is a tar default when run as superuser, and the tar was created from pi-owned directories.

0

Your Raspbian Stretch Lite installation cannot be pristine. I have just used a virgin installation of Raspbian Stretch Lite 2018-11-13. It shows that /etc belongs to user root and group root.

There is another weird thing with your installation. Using sudo to execute commands run them with superuser root and has no restrictions, particular running commands belonging to other users. I cannot see why root should fail to execute timedatectl only why /etc has user:group pi:pi.

I suggest to download Raspbian Stretch Lite 2018-11-13, compare the checksum and either using etcher to flash the image or use

unzip -p 2018-11-13-raspbian-stretch.zip | sudo dd of=/dev/sdX bs=4M conv=fsync

on a Linux machine to flash the image to the SD Card.

Ingo
  • 42,961
  • 20
  • 87
  • 207