How to use multiple options in apt sources.list?
Using Ubuntu 22.04. I have added
nodejs repo following their official manual. However, when I do
sudo apt update, I am getting:
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://deb.nodesource.com/node_20.x nodistro InRelease' doesn't support architecture 'i386'
I did some research and to fix this, I have to add
[arch=amd64] option to
/etc/apt/sources.list.d/nodesource.list. However, when I open the file, the source already has an option:
How to use multiple options values in
I have tried separating them with
, (comma), but this doesn’t work:
deb [arch=amd64,signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main
There are two formats that allow you to add multiple options to
apt sources: the one-line style format, which uses
.list files in
/etc/apt/sources.list.d, and the DEB822 style format, which uses
.sources files in
/etc/apt/sources.list.d. The one-line style format is currently used, but the DEB822 style format is planned to gradually become the default. The usage of each format is described below.
.list – One-line style format
According to the
sources.list(5) manpage the options have to be separated with spaces when using the one-line style format:
If options should be provided they are separated by spaces and all of them together are enclosed by square brackets () included in the line after the type separated from it with a space. If an option allows multiple values these are separated from each other with a comma (,). An option name is separated from its value(s) by an equals sign (=). Multivalue options also have -= and += as separators, which instead of replacing the default with the given value(s) modify the default value(s) to remove or include the given values.
/etc/apt/sources.list.d/nodesource.list should look like this:
deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main
.sources – DEB822 style format
According to the
sources.list(5) manpage, if you are using the DEB822 format, options are set the same way as the the other fields.
Options have the same syntax as every other field: A field name
separated by a colon (:) and optionally spaces from its value(s). Note
especially that multiple values are separated by whitespaces (like
spaces, tabs and newlines), not by commas as in the one-line format.
Multivalue fields like Architectures also have Architectures-Add and
Architectures-Remove to modify the default value rather than replacing
/etc/apt/sources.list.d/nodesource.sources should look like this:
Enabled: yes Types: deb URIs: https://deb.nodesource.com/node_20.x Suites: nodistro Components: main Architectures: amd64 Signed-By: /etc/apt/keyrings/nodesource.gpg