Details
-
Type:
Bug
-
Status: Done
-
Priority:
(None)
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.7.1, 3.0.0, 2.6.2, 3.0.0-report
-
Labels:
-
Story Points:2
-
Backlog:yes
-
Days in progress:0
Description
When following Install using the APT repository from docs.mender.io on a Raspberry Pi fails with error:
pi@raspberrypi:~$ sudo add-apt-repository Error: need a repository as argument pi@raspberrypi:~$ sudo add-apt-repository \ > "deb [arch=armhf] https://downloads.mender.io/repos/debian \ > stable \ > main" Traceback (most recent call last): File "/usr/bin/add-apt-repository", line 95, in <module> sp = SoftwareProperties(options=options) File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__ self.reload_sourceslist() File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist self.distro.get_sources(self.sourceslist) File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 93, in get_sources (self.id, self.codename)) aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/buster
This does not fail when using script from get.mender.io because the repo installation method is different (in the script we add it manually). See snippet below:
add_repo() { curl -fsSL $REPO_URL/gpg | apt-key add - repo="deb [arch=$ARCH] $REPO_URL $CHANNEL main" if ! grep -F "$repo" /etc/apt/sources.list; then echo "adding $repo to /etc/apt/sources.list" echo "$repo" >> /etc/apt/sources.list fi }
Related issue reported here and followed-up here. But basically the norm is to not use add-apt-repository utility and add it manually. See Docker install instructions for an example.
Once we are on it, we will update the script to best practice of using sources.list.d/mender.io instead of sources.list.
Acceptance criteria:
- Mender Docs instructions are aligned to get.mender.io script: install the repo manually.
- Switch in both places from appending to sources.list to best practice of creating dedicated file in sources.list.d
- echo "deb [arch=$ARCH] $REPO_URL $CHANNEL main" > /etc/apt/sources.list.d/mender.io
- get.mender.io is idempotent with old configuration. For example removing the entry from sources.list before creating file in sources.list.d
- Something like: sed -i sources.list -e " $REPO_URL/d"