最近用到udev自动挂载U盘,下载udev源码编译后,放在设备里运行,发现udev启动后立即就退出了,

通过加--debug参数可以看到输出错误信息:

[root@DMF:dev]#mkdir .udev
[root@DMF:dev]#/mnt/nfs/udevd --debug
1546503238.330930 [12471] parse_file: reading '/etc/udev/rules.d/10-add-usb.rules' as rules file
1546503238.334515 [12471] parse_file: reading '/etc/udev/rules.d/10-remove-usb.rules' as rules file
1546503238.336570 [12471] parse_file: reading '/etc/udev/rules.d/11-add-sd.rules' as rules file
1546503238.342339 [12471] parse_file: reading '/etc/udev/rules.d/11-remove-sd.rules' as rules file
1546503238.346703 [12471] udev_rules_new: rules use 420 bytes tokens (35 * 12 bytes), 318 bytes buffer
1546503238.347162 [12471] udev_rules_new: temporary index used 300 bytes (15 * 20 bytes)
1546503126.204165 [12140] rebuild_queue_file: failed to create queue file: No such file or directory
1546503126.206204 [12140] main: error creating queue file

从错误信息上看,是创建文件失败:

1546503126.204165 [12140] rebuild_queue_file: failed to create queue file: No such file or directory

1546503126.206204 [12140] main: error creating queue file

于是就在源代码中搜索这个这个错误打印:“failed to create queue file”:

grep -rn "failed to create queue file" *

搜索结果如下:

libudev/libudev-queue-private.c:270:	err(udev_queue_export->udev, "failed to create queue file: %m\n");
匹配到二进制文件 libudev/.libs/libudev-private.a
匹配到二进制文件 libudev/.libs/libudev-queue-private.o
匹配到二进制文件 udev/udevd

还好只有一个地方,比较容易定位问题,打开文件libudev/libudev-queue-private.c跳到270行:

第270行打印的错误信息,但是有好几个地方都会goto到这里,还需要定位下是从那里goto到这里的,向上翻代码,查看,上面的代码是写文件的,一般出现“No such file or directory”的信息,是在打开文件时报错的,就在打开文件的地方加了一条打印信息,把文件名和路径打印出来:

然后重新编译运行,输出信息为:

filename_tmp: /dev/.udev/queue.tmp, line: 225

打开文件时用的模式是“w+”,所以判断应该是目录不存在导致的,查看dev下,.udev目录是不存在的,手动创建后,再次运行都正常了;

个人微信服务号同步推送文章(微信公众号:fensTeck):

udevd启动失败问题的更多相关文章

  1. windows service 1053错误 启动失败

    做项目移植的时候发现一个项目的window service启动失败,最后试出来是启动时间超时 解决办法是给window service设置一个长一点的等待时间,步骤如下: 启动,输入regedit启动 ...

  2. 玩转Windows服务系列——无COM接口Windows服务启动失败原因及解决方案

    将VS创建的Windows服务项目编译生成的程序,通过命令行 “服务.exe -Service”注册为Windows服务后,就可以通过服务管理器进行管理了. 问题 通过服务管理器进行启动的时候,发现服 ...

  3. ubuntu升级内核后vmware-player启动失败

    在虚拟机软件中,vmware player是对硬件支持很好的,通过它可以很方便的使用网银.单片机开发等等工作.但是最近ubuntu每次升级内核后,vmware都会启动失败,提示:Before you ...

  4. CentOS 7下MySQL服务启动失败的解决思路

    今天,启动MySQL服务器失败,如下所示: [root@spark01 ~]# /etc/init.d/mysqld start Starting mysqld (via systemctl): Jo ...

  5. 服务器重启后SQL Server Agent由于"The EventLog service has not been started" 启动失败

    案例环境: 操作系统   : Microsoft Windows Server 2003 Standard Edtion SP2 数据库版本 : SQL Server 2005 Standard Ed ...

  6. db2start启动失败

    db2start启动失败 [db2inst1@localhost ~]$ db2start db2start: error while loading shared libraries: libaio ...

  7. PHP5.6启动失败

    PHP编译安装完毕,启动失败,提示 1 [23-Jun-2014 12:27:02] ERROR: failed to open configuration file '/usr/local/php/ ...

  8. IIs管理服务一直启动失败的原因之一

    首先eventlog里面的日志: 万维网发布服务(WWW 服务)没有为站点 1 注册 URL 前缀 https://*:8172/.该站点已被禁用.数据字段包含错误号. IISWMSVC_STARTU ...

  9. win10 MySQL启动失败问题

    系统升级到win10之后,本地装的MySQL却突然不能启动,系统显示明明就有,可是总是启动失败.在这里解决一下: 解决win10  mysql服务消失,连接不上的问题,注意:以管理员身份运行DOS命令 ...

随机推荐

  1. js数组算法题01

    题目:随机生成一个长度为 10 的整数类型的数组,例如 [2, 10, 3, 4, 5, 11, 10, 11, 20],将其排列成一个新数组,要求新数组形式如下,例如 [[2, 3, 4, 5], ...

  2. selenium:selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

    可用链接: 1.http://blog.csdn.net/heatdeath/article/details/71136174 2.https://www.cnblogs.com/yousuosiys ...

  3. CSS上划线、下划线、删除线等方法

    text-decoration:underline;     下划线 text-decoration:overline;    顶划线 text-decoration:line-through;  删 ...

  4. 系统部署时的Could not load file or assembly 'Microsoft.VisualStudio.Enterprise.ASPNetHelper问题

    在web.config中,如下代码段 <compilation debug="true" targetFramework="4.0" assemblyPo ...

  5. 第二章: IPC机制

    这章关于进程的概念,没有深入太多,只做了解跟学习 IPC: Inter-Process Communication,进程间通信或者跨进程通信,两个进程之间进行数据交换的过程 2.1介绍 线程:CPU调 ...

  6. Go Pentester - HTTP CLIENTS(4)

    Interacting with Metasploit msf.go package rpc import ( "bytes" "fmt" "gopk ...

  7. Ethical Hacking - Web Penetration Testing(8)

    SQL INJECTION WHAT IS SQL? Most websites use a database to store data. Most data stored in it(userna ...

  8. noi linux gedit 配置(c++环境)

    基本配置 方法一 查看所有命令: gsettings list-recursively | grep -i gedit 命令解释 gsettings set org.gnome.gedit.prefe ...

  9. MapReduce之自定义InputFormat

    在企业开发中,Hadoop框架自带的InputFormat类型不能满足所有应用场景,需要自定义InputFormat来解决实际问题. 自定义InputFormat步骤如下: (1)自定义一个类继承Fi ...

  10. C++语法小记---少见的语法之一

    很少用,列出来,便于理解和熟悉!!! // 1.单独使用位域限定符 ::xxx() //调用全局函数xxx // 2.全局重载new和delete T* tmp = (T*)(::operator n ...