# Installed package disappears after re-boot

**URL:** <https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173>\
**Category:** Product support\
**Created:** [June 5, 2017, 12:12am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173 "2017-06-05T00:12:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![marssystems](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/marssystems/32/3524_2.png) [@marssystems](https://forums.balena.io/u/marssystems)\
**Post date:** [June 5, 2017, 12:12am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/1 "2017-06-05T00:12:10Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [June 5, 2017, 12:51am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/3 "2017-06-05T00:51:59Z")

</div>

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/](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. 🙂 Please don’t hesitate to ask any questions if any clarification or explanation needed!

---

<div class="post-metadata">

**Author:** ![marssystems](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/marssystems/32/3524_2.png) [@marssystems](https://forums.balena.io/u/marssystems)\
**Post date:** [June 5, 2017, 1:29am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/4 "2017-06-05T01:29:44Z")

</div>

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! 😁

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [June 5, 2017, 1:36am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/5 "2017-06-05T01:36:01Z")

</div>

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

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/](https://docs.resin.io/deployment/dockerfile/) in case it’s helpful.

---

<div class="post-metadata">

**Author:** ![marssystems](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/marssystems/32/3524_2.png) [@marssystems](https://forums.balena.io/u/marssystems)\
**Post date:** [June 5, 2017, 1:52am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/6 "2017-06-05T01:52:34Z")

</div>

I edited my docker.template file -

```auto
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?

---

<div class="post-metadata">

**Author:** ![marssystems](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/marssystems/32/3524_2.png) [@marssystems](https://forums.balena.io/u/marssystems)\
**Post date:** [June 5, 2017, 2:20am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/7 "2017-06-05T02:20:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marssystems](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/marssystems/32/3524_2.png) [@marssystems](https://forums.balena.io/u/marssystems)\
**Post date:** [June 5, 2017, 2:23am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/9 "2017-06-05T02:23:34Z")

</div>

> [@imrehg](#):
>
> 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 [Define a container - Balena Documentation](https://docs.resin.io/deployment/dockerfile/) in case it’s helpful.

Thanks for pointing me in the right direction. 👍

---

<div class="post-metadata">

**Author:** ![imrehg](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/imrehg/32/36_2.png) [@imrehg](https://forums.balena.io/u/imrehg)\
**Post date:** [June 5, 2017, 9:32am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/11 "2017-06-05T09:32:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marssystems](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/marssystems/32/3524_2.png) [@marssystems](https://forums.balena.io/u/marssystems)\
**Post date:** [June 5, 2017, 10:35am UTC](https://forums.balena.io/t/installed-package-disappears-after-re-boot/1173/12 "2017-06-05T10:35:02Z")

</div>

Yes I am - actually its an ic880a Rpi3 gateway.
