Raspberry Pi3 - Omnikey 5022 - PCSC_SCAN - SCardEstablishContext: Service not available - raspberry-pi3
I am using the rfid reader Hid Omnikey 5022 on my Raspberry3. i installed :
- libsystemd-dev
- libudev-dev
- pcsc-lite-1.8.25
- libusb-1.0.22
- ccid-1.4.31
- pcsc-tools-1.5.4
- libpcsclite-dev
- libccid
- libpcsc-perl
This reader is supported with the CCID driver
https://ccid.apdu.fr/ccid/supported.html
when i try the command : pcsc_scan
it returns the error : SCardEstablishContext: Service not available
when i use : strace pcsc_scan
it returns :
root#raspberrypi:/home/pi/Downloads# strace pcsc_scan
execve("/usr/local/bin/pcsc_scan", ["pcsc_scan"], [/* 59 vars */]) = 0
brk(NULL) = 0x6ec000
uname({sysname="Linux", nodename="raspberrypi", ...}) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f0d000
access("/etc/ld.so.preload", R_OK) = 0
open("/etc/ld.so.preload", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=42, ...}) = 0
mmap2(NULL, 42, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x76f0c000
close(3) = 0
open("/usr/lib/arm-linux-gnueabihf/libarmmem.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\210\5\0\0004\0\0\0"..., 512) = 512
lseek(3, 20868, SEEK_SET) = 20868
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1000) = 1000
lseek(3, 20540, SEEK_SET) = 20540
read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\1\n\3\f\1\22\4\24"..., 45) = 45
fstat64(3, {st_mode=S_IFREG|0644, st_size=21868, ...}) = 0
mmap2(NULL, 86080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76eca000
mprotect(0x76ecf000, 61440, PROT_NONE) = 0
mmap2(0x76ede000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x76ede000
close(3) = 0
munmap(0x76f0c000, 42) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=82593, ...}) = 0
mmap2(NULL, 82593, PROT_READ, MAP_PRIVATE, 3, 0) = 0x76eb5000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/arm-linux-gnueabihf/libpcsclite.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\360\21\0\0004\0\0\0"..., 512) = 512
lseek(3, 33124, SEEK_SET) = 33124
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1000) = 1000
lseek(3, 32801, SEEK_SET) = 32801
read(3, "A,\0\0\0aeabi\0\1\"\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\24\1\25"..., 45) = 45
fstat64(3, {st_mode=S_IFREG|0644, st_size=34124, ...}) = 0
mmap2(NULL, 101576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76e9c000
mprotect(0x76ea4000, 61440, PROT_NONE) = 0
mmap2(0x76eb3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x76eb3000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0dI\0\0004\0\0\0"..., 512) = 512
lseek(3, 125740, SEEK_SET) = 125740
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1560) = 1560
lseek(3, 90536, SEEK_SET) = 90536
read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(3, {st_mode=S_IFREG|0755, st_size=127300, ...}) = 0
mmap2(NULL, 164432, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76e73000
mprotect(0x76e89000, 61440, PROT_NONE) = 0
mmap2(0x76e98000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x76e98000
mmap2(0x76e9a000, 4688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76e9a000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0#h\1\0004\0\0\0"..., 512) = 512
lseek(3, 1231820, SEEK_SET) = 1231820
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2880) = 2880
lseek(3, 1228284, SEEK_SET) = 1228284
read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(3, {st_mode=S_IFREG|0755, st_size=1234700, ...}) = 0
mmap2(NULL, 1303872, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76d34000
mprotect(0x76e5d000, 65536, PROT_NONE) = 0
mmap2(0x76e6d000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x129000) = 0x76e6d000
mmap2(0x76e70000, 9536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76e70000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0P\t\0\0004\0\0\0"..., 512) = 512
lseek(3, 8680, SEEK_SET) = 8680
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1120) = 1120
lseek(3, 8328, SEEK_SET) = 8328
read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(3, {st_mode=S_IFREG|0644, st_size=9800, ...}) = 0
mmap2(NULL, 73912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76d21000
mprotect(0x76d23000, 61440, PROT_NONE) = 0
mmap2(0x76d32000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x76d32000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0 \27\0\0004\0\0\0"..., 512) = 512
lseek(3, 25352, SEEK_SET) = 25352
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1280) = 1280
lseek(3, 24940, SEEK_SET) = 24940
read(3, "A.\0\0\0aeabi\0\1$\0\0\0\0056\0\6\6\10\1\t\1\n\2\22\4\23\1\24"..., 47) = 47
fstat64(3, {st_mode=S_IFREG|0644, st_size=26632, ...}) = 0
mmap2(NULL, 90640, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76d0a000
mprotect(0x76d10000, 61440, PROT_NONE) = 0
mmap2(0x76d1f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x76d1f000
close(3) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x76f0b000
set_tls(0x76f0b980, 0x76f0c058, 0x76f11050, 0x76f0b980, 0x76f11050) = 0
mprotect(0x76e6d000, 8192, PROT_READ) = 0
mprotect(0x76e98000, 4096, PROT_READ) = 0
mprotect(0x76d1f000, 4096, PROT_READ) = 0
mprotect(0x76d32000, 4096, PROT_READ) = 0
mprotect(0x76eb3000, 4096, PROT_READ) = 0
mprotect(0x76eca000, 20480, PROT_READ|PROT_WRITE) = 0
mprotect(0x76eca000, 20480, PROT_READ|PROT_EXEC) = 0
cacheflush(0x76eca000, 0x76ecf000, 0, 0x15, 0) = 0
mprotect(0x76ede000, 4096, PROT_READ) = 0
mprotect(0x22000, 4096, PROT_READ) = 0
mprotect(0x76f10000, 4096, PROT_READ) = 0
munmap(0x76eb5000, 82593) = 0
set_tid_address(0x76f0b528) = 3210
set_robust_list(0x76f0b530, 12) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x76e772b0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x76d606c0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x76e77390, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x76d606c0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
rt_sigaction(SIGINT, {sa_handler=0x11ea8, sa_mask=[INT], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x76d606b0}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
stat64("/var/run/pcscd/pcscd.comm", {st_mode=S_IFSOCK|0666, st_size=0, ...}) = 0
brk(NULL) = 0x6ec000
brk(0x70d000) = 0x70d000
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/pcscd/pcscd.comm"}, 28) = 0
fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
_newselect(4, NULL, [3], NULL, NULL) = 1 (out [3])
send(3, "\f\0\0\0\21\0\0\0", 8, MSG_NOSIGNAL) = 8
_newselect(4, NULL, [3], NULL, NULL) = 1 (out [3])
send(3, "\4\0\0\0\3\0\0\0\0\0\0\0", 12, MSG_NOSIGNAL) = 12
_newselect(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, "\4\0\0\0\4\0\0\0\35\0\20\200", 12) = 12
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(2, "\33[31mSCardEstablishContext: Serv"..., 55SCardEstablishContext: Service not available.
) = 55
exit_group(-1) = ?
+++ exited with 255 +++
the pcscd seems to work :
pi#raspberrypi:~ $ sudo pcscd -f -d
00000000 [1996378896] debuglog.c:299:DebugLogSetLevel() debug level=debug
00000258 [1996378896] utils.c:82:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory
00000468 [1996378896] configfile.l:360:DBGetReaderList() Parsing conf file: /usr/local/etc/reader.conf.d
00000065 [1996378896] pcscdaemon.c:662:main() pcsc-lite 1.8.25 daemon ready.
00026608 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00000885 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00000898 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00000968 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00001066 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x7800, path: /dev/bus/usb/001/007
00000956 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00000911 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0461, PID: 0x4D64, path: /dev/bus/usb/001/004
00000945 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00000951 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0749, PID: 0x1000, path: /dev/bus/usb/001/006
00000939 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0749, PID: 0x1000, path: /dev/bus/usb/001/006
00000958 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00000978 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00000954 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x076B, PID: 0x5022, path: /dev/bus/usb/001/022
00000069 [1996378896] hotplug_libudev.c:440:HPAddDevice() Adding USB device: HID Global OMNIKEY 5022 Smart Card Reader
00000416 [1996378896] readerfactory.c:1075:RFInitializeReader() Attempting startup of HID Global OMNIKEY 5022 Smart Card Reader [OMNIKEY 5022 Smart Card Reader] (KJ-13171286-1904-000290) 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00001033 [1996378896] readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000202 [1996378896] ifdhandler.c:1961:init_driver() Driver version: 1.4.31
00006743 [1996378896] ifdhandler.c:1978:init_driver() LogLevel: 0x0003
00000071 [1996378896] ifdhandler.c:1989:init_driver() DriverOptions: 0x0000
00001321 [1996378896] ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 0, device: usb:076b/5022:libudev:0:/dev/bus/usb/001/022
00000102 [1996378896] ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00006736 [1996378896] ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau#free.fr)
00000046 [1996378896] ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000033 [1996378896] ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00095750 [1996378896] ccid_usb.c:660:OpenUSBByName() Found Vendor/Product: 076B/5022 (HID Global OMNIKEY 5022 Smart Card Reader)
00000036 [1996378896] ccid_usb.c:662:OpenUSBByName() Using USB bus/device: 1/22
00000016 [1996378896] ccid_usb.c:722:OpenUSBByName() bNumDataRatesSupported is 0
00111362 [1996378896] ifdhandler.c:381:IFDHGetCapabilities() tag: 0xFB3, usb:076b/5022:libudev:0:/dev/bus/usb/001/022 (lun: 0)
00000035 [1996378896] readerfactory.c:396:RFAddReader() Using the reader polling thread
00000957 [1974453120] ifdhandler.c:1154:IFDHPowerICC() action: PowerUp, usb:076b/5022:libudev:0:/dev/bus/usb/001/022 (lun: 0)
00014077 [1974453120] eventhandler.c:289:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00000006 [1996378896] ifdhandler.c:381:IFDHGetCapabilities() tag: 0xFAE, usb:076b/5022:libudev:0:/dev/bus/usb/001/022 (lun: 0)
00000036 [1996378896] ifdhandler.c:476:IFDHGetCapabilities() Reader supports 1 slot(s)
00000047 [1974453120] Card ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
00000702 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00000387 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0B05, PID: 0x7774, path: /dev/bus/usb/001/021
00000366 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0B05, PID: 0x7774, path: /dev/bus/usb/001/021
00000385 [1996378896] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00905718 [1974453120] ifdhandler.c:1154:IFDHPowerICC() action: PowerDown, usb:076b/5022:libudev:0:/dev/bus/usb/001/022 (lun: 0)
00033069 [1974453120] eventhandler.c:482:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED
When pcscd run, i used : sudo pcsc_scan
the pcscd log is (see the lines beginning with '***'):
pi#raspberrypi:~/Documents $ sudo pcscd -f -d
00000000 [1995817744] debuglog.c:299:DebugLogSetLevel() debug level=debug
00000814 [1995817744] configfile.l:360:DBGetReaderList() Parsing conf file: /usr/local/etc/reader.conf.d
00000165 [1995817744] pcscdaemon.c:662:main() pcsc-lite 1.8.25 daemon ready.
00031408 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00001259 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00001041 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00001051 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00001098 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x7800, path: /dev/bus/usb/001/007
00001096 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00001022 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0461, PID: 0x4D64, path: /dev/bus/usb/001/004
00001046 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00001009 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0749, PID: 0x1000, path: /dev/bus/usb/001/006
00001003 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0749, PID: 0x1000, path: /dev/bus/usb/001/006
00001038 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/003
00001001 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00000955 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x076B, PID: 0x5022, path: /dev/bus/usb/001/024
00000143 [1995817744] hotplug_libudev.c:440:HPAddDevice() Adding USB device: HID Global OMNIKEY 5022 Smart Card Reader
00000489 [1995817744] readerfactory.c:1075:RFInitializeReader() Attempting startup of HID Global OMNIKEY 5022 Smart Card Reader [OMNIKEY 5022 Smart Card Reader] (KJ-13171286-1904-000290) 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00001091 [1995817744] readerfactory.c:950:RFBindFunctions() Loading IFD Handler 3.0
00000413 [1995817744] ifdhandler.c:1961:init_driver() Driver version: 1.4.31
00006619 [1995817744] ifdhandler.c:1978:init_driver() LogLevel: 0x0003
00000131 [1995817744] ifdhandler.c:1989:init_driver() DriverOptions: 0x0000
00001393 [1995817744] ifdhandler.c:110:CreateChannelByNameOrChannel() Lun: 0, device: usb:076b/5022:libudev:0:/dev/bus/usb/001/024
00000176 [1995817744] ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00019948 [1995817744] ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau#free.fr)
00000114 [1995817744] ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver
00000032 [1995817744] ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00112071 [1995817744] ccid_usb.c:660:OpenUSBByName() Found Vendor/Product: 076B/5022 (HID Global OMNIKEY 5022 Smart Card Reader)
00000035 [1995817744] ccid_usb.c:662:OpenUSBByName() Using USB bus/device: 1/24
00000027 [1995817744] ccid_usb.c:722:OpenUSBByName() bNumDataRatesSupported is 0
00015695 [1995817744] ifdhandler.c:381:IFDHGetCapabilities() tag: 0xFB3, usb:076b/5022:libudev:0:/dev/bus/usb/001/024 (lun: 0)
00000038 [1995817744] readerfactory.c:396:RFAddReader() Using the reader polling thread
00001081 [1973891968] ifdhandler.c:1154:IFDHPowerICC() action: PowerUp, usb:076b/5022:libudev:0:/dev/bus/usb/001/024 (lun: 0)
00014151 [1973891968] eventhandler.c:289:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00000003 [1995817744] ifdhandler.c:381:IFDHGetCapabilities() tag: 0xFAE, usb:076b/5022:libudev:0:/dev/bus/usb/001/024 (lun: 0)
00000074 [1973891968] Card ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
00000040 [1995817744] ifdhandler.c:476:IFDHGetCapabilities() Reader supports 1 slot(s)
00000916 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00000463 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0B05, PID: 0x7774, path: /dev/bus/usb/001/021
00000415 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0B05, PID: 0x7774, path: /dev/bus/usb/001/021
00000432 [1995817744] hotplug_libudev.c:301:get_driver() Looking for a driver for VID: 0x0424, PID: 0x2514, path: /dev/bus/usb/001/002
00094258 [1973891968] ifdhandler.c:1154:IFDHPowerICC() action: PowerDown, usb:076b/5022:libudev:0:/dev/bus/usb/001/024 (lun: 0)
00034057 [1973891968] eventhandler.c:482:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED
17658438 [1995817744] winscard_msg_srv.c:255:ProcessEventsServer() Common channel packet arrival
00000116 [1995817744] winscard_msg_srv.c:267:ProcessEventsServer() ProcessCommonChannelRequest detects: 14
00000033 [1995817744] pcscdaemon.c:133:SVCServiceRunLoop() A new context thread creation is requested: 14
***00000229 [1955591040] winscard_svc.c:340:ContextThread() Authorized PC/SC client
***00000039 [1955591040] winscard_svc.c:344:ContextThread() Thread is started: dwClientID=14, threadContext #0x14208d8
***00000051 [1955591040] winscard_svc.c:362:ContextThread() Received command: CMD_VERSION from client 14
***00000064 [1955591040] winscard_svc.c:374:ContextThread() Client is protocol version 4:3
***00000026 [1955591040] winscard_svc.c:383:ContextThread() Client protocol is 4:3
***00000025 [1955591040] winscard_svc.c:385:ContextThread() Server protocol is 4:4
***00000025 [1955591040] winscard_svc.c:394:ContextThread() CMD_VERSION rv=0x8010001D for client 14
***00000794 [1955591040] winscard_svc.c:354:ContextThread() Client die: 14
***00000074 [1955591040] winscard_svc.c:1055:MSGCleanupClient() Thread is stopping: dwClientID=14, threadContext #0x14208d8
***00000028 [1955591040] winscard_svc.c:1061:MSGCleanupClient() Freeing SCONTEXT #0x14208d8
07054799 [1973891968] eventhandler.c:358:EHStatusHandlerThread() Card Removed From HID Global OMNIKEY 5022 Smart Card Reader [OMNIKEY 5022 Smart Card Reader] (KJ-13171286-1904-000290) 00 00
02336437 [1973891968] ifdhandler.c:1154:IFDHPowerICC() action: PowerUp, usb:076b/5022:libudev:0:/dev/bus/usb/001/024 (lun: 0)
00014370 [1973891968] eventhandler.c:406:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00000070 [1973891968] eventhandler.c:423:EHStatusHandlerThread() Card inserted into HID Global OMNIKEY 5022 Smart Card Reader [OMNIKEY 5022 Smart Card Reader] (KJ-13171286-1904-000290) 00 00
00000102 [1973891968] Card ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
00593095 [1973891968] eventhandler.c:482:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED
00000501 [1973891968] eventhandler.c:358:EHStatusHandlerThread() Card Removed From HID Global OMNIKEY 5022 Smart Card Reader [OMNIKEY 5022 Smart Card Reader] (KJ-13171286-1904-000290) 00 00
Thank you for your help !
Related
On rhel8 os When I run a program the kernel crash, how can I determine which line of code reports the error ?
I don't know about kernel, I don't know how to troubleshoot. When the problem happened, my system kernel crashed, the following is the vmcore-dmesg.txt log ##dmesg logs [ 378.442884] SPDMD-LUN:[ERROR]lun_del:2218 device nvfile-mgmtd-0 is busy :2 [ 424.511211] XFS (nvfile-storage-0): Mounting V5 Filesystem [ 424.513045] XFS (nvfile-storage-2): Mounting V5 Filesystem [ 424.538953] XFS (nvfile-storage-2): Starting recovery (logdev: internal) [ 424.546536] XFS (nvfile-storage-2): Ending recovery (logdev: internal) [ 425.512217] XFS (nvfile-storage-0): Starting recovery (logdev: internal) [ 425.518929] XFS (nvfile-storage-1): Mounting V5 Filesystem [ 425.520813] XFS (nvfile-storage-3): Mounting V5 Filesystem [ 426.288987] XFS (nvfile-storage-3): Starting recovery (logdev: internal) [ 426.475465] XFS (nvfile-storage-1): Starting recovery (logdev: internal) [ 427.496551] XFS (nvfile-storage-0): Ending recovery (logdev: internal) [ 428.320932] XFS (nvfile-storage-3): Ending recovery (logdev: internal) [ 428.977479] XFS (nvfile-storage-1): Ending recovery (logdev: internal) [ 445.927118] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [ 445.927685] PGD 0 P4D 0 [ 445.928216] Oops: 0000 [#1] SMP NOPTI [ 445.928723] CPU: 4 PID: 591 Comm: kworker/u193:1 Kdump: loaded Tainted: G OE --------- - - 4.18.0-305.el8.x86_64 #1 [ 445.929735] Hardware name: Lenovo ThinkSystem SR860 V2/7Z60CTO1WW, BIOS M5E118K-1.52 08/06/2021 [ 445.930305] Workqueue: xfs-cil/nvfile-storage- xlog_cil_push_work [xfs] [ 445.930910] RIP: 0010:blk_queue_split+0x1c6/0x660 [ 445.933048] Code: c0 45 31 f6 89 44 24 44 89 7c 24 40 31 ff 85 db 0f 84 56 04 00 00 8b 44 24 44 48 89 c1 48 89 44 24 30 48 c1 e1 04 49 03 4d 78 <8b> 41 08 8b 71 0c 48 8b 11 44 29 f8 39 d8 48 89 54 24 48 0f 47 c3 [ 445.936323] RSP: 0018:ffffbcbf9a4bfaf8 EFLAGS: 00010246 [ 445.936711] RAX: 0000000000000000 RBX: 0000000000003000 RCX: 0000000000000000 [ 445.937028] RDX: 0000000000000018 RSI: 0000000000000018 RDI: 0000000000000000 [ 445.937343] RBP: ffffbcbf9a4bfb90 R08: 0000000000000000 R09: ffff940c1965d700 [ 445.937659] R10: 0000000000000000 R11: 0000000000000000 R12: ffff94ca6f590000 [ 445.937979] R13: ffff940bda0ddc80 R14: 0000000000000000 R15: 0000000000000000 [ 445.938304] FS: 0000000000000000(0000) GS:ffff940effd00000(0000) knlGS:0000000000000000
Radix Sort Convert Ascending to Descending (Pascal)
*edit I have radix sort procedure, and i got this code on another site referension. But this radix sort only for ascending not for descending. Can you guys help me how to make it to descending Program SortStuff; Uses Crt, Dos; Type AType = Array [1..400] of Integer; Ptr = ^Node; Node = Record Info : Integer; Link : Ptr; end; LType = Array [0..9] of Ptr; Var Ran : AType; MaxData : Integer; and this section of the procedure of refill Procedure Refill (Var A : AType; Var L : LType); Var I, J : Integer; P : Ptr; begin J := 1; For I := 0 to 9 do begin P := L [I]; While P <> Nil do begin A [J] := P^.Info; P := P^.Link; J := J + 1; end; end; For I := 0 to 9 do L [I] := Nil; end; This is the radix sort code Procedure RadixSort (Var A : AType; MaxData : Integer); Var L : LType; I, divisor, ListNo, Number : Integer; begin For I := 0 to 9 do L [I] := Nil; divisor := 1; While divisor <= 1000 do begin I := 1; While I <= MaxData do begin Number := A [I]; ListNo := Number div divisor MOD 10; Insert (L, Number, ListNo); I := I + 1; end; Refill (A, L); divisor := 10 * divisor; end; end; and this the main code begin ReadData (Ran, MaxData); Writeln ('Unsorted : '); WriteArray (Ran, MaxData); RadixSort (Ran, MaxData); Writeln ('Sorted : '); WriteArray (Ran, MaxData); readln; end. this is the result of the compiler when ascending Unsorted : 7131 5110 638 7836 3809 1278 9577 7590 8244 5902 7610 4787 6809 1510 3564 3358 6411 995 4966 9800 5807 678 9174 9385 4146 1824 4869 9383 3638 2304 8130 1178 5102 2192 1739 1643 2965 7245 7050 2416 3778 5515 4395 3418 4869 9814 6073 5014 8501 210 3966 4891 8992 2882 5512 3775 799 9985 8189 4664 4360 241 7681 6235 7152 8032 8874 19 9253 1943 2049 8301 1848 9175 8698 6578 8111 4442 5157 8832 9848 6448 3881 2753 4100 1130 9516 4539 5515 9756 1047 3313 2937 575 8634 9439 8508 8 2596 3814 4996 5129 9810 1220 8242 7672 7342 1320 3195 7590 4342 5697 7866 2326 6726 3441 8276 6531 2211 6285 4492 9310 2155 2349 1396 9157 772 3984 1955 9417 7644 4814 90 7922 180 6536 7018 7411 263 3775 2014 2339 4064 6623 4173 4031 5979 4930 7654 4039 1531 4916 7357 8802 6935 6108 1580 3999 6225 2641 6330 6907 2584 3437 7753 8680 2192 4461 748 983 364 1695 197 8174 3128 104 4724 546 3826 7640 8669 4481 4763 599 2983 4433 92 8317 8102 413 91 1355 7456 4577 8442 26 8319 5010 1140 1232 1688 4080 4445 3548 5713 8391 4295 296 294 1477 8487 5823 9493 4528 434 2589 9499 6092 9784 6773 1907 9382 2203 3774 8438 8672 3290 3590 4540 2912 7308 9782 5615 8352 9456 5867 5657 218 6838 6294 3295 4741 5949 9369 8949 9672 5853 7054 855 3755 3113 4712 9043 3412 4546 2567 9934 2034 2007 1845 6466 2815 3012 498 5736 2487 881 6250 780 6817 7309 8503 9697 6149 7132 6936 5692 2757 6150 2705 1401 9272 4190 6116 8096 2386 2027 8913 7734 7318 4423 8439 7087 7995 8429 7139 818 1495 3284 2418 3295 5121 2989 5741 433 1905 5468 9828 8946 3179 7615 894 9766 2971 847 6450 4686 9597 4851 2080 7062 1956 2386 7476 1703 2738 3864 6491 7545 3046 1432 1050 3534 6054 5005 4862 9126 2877 1259 8613 1209 4982 236 9877 1697 4142 7484 2562 1554 8105 6483 3440 1462 8463 2006 7193 8316 281 6544 645 7043 2857 70 5525 6953 8924 7032 7593 4514 2192 8088 59 2861 4685 897 7319 3300 410 773 2147 9992 2985 8834 302 437 4323 6566 8357 9802 8257 7543 3607 1131 564 9474 9203 9127 575 708 7767 Sorted : 8 19 26 59 70 90 91 92 104 180 197 210 218 236 241 263 281 294 296 302 364 410 413 433 434 437 498 546 564 575 575 599 638 645 678 708 748 772 773 780 799 818 847 855 881 894 897 983 995 1047 1050 1130 1131 1140 1178 1209 1220 1232 1259 1278 1320 1355 1396 1401 1432 1462 1477 1495 1510 1531 1554 1580 1643 1688 1695 1697 1703 1739 1824 1845 1848 1905 1907 1943 1955 1956 2006 2007 2014 2027 2034 2049 2080 2147 2155 2192 2192 2192 2203 2211 2304 2326 2339 2349 2386 2386 2416 2418 2487 2562 2567 2584 2589 2596 2641 2705 2738 2753 2757 2815 2857 2861 2877 2882 2912 2937 2965 2971 2983 2985 2989 3012 3046 3113 3128 3179 3195 3284 3290 3295 3295 3300 3313 3358 3412 3418 3437 3440 3441 3534 3548 3564 3590 3607 3638 3755 3774 3775 3775 3778 3809 3814 3826 3864 3881 3966 3984 3999 4031 4039 4064 4080 4100 4142 4146 4173 4190 4295 4323 4342 4360 4395 4423 4433 4442 4445 4461 4481 4492 4514 4528 4539 4540 4546 4577 4664 4685 4686 4712 4724 4741 4763 4787 4814 4851 4862 4869 4869 4891 4916 4930 4966 4982 4996 5005 5010 5014 5102 5110 5121 5129 5157 5468 5512 5515 5515 5525 5615 5657 5692 5697 5713 5736 5741 5807 5823 5853 5867 5902 5949 5979 6054 6073 6092 6108 6116 6149 6150 6225 6235 6250 6285 6294 6330 6411 6448 6450 6466 6483 6491 6531 6536 6544 6566 6578 6623 6726 6773 6809 6817 6838 6907 6935 6936 6953 7018 7032 7043 7050 7054 7062 7087 7131 7132 7139 7152 7193 7245 7308 7309 7318 7319 7342 7357 7411 7456 7476 7484 7543 7545 7590 7590 7593 7610 7615 7640 7644 7654 7672 7681 7734 7753 7767 7836 7866 7922 7995 8032 8088 8096 8102 8105 8111 8130 8174 8189 8242 8244 8257 8276 8301 8316 8317 8319 8352 8357 8391 8429 8438 8439 8442 8463 8487 8501 8503 8508 8613 8634 8669 8672 8680 8698 8802 8832 8834 8874 8913 8924 8946 8949 8992 9043 9126 9127 9157 9174 9175 9203 9253 9272 9310 9369 9382 9383 9385 9417 9439 9456 9474 9493 9499 9516 9577 9597 9672 9697 9756 9766 9782 9784 9800 9802 9810 9814 9828 9848 9877 9934 9985 9992 then i tried to modify ListNo := Number div divisor MOD 10; and reverse it into ListNo := divisor div Number MOD 10; and the final result become to Unsorted : 7131 5110 638 7836 3809 1278 9577 7590 8244 5902 7610 4787 6809 1510 3564 3358 6411 995 4966 9800 5807 678 9174 9385 4146 1824 4869 9383 3638 2304 8130 1178 5102 2192 1739 1643 2965 7245 7050 2416 3778 5515 4395 3418 4869 9814 6073 5014 8501 210 3966 4891 8992 2882 5512 3775 799 9985 8189 4664 4360 241 7681 6235 7152 8032 8874 19 9253 1943 2049 8301 1848 9175 8698 6578 8111 4442 5157 8832 9848 6448 3881 2753 4100 1130 9516 4539 5515 9756 1047 3313 2937 575 8634 9439 8508 8 2596 3814 4996 5129 9810 1220 8242 7672 7342 1320 3195 7590 4342 5697 7866 2326 6726 3441 8276 6531 2211 6285 4492 9310 2155 2349 1396 9157 772 3984 1955 9417 7644 4814 90 7922 180 6536 7018 7411 263 3775 2014 2339 4064 6623 4173 4031 5979 4930 7654 4039 1531 4916 7357 8802 6935 6108 1580 3999 6225 2641 6330 6907 2584 3437 7753 8680 2192 4461 748 983 364 1695 197 8174 3128 104 4724 546 3826 7640 8669 4481 4763 599 2983 4433 92 8317 8102 413 91 1355 7456 4577 8442 26 8319 5010 1140 1232 1688 4080 4445 3548 5713 8391 4295 296 294 1477 8487 5823 9493 4528 434 2589 9499 6092 9784 6773 1907 9382 2203 3774 8438 8672 3290 3590 4540 2912 7308 9782 5615 8352 9456 5867 5657 218 6838 6294 3295 4741 5949 9369 8949 9672 5853 7054 855 3755 3113 4712 9043 3412 4546 2567 9934 2034 2007 1845 6466 2815 3012 498 5736 2487 881 6250 780 6817 7309 8503 9697 6149 7132 6936 5692 2757 6150 2705 1401 9272 4190 6116 8096 2386 2027 8913 7734 7318 4423 8439 7087 7995 8429 7139 818 1495 3284 2418 3295 5121 2989 5741 433 1905 5468 9828 8946 3179 7615 894 9766 2971 847 6450 4686 9597 4851 2080 7062 1956 2386 7476 1703 2738 3864 6491 7545 3046 1432 1050 3534 6054 5005 4862 9126 2877 1259 8613 1209 4982 236 9877 1697 4142 7484 2562 1554 8105 6483 3440 1462 8463 2006 7193 8316 281 6544 645 7043 2857 70 5525 6953 8924 7032 7593 4514 2192 8088 59 2861 4685 897 7319 3300 410 773 2147 9992 2985 8834 302 437 4323 6566 8357 9802 8257 7543 3607 1131 564 9474 9203 9127 575 708 7767 Sorted : 7131 5110 7836 3809 1278 9577 7590 8244 5902 7610 4787 6809 1510 3564 3358 6411 4966 9800 5807 9174 9385 4146 1824 4869 9383 3638 2304 8130 1178 5102 2192 1739 1643 2965 7245 7050 2416 3778 5515 4395 3418 4869 9814 6073 5014 8501 3966 4891 8992 2882 5512 3775 9985 8189 4664 4360 7681 6235 7152 8032 8874 9253 1943 2049 8301 1848 9175 8698 6578 8111 4442 5157 8832 9848 6448 3881 2753 4100 1130 9516 4539 5515 9756 1047 3313 2937 8634 9439 8508 2596 3814 4996 5129 9810 1220 8242 7672 7342 1320 3195 7590 4342 5697 7866 2326 6726 3441 8276 6531 2211 6285 4492 9310 2155 2349 1396 9157 3984 1955 9417 7644 4814 7922 6536 7018 7411 3775 2014 2339 4064 6623 4173 4031 5979 4930 7654 4039 1531 4916 7357 8802 6935 6108 1580 3999 6225 2641 6330 6907 2584 3437 7753 8680 2192 4461 1695 8174 3128 4724 3826 7640 8669 4481 4763 2983 4433 8317 8102 1355 7456 4577 8442 8319 5010 1140 1232 1688 4080 4445 3548 5713 8391 4295 1477 8487 5823 9493 4528 2589 9499 6092 9784 6773 1907 9382 2203 3774 8438 8672 3290 3590 4540 2912 7308 9782 5615 8352 9456 5867 5657 6838 6294 3295 4741 5949 9369 8949 9672 5853 7054 3755 3113 4712 9043 3412 4546 2567 9934 2034 2007 1845 6466 2815 3012 5736 2487 6250 6817 7309 8503 9697 6149 7132 6936 5692 2757 6150 2705 1401 9272 4190 6116 8096 2386 2027 8913 7734 7318 4423 8439 7087 7995 8429 7139 1495 3284 2418 3295 5121 2989 5741 1905 5468 9828 8946 3179 7615 9766 2971 6450 4686 9597 4851 2080 7062 1956 2386 7476 1703 2738 3864 6491 7545 3046 1432 1050 3534 6054 5005 4862 9126 2877 1259 8613 1209 4982 9877 1697 4142 7484 2562 1554 8105 6483 3440 1462 8463 2006 7193 8316 6544 7043 2857 5525 6953 8924 7032 7593 4514 2192 8088 2861 4685 7319 3300 2147 9992 2985 8834 4323 6566 8357 9802 8257 7543 3607 1131 9474 9203 9127 7767 92 91 638 995 678 799 575 772 748 983 546 599 855 881 780 818 894 847 645 897 773 564 575 708 90 364 413 434 498 433 410 437 19 263 296 294 281 302 210 241 218 236 70 180 197 8 59 26 104
ubiattach failed with too many bad blocks
I was trying to read firmware from a NAND chip, and extract its program and data for analyse. From online I learned, you must create an UBI device with your image file write to it, then you can mount it to your system. Description First I read a bin file from FLASH chip. binwalk I get this. $ binwalk -Me Flash_data.bin DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 771180 0xBC46C device tree image (dtb) 772444 0xBC95C device tree image (dtb) 823236 0xC8FC4 CRC32 polynomial table, little endian 2703360 0x294000 uImage header, header size: 64 bytes, header CRC: 0xF092DEF5, created: 2016-10-04 21:32:58, image size: 2773040 bytes, Data Address: 0x80008000, Entry Point: 0x80008000, data CRC: 0x365DF8B1, OS: Linux, CPU: ARM, image type: OS Kernel Image, compression type: none, image name: "Linux-3.2.0" 2703424 0x294040 Linux kernel ARM boot executable zImage (little-endian) 2722452 0x298A94 gzip compressed data, maximum compression, from Unix, last modified: 1970-01-01 00:00:00 (null date) 8110080 0x7BC000 UBI erase count header, version: 1, EC: 0x2, VID header offset: 0x800, data offset: 0x1000 From its output files, I foun this ubi image file. $ binwalk 7BC000.ubi DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 UBI erase count header, version: 1, EC: 0x2, VID header offset: 0x800, data offset: 0x1000 $ file 7BC000.ubi 7BC000.ubi: UBI image, version 1 Some information about NAND chip: PageSize : 2048 SpareSize : 64 PagesPerBlock : 64 Blocks Size : 128KB + 4KB Total Block : 2048 Device Size : 256MB + 8192KB8192KB Bus Width : 8 Then I tried to mount it, like this: $ sudo modprobe mtdblock $ sudo modprobe nandsim first_id_byte=0x20 second_id_byte=0xac third_id_byte=0x00 fourth_id_byte=0x15 $ mtdinfo /dev/mtd0 mtd0 Name: NAND simulator partition 0 Type: nand Eraseblock size: 131072 bytes, 128.0 KiB Amount of eraseblocks: 4096 (536870912 bytes, 512.0 MiB) Minimum input/output unit size: 2048 bytes Sub-page size: 512 bytes OOB size: 64 bytes Character device major/minor: 90:0 Bad blocks are allowed: true Device is writable: true $ sudo flash_erase /dev/mtd0 0 0 $ cp 7BC000.ubi test_infile $ sudo ubiformat /dev/mtd0 -O 2048 -f test_infile ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 4095 -- 100 % complete ubiformat: 4096 eraseblocks are supposedly empty ubiformat: error!: file "test_infile" (size 268713984 bytes) is not multiple of eraseblock size (131072 bytes) error 0 (Success) The size of "test_file" is 0x10044000, so I just remove the last 0x4000 bytes, and tried to ubiformat again. $ dd if=test_infile of=test_infile_dd bs=268697600 count=1 $ sudo ubiformat /dev/mtd0 -O 2048 -f test_infile_dd ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 4095 -- 100 % complete ubiformat: 4096 eraseblocks are supposedly empty ubiformat: flashing eraseblock 1 -- 0 % complete ubiformat: error!: bad UBI magic 0xffffffff, should be 0x55424923 ubiformat: error!: bad EC header at eraseblock 1 of "test_infile_dd" I did some research and found out, in this UBI image, there are many blocks, and every block contains data and OOB. The reason last command fails because it searchs 0x55424923 at wrong position which is 0x20000, because of OOB, 0x55424923 is actually at 0x21000, so I think perhaps delete all of OOB part from "this_file_dd" might work. The bash command and test as follows. #!/bin/bash # ./dump.sh # pagesize 0x20000 # oob size 0x01000 # block 1 dd if=infile of=test_infile_dd_nooob bs=$((0x20000)) count=1 declare -i i=1 # block others while ((i<2048)) do dd if=test_infile of=out bs=$((0x21000)) count=1 skip=$i dd if=out of=outfile bs=$((0x20000)) count=1 cat outfile >> test_infile_dd_nooob rm out rm outfile let i++ done After remove all OOB, compare 2 file, and noticed that OOB has been remove. $ xxd test_infile_dd | grep "5542 4923" ⏎ 00000000: 5542 4923 0100 0000 0000 0000 0000 0002 UBI#............ 00021000: 5542 4923 0100 0000 0000 0000 0000 0002 UBI#............ 00042000: 5542 4923 0100 0000 0000 0000 0000 0001 UBI#............ 00063000: 5542 4923 0100 0000 0000 0000 0000 0001 UBI#............ 00084000: 5542 4923 0100 0000 0000 0000 0000 0001 UBI#............ $ xxd test_infile_dd_nooob | grep "5542 4923" 00000000: 5542 4923 0100 0000 0000 0000 0000 0002 UBI#............ 00020000: 5542 4923 0100 0000 0000 0000 0000 0002 UBI#............ 00040000: 5542 4923 0100 0000 0000 0000 0000 0001 UBI#............ 00060000: 5542 4923 0100 0000 0000 0000 0000 0001 UBI#............ 00080000: 5542 4923 0100 0000 0000 0000 0000 0001 UBI#............ Then ubiformat again, another error about bad UBI magic. $ sudo ubiformat /dev/mtd0 -O 2048 -f test_infile_dd_nooob ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 4095 -- 100 % complete ubiformat: 1 eraseblocks have valid erase counter, mean value is 0 ubiformat: 4095 eraseblocks are supposedly empty ubiformat: warning!: only 1 of 4096 eraseblocks have valid erase counter ubiformat: erase counter 0 will be used for all eraseblocks ubiformat: note, arbitrary erase counter value may be specified using -e option ubiformat: continue? (y/N) y ubiformat: use erase counter 0 for all eraseblocks ubiformat: flashing eraseblock 1074 -- 54 % complete ubiformat: error!: bad UBI magic 00000000, should be 0x55424923 ubiformat: error!: bad EC header at eraseblock 1074 of "test_infile_dd_nooob" Used ghex to fix wrong EC header in EB-1074, and ubiformat again, same block's CRC is not right. sudo ubiformat /dev/mtd0 -O 2048 -f test_infile_dd_nooob -e 10 ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 4095 -- 100 % complete ubiformat: 1074 eraseblocks have valid erase counter, mean value is 10 ubiformat: 3022 eraseblocks are supposedly empty ubiformat: use erase counter 10 for all eraseblocks ubiformat: flashing eraseblock 1074 -- 54 % complete ubiformat: error!: bad CRC 0x7d72af58, should be 00000000 ubiformat: error!: bad EC header at eraseblock 1074 of "test_infile_dd_nooob" Fix CRC and ubiformat again, enable ubi and ubiattach to mtd0, but another error occurs. sudo ubiformat /dev/mtd0 -O 2048 -f test_infile_dd_nooob -e 10 ⏎ ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 4095 -- 100 % complete ubiformat: 1074 eraseblocks have valid erase counter, mean value is 10 ubiformat: 3022 eraseblocks are supposedly empty ubiformat: use erase counter 10 for all eraseblocks ubiformat: flashing eraseblock 1987 -- 100 % complete ubiformat: formatting eraseblock 4095 -- 100 % complete $ sudo modprobe ubi $ sudo modprobe ubi mtd=0 $ sudo ubiattach -m 0 -O 2048 ubiattach: error!: cannot attach mtd0 error 22 (Invalid argument) Do dmesg I found this message. $ sudo dmesg [ 6974.021149] 0001efa0: 00 00 00 00 00 00 00 00 10 0a 00 00 01 00 00 00 00 0a d9 d5 05 f9 20 a1 63 d7 00 00 00 02 fb d2 ...................... .c....... [ 6974.021150] 0001efc0: ce 15 00 00 00 0d 00 00 02 00 00 00 04 00 20 00 c7 00 00 00 0d 0d 0d 00 00 00 0b 01 b8 00 03 db .............. ................. [ 6974.021151] 0001efe0: 03 9d 03 5e 03 20 02 fd 02 d8 02 93 02 4e 02 1b 01 f6 01 b8 20 00 7a 14 08 00 32 3b 81 0e 04 17 ...^. .......N...... .z...2;.... [ 6974.023703] ubi0 error: validate_ec_hdr [ubi]: node with incompatible UBI version found: this UBI version is 1, image version is 0 [ 6974.023707] ubi0 error: validate_ec_hdr [ubi]: bad EC header [ 6974.023707] Erase counter header dump: [ 6974.023708] magic 0x55424923 [ 6974.023708] version 0 [ 6974.023709] ec 10 [ 6974.023709] vid_hdr_offset 2048 [ 6974.023710] data_offset 4096 [ 6974.023710] image_seq 144665903 [ 6974.023711] hdr_crc 0xb574c34c [ 6974.023711] erase counter header hexdump: [ 6974.023713] 00000000: 55 42 49 23 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 08 00 00 00 10 00 08 9f 6d 2f 00 00 00 00 UBI#......................m/.... [ 6974.023713] 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b5 74 c3 4c .............................t.L [ 6974.023715] CPU: 4 PID: 14955 Comm: ubiattach Tainted: G W E 5.7.0-kali1-amd64 #1 Debian 5.7.6-1kali2 [ 6974.023716] Hardware name: Dell Inc. Inspiron 7472/0GHVRJ, BIOS 1.1.6 06/14/2018 [ 6974.023716] Call Trace: [ 6974.023722] dump_stack+0x66/0x90 [ 6974.023725] validate_ec_hdr+0x8a/0xe0 [ubi] [ 6974.023729] ubi_io_read_ec_hdr+0x1e9/0x280 [ubi] [ 6974.023732] ubi_attach+0x1d3/0x14c0 [ubi] [ 6974.023736] ubi_attach_mtd_dev+0x5b3/0xd30 [ubi] [ 6974.023741] ? __get_mtd_device+0x2c/0xa0 [mtd] [ 6974.023743] ? _cond_resched+0x15/0x30 [ 6974.023746] ctrl_cdev_ioctl+0xda/0x1c0 [ubi] [ 6974.023748] ksys_ioctl+0x87/0xc0 [ 6974.023749] __x64_sys_ioctl+0x16/0x20 [ 6974.023751] do_syscall_64+0x52/0x180 [ 6974.023753] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 6974.023754] RIP: 0033:0x7f3f55902c87 [ 6974.023756] Code: 00 00 00 48 8b 05 09 92 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d d9 91 0c 00 f7 d8 64 89 01 48 [ 6974.023756] RSP: 002b:00007ffd4fec6f88 EFLAGS: 00000206 ORIG_RAX: 0000000000000010 [ 6974.023757] RAX: ffffffffffffffda RBX: 00007ffd4fec7020 RCX: 00007f3f55902c87 [ 6974.023758] RDX: 00007ffd4fec6fb0 RSI: 0000000040186f40 RDI: 0000000000000003 [ 6974.023758] RBP: 0000000000000003 R08: 0000000000000001 R09: 0000000000000000 [ 6974.023759] R10: fffffffffffff48e R11: 0000000000000206 R12: 000055c2a393c052 [ 6974.023759] R13: 00007ffd4fec6fb0 R14: 0000000000000000 R15: 0000000000000000 [ 6974.023763] ubi0 error: ubi_io_read_ec_hdr [ubi]: validation failed for PEB 1074 [ 6974.061006] ubi0 error: ubi_attach_mtd_dev [ubi]: failed to attach mtd0, error -22 But I don't know how to solve this, so I just remove block 1074 from file. $ dd if=test_infile_dd_nooob of=test_infile_dd_nooob_no1074_1 bs=131072 count=1074 $ dd if=test_infile_dd_nooob of=test_infile_dd_nooob_no1074_2 bs=131072 skip=1075 $ cat test_infile_dd_nooob_no1074_1 test_infile_dd_nooob_no1074_2 > test_infile_dd_nooob_no1074 Then ubiformat and attach again, but there was another error. $ sudo ubiformat /dev/mtd0 -O 2048 -f test_infile_dd_nooob_no1074 -e 10 ubiformat: mtd0 (nand), size 536870912 bytes (512.0 MiB), 4096 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes libscan: scanning eraseblock 4095 -- 100 % complete ubiformat: 4096 eraseblocks have valid erase counter, mean value is 10 ubiformat: use erase counter 10 for all eraseblocks ubiformat: flashing eraseblock 1986 -- 100 % complete ubiformat: formatting eraseblock 4095 -- 100 % complete $ sudo ubiattach -m 0 -O 2048 ⏎ ubiattach: error!: cannot attach mtd0 error 22 (Invalid argument) Check dmesg and found this, this is where I don't know how to do, I don't know how I get so many bad blocks. $ sudo dmesg ubi0: scanning is finished [ 7392.005554] ubi0 error: ubi_attach [ubi]: 1205 PEBs are corrupted and preserved [ 7392.005554] Corrupted PEBs are: 1805 1802 1793 1678 1674 1670 1666 1662 1654 1653 1652 1649 1640 1639 1626 1625 1621 1605 1587 1586 1581 1563 1553 1540 1534 1533 1532 1531 1530 1529 1528 1527 1526 1525 1524 1523 1522 1521 1520 1519 1518 1517 1516 1515 1514 1512 1511 1510 1509 1508 1507 1506 1505 1504 1503 1502 1501 1500 1499 1498 1496 1495 1494 1493 1492 1491 1490 1489 1488 1487 1486 1485 1484 1483 1482 1481 1471 1449 1448 1447 1446 1445 1444 1441 1439 1438 1437 1436 1435 1434 1433 1432 1431 1430 1429 1428 1425 1424 1423 1422 1421 1420 1419 1418 1417 1416 1415 1414 1413 1412 1411 1410 1409 1408 1407 1406 1405 1404 1403 1402 1401 1400 1399 1398 1397 1396 1395 1394 1393 1391 1390 1389 1388 1387 1386 1385 1384 1383 1382 1381 1380 1379 1378 1377 1376 1375 1374 1373 1372 1371 1370 1369 1368 1367 1366 1365 1364 1363 1362 1361 1360 1359 1358 1357 1356 1355 1354 1353 1352 1351 1350 1349 1348 1347 1346 1345 1344 1343 1342 1341 1340 1339 1338 1337 1335 1334 1333 1332 1331 1330 1329 1328 1327 1326 [ 7392.005578] 1325 1324 1323 1322 1321 1294 1275 1274 1273 1264 1230 1223 1221 1219 1214 1211 1210 1207 1204 1203 1202 1201 1200 1199 1198 1197 1196 1195 1194 1193 1192 1191 1190 1189 1188 1187 1186 1185 1184 1183 1182 1181 1180 1179 1178 1177 1176 1175 1174 1173 1172 1165 1164 1163 1157 1147 1144 1143 1142 1141 1140 1139 1138 1137 1136 1134 1133 1132 1131 1130 1129 1128 1127 1126 1125 1124 1123 1122 1121 1120 1119 1118 1117 1116 1115 1114 1112 1111 1110 1109 1108 1106 1105 1098 1085 1053 1052 1044 1016 1003 1002 977 973 972 963 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 900 899 898 897 896 895 894 893 892 891 890 889 888 887 886 885 884 883 882 881 880 879 878 877 876 875 874 873 872 871 870 869 868 867 866 865 864 863 862 861 860 859 858 857 856 855 854 853 852 851 850 849 848 847 846 845 844 841 840 839 838 837 836 835 834 833 832 831 830 829 828 827 826 825 824 823 822 821 820 [ 7392.005606] 819 818 817 816 815 814 813 812 811 810 809 808 807 806 805 804 803 802 801 800 799 798 797 796 795 794 793 792 791 790 789 788 787 785 784 782 781 780 779 778 777 776 775 774 773 772 771 770 769 768 767 766 765 764 763 762 761 760 759 758 757 756 755 754 753 752 751 750 749 748 747 746 745 744 743 742 741 740 739 738 737 736 735 734 733 732 731 730 729 727 726 725 724 723 722 721 720 719 718 716 715 714 713 712 711 710 709 708 707 706 705 704 703 702 701 700 699 698 697 696 695 694 693 692 691 690 689 688 687 686 685 684 683 682 681 680 679 678 677 676 675 674 673 672 671 670 668 667 666 665 664 663 662 661 660 659 657 656 655 654 653 652 651 650 649 648 647 646 645 644 643 642 641 640 639 638 637 636 635 634 633 632 631 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 611 610 609 608 607 606 605 604 602 601 600 599 598 597 596 595 594 593 592 591 589 588 587 586 585 584 583 582 581 580 579 578 577 576 575 574 573 572 571 570 569 568 567 566 565 564 563 [ 7392.005634] 562 561 560 559 558 557 556 554 553 552 551 550 549 548 547 546 545 544 543 541 540 539 538 537 536 535 534 533 532 531 530 529 528 527 526 525 524 523 522 521 520 519 518 517 516 515 514 513 512 511 510 509 508 507 506 505 504 503 502 501 500 498 497 496 495 494 493 492 491 489 488 487 486 485 484 483 482 481 480 479 478 477 476 475 474 473 472 471 470 469 468 467 466 465 464 463 461 460 459 458 457 456 455 454 453 452 451 450 449 448 447 446 445 444 443 441 440 438 437 436 435 434 433 432 431 430 429 428 427 426 425 424 423 422 421 420 419 418 417 416 415 414 413 412 411 410 409 408 407 406 405 404 403 402 401 400 399 398 397 396 395 394 393 392 391 390 389 388 387 386 384 383 382 381 380 379 378 377 376 375 374 373 372 371 370 369 368 367 366 365 364 363 362 361 360 359 358 357 356 355 354 353 352 351 350 349 348 347 346 345 344 343 342 341 340 339 338 337 336 335 333 332 331 330 329 328 327 326 325 324 323 322 321 320 319 318 317 316 315 314 313 312 311 310 309 308 307 306 [ 7392.005661] 305 304 303 302 301 300 295 294 293 292 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275 274 273 271 270 269 268 267 266 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 233 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 177 176 175 174 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 [ 7392.005690] 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 [ 7392.005698] ubi0 error: ubi_attach.cold [ubi]: too many corrupted PEBs, refusing [ 7392.028819] ubi0 error: ubi_attach_mtd_dev [ubi]: failed to attach mtd0, error -22 [ 7393.182325] systemd-journald[331]: /dev/kmsg buffer overrun, some messages lost. I read the official documents, it says only in 2 senerios a block will be marked as bad. One is when write opertion to eraseblock fails, UBI will move data from bad EB to a good EB, and do some tests so it can confirm whether bad EB is really bad; or when erase opertion have EIO error, then EB will be marked as bad block immediately. I am not sure which reason caused so much bad block. My questions In the progess, is my command doing wrong? If not, how to repair this UBI image so I can read its programs and data? Is there other ways that can get programs and data from this UBI image file? Tools and versions Kali 2020.3 mtd-utils 2.1.1
How to strace for X11 output "connect /tmp/.X11-unix/X1: No such file or directory"
I want to silently test whether X11 is working, from a script. I keep getting "connect /tmp/.X11-unix/X1: No such file or directory", even if I redirect stdout and stderr to /dev/null with (for example) xset q > /dev/null 2>&1 I strace'd, and it doesn't appear to be getting written by xset. I also strace'd the relevant sshd and it doesn't seem to be writing it either. xset, xdpyinfo and the test program at How to check if X server is running? all output this useless error message. In fact, so does vim. But "ls" does not. I also tried: script -e -c 'xset q' /dev/null > /dev/null 2>&1 ...but even that outputs the error message. What do I need to do to silence this overaggressive error message? Thanks! PS: Here's an strace of xset q: 20878 execve("/usr/bin/xset", ["xset", "q"], 0x7ffe3e91cfe0 /* 33 vars */) = 0 20878 brk(NULL) = 0x563d8a664000 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=141841, ...}) = 0 20878 mmap(NULL, 141841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f19ac118000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXmuu.so.1", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\23\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14528, ...}) = 0 20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac144000 20878 mmap(NULL, 2109592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19abd10000 20878 mprotect(0x7f19abd13000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19abf12000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19abf12000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXext.so.6", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\2205\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=73640, ...}) = 0 20878 mmap(NULL, 2169496, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19abaf8000 20878 mprotect(0x7f19abb09000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19abd08000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7f19abd08000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libX11.so.6", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\207\1\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=1277384, ...}) = 0 20878 mmap(NULL, 3374392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab7c0000 20878 mprotect(0x7f19ab8f3000, 2097152, PROT_NONE) = 0 20878 mmap(0x7f19abaf3000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x133000) = 0x7f19abaf3000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\34\2\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0755, st_size=2030544, ...}) = 0 20878 mmap(NULL, 4131552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab3c8000 20878 mprotect(0x7f19ab5af000, 2097152, PROT_NONE) = 0 20878 mmap(0x7f19ab7af000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f19ab7af000 20878 mmap(0x7f19ab7b5000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19ab7b5000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libxcb.so.1", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\261\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=162232, ...}) = 0 20878 mmap(NULL, 2257576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19ab1a0000 20878 mprotect(0x7f19ab1c6000, 2097152, PROT_NONE) = 0 20878 mmap(0x7f19ab3c6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26000) = 0x7f19ab3c6000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14560, ...}) = 0 20878 mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aaf98000 20878 mprotect(0x7f19aaf9b000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19ab19a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19ab19a000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXau.so.6", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\16\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=14456, ...}) = 0 20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac142000 20878 mmap(NULL, 2109720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aad90000 20878 mprotect(0x7f19aad92000, 2097152, PROT_NONE) = 0 20878 mmap(0x7f19aaf92000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f19aaf92000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libXdmcp.so.6", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\21\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=22616, ...}) = 0 20878 mmap(NULL, 2117760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aab88000 20878 mprotect(0x7f19aab8d000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19aad8c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4000) = 0x7f19aad8c000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libbsd.so.0", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P4\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=80104, ...}) = 0 20878 mmap(NULL, 2179152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa970000 20878 mprotect(0x7f19aa983000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19aab82000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12000) = 0x7f19aab82000 20878 mmap(0x7f19aab84000, 80, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aab84000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\"\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=31680, ...}) = 0 20878 mmap(NULL, 2128864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa768000 20878 mprotect(0x7f19aa76f000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19aa96e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f19aa96e000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000b\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0755, st_size=144976, ...}) = 0 20878 mmap(NULL, 2221184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa548000 20878 mprotect(0x7f19aa562000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19aa761000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19000) = 0x7f19aa761000 20878 mmap(0x7f19aa763000, 13440, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aa763000 20878 close(3) = 0 20878 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac13d000 20878 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f19ac115000 20878 arch_prctl(ARCH_SET_FS, 0x7f19ac115740) = 0 20878 mprotect(0x7f19ab7af000, 16384, PROT_READ) = 0 20878 mprotect(0x7f19aa761000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19aa96e000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19aab82000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19aad8c000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19aaf92000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19ab19a000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19ab3c6000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19abaf3000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19abd08000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19abf12000, 4096, PROT_READ) = 0 20878 mprotect(0x563d8872f000, 4096, PROT_READ) = 0 20878 mprotect(0x7f19ac13f000, 4096, PROT_READ) = 0 20878 munmap(0x7f19ac118000, 141841) = 0 20878 set_tid_address(0x7f19ac115a10) = 20878 20878 set_robust_list(0x7f19ac115a20, 24) = 0 20878 rt_sigaction(SIGRTMIN, {sa_handler=0x7f19aa54dcb0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f19aa55a890}, NULL, 8) = 0 20878 rt_sigaction(SIGRT_1, {sa_handler=0x7f19aa54dd50, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f19aa55a890}, NULL, 8) = 0 20878 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 20878 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 20878 brk(NULL) = 0x563d8a664000 20878 brk(0x563d8a685000) = 0x563d8a685000 20878 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 20878 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) 20878 close(3) = 0 20878 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 20878 connect(3, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) 20878 close(3) = 0 20878 openat(AT_FDCWD, "/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=529, ...}) = 0 20878 read(3, "# /etc/nsswitch.conf\n#\n# Example"..., 4096) = 529 20878 read(3, "", 4096) = 0 20878 close(3) = 0 20878 stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=304, ...}) = 0 20878 openat(AT_FDCWD, "/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=92, ...}) = 0 20878 read(3, "# The \"order\" line is only used "..., 4096) = 92 20878 read(3, "", 4096) = 0 20878 close(3) = 0 20878 futex(0x7f19ab7b7ba4, FUTEX_WAKE_PRIVATE, 2147483647) = 0 20878 openat(AT_FDCWD, "/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=304, ...}) = 0 20878 read(3, "# Dynamic resolv.conf(5) file fo"..., 4096) = 304 20878 read(3, "", 4096) = 0 20878 close(3) = 0 20878 uname({sysname="Linux", nodename="zareason-limbo", ...}) = 0 20878 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=141841, ...}) = 0 20878 mmap(NULL, 141841, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f19ac0f0000 20878 close(3) = 0 20878 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) 20878 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3 20878 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P#\0\0\0\0\0\0"..., 832) = 832 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=47568, ...}) = 0 20878 mmap(NULL, 2168632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f19aa330000 20878 mprotect(0x7f19aa33b000, 2093056, PROT_NONE) = 0 20878 mmap(0x7f19aa53a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xa000) = 0x7f19aa53a000 20878 mmap(0x7f19aa53c000, 22328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f19aa53c000 20878 close(3) = 0 20878 mprotect(0x7f19aa53a000, 4096, PROT_READ) = 0 20878 munmap(0x7f19ac0f0000, 141841) = 0 20878 openat(AT_FDCWD, "/etc/hosts", O_RDONLY|O_CLOEXEC) = 3 20878 fstat(3, {st_mode=S_IFREG|0644, st_size=403, ...}) = 0 20878 read(3, "127.0.0.1\tlocalhost\n127.0.1.1\tza"..., 4096) = 403 20878 read(3, "", 4096) = 0 20878 close(3) = 0 20878 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_TCP) = 3 20878 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0 20878 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0 20878 connect(3, {sa_family=AF_INET, sin_port=htons(6013), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 20878 getpeername(3, {sa_family=AF_INET, sin_port=htons(6013), sin_addr=inet_addr("127.0.0.1")}, [124->16]) = 0 20878 uname({sysname="Linux", nodename="zareason-limbo", ...}) = 0 20878 access("/home/dstromberg/.Xauthority", R_OK) = 0 20878 openat(AT_FDCWD, "/home/dstromberg/.Xauthority", O_RDONLY) = 4 20878 fstat(4, {st_mode=S_IFREG|0600, st_size=827, ...}) = 0 20878 read(4, "\1\0\0\16zareason-limbo\0\0010\0\22MIT-MAGIC"..., 4096) = 827 20878 read(4, "", 4096) = 0 20878 close(4) = 0 20878 getsockname(3, {sa_family=AF_INET, sin_port=htons(37214), sin_addr=inet_addr("127.0.0.1")}, [124->16]) = 0 20878 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) 20878 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 20878 fcntl(3, F_SETFD, FD_CLOEXEC) = 0 20878 poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}]) 20878 writev(3, [{iov_base="l\0\v\0\0\0\22\0\20\0\0\0", iov_len=12}, {iov_base="", iov_len=0}, {iov_base="MIT-MAGIC-COOKIE-1", iov_len=18}, {iov_base="\0\0", iov_len=2}, {iov_base="\256b\245\317f\262\25\254\27\365!H\212\3316J", iov_len=16}, {iov_base="", iov_len=0}], 6) = 48 20878 recvfrom(3, 0x563d8a6660e0, 8, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable) 20878 poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN|POLLERR|POLLHUP}]) 20878 recvfrom(3, 0x563d8a6660e0, 8, 0, NULL, NULL) = -1 ECONNRESET (Connection reset by peer) 20878 shutdown(3, SHUT_RDWR) = -1 ENOTCONN (Transport endpoint is not connected) 20878 close(3) = 0 20878 write(2, "xset: unable to open display \"l"..., 47) = 47 20878 exit_group(1) = ? 20878 +++ exited with 1 +++ And here's a type -a xset: $ type -a xset below cmd output started 2019 Sun Jun 30 07:49:33 AM PDT xset is /usr/bin/xset Running without redirection, to show the order of the messages: $ xset q below cmd output started 2019 Sun Jun 30 08:03:24 AM PDT connect /tmp/.X11-unix/X1: No such file or directory xset: unable to open display "localhost:13.0" In response to a comment from melpomene, I set up a test account with no startup files at all. I then ssh -Y'd to it, sudo'd, and got the same error message as described above. I had been testing in gnome-terminal exclusively. I just tried konsole and again got the offending error message. I just tried strace'ing the openssh client; it produced a single occurrence of the string "connect", which did not look relevant (other than connecting to the ssh server). I had been testing exclusively on a Linux Mint 19.1 system. I just tried it on a freshly-installed Debian 9.9 system, and got the same result. Steps to replicate: ssh -Y remote.host.example.com sudo bash xset -q > /dev/null 2>&1 You may see the offending error message after these 3 simple steps.
This is pretty easy to understand and replicate, but there is a number of moving parts. We ssh to a remote machine with X forwarding. This ssh process must have access to a working X server locally. Here we'll start it up with a joke $DISPLAY: (local) $ DISPLAY=:87 ssh -Y remote Warning: No xauth data; using fake authentication data for X11 forwarding That Warning is an indication that ssh cannot contact a working X server locally. On remote $DISPLAY is not :87 (remote) $ echo $DISPLAY (remote) localhost:11.0 This is the magic that ssh's -Y does and how its X11 proxy works. We run a command on remote that tries to connect to $DISPLAY: (remote) $ xset -q connect /tmp/.X11-unix/X99: No such file or directory xset: unable to open display "localhost:11.0" And here is your problem: (remote) $ xset -q >/dev/null 2>&1 connect /tmp/.X11-unix/X99: No such file or directory The unable error message was being printed by xset, and has been redirected away. However the connect error message is coming out of ssh. Remember that xset runs on remote, while ssh is running on local. You need to validate $DISPLAY on local before running ssh. You can quieten ssh in a number of ways, but I'm not a fan of throwing away error messages. One way would be to reduce the error verbosity: (local) $ DISPLAY=:87 ssh -Y -o LogLevel=FATAL remote 'xset -q &>/dev/null' See man ssh_config for a list of ssh settings.
sort the numbers in multiple lines in vim
I have a file formatted as such: ... [ strNADPplus ] 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 11153 11154 11155 11156 11157 11158 11159 11160 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 12964 12965 12966 12967 12968 12969 12970 5360 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 13110 13111 13112 13113 13114 13115 13116 13117 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 13173 13174 13175 13176 13177 13178 13179 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 13557 13558 13559 13560 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 13683 13684 13685 13686 6021 6022 6023 6024 6025 6026 6027 6028 6029 13718 13719 13720 13721 13722 13723 6339 6340 6341 6342 6343 6344 6345 6346 6347 14044 14045 14046 14047 14048 14049 ... I want to sort the numbers in that block of lines to have something that looks like: 1 2 3 4 7 8 9 100 101 121 345 346 348 10232 16654 ... I first tried with :4707,4743%sort n (4707 and 4743 are the lines of that block), but I was only able to sort the first values of each line. I then tried to join the selection and sort the line: visual mode + J and :'<,'>sort n. But it doesn't sort correctly. 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 11153 11154 11155 11156 11157 11158 11159 11160 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 12964 12965 12966 12967 12968 12969 12970 5360 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 13110 13111 13112 13113 13114 13115 13116 13117 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 13173 13174 13175 13176 13177 13178 13179 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 13557 13558 13559 13560 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 13683 13684 13685 13686 6021 6022 6023 6024 6025 6026 6027 6028 6029 13718 13719 13720 13721 13722 13723 6339 6340 6341 6342 6343 6344 6345 6346 6347 14044 14045 14046 14047 14048 14049 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 7502 7503 7504 7505 7506 7507 7508 7509 15208 15209 15210 15211 15212 15213 15214 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 15377 15378 15379 15380 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 5254 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 5463 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 6334 6335 6336 6337 6338 14050 14051 14052 14053 14054 14055 14056 14057 7414 7415 7416 7417 7418 7419 7420 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 7498 7499 7500 7501 15215 15216 15217 15218 15219 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 How do I sort everything and keep that layout?
I would simply use standard external unix tools: :'<,'>!tr ' ' '\n' | sort -n | tr '\n' ' ' | fold -w 15 -s This wraps lines to 15 characters. :'<,'>!tr ' ' '\n' | sort -n | paste -d' ' - - - This wraps to 3 numbers per line.