OpenWRT编译报错信息汇总
报错信息:
Configuring luci-i18n-s-s-libev-zh-cn.
Configuring luci-i18n-firewall-zh-cn.
Configuring ppp-mod-pppoe.
Collected errors:
* check_data_file_clashes: Package libustream-openssl wants to install file /home/shixiaofeng/source/build_dir/target-mipsel_24kc_musl/root-ramips/lib/libustream-ssl.so
But that file is already provided by package * libustream-mbedtls
* opkg_install_cmd: Cannot install package libustream-openssl.
package/Makefile:64: recipe for target 'package/install' failed
make[2]: *** [package/install] Error 255
make[2]: Leaving directory '/home/shixiaofeng/source'
package/Makefile:106: recipe for target '/home/shixiaofeng/source/staging_dir/target-mipsel_24kc_musl/stamp/.package_install' failed
make[1]: *** [/home/shixiaofeng/source/staging_dir/target-mipsel_24kc_musl/stamp/.package_install] Error 2
make[1]: Leaving directory '/home/shixiaofeng/source'
/home/shixiaofeng/source/include/toplevel.mk:199: recipe for target 'world' failed
make: *** [world] Error 2
解决方法:
在make menuconfig进行配置编译选项中,Libraries --->下面,libustream-openssl和libustream-mbedtls中间去掉一个。
在make menuconfig进行配置编译选项中,LuCI->Collection下的libustream-mbedtls和luci-ssl-openssl两个选项都进行了选择,其实只要进行其中一个选择便可。
在进入OpenWRT文件系统之后,系统服务要全部使能。
cd /etc/init.d/
for i in `ls`; do ./$i enable;done
然后重启即可。
如果wpad服务没有启动的话可能会在OpenWRT的无线配置页面显示radio 0 未激活的设备。
然后无线网AP端一个可用的配置为:配置文件路径在:/etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option path 'soc/3600000.pcie/pci0001:00/0001:00:00.0/0001:01:00.0'
option country 'US'
option legacy_rates '1'
option hwmode '11g'
option channel '11'
option htmode 'HT20'
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option ssid 'OpenWrt'
option encryption 'psk-mixed'
option key '12345678'
使用logread命令可以查看OpenWRT的log信息,包括内核的打印信息和各种服务的打印信息。这对于出现问题时候查找原因很有效。
opkg update命令失败是因为没有在OpenWRT安装wget命令
root@OpenWrt:/# opkg update
Downloading https://downloads.openwrt.org/releases/21.02-SNAPSHOT/targets/layerscape/armv8_64b/packages/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02-SNAPSHOT/targets/layerscape/armv8_64b/packages/Packages.gz
Downloading https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/base/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/base/Packages.gz
Downloading https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/luci/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/luci/Packages.gz
Downloading https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/packages/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/packages/Packages.gz
Downloading https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/routing/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/routing/Packages.gz
Downloading https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/telephony/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/telephony/Packages.gz
Collected errors:
* opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02-SNAPSHOT/targets/layerscape/armv8_64b/packages/Packages.gz, wget returned 255.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/base/Packages.gz, wget returned 255.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/luci/Packages.gz, wget returned 255.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/packages/Packages.gz, wget returned 255.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/routing/Packages.gz, wget returned 255.
* opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02-SNAPSHOT/packages/aarch64_generic/telephony/Packages.gz, wget returned 255.
可以在文件系统做一个软链接解决:
ln -s /bin/uclient-fetch /bin/wget
使用opkg命令安装第三方包的时候会报错架构不兼容
* pkg_hash_fetch_best_installation_candidate: Packages for python found, but incompatible with the architectures configured
* opkg_install_cmd: Cannot install package python.
通常情况下是和软件源有关,查看OpenWRT的OS版本和软件源架构的命令有如下几个:
root@OpenWrt:/# uname -a
Linux OpenWrt 5.4.111 #0 SMP PREEMPT Thu Apr 22 08:11:14 2021 aarch64 GNU/Linux
root@OpenWrt:/# opkg info nmap
Package: nmap
Version: 7.80-3
Depends: libc, libpcap1, libstdcpp6, zlib, libpcre
Status: unknown ok not-installed
Section: net
Architecture: aarch64_generic
Size: 2271366
Filename: nmap_7.80-3_aarch64_generic.ipk
Description: Utility for network exploration or security auditing
root@OpenWrt:/# opkg print-architecture
arch all 1
arch noarch 1
arch aarch64_generic 10
root@OpenWrt:/# cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='21.02-SNAPSHOT'
DISTRIB_REVISION='r16051-15cd9a5d5c'
DISTRIB_TARGET='layerscape/armv8_64b'
DISTRIB_ARCH='aarch64_generic'
DISTRIB_DESCRIPTION='OpenWrt 21.02-SNAPSHOT r16051-15cd9a5d5c'
DISTRIB_TAINTS='no-all busybox'
root@OpenWrt:~# cat /etc/os-release
NAME="OpenWrt"
VERSION="21.02-SNAPSHOT"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 21.02-SNAPSHOT"
VERSION_ID="21.02-snapshot"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r16052-6f053e5b4f"
OPENWRT_BOARD="layerscape/armv8_64b"
OPENWRT_ARCH="aarch64_generic"
OPENWRT_TAINTS="no-all busybox"
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 21.02-SNAPSHOT r16052-6f053e5b4f"
这种情况下的解决方法为:
注: 下文中
packagename
和initname
请根据实际情况修改
自动安装
- 将下载的IPK上传至路由器, 或者直接在路由器使用 wget 下载;
- SSH 登录到路由器, 使用
opkg install {packagename}.ipk
安装; - 修改配置文件后使用
/etc/init.d/{initname} start
命令启动.
当架构不兼容时会提示
but incompatible with the architectures configured
,
此种情况一般在ramips_24kec
架构的软件包安装时出现.
可以通过编辑/etc/opkg.conf
调整架构支持,
在文件末尾添加(也可以在 LuCI 设置页面修改):arch all 100
arch ramips 200
arch ramips_24kec 300
添加完成后使用
opkg update
更新一次
再次使用opkg install {packagename}.ipk
安装手动安装
- 解压 ipk 包:
tar xzf {packagename}.ipk
- 解压 data 包完成最终安装:
tar xzf data.tar.gz -C /
- 删除安装包残留:
rm {packagename}.ipk control.tar.gz data.tar.gz debian-binary
注: 上面 3 条命令注意复制完整并替换
packagename
手动安装后没有卸载信息, 建议只在自动安装失败时使用
如需要卸载, 可以直接删除步骤 2 中解压出的文件- 解压 ipk 包:
另一种情况下是发现制作的OpenWRT镜像的 /usr/lib/opkg/ 目录下缺少文件,导致opkg命令不能正常工作。
经检查原因是打包的时候使用了错误的路径:
openwrt_ok1012_v1.2/staging_dir/target-aarch64_generic_musl/root-layerscape/lib/modules/4.9.111/
正确的路径应该为:
openwrt_ok1012_v1.2/build_dir/target-aarch64_generic_musl/root-layerscape/lib/modules/4.9.111/
OpenWRT的网络配置文件的路径为:/etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd07:fa51:0018::/48'
config interface 'lan'
option type 'bridge'
option ifname 'eth0 eth1 eth2 eth3 eth4 eth5 eth6'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option ifname 'wwan0'
option proto 'qmi'
option device '/dev/cdc-wdm0'
option auth 'none'
option pdptype 'ipv4'
config interface 'docker'
option ifname 'docker0'
option proto 'none'
option auto '0'
config device 'docker0'
option type 'bridge'
option name 'docker0'
list ifname 'docker0'
在OpenWRT系统中使用移远RM500Q-GL 5G模块的时候,会发现在系统在使用qmi拨号的时候如果5G模块的SIM卡还未初始化好的时候,就会一直卡在
daemon.notice netifd: wan (5346): Waiting for SIM initialization
此时多等待一会,然后将连接5G模块的USB总线复位一次就可以解决问题
在系统的/etc/rc.local文件中添加复位的命令
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
sleep 5
echo 0 > /sys/bus/usb/devices/6-1/authorized
sleep 20
echo 1 > /sys/bus/usb/devices/6-1/authorized
exit 0