Installed package disappears after re-boot

Hi!

I installed gpsd - apt-get install gpsd gpsd-clients python-gps - and everything was good until I re-booted the RPi3 at which point gpsd was nowhere to be found.
Is there some way to keep packages across boots?

Thanks in advance :slight_smile:

Hi, how were you installing these packages? Was it by any chance in the web terminal of the device?

Your experience should be connected to how Docker containers work. Your application is built as a Docker container that is run on your device (your Raspberry Pi in this case). The web terminal connects to within the running container, and changes to running containers are not permanent, whenever the container restarts, it starts from the same original state. If you want to have changes, you have to rebuild your container (e.g. adding these installs to your Dockerfile).

You can check out some more in our getting started guide https://docs.resin.io/raspberrypi3/python/getting-started/

This change in thinking in terms of containers is tricky at first, but soon it will become second nature. :slight_smile: Please don’t hesitate to ask any questions if any clarification or explanation needed!

Yes - I used the terminal. I assumed that it was the same as Putty - obviously not.
So if I put RUN apt-get install gpsd gpsd-clients python-gps - in my docker.template file that will make gpsd a permanent fixture in my build? Sounds pretty straightforward to me! :grin:

It is the same as putty, you are just connecting into the running container, that is the application running on your Pi :slight_smile:

Yes, the Dockerfile or Dockerfile.template sets up what should be within the container that is deployed on the device. Some more info about how Dockerfiles work is at https://docs.resin.io/deployment/dockerfile/ in case it’s helpful.

I edited my docker.template file -

FROM resin/%%RESIN_MACHINE_NAME%%-buildpack-deps:latest

# Enable systemd, as Resin requires this
ENV INITSYSTEM on

# Make the hardware type available as a runtime env var
ENV RESIN_ARCH %%RESIN_ARCH%%
ENV RESIN_MACHINE_NAME %%RESIN_MACHINE_NAME%%
 
# Copy the build and run environment
COPY . /opt/ttn-gateway/
WORKDIR /opt/ttn-gateway/

# Install any packages here
 RUN apt-get install gpsd gpsd-clients python-gps

# Build the gateway (or comment this out if debugging on-device)
RUN ./dev/build.sh && rm -rf ./dev

# Start it up
CMD ["sh", "-c", "./run.py"]

but it failed to build with the following error -

[Error] Build failed: The command ‘/bin/sh -c apt-get install gpsd gpsd-clients python-gps’ returned a non-zero code: 100
[Info] Uploading failed build to registry for caching purposes…
[=================================> ] 66%
[Error] Build failed: unauthorized: authentication required

Is this just a syntax error?

Yep! - syntax error (my bad!)
After looking at some examples I found that I missed out a -y. All sorted now :laughing:

1 Like

Thanks for pointing me in the right direction. :thumbsup:

Sure thing!
And I see that you are deploying The Things Network node, great to see those! :slight_smile:

Yes I am - actually its an ic880a Rpi3 gateway.

1 Like