在树莓派上尝试运行sudo apt install raspberrypi-kernel-headers得到以下错误提示
pi@raspberrypi:~ $ sudo apt install raspberrypi-kernel-headers
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package raspberrypi-kernel-headers
最终问题定位还是跟apt source有关,主要原因是之前把apt source更换为国内镜像时,按照某些网上的指引,把/etc/source/source.list.d/raspi.list
这个文件重命名了,而这个文件里面有个很重要的源,正是跟raspberrypi-kernel-headers有关的,于是把/etc/source/source.list.d/raspi.list
恢复回来,然后把里面的http链接改为https,内容如下:
deb https://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src https://archive.raspberrypi.org/debian/ stretch main ui
修改apt源后按照惯例运行sudo apt-get update
,然后再次运行sudo apt install raspberrypi-kernel-headers
就可以看到让人舒适的结果