extract-ikconfig có chạy được trên AlpineLinux xài Busybox không?

extract-ikconfig là shell script dùng để chiết ra file config nằm bên trong Linux kernel là vmlinuz.

Alpine Linux là bản Linux hiếm hoi xài Busybox để cho dung lượng thật sự mi nhon.

Mặc dù Alpine Linux không có biên dịch chức năng CONFIG_IKCONFIG=y nhưng bạn thử chạy extract-ikconfig sẽ thấy lỗi sau

./extract-ikconfig /boot/vmlinuz-lts | grep unrecognized
grep: unrecognized option: b
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.

Usage: grep [-HhnlLoqvsrRiwFE] [-m N] [-A|B|C N] { PATTERN | -e PATTERN... | -f FILE... } [FILE]...

Search for PATTERN in FILEs (or stdin)

        -H      Add 'filename:' prefix
        -h      Do not add 'filename:' prefix
        -n      Add 'line_no:' prefix
        -l      Show only names of files that match
        -L      Show only names of files that don't match
        -c      Show only count of matching lines
        -o      Show only the matching part of line
        -q      Quiet. Return 0 if PATTERN is found, 1 otherwise
        -v      Select non-matching lines
        -s      Suppress open and read errors
        -r      Recurse
        -R      Recurse and dereference symlinks
        -i      Ignore case
        -w      Match whole words only
        -x      Match whole lines only
        -F      PATTERN is a literal (not regexp)
        -E      PATTERN is an extended regexp
        -m N    Match up to N times per file
        -A N    Print N lines of trailing context
        -B N    Print N lines of leading context
        -C N    Same as '-A N -B N'
        -e PTRN Pattern to match
        -f FILE Read pattern from file

Điều kì lạ là lỗi grep: unrecognized option: b lặp lại 8 lần do trong shell script extract-ikconfig xài grep 8 lần.

alpine319:~# ./extract-ikconfig /boot/vmlinuz-lts 2> output.txt
alpine319:~#
alpine319:~# grep unrecognized output.txt
grep: unrecognized option: b
grep: unrecognized option: b
grep: unrecognized option: b
grep: unrecognized option: b
grep: unrecognized option: b
grep: unrecognized option: b
grep: unrecognized option: b
grep: unrecognized option: b

Lí do là lệnh grep trong Busybox của Alpine Linux đã bỏ đi tùy chọn -b do họ thấy không cần thiết.