Unable to activate swap

I'm using openwrt 19.07.1 on TP-Link TL-WR741N/ND v1 (tiny) , openwrt image and kernel are custom built to enable hardware mod for usb 1.1.
I added a usb thumb drive (very old 128Mb in size) as extroot and swap, everything works perfectly except swap.
blkid :

root@OpenWrt:~# blkid
/dev/mtdblock2: TYPE="squashfs"
/dev/sda1: UUID="73426687-b707-4d63-9fb7-7f6db772e644" TYPE="ext4" PARTUUID="2aa2f910-01"
/dev/sda2: UUID="130e5ebd-8be3-493c-8a26-6a06f79727c8" TYPE="swap" PARTUUID="2aa2f910-02"


root@OpenWrt:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 3072      3072         0 100% /rom
tmpfs                    13904      1056     12848   8% /tmp
/dev/sda1                84099      3190     74531   4% /overlay
overlayfs:/overlay       84099      3190     74531   4% /
tmpfs                      512         0       512   0% /dev


root@OpenWrt:~# cat /etc/config/fstab 
config 'global'
	option	anon_swap	'0'
	option	anon_mount	'0'
	option	auto_swap	'1'
	option	auto_mount	'1'
	option	delay_root	'5'
	option	check_fs	'0'

config 'mount'
	option	target	'/overlay'
	option	uuid	'73426687-b707-4d63-9fb7-7f6db772e644'
	option	enabled	'1'

config 'swap'
	option	uuid	'130e5ebd-8be3-493c-8a26-6a06f79727c8'
	option	enabled	'1'



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

swapfile :

root@OpenWrt:~# mkswap /swapfile
mkswap: /swapfile: insecure permissions 0644, 0600 suggested.
Setting up swapspace version 1, size = 32 MiB (33550336 bytes)
no label, UUID=de92abfa-dedf-4225-83e0-477329e20309
root@OpenWrt:~# swapon /swapfile
block: failed to swapon /swapfile (-1)

I tried mkswap /dev/sda2 before swap on , but same results.
any help is apreciated

Tiny builds do not include swapfile support to shrink the kernel size.

1 Like

thanks , any chance there's a way to enable it through menuconfig?

Yep, it should be in Global build settings -> Kernel build options -> [*] Support for paging of anonymous memory (swap)

Since you're doing hardware mods consider upgrading to a 64 MB RAM chip. This is simply change out the chip, no other hardware or software needs to be changed.

@jow thanks , I think I enabled that option through "make kernel_menuconfig" , I'll try to enable it through "make menuconfig"

@mk24 , I already tried to solder a 64MB chip instead of 32MB but that didn't work out :smiley:

It propbably got overridden by the menuconfig setting. Iirc kernel_menuconfig choices only work for configs which are not covered by the normal menuconfig

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.