Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:additional-software:opkg [2021/08/18 18:52] – [Proxy support] vgaetera | docs:guide-user:additional-software:opkg [2023/04/03 00:34] – [Local repository] update vgaetera | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| The '' | The '' | ||
| - | Opkg is a fork of '' | + | Opkg is a fork of '' |
| Opkg is a full package manager for the root file system, including kernel modules and drivers, while ipkg is just a way to add software to a separate directory (e.g. ''/ | Opkg is a full package manager for the root file system, including kernel modules and drivers, while ipkg is just a way to add software to a separate directory (e.g. ''/ | ||
| - | Opkg is sometimes called // | + | Opkg is sometimes called // |
| The package manager '' | The package manager '' | ||
| Line 133: | Line 133: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| + | ==== Basics ==== | ||
| <code bash> | <code bash> | ||
| # Install a package | # Install a package | ||
| Line 145: | Line 146: | ||
| </ | </ | ||
| + | ==== Extras ==== | ||
| You can make use of [[wp> | You can make use of [[wp> | ||
| Use a [[wp> | Use a [[wp> | ||
| Line 151: | Line 153: | ||
| opkg list | grep -e < | opkg list | grep -e < | ||
| opkg list | awk -e '/< | opkg list | awk -e '/< | ||
| - | opkg info kmod-ipt-* | awk -e '/ | + | opkg info kmod-nf-\* | awk -e '/ |
| opkg list-installed | awk -e ' | opkg list-installed | awk -e ' | ||
| for pkg in < | for pkg in < | ||
| Line 157: | Line 159: | ||
| </ | </ | ||
| - | :!: Mass upgrade of all packages is [[meta: | + | ==== Upgrading packages ==== |
| - | If you still want to proceed, set up [[docs: | + | <WRAP important> |
| + | Mass upgrade of all packages is [[meta: | ||
| + | The chance of soft-bricking your device is significant, so be fully prepared to perform a [[docs: | ||
| + | Proceed at your own risk. | ||
| + | </ | ||
| <code bash> | <code bash> | ||
| Line 255: | Line 261: | ||
| <code bash> | <code bash> | ||
| - | # Runtime configuration | + | # Configure profile |
| + | mkdir -p / | ||
| + | cat << " | ||
| export https_proxy=http:// | export https_proxy=http:// | ||
| + | EOF | ||
| + | . / | ||
| - | # Persistent workaround | + | # Workaround |
| sed -i -e " | sed -i -e " | ||
| </ | </ | ||
| Line 293: | Line 303: | ||
| ===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
| - | ==== Out of space ==== | + | ==== Verbose opkg update |
| - | If // | + | <code bash> |
| - | The lock file can be deleted by issuing the '' | + | # Save the script |
| + | cat << " | ||
| + | #!/bin/sh | ||
| + | rm -f -R /tmp/opkg-lists | ||
| + | mkdir -p /tmp/opkg-lists | ||
| + | while read TYPE REPO URL | ||
| + | do | ||
| + | wget -O /tmp/opkg-lists/" | ||
| + | wget -O /tmp/opkg-lists/" | ||
| + | gunzip -k /tmp/opkg-lists/" | ||
| + | usign -V -P / | ||
| + | | grep -e " | ||
| + | && mv -f / | ||
| + | done < / | ||
| + | EOF | ||
| + | chmod +x opkg-update.sh | ||
| - | Additionally, | + | # Run the script |
| - | + | ./opkg-update.sh | |
| - | One way to do this is get a list of the files it was installing, then delete them. | + | |
| - | + | ||
| - | Replace the url with the appropriate package. | + | |
| - | + | ||
| - | <code bash> | + | |
| - | (cd /; \ | + | |
| - | wget -q -O - http:// | + | |
| - | | tar -Oxz ./ | + | |
| </ | </ | ||
| - | However, the above line does not delete the dependencies | + | ==== Out of space ==== |
| - | Also, it leaves empty directories around. | + | Remove partly installed packages and their dependencies |
| - | The script below intends to fix those. | + | |
| <code bash> | <code bash> | ||
| # Save the script | # Save the script | ||
| - | cat << " | + | cat << " |
| #!/bin/sh | #!/bin/sh | ||
| - | # takes one argument/ | ||
| - | # correctly and should be removed along with its dependencies | ||
| - | # example: ./ | ||
| - | |||
| - | # get list of all packages that would be installed along with package x | ||
| - | PKGS=" | ||
| - | | grep -e " | ||
| - | | cut -f 2 -d " " \ | ||
| - | | sed -e " | ||
| opkg update | opkg update | ||
| - | + | URL=" | |
| - | for PKG in ${PKGS} | + | | sed -n -e "/ |
| - | do | + | rm -f / |
| - | LIST=" | + | for URL in ${URL} |
| - | | tar -Oxz ./ | + | do FILE=" |
| - | | tar -t -z \ | + | | tar -O -x -z ./ |
| - | | sort -r \ | + | | tar -t -z \ |
| - | | sed -e "s/^./\/overlay\/upper/" | + | | sort -r \ |
| - | for FILE in ${LIST} | + | | sed -e "s|^\.|/ |
| - | do | + | for FILE in ${FILE} |
| - | | + | do if [ -f " |
| - | then | + | then rm -f " |
| - | echo " | + | elif [ -d " |
| - | | + | then rmdir " |
| - | elif [ -d " | + | fi |
| - | then | + | done |
| - | echo " | + | |
| - | | + | |
| - | fi | + | |
| - | done | + | |
| done | done | ||
| - | echo "You may need to reboot for the free space to become visible" | ||
| EOF | EOF | ||
| - | chmod +x ./opkgremovepartlyinstalledpackage.sh | + | chmod +x opkg-rm-pkg-deps.sh |
| + | </code> | ||
| + | |||
| + | <code bash> | ||
| # Run the script | # Run the script | ||
| - | ./opkgremovepartlyinstalledpackage.sh < | + | ./opkg-rm-pkg-deps.sh package_name |
| + | |||
| + | # Reboot to make the free space visible | ||
| + | reboot | ||
| </ | </ | ||
| ==== Local repository ==== | ==== Local repository ==== | ||
| - | There may be use cases where having a package repository on the device itself is advantageous. Such cases may include: | + | There may be use cases where having a package repository on the device itself is advantageous: |
| - | * Unreliable WANs, where the connectivity upstream of the device to a remote repository goes down for an unacceptable period of time | + | * Unreliable WANs, where the connectivity upstream of the device to a remote repository goes down for an unacceptable period of time. |
| - | * Bandwidth Caps, where the connectivity upstream of the device to a remote repository has a limited amount of data that can be fetched before the connectivity is throttled or goes down until the next period where the cap resets | + | * Bandwidth Caps, where the connectivity upstream of the device to a remote repository has a limited amount of data that can be fetched before the connectivity is throttled or goes down until the next period where the cap resets. |
| - | * A repository with customization; | + | * A repository with customization; |
| - | * The device acts as a reference device for other systems, to ensure that the package versions across the devices local to the network remain consistent | + | * The device acts as a reference device for other systems, to ensure that the package versions across the devices local to the network remain consistent. |
| - | + | Set up a local repository for your target. | |
| - | FIXME Convert this into LEDE and explain what it is actually doing. | + | Assuming about 2-3 GB of free space is available. |
| - | + | ||
| - | An example | + | |
| <code bash> | <code bash> | ||
| - | r=44685 | + | # Install packages |
| - | search=" | + | opkg update |
| - | replace=" | + | opkg install rsync |
| - | sed -i -e " | + | |
| - | </ | + | |
| - | To share the repository with other devices | + | # Save the script |
| + | cat << " | ||
| + | #!/bin/sh | ||
| + | . / | ||
| + | REPO_LOCAL=" | ||
| + | REPO_URL=" | ||
| + | case " | ||
| + | (snapshot) REPO_DIR=" | ||
| + | (*) REPO_DIR=" | ||
| + | esac | ||
| + | REPO_CORE=" | ||
| + | REPO_PKGS=" | ||
| + | for REPO_DIR in " | ||
| + | do mkdir -p " | ||
| + | rsync --bwlimit=" | ||
| + | " | ||
| + | " | ||
| + | done | ||
| + | EOF | ||
| + | chmod +x opkg-sync-local-repo.sh | ||
| - | <code bash> | + | # Run the script |
| - | ln -s / | + | ./opkg-sync-local-repo.sh |
| - | </code> | + | |
| - | On the second device, perform a similar search and replace using sed, but instead point to the first device' | + | # Configure Opkg to use local repo |
| + | . / | ||
| + | REPO_LOCAL=" | ||
| + | REPO_URL=" | ||
| + | sed -i -e " | ||
| - | <code bash> | + | # Share the repository on the LAN |
| - | r=44685 | + | ln -f -s ${REPO_LOCAL# |
| - | search=" | + | |
| - | replace=" | + | # Configure Opkg on the clients |
| - | sed -i -e "s!$search!$replace!" / | + | . / |
| + | REPO_LOCAL="http://192.168.1.1/ | ||
| + | REPO_URL=" | ||
| + | sed -i -e "s|${REPO_URL}|${REPO_LOCAL}|" /etc/opkg/distfeeds.conf | ||
| </ | </ | ||
| + | |||
| + | See also: [[: | ||
| ===== Non-standard installation destinations ===== | ===== Non-standard installation destinations ===== | ||
| Line 401: | Line 432: | ||
| </ | </ | ||
| - | The default opkg.conf actually contains three destinations: | + | The default |
| <code bash> | <code bash> | ||