Ubuntu -> BSD 启动盘格式化失败

Ubuntu -> BSD 启动盘格式化失败

我想通过 USB 启动棒安装 pfSense。我尝试按照此处的说明进行操作:

https://doc.pfsense.org/index.php/Writing_Disk_Images#Linux.2Fother

不幸的是,它们相当模糊,所以我不得不稍微填补一下空白。我在 Ubuntu 上这样做:

  1. wget https://nyifiles.pfsense.org/mirror/downloads/pfSense-CE-memstick-2.3.4-RELEASE-amd64.img.gz
  2. sha256sum pfSense-CE-memstick-2.3.4-RELEASE-amd64.img.gz
  3. gunzip pfSense-CE-memstick-2.3.4-RELEASE-amd64.img.gz
  4. dd if=pfSense-CE-memstick-2.3.4-RELEASE-amd64.img of=/dev/sdb bs=65536 iflag=noatime status=progress

此时,USB 驱动器应已准备好启动并进行安装。它确实启动了,但在安装过程中抛出了一堆错误:

Execution of the command

/usr/bin/tar -C /mnt/ -xzpf /distrib/pfSense.txz

FAILED with a return code of 1.

(da0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI status: Check Condition
(da0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:21.0 (Logical block address out of range)
(da0:umass-sim0:0:0:0): Error 22, Unretryable error
g_vfs_done():ufs/pfSense[READ(offset=567148544, length=131072)]error = 5

/lib/libcrypto.so.7: truncated input
Tar: Error exit delayed from previous errors.
Exit status: 1

我怀疑我对 USB 驱动器的写入操作有误,因为有几个指标表明出现了问题。

从 Ubuntu 来看,这看起来没问题:

# disktype /dev/sdb

--- /dev/sdb
Block device, size 14.94 GiB (16039018496 bytes)
FreeBSD boot loader (i386 boot1 at sector 0)
FreeBSD boot loader (i386 boot2/BTX 1.02 at sector 2)
BSD disklabel (at sector 1), 8 partitions
Partition a: 677.0 MiB (709894144 bytes, 1386512 sectors from 0)
  Type 7 (4.2BSD fast file system)
  Includes the disklabel and boot code
  UFS2 file system, 64 KiB offset, little-endian
    Volume name "pfSense" (in superblock)
Partition c: 677.0 MiB (709894144 bytes, 1386512 sectors from 0)
  Type 0 (Unused)

# mount -r -t ufs -o ufstype=ufs2 /dev/sdb /mnt/stick/
# ls /mnt/stick
bin   cf    conf.default  dev      etc   lib      media  pkgs  rescue  sbin     sys  usr
boot  conf  COPYRIGHT     distrib  home  libexec  mnt    proc  root    scripts  tmp  var

但这一切看起来都很糟糕:

# ls /mnt/stick/distrib
ls: reading directory '.': Input/output error

# fsck.ufs -f /dev/sdb
** /dev/sdb

CANNOT READ BLK: 128
CONTINUE? [yn] y

THE FOLLOWING DISK SECTORS COULD NOT BE READ: 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,

# fdisk -l /dev/sdb
Disk /dev/sdb: 15 GiB, 16039018496 bytes, 31326208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090

Device     Boot Start   End Sectors  Size Id Type
/dev/sdb4  *        0 49999   50000 24.4M a5 FreeBSD

奇怪的是,循环挂载图像文件是有效的:

# mount -r -t ufs -o loop,ufstype=ufs2 pfSense-CE-memstick-2.3.4-RELEASE-amd64.img /mnt/stick/

# ls stick/distrib
pfSense.txz

# bsdtar tf pfSense.txz
... shows all filenames ...

# fsck.ufs pfSense-CE-memstick-2.3.4-RELEASE-amd64.img 
** pfSense-CE-memstick-2.3.4-RELEASE-amd64.img
** Last Mounted on 
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
UNALLOCATED  I=2942  OWNER=root MODE=0
SIZE=0 MTIME=Dec 31 19:00 1969 
NAME=/usr/local/share/licenses/pkg-1.10.1_1/LICENSE

REMOVE? [yn] n

** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? [yn] n

SUMMARY INFORMATION BAD
SALVAGE? [yn] n

BLK(S) MISSING IN BIT MAPS
SALVAGE? [yn] n

16256 files, 645714 used, 42892 free (124 frags, 5346 blocks, 0.0% fragmentation)

***** FILE SYSTEM MARKED DIRTY *****

***** PLEASE RERUN FSCK *****

我有很多问题,包括:

  • 为什么有些工具报告正确的 677MiB 而其他工具只报告 24MB?
  • 是不是 USB 驱动器设置不正确,还是我只是对 FreeBSD UFS 分区错误地使用了 Ubuntu 工具?
  • 安装(块地址超出范围)失败的原因是什么?
  • 在循环 fsck 中,任何错误(摘要信息不好等)是否重要?

谢谢。

答案1

原来是硬件问题。换了另一个 USB 后就好了。很不幸,不过没关系。

相关内容