“error getting socket: Address family not supported by protocol”的解决方案

原本我是想KVM支持NAT,在重新编译kernel,当然为了NAT,我得去重新menuconfig,不知为啥手贱,估计将“Networking options”里面的“Unix domain sockets”选项选为了编译为module,于是就遇到了如下的kernel panic。

FATAL: Module scsi_wait_scan not found.
udevadm[2067]: error getting socket: Address family not supported by protocol
udevadm[2073]: error getting socket: Address family not supported by protocol

dracut Warning: No root device "block:/dev/disk/by-uuid/e006b79d-9eb6-4f18-a11c-517448eb074f" found
dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
dracut Warning: Signal caught!

dracut Warning: Boot has failed. To debug this issue add "rdshell" to the kernel command line.
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000100

Pid: 1, comm: init Not tainted 3.5.0+ #1
Call Trace:
 [] ? panic+0xbe/0x1c6
 [] ? do_exit+0x366/0x7c0
 [] ? do_group_exit+0x74/0x9e
 [] ? sys_exit_group+0x12/0x19
 [] ? system_call_fastpath+0x16/0x1b

当我遇到这个panic的现象后,其实我也进行了.config文件的对比,我其实也看到了“CONFIG_UNIX”这一项的差异,由于还有其他的不同点,我就没把这个差异放在心上,没重视它。后来才发现,“CONFIG_UNIX”是为了配置“Unix domain sockets”的,“CONFIG_UNIX”一般都是应该配置为y(编译进kernel),如果只有在少数(如嵌入式)系统中才配置为m(作为module,名为”unix”的module)。即是没有连接到任何网络,有很多常用的程序都使用“unix domain socket”进行通信的,如X-Window、syslog等程序,估计还有我本例遇到的udevadm(udevd)等程序,都是依赖于“CONFIG_UNIX=y”这个配置的。

另外,看了一下配置kernel时,对CONIFG_UNIX选项的说明,如下,看了就都明白了吧。

 CONFIG_UNIX:                                                                                                  x
  x                                                                                                               x
  x If you say Y here, you will include support for Unix domain sockets;                                          x
  x sockets are the standard Unix mechanism for establishing and                                                  x
  x accessing network connections.  Many commonly used programs such as                                           x
  x the X Window system and syslog use these sockets even if your                                                 x
  x machine is not connected to any network.  Unless you are working on                                           x
  x an embedded system or something similar, you therefore definitely                                             x
  x want to say Y here.                                                                                           x
  x                                                                                                               x
  x To compile this driver as a module, choose M here: the module will be                                         x
  x called unix.  Note that several important services won't work                                                 x
  x correctly if you say M here and then neglect to load the module.                                              x
  x                                                                                                               x
  x Say Y unless you know what you are doing.                                                                     x
  x                                                                                                               x
  x Symbol: UNIX [=y]                                                                                             x
  x Type  : tristate                                                                                              x
  x Prompt: Unix domain sockets                                                                                   x
  x   Defined at net/unix/Kconfig:5                                                                               x
  x   Depends on: NET [=y]                                                                                        x
  x   Location:                                                                                                   x
  x     -> Networking support (NET [=y])                                                                          x
  x       -> Networking options                                                                                   x
  x                                    

了解更多关于Unix Domain Socket的内容,可以参考如下链接:
http://beej.us/guide/bgipc/output/html/multipage/unixsock.html

【后记1】2012.08
关于“FATAL: Module scsi_wait_scan not found.”这个错误,应该在kernel config中配置“CONFIG_SCSI_SCAN_ASYNC=y”,如果有“CONFIG_SCSI_WAIT_SCAN”则也应该配置“CONFIG_SCSI_WAIT_SCAN=m”。加这个后记是因为,我在8月份遇到一次kernel panic是和“FATAL: Module scsi_wait_scan not found.”相关的。
【后记2】2012.10.30
我在启动KVM guest(guest中使用Linux 3.6 kernel)再次遇到一直打印“FATAL: Module scsi_wait_scan not found.”的错误信息。后来查了一下,Linux 3.6中已经没有CONFIG_SCSI_WAIT_SCAN配置项可选了,后来发现guest的grub中的root设备写法的问题(这时不能写成/dev/sda1)。
出现问题的grub中kernel行如下:
kernel (hd0,0)/boot/vmlinuz-3.6.0 ro root=/dev/sda1
修改为UUID的方式去找到root设备,就没有“FATAL: Module scsi_wait_scan not found.”错误,可以正常启动了,如下:
kernel /boot/vmlinuz-3.6.0 ro ro root=UUID=7391683c-12c6-405a-b2e0-ee05c678772c

master

Stay hungry, stay foolish.

One Comment

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

*