Skip to content

opkg program does not allow changing lockfile location; cannot run if /opt is readonly #716

@jtmoon79

Description

@jtmoon79

Problem

An embedded Linux device with a readonly mount of path /opt means opkg fails Could not create lock file /opt/tmp/opkg.lock. The opkg installer should allow a different lockfile location, .e.g. --lock path/opkg.lock

Reproduction

Given any system with readonly /opt path.

  1. cd /tmp
  2. Download the opkg file.
  3. Download the opkg.conf file.
  4. Change opkg.conf file from
src/gz entware http://bin.entware.net/armv7sf-k3.2
dest root /
dest ram /opt/tmp
lists_dir ext /opt/var/opkg-lists
option tmp_dir /opt/tmp
arch all 100
arch armv7-3.2 160

to a writeable location (any writable path will do; just prepend /tmp)

src/gz entware http://bin.entware.net/armv7sf-k3.2
dest root /
dest ram /tmp/opt/tmp
lists_dir ext /tmp/opt/var/opkg-lists
option tmp_dir /tmp/opt/tmp
arch all 100
arch armv7-3.2 160
  1. run opkg
$ /tmp/opkg --conf /tmp/opkg.conf -V3 -d /tmp/ -t /tmp/ update
opkg_conf_parse_file: Loading conf file /tmp/opkg.conf.
opkg_conf_parse_file: Supported arch all priority (100)
opkg_conf_parse_file: Supported arch armv7-3.2 priority (160)
Collected errors:
 * opkg_conf_set_option: Duplicate option tmp_dir, using first seen value "/tmp/".
 * opkg_conf_load: Could not create lock file /opt/tmp/opkg.lock: No such file or directory.

The culprit message is Could not create lock file /opt/tmp/opkg.lock: No such file or directory.
On my system, the path /opt is readonly (because the mount root / is readonly). The / is of type squashfs and so cannot be remounted as read-write (mount -o remount,rw / has no affect).

Solution

The opkg should have an option to specify the lockfile path.

$ /tmp/opkg --lock /tmp/opkg.lock

The opkg.conf should also allow specifying the lockfile path.

Environment

  • Entware feed: armv7sf-k3.2
  • Firmware version DDWRT latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions