I've got a Linux embedded system that I'm experimenting with (the Elektor Embedded Linux Made Easy board, based on the GNUBLIN http://en.gnublin.org/index.php/GNUBLIN-Elektor). I'm using the 3.3 kernel provided by them (http://en.gnublin.org/index.php/Kernel_compile_%2B_Module_installation), which I've configured and compiled myself. I built the root file system myself using buildroot.

I've been experimenting with swap on this board (it's only got 8MB RAM!) and I've got it working. However I can't seem to get the system to automatically mount and activate the swap via fstab. My swap is implemented as a dedicated partition on the microSD card (mmcblk0p4). Here is my fstab:

# /etc/fstab: static file system information.
# <file system> <mount pt>     <type>   <options>         <dump> <pass>
/dev/root       /              ext4     rw,noauto         0      1
/dev/mmcblk0p1  /media/mmc_1   ext2     defaults          0      0
/dev/mmcblk0p4  none           swap     auto              0      0
proc            /proc          proc     defaults          0      0
devpts          /dev/pts       devpts   defaults,gid=5,mode=620   0      0
tmpfs           /dev/shm       tmpfs    mode=0777         0      0
tmpfs           /tmp           tmpfs    mode=1777         0      0
sysfs           /sys           sysfs    defaults          0      0

swap works, because if I enter swapon -a in the command line, it becomes activated, as reported by free. But it just won't activate automatically on boot.

My other entries in fstab work fine - for example, /dev/mmcblk0p1 is auto mounted correctly on boot.

I've pasted the output of the boot process here: http://pastebin.com/0qQ4RAd8

Any thoughts?

  • Where does your buildroots init system run swapon? – Matt Jul 22 '14 at 10:44
  • @mtm I don't know. When I built the buildroot system I didn't notice any settings regarding swap. I assumed that if support was built into the kernel, whatever program parses the fstab file would be responsible for turning on swap if a relevant entry existed. – Amr Bekhit Jul 22 '14 at 11:04
  • 1
    I was just thinking it might not be default in an embedded environment? A grep -r swap might point you towards what is doing the work or other configuration. Sorry haven't used buildroot but if you figure out the 'what', the 'why' usually follows. – Matt Jul 22 '14 at 11:10
  • It's up to the init scripts. Init scripts for desktop/server systems look up swap entries from fstab and bring them up fairly early in the boot process, but many embedded distributions don't, because swap on embedded systems is rare. – Gilles 'SO- stop being evil' Jul 22 '14 at 22:50

Exchange auto with sw in the fstab line. This tells the system to activate it using swapon after booting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.