Re-make my Raspberry Pi system, again.

Last year, I wrote a post titled Re-make my Raspberry Pi after a stupid mistake. A few days ago, my Raspberry Pi screwed up again, and I had to re-make the system once more.

I mentioned in my last post that a great tutorial (HackerShackOfficial/Raspberry-Pi-VNC-Mac) helped me a lot in setting up the Raspberry Pi to connect with my Mac. Unfortunately, I found that it is a bit outdated now. So, I am writing this post to record what I did and hopefully provide some tips to others.


Firstly, I needed to install tightvncserver like before. We will come back to tightvncserver later.


Problems appeared when I tried to install netatalk. For some reason, netatalk could not be found. So, I had to go to the netatalk source code and install it locally by myself.

Fortunately, most dependencies can be installed painlessly with apt.

Something has changed from before; I needed to create the file /usr/local/etc/afp.conf and change its contents to:

basedir regex = /home

Furthermore, I created the /etc/systemd/system/netatalk.service file:

Description=Netatalk AFP fileserver for Macintosh clients

ExecStart=/usr/local/sbin/netatalk -d


After creating the service file, I ran the following systemd commands:

sudo systemctl daemon-reload

sudo systemctl enable netatalk

sudo systemctl start netatalk


sudo apt install avahi-daemon is the same as before. I needed to add the file /etc/avahi/services/afpd.service with the following content:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
   <name replace-wildcards="yes">%h</name>

And the /etc/avahi/services/rfb.service:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
  <name replace-wildcards="yes">%h</name>

Back to VNC

I tried to add the tightvncserver to systemd, but I failed because of permission problems. It appears that systemd wants it to run as root, but for some reasons, it needs to be run as a user.

So, I created the script vncserver :1 -geometry 1920x1080 -depth 24 and modified ~/.vnc/xstartup to:

xrdb "$HOME/.Xresources"
startlxde &

Otherwise, the screen share would show just a blank grey screen.


One of my Raspberry Pi’s functions is serving as my Plex host server. I installed Plex, and the only thing that stopped me was a permission problem. Plex could not read or write to the user’s owned folder, as Plex runs as the plex user.

Thanks to someone on Reddit, I learned that I could just change the running user of Plex by adding the following to /etc/systemd/system/plexmediaserver.service.d/override.conf:



That’s it. There were a lot of details, dependencies, and configurations. I think I will collect all the setup commands somewhere in case it screws up again in the future.

Written on June 19, 2024