New debian package prepuse

I have built the debian package prepuse

prepuse - prepare a mobile device for specific use

The description is: configure a mobile device from a small GUI with special settings and start needed programs for a specific usage

Until now I only use it to prepare my librem5 to use pure-maps.
Because it helps me I hope you will also like it.

If you try it, please give me feedback. I would like to know if you plan to use it in future, of if you have any ideas what could be improved, or if you have found a bug. Or if you have any questions. Or if you have other use cases, where you prepare your librem5 manually before usage, that could be improved with prepuse. If prepuse is helpful for a a lot of people, I would consider uploading it as official debian package.


# make sure you have PureMaps and OSMScoutServer installed on your librem5
sudo flatpak list | grep -e PureMaps -e OSMScoutServer
# example output:
OSM Scout Server    io.github.rinigus.OSMScoutServer    3.0.0   stable  flathub system
Pure Maps   io.github.rinigus.PureMaps  3.2.0   stable  flathub system

# Prepare for building the prepuse debian package 
sudo apt-get update
sudo apt-get install python3-docutils devscripts

# Install the sources, build the debian package and install it
git clone
cd prepuse
sudo apt install ./prepuse*.deb

see the manpage prepuse(1), on the librem console. Or press the help button
from the running application.

I have also provided a few screenshots:


What does it mean, to prepare the mobile device?

1 Like

It looks interesting, but I’m still not sure what it actually does. Apply desired settings to flatpaks?
Some notes:

  • some people might be more willing to try a pre-built package. It seems installation takes more effort than what the app solves (yet).
  • check the spelling of prepare/preparation in the pdf
  • You can shorten the last lines of the installation instructions to
sudo apt install ./prepuse*.deb

Thanks for the question. I will try to explain, what it means for me to prepare the mobile device for pure-maps (Sorry I forgot to explain it, but it is at least in the manpage).

When me and my wife start on Sunday to make a wandering tour I need the GPS working on my librem5 very fast after we have suddenly decided where to go. My wife wants me to just load the GPS-track and then to get routed to the starting point with the car and then to find the track while wandering. I usually already have the librem5 charged from the night. But now I have to do a lot of things.:

  • blank-screen=off makes sure, that the screen is on as long as I need it.
  • gnss-check-reset=on checks that the gnss service is really running and sends data, if not the gnss service and the kernel modules will be restarted without rebooting
  • gnss-test=on this script is from purism itself. I like it, because it shows the raw GPS data. To be sure everything works I want to start it and see it and get a reassured feeling. After it has proofed to work, it can be stopped (this can also be easily done with prepuse, if you change gnss-test=on to gnss-test=off and just restart).
  • idle-dim=off Also while driving in my car, I do not want the display to dim after some time
  • location=on There is a security option in the settings, where you have to allow the access to GPS. I want to make sure, that I do not forget this.
  • osmscout-server=on Because I want to have offline data from openstreetmap I have to start the server on my librem5 that provides that data
  • pure-maps.prep=on For sure I need to start pure-maps itself, as my main GPS display
  • screen-lock=off I do not want that the screen gets locked while driving in the car.

Before I had prepuse I had to do all this steps manually. And instead of using the gnss-check-reset way (that I did not know before) I rebootet.

With this script it is easier. And After we have done our wandering tour, everything can be turned the other way around in the same way with just one click. Before that I sometimes forgot to change values back. And this could lead to a high battery usage.

I hope somebody will find another idea what prepuse could be used for (besides GPS), so I did call it prepuse and not prepGPS


Thanks, that this hint is useful.

Yes. It needs a top level readme. Here’s a link to the basic manpage which gives some idea: src/prepuse-1.rst · master · Bernd Schumacher / Prepuse · GitLab

The repo is here: Files · master · Bernd Schumacher / Prepuse · GitLab

As you can see, it installs a bunch of sh scripts (one of which uses yad = “yet another dialogue” to provide a GUI to kick them off) to apply various gsettings, do insmod/rmmod, install flatpaks, etc.

Personally, I wouldn’t install these to run them … but if you can read sh scripts, it does provide reasonable “documentation” of the steps one might undertake to, for example, get gnss ready to be used with mapping software, etc.

I write myself similar (but not for “general use” so they are less complicated) scripts … and usually include a “–noexec” option which lists the commands that it would execute to remind myself of what’s going on.


After reading your description, it makes sense.
I think I would name it ProfileSwitcher or UseProfileSwitcher (UPS!) or something like that.
Some general purpose profiles that might be useful:

  • Normal
  • Navigation
  • Reader (screen stays on, brightness?)
  • Video (probably similar to Reader)
  • Do-Not-Disturb
  • Energy Saving (e.g. all radios off)
  • Docked / Convergence Mode (e.g. switch to Audio via BT, mount network drives …)

But what each mode means could be different for different people.
I didn’t yet play with GPS on my L5, but many who did were having trouble getting a satellite fix, and downloading it from the Internet is not yet automated. So this might be a helpful addition. Although at some point this might be integrated into PureOS.

1 Like

I’ m very interested trying your script, but when doing
“git clone”
I get an error: Permission denied (publickey)
fatal: Could not read Remote-Repository.
Please make sure that the repository exists and that you are authorized to access it.

Could you please help me?
Thanks a lot

1 Like


git clone

The other command you listed is for SSH.


Thanks for your answer, but doing so it says:
fatal: could not access to “Bernd Schumacher / Prepuse · GitLab
URL using bad/illegal format or missing URL

1 Like

I do not have the same issue using Debian. Do you have a stable Internet connection, accurate date and time, and installed git beforehand?

You can try using sudo and see if that helps, although you should not need to unless your current working directory requires it.


Sorry, must have been a typo, now I succeeded in cloning, making and installing it.
But after starting “prepuse” and choosing “pure-maps” it just shows "readPREPstates 50% and nothing happens.

1 Like

Do you have the OSMScoutServer flatpak installed? You can try restarting the application, reselecting "pure-maps’, and seeing if your situation changes.


Yes, I have OSMScoutServer version 3.0.0 and pure maps version 3.2.0 installed. Restarting “prepuse" gives an error saying prepuse is already running pid=19952045.
The already running prepuse may be busy running PREP-FILES. The following PREP-FILES are running:
/bin/sh /usr/prepcmd gnss-check-reset status
Please wait for the GIU and quit before starting a new prepuse.

1 Like

Okay, from here, there are two options:

  1. Wait as suggested.
  2. Restart the Librem 5, then open the app and retry again.

You decide which you prefer.


I did the last option several times (and than restarting the Librem5) but the “read PREP states” seems to be frozen always at 50%. How long should this procedure take, 30 minutes?

1 Like

I do not know, I am only here to provide support.

This is the description of gnss-check-reset.prep:

Check state of gnss modules and service and restart if not ok.
Normally this PREP-FILE would not be necessarry, but if
GPS is not running, it may help to restart GPS,
without reboot of mobile device.

So it is suggesting that you should restart GPS, although I do not exactly know how to do so. However, I do know that you cannot be in Lockdown Mode, as that disables the various sensors required to use GPS.


First of all thank very much for your kind support!
Now unfortunately I have to continue with my “real” work, so I will look into this tomorrow.
But yes, I’m not in Lockdown Mode and I also manually switch on the location service showing this pin logo in the upper right of the screen. But I often run into problems with GPS tracking, sometimes it takes ages until my correct position is shown on pure maps.
Thanks again for the help!

1 Like

If one of the preparations takes to long. You can disable it for a use case. Exp:
If gnss-check-reset.prep is the problem in the pure maps use case, comment it out in the file /etc/prepuse/pur-maps.use: old line: “gnss_check_reset=on” new line: “# gnss_check_reset=on”.

Because gnss-check-reset.prep is optional, everything already may work fine now.

But you can also check what gnss-check-reset.prep does:

cat /usr/share/prepuse/gnss-check-reset.prep
# vim: set filetype=sh :
# gnss-check-reset.prep - see man prepuse(1)
# Copyright: 2023 Bernd Schumacher <>
# License: GPL-3.0+

  [ "$(sudo gnss-check-reset --only-check)" = "ok" ] && echo on || echo off

  # gnss should not be stopped

  sudo gnss-check-reset

And you can try it manually by calling:

sudo gnss-check-reset

You can also call this script with --help or with -h and try the shown options:

sudo gnss-check-reset -h
gnss-check-reset [-d] [–only-check]
-d turn debug on
–only-check only check status of gnss
ERROR: unknown option <-h>

I hope, if we find out more info about the problem, it can be fixed.


Thanks a lot for your reply. I’ve modified the file as you showed, and now your app starts without freezing. I will test it out “in the wild” next weekend.
Thank you for programming this app and making it available to us!

1 Like