imx6ull:buildroot 创建的 sshd 启动慢

您所在的位置:网站首页 sshd自启动 imx6ull:buildroot 创建的 sshd 启动慢

imx6ull:buildroot 创建的 sshd 启动慢

2023-08-19 11:32| 来源: 网络整理| 查看: 265

在用buildroot 构建 imx6ull 根文件系统过程中产生过一些大大小小的问题, 比如在添加 ssh 的时候,发现 sshd 在开机自启的时候占用了很长的一段时间, 仔细观察打印信息发现,sshd 一定要等待直到

random: nonblocking pool is initialized

初始化结束后才能正常启动,而 nonblocking pool 的初始化要 2 分钟。 sshd 是否依赖 nonblocking pool 我无暇考证,且在厂家提供的根文件系统中, 启动 sshd 也并不需要等待 nonblocking pool 初始化完成, 具体缺少哪块部件也不好查找。无计可施下我只能选择加速 nonblocking pool 的初始化速度从而解决 sshd 启动过慢的问题。具体做法是修改内核代码, 在 kernel_code/drivers/char/random.c 约 900 行处的 void add_interrupt_randomness(int irq, int irq_flags) 中有一处判断:

if ((fast_pool->count < 64) && !time_after(now, fast_pool->last + HZ)) return;

在此基础上加上 nonblocking_pool.initialized 判断:

if ((fast_pool->count < 64) && !time_after(now, fast_pool->last + HZ) && nonblocking_pool.initialized) return;

加入以上修改后重新编译内核并烧写,开机时 sshd 可以正常启动。详见: https://lore.kernel.org/patchwork/patch/578584/

另外,记得在 /etc/ssh/sshd_config 下打开 PermitRootLogin yes 释放 root 权限登录。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3