NSLU2-Linux
view · edit · print · history

The current installer for NSLU2 available via http://www.slug-firmware.net (debian-etch-rc1-20061102.zip and debian-4.0r2.zip) seems to repeatedly close SSH during installation, causing the install to restart.

The simplest cause of this is the configuration of the ssh client used to connect to the NSLU2 (slug) in question. See Debian bug 458154 for details and discussion. In summary, you may be able to get away with adding the following to your ~/.ssh/config:

ServerAliveInterval 3

Otherwise this may be a symptom of the NSLU2 running out of available memory. When a process grows too much, the OOM (Out Of Memory) killer of the kernel kills it, and its parents. The OOM killer is controlled with /proc/sys/vm/overcommit_memory and /proc/sys/vm/overcommit_ratio. A given process can be made immune to the OOM killer with echo OOM_DISABLE > /proc/<pid>/oom_adj. Although it is interesting to know about the OOM killer, there is no report that tweaking it solves the problem.

A solution to this is to:

  1. run the installer up to the point where it will create partitions for you.
  2. log into the box via a second terminal, and choose the second option, a command shell.
  3. use fdisk to partition the disk you intend to use, including at least 128 MB of swap space.
  4. use mkswap /dev/<swap partition> and then swapon /dev/<swap partition> to activate that swap space.
  5. use mke2fs -j /dev/<root partition> to format your root partition.
  6. logout, and go back to the SSH session still connected to the installer.
  7. Tell it to use the swap space as swap, it will need to format the swap space as swap, and there is not way to prevent this formatting (that I can tell).
  8. Tell it to mount the root partition as / and in the same screen select Do not format / keep existing data. Do not let it do any extra work. it will mount these, unmount swap, remount swap, and let you proceed through the installation.

Resizing the SSH terminal screen will also cause a disconnect; don't do that. Attempting to format very large partitions also creates this problem, but the workaround does not help. Try to make the primary partition smaller. This will allow the installer to run in the normal fashion.

Note by Chris S: I got it to work on a 500GB partition by using "modprobe -r" to unload the fat and vfat drivers (lsmod to view the modules loaded). They're a waste of memory if you aren't installing to a FAT partition. Also use "modprobe -r" to unload the ixp4xx_beeper driver to save a little more RAM. Then hit <Go Back> on the partitioner to have it close the partitioner and return to the installer menu (this also saves memory). All told, I had over 11MB of free ram when I entered the mke2fs command. FYI, when creating the partitions DO NOT USE sector 0. Fdisk will let you use it, but when you reboot your drive will be useless until you are able to recover the boot sector. -- reply J.S: only had about 9.8mb free ram on trying this - still crashes. linux pc formatting using mke2fs isnt detected by the slug :(

So it seems that it is the formatting of the root / primary partition that causes the memory crash, rather than the formatting of the swap space.

An alternate solution is to:

  1. Use your desktop Linux computer to partition and format the disk prior to installation

Note by Loic Dachary: the instructions suggesting to add swap prior to running mke2fs on a large partition succeeded on one NSLU2 and always fails on another one. I'm stuck with it:

~ # cat /proc/swaps
Filename                                Type            Size    Used    Priority
~ # mkswap /dev/sda1
Setting up swapspace version 1, size = 515682304 bytes
~ # swapon /dev/sda1
~ # mke2fs -j /dev/sda2
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
921120 inodes, 1839516 blocks
91975 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1887436800
57 block groups
32768 blocks per group, 32768 fragments per group
16160 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: Connection to 192.168.1.130 closed by remote host.
Connection to 192.168.1.130 closed.
(reconnect)
~ # cat /proc/meminfo
MemTotal:        29988 kB
MemFree:          9676 kB
Buffers:             0 kB
Cached:          10956 kB
SwapCached:       2528 kB
Active:           9020 kB
Inactive:         6380 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        29988 kB
LowFree:          9676 kB
SwapTotal:      503592 kB
SwapFree:       501064 kB
Dirty:               0 kB
Writeback:           0 kB
AnonPages:        2096 kB
Mapped:           2300 kB
Slab:             2448 kB
PageTables:        276 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:    518584 kB
Committed_AS:     8392 kB
VmallocTotal:   991232 kB
VmallocUsed:     17084 kB
VmallocChunk:   966652 kB
~ # cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/scsi/host0/bus0/target0/lun0/part1 partition       503592  2528    -1
~ # cat /proc/sys/vm/overcommit_memory
0
~ # cat /proc/sys/vm/overcommit_ratio
50
~ # dmesg 
Adding 503608k swap on /dev/sda2.  Priority:-2 extents:1 across:503608k
oom-killer: gfp_mask=0x200d0, order=0
Mem-info:
DMA per-cpu:
cpu 0 hot: high 6, batch 1 used:0
cpu 0 cold: high 2, batch 1 used:1
DMA32 per-cpu: empty
Normal per-cpu: empty
HighMem per-cpu: empty
Free pages:        1076kB (0kB HighMem)
Active:1876 inactive:4012 dirty:3 writeback:3138 unstable:0 free:269 slab:725 mapped:63 pagetables:69
DMA free:1076kB min:724kB low:904kB high:1084kB active:7504kB inactive:16048kB present:32768kB pages_scanned:1376 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
DMA32 free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
DMA: 25*4kB 2*8kB 2*16kB 1*32kB 4*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB = 1076kB
DMA32: empty
Normal: empty
HighMem: empty
Swap cache: add 2193, delete 2171, find 546/561, race 0+0
Free swap  = 499188kB
Total swap = 503608kB
Free swap:       499188kB
8192 pages of RAM
376 free pages
712 reserved pages
725 slab pages
3192 pages shared
22 pages swap cached
Out of Memory: Kill process 2176 (sshd) score 74 and children.
Out of memory: Killed process 6189 (sshd).
view · edit · print · history · Last edited by tk.
Based on work by Del Merritt, Loic Dachary, Christopher Salinardi, Chris Salinardi, Milam, fcarolo, jabdebianorg, ptan, and Nick Solonar.
Originally by Dean Jackson.
Page last modified on August 17, 2008, at 10:27 AM