评论1:

评论1:

最近,我在一台多年来一直使用 FreeBSD 6.2 运行良好的机器上安装了 FreeBSD 10.1。由于机器位于数据中心,我通过串行控制台配置了远程访问。

安装后,我在启动时遇到了一个奇怪的问题。每次重启都无法挂载 rootfs。

uhub4: 8 ports with 8 removable, self powered
Trying to mount root from ufs:/dev/raid/r0p2 [rw]...
mountroot: waiting for device /dev/raid/r0p2 ...
Mounting from ufs:/dev/raid/r0p2 failed with error 19.

Loader variables:
  vfs.root.mountfrom=ufs:/dev/raid/r0p2
  vfs.root.mountfrom.options=rw

Manual root filesystem specification:
  <fstype>:<device> [options]
  Mount <device> using filesystem <fstype>
  and with the specified (optional) option list.

  eg. ufs:/dev/da0s1a
  zfs:tank
  cd9660:/dev/acd0 ro
  (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)

  ?  List valid disk boot devices
  .  Yield 1 second (for background tasks)
  <empty line>  Abort manual input

mountroot>

但当我按下 Enter 键(通过连接的键盘或串行控制台)时,我可以看到以下内容,系统重新启动正常

mountroot>
panic: mountroot: unable to (re-)mount root.
cpuid = 0
KDB: stack backtrace:
#0 0xffffffff80963000 at kdb_backtrace+0x60
#1 0xffffffff80928125 at panic+0x155
#2 0xffffffff809c554f at vfs_mountroot+0x1eaf
#3 0xffffffff808d7533 at start_init+0x53
#4 0xffffffff808f8b6a at fork_exit+0x9a
#5 0xffffffff80d0acbe at fork_trampoline+0xe
Uptime: 12s
Automatic reboot in 15 seconds - press a key on the console to abort

现在系统重新启动,一切正常

Trying to mount root from ufs:/dev/raid/r0p2 [rw]...
Setting hostuuid: 530c9cf5-a7e5-11e4-97b5-00e08146563c.
Setting hostid: 0xe4218f4f.
Entropy harvesting: interrupts ethernet point_to_point swi.
Starting file system checks:
/dev/raid/r0p2: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/raid/r0p2: clean, 7232943 free (983 frags, 903995 blocks, 0.0% fragmentation)
/dev/raid/r1s1f: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/raid/r1s1f: clean, 41630678 free (104646 frags, 5190754 blocks, 0.1% fragmentation)
/dev/raid/r0p4: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/raid/r0p4: clean, 49146170 free (8498 frags, 6142209 blocks, 0.0% fragmentation)
Mounting local file systems:.
Writing entropy file:.

我只是认为,如果系统在无法挂载根目录时自动重新启动(我猜是由于内核恐慌),我就可以让这个系统正常工作,它只会重新启动两次。

我找到了类似的线程,但与 Linux 相关,我可以在其中设置 /etc/sysctl 变量并让系统在内核崩溃时自动重启

kernel.panic = 20

内核崩溃后自动重启

但它似乎在 FreeBSD 上不起作用。我的问题是,当无法挂载 rootfs 时,有没有办法让这个系统自动重启?我希望它可以在第二次运行时重新启动并挂载 root?

我也会很感激任何其他建议。

谢谢

评论1:

我被要求从服务器设置中输出一些数据,如下所示:

nn@d02:~ % uname -a
    FreeBSD hostname 10.1-RELEASE-p19 FreeBSD 10.1-RELEASE-p19 #0: Sat Aug 22 03:55:09 UTC 2015     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64

nn@d02:~ % freebsd-version -k
10.1-RELEASE-p19

nn@d02:~ % freebsd-version -u
10.1-RELEASE-p19

nn@d02:~ % gpart show
=>       34  488390589  raid/r0  GPT  (233G)
         34       1024        1  freebsd-boot  (512K)
       1058   62914560        2  freebsd-ufs  (30G)
   62915618    8388608        3  freebsd-swap  (4.0G)
   71304226  417086396        4  freebsd-ufs  (199G)
  488390622          1           - free -  (512B)

=>       63  488390593  raid/r1  MBR  (233G)
         63  488375937        1  freebsd  [active]  (233G)
  488376000      14656           - free -  (7.2M)

=>        0  488375937  raid/r1s1  BSD  (233G)
          0    1048576          1  freebsd-ufs  (512M)
    1048576    8324192          2  freebsd-swap  (4.0G)
    9372768    6258688          4  freebsd-ufs  (3.0G)
   15631456    1048576          5  freebsd-ufs  (512M)
   16680032  471695905          6  freebsd-ufs  (225G)

nn@d02:~ % graid show
graid: Unknown command: show.

nn@d02:~ % graid status
   Name   Status  Components
raid/r0  OPTIMAL  ada0 (ACTIVE (ACTIVE))
                  ada1 (ACTIVE (ACTIVE))
raid/r1  OPTIMAL  ada2 (ACTIVE (ACTIVE))
                  ada3 (ACTIVE (ACTIVE))

答案1

GENERIC如果您在 FreeBSD 中使用内核,则该KDB选项与 sysctl 一起启用debug.debugger_on_panic,默认在出现问题时进入内核调试器进行故障排除。

要停止调用调试器,请将 sysctl 更改debug.debugger_on_panic0按照内核调试选项词汇表。这应该可以解决您在发生恐慌时需要在场才能与服务器交互的问题。

希望这对你有帮助。祝你好运。=)

相关内容