Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3646 - Unable to Swap /proc/swaps does not exist (ramips rt305x/) #8682

Closed
openwrt-bot opened this issue Feb 27, 2021 · 5 comments
Closed
Labels
flyspray kernel pull request/issue with Linux kernel related changes release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release

Comments

@openwrt-bot
Copy link

xapukserge:

Device Dlink DIR320 rev.B1
OpenWrt 19.07.7 r11306-c4a6851c72 / LuCI openwrt-19.07 branch git-21.044.30835-34e0d65

Istalled packages:
block-mount
kmod-usb-core
kmod-usb2
kmod-usb-ohci
kmod-usb-storage
kmod-fs-ext4
zram-swap
swap-utils

How-to:
root@OpenWrt:~# mkswap /dev/sda1
mkswap: /dev/sda1: warning: wiping old swap signature.
Setting up swapspace version 1, size = 511 MiB (535818240 bytes)
no label, UUID=5413e04d-954e-493c-b26d-926a67af1bbc

root@OpenWrt:~# swapon -a
block: failed to swapon /dev/sda1

root@OpenWrt:~# cat /proc/swaps
cat: can't open '/proc/swaps': No such file or directory

So, I think, swap module was accidentally turned off during building firmware, because OpenWRT build version 18.06 works fine!

@openwrt-bot
Copy link
Author

odmdas:

Hi, xapukserge.

A quick search showed that the swap option is enabled for all targets except those marked as small_flash [0].

config KERNEL_SWAP
bool "Support for paging of anonymous memory (swap)"
default y if !SMALL_FLASH

rt305x is marked as small_flash [1].

FEATURES+=usb ramdisk small_flash

small_flash feature flag was introduced in commit cf7154d.

You can try building a modified OpenWrt with the swap option forcibly enabled and see if there is any worth. Especially on the upcoming 21.02 release with the 5.4 kernel. Post your results.
I use a similar device, ZyXEL Keenetic, without LuCI, and there are some free megabytes of RAM.
What is your use case in which swap is needed?

[0] https://github.com/openwrt/openwrt/blob/v19.07.6/config/Config-kernel.in

[1] https://github.com/openwrt/openwrt/blob/v19.07.6/target/linux/ramips/rt305x/target.mk

@aparcar aparcar added release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release kernel pull request/issue with Linux kernel related changes labels Feb 22, 2022
@981213
Copy link
Member

981213 commented Mar 7, 2022

Swap support is disabled for small_flash targets to save space. This isn't really a bug.

@981213 981213 closed this as completed Mar 7, 2022
@KOLANICH
Copy link

KOLANICH commented Feb 1, 2023

I wonder if swap support can be provided as separate packages. Because now I have 3 MiB of free space on flash (Keenetic and Keenetic Lite b, 8 MiB flash size), but I'm short on RAM (32 MiB).

Also I'm thinking about replacing flash and RAM chips, but rebuilding the kernel takes long and is a memory-hungry process, so it may be cheaper to throw the routers into garbage and buy new ones, instead of building an own kernel for every release.

@981213
Copy link
Member

981213 commented Feb 1, 2023

Unfortunately mtd devices can't be used as swap. You need block devices such as a USB flash drive for swap to work.

so it may be cheaper to throw the routers into garbage and buy new ones, instead of building an own kernel for every release.

Agree :)

@KOLANICH
Copy link

KOLANICH commented Feb 1, 2023

Unfortunately mtd devices can't be used as swap. You need block devices such as a USB flash drive for swap to work.

  1. I tried to use zram.
  2. Just Keenetic (the first gen white one) has a USB port. On stock NDMSv1 firmware it used to be hosting transmission + web interface + fully working access point functionality with wps + upnp port forwarding + samba server + dyndns client + ntfs-3g even without a swap (all of these are stock firmware features), and adding swap (the support was present, one just needed a swapon command in the shell script on the medium that was run automatically on medium attachment) allowed also to host minidlna (I don't remember by now if I had to disable torrent when watching) and stream 1080p video to home cinema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray kernel pull request/issue with Linux kernel related changes release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release
Projects
None yet
Development

No branches or pull requests

4 participants