Snapshot is read-only? Can't upgrade base-files package

Hey gang,

Basic question (coming from someone who is used to building and configuring OWRT using the ext4fs on x86 hardware):

How do I add/remove packages with a squash-fs image?

I just flashed an OWRT Snapshot build to a router device, using a squashfs image. It worked, but when I try to do any opkg management via LUCI I'm prompted with a bunch of "read-only" filesystem errors. I can't remove or add new packages.

The funny thing is that changes I make to core OWRT settings seem to stick just fine after a reboot (e.g. network config, system settings)

Thanks in advance! :slight_smile:

Squashfs is always read only (and it is a compressed format).

I you want to add or remove packages from the squashfs image itself, you'll use imagebuilder to specify what you want included/excluded in the image.

You can always install packages after the fact via the opkg package manager -- these get stored in your overlay (which is a r/w partition). You can sort-of 'remove' packages, but it doesn't actually remove it from the rom (image), but it will 'mark' it as removed so the system ignores it.

1 Like

Thanks for the fast reply.

I get that squashfs is read-only, but I thought somehow that the "overlay" was capable of addressing all remaining storage space on the device (or else, what's the point of have all that space? Anything above and beyond the ROM image size would be wasted, right?)

If it helps, I am using the Software section in LUCI (but I get the same error using opkg cmd). It's complaining that my fs is read-only... but then I'm confused as to how we're supposed to do package maintenance after we've flashed our initial image.

I guess a follow-up question I have about the overlay: if I install an opkg (after the initial image has been flashed to the device) will it be lost upon reboot? I'm guessing (hoping?) that the ROM partition itself is squashfs but then additional packages (and other sorts of read/write action related to the ROM) are stored in another partition (ext4fs?) that's preserved after reboot?

Thanks again.

Specifically, I'm getting this error when trying to upgrade the base-files pkg in LUCI:

umount: devpts busy - remounted read-only
umount: tmpfs busy - remounted read-only
umount: can't remount tmpfs read-only
umount: proc busy - remounted read-only
Collected errors:
 * copy_file: unable to open `/etc/group-opkg.backup': Read-only file system.
 * file_copy: Failed to copy file /etc/group to /etc/group-opkg.backup.
 * backup_make_backup: Failed to copy /etc/group to /etc/group-opkg.backup
 * opkg_install_cmd: Cannot install package base-files.
 * pkg_write_filelist: Failed to open //usr/lib/opkg/info/base-files.list: Read-only file system.

The opkg install command failed with code 255.

What is the output of:

ubus call system board
mount
df -h

Which package are you trying to install?

Base files is a core package, it cannot be removed or installed.

1 Like

Also, I meant to include this information...

Upgrading packages (via the CLI opkg upgrade command or the LuCI Upgrade... button) can result in major problems. It is generally highly discouraged, unless you know what you are doing or if there is specific instruction to do so.

Installing new packages is okay, and upgrading targeted packages (when required for a feature addition, bug fix, or security patch) is also okay. But don't upgrade packages unless there is a specific reason to do so.

2 Likes

Thanks @psherman and @jdwl1o1 ,

I came here to say I narrowed it down to the base-files package itself.
I was able to add/remove (as much as one can "remove" with an overlay) just fine when it came to every other package. I realize now that the one package I started with (base-files) didn't behave like all the rest... which makes sense, considering the way that squashfs and the overlay work.

Base files is a core package, it cannot be removed or installed.

Agreed. I guess it just threw me off when I saw it available as an Upgradable package. That simply didn't work (for me, at least) whereas the other packages did.

Thanks again!

If you're still curious:

root@xxxxx:~# ubus call system board
{
	"kernel": "5.15.98",
	"hostname": "xxxxx",
	"system": "ARMv7 Processor rev 0 (v7l)",
	"model": "TP-Link OnHub",
	"board_name": "tplink,onhub",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "SNAPSHOT",
		"revision": "r22256-14334c222e",
		"target": "ipq806x/chromium",
		"description": "OpenWrt SNAPSHOT r22256-14334c222e"
	}
}

mount:

/dev/root on /rom type squashfs (ro,relatime,errors=continue)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mmcblk0p3 on /overlay type f2fs (rw,lazytime,noatime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,checkpoint_merge,fsync_mode=posix,discard_unit=block)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,noexec,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
bpffs on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,noatime,mode=700)
pstore on /sys/fs/pstore type pstore (rw,noatime)

df:


Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.3M      4.3M         0 100% /rom
tmpfs                   484.7M     64.0K    484.6M   0% /tmp
/dev/mmcblk0p3            3.5G    288.1M      3.2G   8% /overlay
overlayfs:/overlay        3.5G    288.1M      3.2G   8% /
tmpfs                   512.0K         0    512.0K   0% /dev