_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
I use an OperWrt router that has 12MB of root disk storage. It makes me conscious of disk space on those occasions I log onto it; especially when handling packages using opkg
.
$ df -h /
Filesystem Size Used Available Use% Mounted on
overlayfs:/overlay 11.8M 10.2M 1.6M 86% /
# ¯\_(ツ)_/¯
Here are a few of commands I use to identify packages, and remove them together with orphaned dependencies. These work on OpenWrt 18.06.1.
List all explicitly installed native packages (i.e. present in the opkg
database) that are not dependencies [src]:
for i in $(opkg list-installed | sed "s/ - .*//"); do
if ! (grep -q "Package: ${i}" < /rom/usr/lib/opkg/status) && \
! (opkg whatdepends "${i}" | grep -q "depends on ${i}"); then
echo "${i}"
fi
done
As a one-liner:
$ for i in $(opkg list-installed | sed "s/ - .*//"); do if ! (grep -q "Package: ${i}" < /rom/usr/lib/opkg/status) && ! (opkg whatdepends "${i}" | grep -q "depends on ${i}"); then echo "${i}"; fi; done
block-mount
btrfs-progs
chattr
curl
ip-tiny
iperf3
kmod-fs-btrfs
kmod-usb-storage
lsattr
luci-app-aria2
luci-app-hd-idle
luci-app-sqm
luci-app-vnstat
luci-app-wireguard
nfs-kernel-server
openssh-sftp-server
rsync
Remove a target package including all of its dependencies, provided that they are not required by other packages:
$ opkg remove --force-removal-of-dependent-packages --autoremove rsync
Removing package rsync from root...
libpopt was autoinstalled and is now orphaned, removing.
Removing package libpopt from root...