I am trying to set up a stable repository and getting an error —
need a single repository as an argument
Can someone please tell me what is wrong with this statement:
sudo add-apt-repository deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
Zanna♦
68.2k55 gold badges210 silver badges320 bronze badges
asked Jan 24, 2019 at 19:51
I think you are after this, actually:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
The quotes make the entire string you were trying to add be treated as a single argument. This way you don’t need to mess with escaping spaces (which your command didn’t actually do properly which is why it all failed and gave you errors).
Note that you will still need to download the GPG key in use for the repository, as add-apt-repository
is incapable of doing that for straight strings like you’re adding here.
answered Jan 24, 2019 at 19:54
Thomas Ward♦Thomas Ward
70.4k29 gold badges172 silver badges236 bronze badges
0
- Forum
- The Ubuntu Forum Community
- Ubuntu Official Flavours Support
- General Help
- [SOLVED] Question about ‘add-apt-repository’ command
-
Question about ‘add-apt-repository’ command
Here is a simple question about the «add-apt-repository» command.
So I was trying to install Oracle’s VirtualBox the correct way and when tried to add repositories for the software, I suddenly ran into questions; for example the official site says to add the line ‘deb http://download.virtualbox.org/virtualbox/debian trusty contrib‘ into the «/etc/apt/sources.list» file. Why can’t I do this via terminal? Or what is the correct command for this? I successfully managed to add the line via GUI or Nano’ing the «sources.list» file, but not via terminal. It’s kind of confusing since most of other repository entries I have on my machine has instead a «ppa:» naming scheme, not «http://xxx.xxx.xxx» etc.
-
Re: Question about ‘add-apt-repository’ command
Did you try using add-apt-repository? There is a man (manual) page for this command as there is for all commands.
Code:
man add-apt-repository
add-apt-repository is a script which adds an external APT repository to either /etc/apt/sources.list or a file in /etc/apt/sources.list.d/ or removes an already existing repository.
Regards.
It is a machine. It is more stupid than we are. It will not stop us from doing stupid things.
Ubuntu user #33,200. Linux user #530,530
-
Re: Question about ‘add-apt-repository’ command
Yes I did use «add-apt-repository man. As I said it’s not working for the line in question.
Console outputs the following error:
Code:
Error: need a single repository as argument
-
Re: Question about ‘add-apt-repository’ command
add-apt-repository can be used for traditional ‘deb address section’ repositories, almost as-is.
For instance, I prefer using the latest official builds of mkvtoolnix instead of the ones in the Ubuntu repositories. The info is given as the traditional ‘add this to your sources.list’ as:
(for 15.10):Code:
deb http://mkvtoolnix.download/ubuntu/wily/ ./ deb-src http://mkvtoolnix.download/ubuntu/wily/ ./
But I’d prefer to do it with add-apt-repository so I don’t have to worry about opening a text editor.
Code:
sudo add-apt-repository "deb http://mkvtoolnix.download/ubuntu/wily/ ./" wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add -
(that second one is just importing the signing keys; not all repos will require that kind of thing)
You have to remember to enclose the entire deb line in double-quotes as the argument to add-apt-repository.
-
Re: Question about ‘add-apt-repository’ command
Originally Posted by qyot27
add-apt-repository can be used for traditional ‘deb address section’ repositories, almost as-is.
For instance, I prefer using the latest official builds of mkvtoolnix instead of the ones in the Ubuntu repositories. The info is given as the traditional ‘add this to your sources.list’ as:
(for 15.10):Code:
deb http://mkvtoolnix.download/ubuntu/wily/ ./ deb-src http://mkvtoolnix.download/ubuntu/wily/ ./
But I’d prefer to do it with add-apt-repository so I don’t have to worry about opening a text editor.
Code:
sudo add-apt-repository "deb http://mkvtoolnix.download/ubuntu/wily/ ./" wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add -
(that second one is just importing the signing keys; not all repos will require that kind of thing)
You have to remember to enclose the entire deb line in double-quotes as the argument to add-apt-repository.
Thanks, it worked! Now let me try and understand why.
So basically what is a «PPA» and why do I need to include the symmetric double quotes if the line to be added does not come with PPA? What is the difference between a «PPA» and a «non-PPA» repository address? Also, what is the difference between adding or not that second line «deb-src» from your example? Is that the repository address for the source code or something?
Last edited by lakeshore2985; March 26th, 2016 at 03:04 AM.
-
Re: Question about ‘add-apt-repository’ command
Originally Posted by lakeshore2985
So basically what is a «PPA» and why do I need to include the symmetric double quotes if the line to be added does not come with PPA? What is the difference between a «PPA» and a «non-PPA» repository address? Also, what is the difference between adding or not that second line «deb-src» from your example? Is that the repository address for the source code or something?
Technically, any external repository is a ‘PPA’. All ‘PPA’ stands for is ‘Personal Package Archive’…i.e., a plain old repository. The double quotes are needed because there are space characters in the information, and the double-quotes let add-apt-repository see it as a single item rather than three or more (the word deb, the address, and one or more sections). The ppa: protocol used on Launchpad doesn’t contain spaces, so it can be interpreted as a single item regardless of double-quotes.
The reason that you can go on Launchpad, look up PPAs, and use the ppa: protocol to add them via add-apt-repository is because it translates Launchpad’s ppa: address data into the right lines/configuration files to add to the sources.list (or said another way, if you use ‘ppa:’ it knows to go to Launchpad and grab the data from that shorthand). There’s nothing all that special about it, except that Launchpad is a centralized hosting service and the ppa: protocol they provide also imports the authentication keys along with the rest of the repo data. If you notice, Launchpad provides a traditional ‘copy this to your sources.list and use this GPG key to authenticate it’ information box in the write-up for each PPA, so you could do it manually if you wanted.
And yes, the deb-src repo is a repository for the source code of the packages in the deb repo.
Last edited by qyot27; March 27th, 2016 at 12:55 AM.
-
Re: Question about ‘add-apt-repository’ command
Originally Posted by qyot27
Technically, any external repository is a ‘PPA’. All ‘PPA’ stands for is ‘Personal Package Archive’…i.e., a plain old repository. The double quotes are needed because there are space characters in the information, and the double-quotes let add-apt-repository see it as a single item rather than three or more (the word deb, the address, and one or more sections). The ppa: protocol used on Launchpad doesn’t contain spaces, so it can be interpreted as a single item regardless of double-quotes.
The reason that you can go on Launchpad, look up PPAs, and use the ppa: protocol to add them via add-apt-repository is because it translates Launchpad’s ppa: address data into the right lines/configuration files to add to the sources.list (or said another way, if you use ‘ppa:’ it knows to go to Launchpad and grab the data from that shorthand). There’s nothing all that special about it, except that Launchpad is a centralized hosting service and the ppa: protocol they provide also imports the authentication keys along with the rest of the repo data. If you notice, Launchpad provides a traditional ‘copy this to your sources.list and use this GPG key to authenticate it’ information box in the write-up for each PPA, so you could do it manually if you wanted.
And yes, the deb-src repo is a repository for the source code of the packages in the deb repo.
Thank you for clearing this up!
-
Re: Question about ‘add-apt-repository’ command
If your question has been answered to your satisfaction, please mark the thread ‘Solved’ under the Thread Tools menu at the top of the page. This will help others who may have the same question. Thanks.
-
Re: Question about ‘add-apt-repository’ command
Bookmarks
Bookmarks

Posting Permissions
установи
software-properties-common python3-software-properties
тогда будет работать add-apt-repository
Отредактировать /etc/apt/sources.list
Но судя по вопросу следующий будет- «все сломалось, как восстановить систему?» Установка из ppa не рекомендована.
Цитата: dmitry1903 от 16 марта 2018, 20:27:16Если нужен пакет, которого нет в дебиановском репозитории, будет ли безопаснее скачать этот пакет и установить вручную, а не добавлять посторонний репозиторий?
Для одного пакета репозиторий создают только тогда когда предполагают частые обновления. Например браузеры с закрытым кодом. Кто их использует и по долгу сидит на одном выпуске debian прекрасно знают что рано или поздно для этого репозитория зависимости ломаются ( порядка 2х с небольшим лет). Другой случай вроде wine, пакет тянет за собой дополнительные зависимости из этого стороннего репозитория. Для целостности пакетной базы это практически всегда плохо. Поставив однажды свежий wine из стороннего источника через какое то время можно получить проблемы с обновлением системы или невозможность установки некоторых родных пакетов. Бывает что всё обходится без последствий но гарантия слетает.
Русские дебианщики против цифрового слабоумия !
I want to install opencv in ubuntu 17.04 and I know that the jasper library is removed from ubuntu 17.04
what should I do to complete install opencv correctly ???
I tried used this two below command that showed here but it does not work
sudo apt-get install opencv-data
sudo apt-get install libopencv-dev
asked Jun 9, 2017 at 23:49
Use these commands:
sudo add-apt-repository 'deb http://security.ubuntu.com/ubuntu xenial-security main'
sudo apt update
sudo apt install libjasper1 libjasper-dev
This worked on my Ubuntu 18.04 after I replaced the double-quotes with single quotes. With the double quotes I was getting this error:
Error: need a single repository as argument
DMin
9,65910 gold badges45 silver badges65 bronze badges
answered Mar 30, 2020 at 12:01
1
Try this answer
You will be able to install the libjasper-dev from a previous release
answered Jun 11, 2017 at 20:27
1
Under Ubuntu18.04, if you directly add-apt-repository
will encounter another GPG error.
$ sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://dl.yarnpkg.com/debian stable InRelease: The following signatures were invalid: ...EXPKEYSIGhttps://dl.yarnpkg.com/debian/dists/stable/InRelease The following signatures were invalid: EXPKEYSIG ...
You have to update the key
sudo apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com
Then you are now safe to install libjasper-dev
.
sudo apt-get install libjasper-dev
Reference
answered May 7, 2021 at 2:23
stackoverYCstackoverYC
4702 gold badges4 silver badges13 bronze badges
1
To build the latest version of libjasper as package for Ubuntu do the following:
Download the Jasper source code from here: https://github.com/jasper-software/jasper/tree/version-2.0.25
Run the following script:
#!/bin/bash
VERSION=2.0.25
unzip jasper-version-$VERSION.zip
cd jasper-version-$VERSION
mkdir compile
SOURCE_DIR=`pwd`
BUILD_DIR=compile
INSTALL_DIR=/usr
OPTIONS=
cmake -G "Unix Makefiles" -H$SOURCE_DIR -B$BUILD_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $OPTIONS
cd compile
make clean all
cat >description-pak <<EOF
JasPer Image Processing/Coding Tool Kit
EOF
fakeroot checkinstall --fstrans --install=no --pkgname=libjasper --pkgversion=$VERSION --pkgrelease 1 --pkglicense="JasPer 2.0"
bash -c "make install" </dev/null
mv libjasper_$VERSION-1_amd64.deb ../..
cd ../..
rm -rf jasper-version-$VERSION
Result is a Debian package that can be installed using dpkg or apt.
answered Feb 18, 2021 at 10:32
MeixnerMeixner
6055 silver badges8 bronze badges
This Solution was tested on mendel(debian) with arm64 architecture. If this works for Ubuntu is not clear.
Open terminal and run the following commands:
cd /etc/apt/sources.list.d
sudo nano multistrap-main.list
Add there these two lines:
deb http://ports.ubuntu.com/ubuntu-ports xenial-security main
deb http://ports.ubuntu.com/ubuntu-ports impish main
save and exit. Then run:
sudo apt update
If there is a key missing use the following and run again update:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <key>
Then install jasper:
sudo apt-get install libjasper-dev
Finally remove or comment out the added repositories from multistrap-main.list.
answered Nov 3, 2021 at 22:10
w0rs3w0rs3
13 bronze badges
problem adding a repository
Trying to add a repository using add-apt-repository and get an error message
Here is the output:
ohn@john-K52Jc:~$ sudo add-apt-repository http://ppa.launchpad.net/opencpn/opencpn/ubuntu raring
Error: need a single repository as argument
Where is my syntax wrong?
Question information
Raring is EOL and no longer supported in any way. It is EOL. I suggest you wipe Raring off the system and do a clean install of Trusty which is LTS and supported til April 2019.
You can add a PPA with:
sudo add-apt-repository ppa:opencpn/opencpn
You need the bold PPA link from the PPA page.
Thanks
Thanks for your help
I upgraded to Trusty when it was released.
Still having the error message about requiring a single repository when I used the OpenCPN commands.
With your command this is what happended:
john@john-K52Jc:~$ sudo add-apt-repository http://ppa.launchpad.net/opencpn/opencpn/ubuntu trusty main
Error: need a single repository as argument
john@john-K52Jc:~$ sudo add-apt-repository ppa:opencpn/opencpn
A Chartplotter and GPS Navigation Software.
OpenCPN is a free software (GPLv2) project to create a concise chartplotter and navigation software for use as an underway or planning tool. OpenCPN is developed by a team of active sailors using real world conditions for program testing and refinement.
More info: https://launchpad.net/~opencpn/+archive/ubuntu/opencpn
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpp938icy5/secring.gpg’ created
gpg: keyring `/tmp/tmpp938icy5/pubring.gpg’ created
gpg: requesting key C865EB40 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpp938icy5/trustdb.gpg: trustdb created
gpg: key C865EB40: public key «Launchpad PPA for OpenCPN» imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
john@john-K52Jc:~$ opencpn
opencpn: error while loading shared libraries: libwx_baseu-2.8.so.0: cannot open shared object file: No such file or directory
What next?
John
Did you check if libwxbase2.8-0 is installed?
try to install it with
sudo apt-get install libwxbase2.8-0
Thank you Miguel and Manfred
libwxbase2.8-0 was not installed and has been added
Then I ran sudo add-apt-repository and seemed to download it:
john@john-K52Jc:~$ sudo add-apt-repository ppa:opencpn/opencpn
A Chartplotter and GPS Navigation Software.
OpenCPN is a free software (GPLv2) project to create a concise chartplotter and navigation software for use as an underway or planning tool. OpenCPN is developed by a team of active sailors using real world conditions for program testing and refinement.
More info: https://launchpad.net/~opencpn/+archive/ubuntu/opencpn
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmptcvhjrdc/secring.gpg’ created
gpg: keyring `/tmp/tmptcvhjrdc/pubring.gpg’ created
gpg: requesting key C865EB40 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmptcvhjrdc/trustdb.gpg: trustdb created
gpg: key C865EB40: public key «Launchpad PPA for OpenCPN» imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
I now have an icon in unity but it does not run and when I use the terminal here is the result:
john@john-K52Jc:~$ opencpn
opencpn: error while loading shared libraries: libwx_gtk2u_core-2.8.so.0: cannot open shared object file: No such file or directory
How do I install OpenCPN from here?
Again there seems to be a missing library. You could try to install it by running «sudo apt-get install libwxgtk2.8-0», but probably there are more missing libraries.
After adding the repository, did you install OpenCPN running «sudo apt-get install opencpn»? Normaly this should install all necessary libraries too.
I did a little research and just realized that there is no package for Ubuntu 14.04 Trusty in the repository.
Thus, you should install OpenCPN via the .deb package available on
http://opencpn.org/ocpn/download
Also have a look at
http://opencpn.org/ocpn/installing_opencpn
under the Linux paragraph there are detailed instructions on how to install it, and even on how to install the needed dependencies(!).
If you already installed OpenCPN in some way, but are only missing the dependencies (as running «opencpn» gives you an output), just run the commands given on the OpenCPN Installation site:
«sudo gdebi <downloaded_opencpn_file.deb>» (if you installed a .deb package)
or
«sudo apt-get install libwxgtk2.8-0 libwxbase2.8-0 wx-common libglu1-mesa libgl1-mesa-glx zlib1g bzip2 gpsd gpsd-clients xcalib xdg-utils libportaudio2 libkml0 libtinyxml2.6.2 liburiparser1 zlib1g libexpat1»
Also you may want to remove the ppa from your sources list, as it will only give errors when you update.
For this run «sudo add-apt-repository —remove ppa:opencpn/opencpn»
I hope this will help!
Hi Miguel
Ran sudo apt-get install libwxgtk2.8-0 and installed some stuff and then sudo apt-get install opencpn
Here is the output:
john@john-K52Jc:~$ sudo apt-get install libwxgtk2.8-0
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
libpostproc52 linux-headers-3.13.0-24 linux-headers-3.13.0-24-generic
linux-image-3.13.0-24-generic linux-image-extra-3.13.0-24-generic
Use ‘apt-get autoremove’ to remove them.
The following NEW packages will be installed:
libwxgtk2.8-0
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 2,340 kB of archives.
After this operation, 8,897 kB of additional disk space will be used.
Get:1 http://mirrors.us.kernel.org/ubuntu/ trusty/universe libwxgtk2.8-0 i386 2.8.12.1+dfsg-2ubuntu2 [2,340 kB]
Fetched 2,340 kB in 3s (711 kB/s)
Selecting previously unselected package libwxgtk2.8-0:i386.
(Reading database … 289142 files and directories currently installed.)
Preparing to unpack …/libwxgtk2.8-0_2.8.12.1+dfsg-2ubuntu2_i386.deb …
Unpacking libwxgtk2.8-0:i386 (2.8.12.1+dfsg-2ubuntu2) …
Setting up libwxgtk2.8-0:i386 (2.8.12.1+dfsg-2ubuntu2) …
Processing triggers for libc-bin (2.19-0ubuntu6) …
john@john-K52Jc:~$ sudo apt-get install opencpn
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package opencpn is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘opencpn’ has no installation candidate
john@john-K52Jc:~$
I don’t think I installed all of the repository for when I run sudo add-apt-repository here is the output:
john@john-K52Jc:~$ sudo add-apt-repository http://ppa.launchpad.net/opencpn/opencpn/ubuntu trusty main
Error: need a single repository as argument
How do I get a single repository as argument?
You were trying the wrong PPA.
Please run these Terminal commands instead:
sudo add-apt-repository ppa:nohal/opencpn
sudo apt-get update
sudo apt-get install opencpn
I expect that the commands given by Mark will help.
I just want to add some background information that might shed some light on what was going wrong here:
1. The command add-apt-repository needs just one single argument, either in the form ppa:user/ppa-name or in the form «http://sourceserver/directory/ubuntu release bucket» WITH QUOTES AROUND. This makes it «a single repository». (See my comment in response #4)
2. Just adding a repository server with the add-apt-repository command is not enough. This only adds the server to the list of repositories, but does not download anything yet. You need to execute «sudo apt-get update» (or use the reload button in software-center or synaptic) to pull in the information about the repository’s contents. Only after doing that, the commands to install or upgrade software will also look in that repository.
3. You seem to have mixed the commands to build and install opencpn from source with attempts to install pre-built packages from Ubuntu repositories. This might fail (and apparently has failed with «error while loading shared libraries»).
If you stick to .dev packages installed with apt-get commands or via software-center or synaptic or gdebi, then the dependencies will be automatically be taken care of.
If you try downloading the source and building the executable yourself, then you have to make sure by yourself, that all dependencies are satisfied (e.g. see the instructions in the link to opencpn.org given by Miguel).
4. I found two PPAs on Launchpad with opencpn software https://launchpad.net/ubuntu/+ppas?name_filter=opencpn The second one (ppa:opencpn/opencpn) has that software only for the Ubuntu releases up to raring. The first one (ppa:nohal/opencpn) has also software for trusty. So you should remove the opencpn one and add nohal one with the commands already given by Miguel and Mark.
And another thing:
The output
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded
of the apt-get install command shows that not all packages on your system are fully up-to-date.
You should either issue the commands
sudo apt-getupdate
sudo apt-get upgrade
or start update-manager to upgrade all your packages to the latest version.
Thank you so much for your help.
With Mark’s commands in response #9 I am able to do a clean installation on my desktop and the new version of OpenCPN looks different to what I am stuck with on my laptop where my boat languishes where it was two years ago.
What I think I need to do now is a complete removal of all versions of OpenCPN but it does not show up on Synaptic and removing it with the Ubuntu Software centre is not effective enough
What do you suggest?
What is the output of :
lsb_release -a; uname -a; apt-cache policy opencpn
Thanks
john@john-K52Jc:~$ lsb_release -a; uname -a; apt-cache policy opencpn
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
Linux john-K52Jc 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:43:42 UTC 2014 i686 i686 i686 GNU/Linux
opencpn:
Installed: 3.3.1825-0~trusty2
Candidate: 3.3.1825-0~trusty2
Version table:
*** 3.3.1825-0~trusty2 0
500 http://ppa.launchpad.net/nohal/opencpn/ubuntu/ trusty/main i386 Packages
100 /var/lib/dpkg/status
john@john-K52Jc:~$
Hints for removing all versions of opencpn (with the aim to do a clean installation afterwards):
1. to remove the Ubuntu version:
sudo dpkg —purge opencpn
2. to check whether there are opencpn files elsewhere on your system:
sudo updatedb
locate opencpn
Please copy/paste all output as done before
Thank you all for your help.
Sowmehow I have got the old version of OpenCPN to talk to the GPS so that it is functioning.
Have run out of time as I am going cruising.
Will work on the problem when I get back
John