{"id":228,"date":"2007-02-08T10:07:33","date_gmt":"2007-02-08T08:07:33","guid":{"rendered":"http:\/\/www.lucas-nussbaum.net\/blog\/?p=228"},"modified":"2007-02-08T10:11:16","modified_gmt":"2007-02-08T08:11:16","slug":"running-debian-on-your-linksys-wrt54g-sort-of","status":"publish","type":"post","link":"https:\/\/www.lucas-nussbaum.net\/blog\/?p=228","title":{"rendered":"Running Debian on your Linksys WRT54G* &#8230; sort of"},"content":{"rendered":"<p>I&#8217;m the happy owner of a Linksys WRT54GL. <a href=\"http:\/\/www.openwrt.org\/\">OpenWRT<\/a> is nice, but &#8230; well. Debian is just nicer. And I couldn&#8217;t resist the idea of running Debian on this little MIPS system. Since there&#8217;s clearly not enough space available on the Linksys, I decided to install etch in a chroot, that I would mount using NFS.<\/p>\n<p><a href=\"http:\/\/kitenet.net\/~joey\/blog\/entry\/debian_on_the_linksys_wrt54gs.html\">Joey tried that already<\/a>, the Debian wiki provides <a href=\"http:\/\/wiki.debian.org\/DebianWRT\">some information<\/a>, but I use another technique.  <\/p>\n<p>First, on another system (an i386, I debootstrap&#8217;ed a mipsel etch, using <tt>--foreign<\/tt>. This tells debootstrap not to run the <i>second stage<\/i>:<br \/>\n<tt>debootstrap --arch mipsel --foreign etch \/space\/debian-mipsel http:\/\/ftp.fr.debian.org\/debian<\/tt><\/p>\n<p>Then, I modified <tt>\/etc\/exports<\/tt> to allow the router to mount that chroot:<br \/>\n<tt>\/space\/debian-mipsel 192.168.1.1(rw,sync,no_root_squash)<\/tt><\/p>\n<p>I mounted it on the router:<br \/>\n<tt>ipkg install kmod-nfs<br \/>\ninsmod sunrpc<br \/>\ninsmod lockd<br \/>\ninsmod nfs<br \/>\nmount -t nfs star:\/space\/debian-mipsel \/debian -o nolock<br \/>\nmount -t proc \/dev\/null \/debian\/proc<\/tt><\/p>\n<p>I set up some swap space on the NFS mount (mandatory, or debootstrap&#8217;s second stage will fail):<br \/>\n<tt>ipkg install losetup<br \/>\nipkg install kmod-loop<br \/>\nipkg install swap-utils<br \/>\ndd if=\/dev\/zero of=\/debian\/swapfile bs=1M count=100<br \/>\nlosetup \/dev\/loop\/0 \/debian\/swapfile<br \/>\nmkswap \/dev\/loop\/0<br \/>\nswapon \/dev\/loop\/0<\/tt><\/p>\n<p>I chrooted inside \/debian, and ran debootstrap&#8217;s second stage:<br \/>\n<tt>chroot \/debian \/bin\/bash<br \/>\ndebootstrap\/debootstrap --second-stage<\/tt><\/p>\n<p>When you are done playing, you can disable the swap space and umount everything:<br \/>\n<tt>swapoff \/dev\/loop\/0<br \/>\nlosetup -d \/dev\/loop\/0<br \/>\numount \/debian\/proc<br \/>\nsleep 1 # or umount \/debian will fail<br \/>\numount \/debian<\/tt><\/p>\n<p>If you want to re-mount everything, all you need to do is:<br \/>\n<tt>insmod sunrpc<br \/>\ninsmod lockd<br \/>\ninsmod nfs<br \/>\nmount -t nfs star:\/space\/debian-mipsel \/debian -o nolock<br \/>\nmount -t proc \/dev\/null \/debian\/proc<br \/>\nlosetup \/dev\/loop\/0 \/debian\/swapfile<br \/>\nswapon \/dev\/loop\/0<br \/>\nchroot \/debian \/bin\/bash<\/tt><\/p>\n<p>That first stage\/second stage split in debootstrap is really cool: it&#8217;s an easy way to run Debian anywhere, only requiring to be able to <tt>chroot<\/tt> at some point.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m the happy owner of a Linksys WRT54GL. OpenWRT is nice, but &#8230; well. Debian is just nicer. And I couldn&#8217;t resist the idea of running Debian on this little MIPS system. Since there&#8217;s clearly not enough space available on the Linksys, I decided to install etch in a chroot, that I would mount using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"0","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,13,12,7],"tags":[],"class_list":["post-228","post","type-post","status-publish","format-standard","hentry","category-debianubuntu","category-planetdebian","category-planetubuntu","category-technology"],"_links":{"self":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=228"}],"version-history":[{"count":0,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}