[SOLVED] OpenWrt cannot find lsblk sometimes

I've been experimenting on many repeated installs of OpenWrt and there is this peculiar situation that I keep stumbling upon. Many times, I was trying to call 'lsblk' from either the terminal on Pi4 or via SSH. In some new installation sometime 'lsblk' will be present and run OK, other times I will simply get an error message:

lsblk: not found

Is there an operation that I can perform to install the package that include 'lsblk' ?
Why is it present only sometimes ?

lsblk is not a default package on any platform that I'm aware, so you need to install it on any fresh install:

$ opkg update

$ opkg -A info lsblk
Package: lsblk
Version: 2.39-2
Depends: libc, libblkid1, libmount1, libsmartcols1
Status: unknown ok not-installed
Section: utils
Architecture: mips_24kc
Size: 63444
Filename: lsblk_2.39-2_mips_24kc.ipk
Description: lsblk lists information about all or the specified block devices

$ opkg install lsblk
...
2 Likes

opkg install lsblk
will return an error:

unknown package: lsblk
opkg_install_cmd: Cannot install package lsblk.

As for: $ opkg -A info lsblk
there is absolutely nothing other than a linefeed coming out.
???

Ok, something is not working so we need to debug. Post the output from below.

ubus call system board
cat /etc/opkg/distfeeds.conf

root@OpenWrt:~# cat /etc/opkg/distfeeds.conf
src/gz openwrt_core https://downloads.openwrt.org/releases/23.05.2/targets/bcm27xx/bcm2711/packages
src/gz openwrt_base https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_cortex-a72/base
src/gz openwrt_luci https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_cortex-a72/luci
src/gz openwrt_packages https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_cortex-a72/packages
src/gz openwrt_routing https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_cortex-a72/routing
src/gz openwrt_telephony https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_cortex-a72/telephony
root@OpenWrt:~#

Above is the output I got from the SSH Terminal on OpenWrt.
I'm running OpenWrt on a Pi4 2Gb and a 16Gb sdcard.
Fresh installed with minor mods to extend the full access of the sdcard. took instructions from a video on YT.
thanks for your help.

The feeds file looks fine, did the opkg update produce the expected output? Something like this:

$ opkg update
Downloading https://downloads.openwrt.org/releases/23.05.2/targets/x86/64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/23.05.2/targets/x86/64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/23.05.2/packages/x86_64/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://downloads.openwrt.org/releases/23.05.2/packages/x86_64/base/Packages.sig
Signature check passed.
... a dozen more lines like above ...

Yes, all download signatures check passed

Well, that's very strange. The package is on the download server in the right place, try this:

wget https://downloads.openwrt.org/releases/23.05.2/packages/aarch64_cortex-a72/base/lsblk_2.39-2_aarch64_cortex-a72.ipk

opkg install lsblk_2.39-2_aarch64_cortex-a72.ipk
1 Like

OK. Now 'lsblk' is functional.
opkg -A info lsblk return positive
opkg install lsblk Package lsblk (2.39-2) installed in root is up to date.

Do we know why I'm getting this weird behaviour ?
Should I systematically add to my installation procedure these two last command lines ?

Thanks, things seems back on track . Cheers

I really have no clue what the issue is, we simply reproduced what opkg does when you do a normal install using a package name... I selected that directory right out of your opkg feeds, found the package starting with lsblk and grabbed the link to it.

The usual suspects are

  1. DNS not working, which causes opkg update to fail with "error 4" or something like that (plus that wget from openwrt.org won't work without DNS, either);
  2. The package build is failing and the package does not exist on the download server, but that's very rare for a release build and 23.05.2 is very stable at this point.

Neither of these appear to be the case here.

Oh well... At least , now that I understand your approach, I'll be wiser next time it happens.

thanks again.

Oh, just had a thought! This is very unlikely, but maybe the package database is corrupted. Do these steps and see if it works:

Remove the package lists (the rm).
Restore the package lists (the update).
See if some package you don't have is available (the info).
Try to install it, I picked lscpu, but anything you like is fine.

$ rm /tmp/opkg-lists/*
$ opkg update
$ opkg -A info lscpu
$ opkg install lscpu

Some 12 files in that folder. Deleted them all and opkg update.
Then they all came back.
opkg -A info lscpu worked fine before and after update
opkg install lscpu worked fine also.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.