Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). gpg: no valid OpenPGP data found.
时间: 2024-05-18 14:13:23 浏览: 32
这个错误可能是由于您使用的是apt-key命令添加密钥,而这个命令已经被弃用了。新的命令是使用apt-key add命令来添加密钥,而且该命令已经将密钥添加到新的密钥管理器中。
为了解决这个问题,您可以使用以下命令手动添加ROS 2的密钥:
```
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | gpg --dearmor | sudo tee /usr/share/keyrings/ros-archive-keyring.gpg >/dev/null
```
这个命令会从ROS 2的GitHub存储库下载密钥并将其添加到新的密钥管理器中。
然后,您可以使用以下命令添加ROS 2软件源:
```
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
```
请注意,上述命令假定您正在使用Ubuntu 20.04操作系统。如果您使用的是其他操作系统,请将“$(lsb_release -cs)”替换为您的操作系统代号。
如果上述步骤无法解决问题,请尝试使用ROS 2官方网站上提供的其他安装方法。
相关问题
arning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
The warning you mentioned is related to the use of the `apt-key` command in managing keyring files for package repositories in Debian-based systems. Starting from Ubuntu 20.04 and Debian 10, the `apt-key` command has been deprecated, and it is recommended to manage keyring files in the `trusted.gpg.d` directory instead.
To address this warning, you can follow these steps:
1. Open a terminal.
2. Create a new file in the `trusted.gpg.d` directory:
```shell
sudo touch /etc/apt/trusted.gpg.d/custom.gpg
```
3. Import the GPG key using the `gpg` command:
```shell
sudo gpg --dearmor --output /etc/apt/trusted.gpg.d/custom.gpg /path/to/keyfile.gpg
```
Replace `/path/to/keyfile.gpg` with the actual path to the GPG key file you want to import.
4. Update the package lists:
```shell
sudo apt update
```
By following these steps, you should be able to manage keyring files without triggering the deprecated warning.
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
这个警告信息表明apt-key命令已经过时,建议使用新的命令管理软件源的GPG密钥。
从Ubuntu 20.04开始,apt-key命令已经被弃用,而是使用新的命令来管理软件源的GPG密钥。新的命令将GPG密钥存储在`/etc/apt/trusted.gpg.d/`目录中,而不是`/etc/apt/trusted.gpg`文件中。
如果您想继续使用apt-key命令来管理GPG密钥,可以忽略上述警告信息。但是,建议您使用新的命令来管理GPG密钥,以便更好地适应新的软件源管理方式。
您可以使用以下命令将清华大学的公钥添加到系统中:
```
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
```
请注意,上述命令中的“3B4FE6ACC0B21F32”是清华大学的公钥指纹,如果您使用其他软件源,请使用相应的公钥指纹。
然后,运行以下命令将软件源添加到系统中:
```
sudo sh -c "echo 'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse' > /etc/apt/sources.list.d/tsinghua.list"
```
最后,运行以下命令更新软件源并安装软件包:
```
sudo apt update
sudo apt install <package_name>
```
请注意,上述命令中的`<package_name>`应替换为您要安装的软件包名称。