LinearTapeFileSystem / ltfs

Reference implementation of the LTFS format Spec for stand alone tape drive
BSD 3-Clause "New" or "Revised" License
257 stars 76 forks source link

Failed to execute SG_IO ioctl, opcode = 12 (25). #408

Closed melop closed 1 year ago

melop commented 1 year ago

Describe the bug I compiled and installed the release version of 2.4.5.0 of ltfs on Ubuntu 22.04.2 LTS into a custom directory by specifying --prefix to ./configure. I didn't install to the system folders because previously I might have broken the system doing so (though the exact reason is not yet determined, during boot up ubuntu tries to look for the /boot drive and failed to mount after time out. We checked the uuid of the boot drive in /etc/fstab and they are all correct. This happened twice before and we had to reinstall the system, but not sure if it is related to ltfs).

Anyways, now the system is able to detect our Dell LTO-9 tape drive. As shown by : lsscsi -g [0:0:31:0] enclosu CHENBRO 380-23710-3001 1210 - /dev/sg0 [0:2:0:0] disk AVAGO MR9361-8i 4.68 /dev/sda /dev/sg1 [1:0:0:0] disk ATA INTEL SSDSC2KB24 0132 /dev/sdb /dev/sg3 [7:0:8:0] tape IBM ULTRIUM-HH9 N9B1 /dev/st0 /dev/sg2

However, the following command shows error: sudo ltfs -o device_list 5e4 LTFS14000I LTFS starting, LTFS version 2.4.5.0 (10502), log level 2. 5e4 LTFS14058I LTFS Format Specification version 2.4.0. 5e4 LTFS14104I Launched by "ltfs -o device_list". 5e4 LTFS14105I This binary is built for Linux (x86_64). 5e4 LTFS14106I GCC version is 11.3.0. 5e4 LTFS17087I Kernel version: Linux version 5.15.0-73-generic (buildd@bos03-amd64-060) (gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 i386. 5e4 LTFS17089I Distribution: DISTRIB_ID=Ubuntu. 5e4 LTFS17089I Distribution: PRETTY_NAME="Ubuntu 22.04.2 LTS". 5e4 LTFS17085I Plugin: Loading "sg" tape backend. **5e4 LTFS30200I Failed to execute SG_IO ioctl, opcode = 12 (25). 5e4 LTFS30206I Cannot open device: inquiry failed (-21700). 5e4 LTFS30200I Failed to execute SG_IO ioctl, opcode = 12 (25). 5e4 LTFS30206I Cannot open device: inquiry failed (-21700). 5e4 LTFS30200I Failed to execute SG_IO ioctl, opcode = 12 (25).

melop commented 1 year ago

LTFS30206I Cannot open device: inquiry failed (-21700). LTFS30250I Opened the SCSI tape device 7.0.8.0 (/dev/sg2). LTFS30207I Vendor ID is IBM . LTFS30208I Product ID is ULTRIUM-HH9 . LTFS30214I Firmware revision is N9B1. LTFS30215I Drive serial is 10WT001089. LTFS30290I Changer /dev/sg2 isn't reserved from any nodes. LTFS30285I The reserved buffer size of 10WT001089 is 262144. LTFS30294I Setting up timeout values from RSOC. LTFS17160I Maximum device block size is 1048576. LTFS11330I Loading cartridge. LTFS30263I LOAD_UNLOAD returns Internal error detected in the host adapter (-21702) /dev/sg2. LTFS11331E Failed to load the cartridge (ltfs_load_tape). LTFS17157I Changing the drive setting to write-anywhere mode. LTFS15049I Checking the medium (mount). LTFS30263I LOAD_UNLOAD returns Internal error detected in the host adapter (-21702) /dev/sg2. LTFS11006E Cannot read volume: failed to load the tape. LTFS30252I Logical block protection is disabled. LTFS15023I Formatting failed.

Using the mt command also shows an error: sudo mt -f /dev/sg2 rewind mt: /dev/sg2: rmtioctl failed: Operation not permitted

But, using the same command on /dev/st0 shows no error: sudo mt -f /dev/st0 rewind

The eject command (after inserting an unformatted empty tape into the tapedrive) sudo mt -f /dev/sg2 eject mt: /dev/sg2: rmtioctl failed: Operation not permitted

sudo mt -f /dev/st0 eject mt: /dev/st0: rmtioctl failed: Input/output error

Please help~

piste-jp commented 1 year ago

The error code reported in LTFS is below.

https://github.com/LinearTapeFileSystem/ltfs/blob/f95a9a4463a0e3dbb0b69aa57324a78e4eb80322/src/libltfs/ltfs_error.h#LL457C1-L457C69

https://github.com/LinearTapeFileSystem/ltfs/blob/f95a9a4463a0e3dbb0b69aa57324a78e4eb80322/src/tape_drivers/linux/sg/sg_scsi_tape.c#L243-L246

It means the HBA returns an error through the sg driver. Could you confirm you are using a HBA that supports tape device correctly.

piste-jp commented 1 year ago

Close because no activities from 6/19.