Page 1 of 4 123 ... LastLast
Results 1 to 15 of 50

Thread: HOWTO install debian on 128 mb usb stick

  1. #1
    Join Date
    Apr 2005
    Location
    Amsterdam
    Posts
    14

    HOWTO install debian on 128 mb usb stick

    install debian on a usb stick

    Setup good firmware

    I used phedny's custom firmware (1.9.2.7-3b) with ipv6 support, you can download it here. Howto install new firmware is described in other howto's on the wl500g forums.

    If you don't want ipv6, you can skip setting it up. But hey, why not use ipv6 when I included all kinds of neat ipv6 things like radvd, iproute2, ping6 and traceroute6! Well, read howto setup your wl500g as a ipv6 router

    I disabled the stupid-ftp server, because it's .. to simple. Why not use a cool ftpd server when you have a working debian installation? :-) If you have disabled the ftp server on the admin webpages, the usb-storage modules won't be loaded into the kernel. Make sure you have loaded the required modules into the kernel:

    Code:
    insmod /lib/modules/2.4.20/kernel/drivers/scsi/scsi_mod.o
    insmod /lib/modules/2.4.20/kernel/drivers/scsi/sd_mod.o
    insmod /lib/modules/2.4.20/kernel/drivers/usb/storage/usb-storage.o
    Download the image and store it on the usb memory stick:

    Code:
    wget -O /dev/scsi/host0/bus0/target0/lun0/disc http://masteen2.iiivx.net/wl500g/debian/debian-sarge-128mb-mipsel.image
    this image includes a partition table and stuff, because the ipv6 firmware doesn't have e2fsprogs out of the box. Mount the crazy thing so you can start messing around.

    Code:
    mount /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/harddisk
    Get into your debian installation.

    Code:
    chroot /tmp/harddisk/debian-distro /bin/bash
    mount -t proc none /proc
    mount -t devfs devfs /dev
    swapon /dev/scsi/host0/bus0/target0/lun0/part2
    Generate your own key's and start dropbear
    Code:
    rm /etc/dropbear/dropbear_rsa_host_key && rm /etc/dropbear/dropbear_dss_host_key
    dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
    dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
    /etc/init.d/dropbear start
    Use your fresh debian installation

    Now the second part, using your debian installation!

    Ssh to your router using the account 'normaluser' and the default password 'userpasswd'. Change your password and type 'su', the default root password is 'rootpasswd'.

    Do something kinky like
    Code:
    apt-get update; apt-get dist-upgrade
    And enjoy! Don't forget to regulary clean up the useless stuff I mentioned before.

    Additional information

    Example of how things can look when everything goes okay
    Code:
    Feanor:~ iiivx$ ssh normaluser@192.168.1.1
    normaluser@192.168.1.1's password: 
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    normaluser@wl500g-router:~$ su
    Password: 
    wl500g-router:/home/normaluser# uptime
     21:08:10 up 2 days,  8:38,  1 user,  load average: 0.29, 0.36, 0.69
    wl500g-router:/home/normaluser# uname -a
    Linux wl500g-router 2.4.20 #57 Thu Feb 10 14:29:29 CET 2005 mips GNU/Linux
    wl500g-router:/home/normaluser# cat /etc/debian_version 
    3.1
    wl500g-router:/home/normaluser#

    How did I make this? How can this work?

    Indeed, "cdebootstrap -amipsel sarge debian-distro http://ftp.de.debian.org/debian" creates a 100 megabyte filetree, and if you unpack the stuff it gets even worse. So I decided to delete all the 'useless' crap.

    The first reduction technique is to remove the documentation from the root filesystem. They include the Perl .pod files and everything under the following directories:
    Code:
    /usr/doc
    /usr/info
    /usr/man
    /usr/share/doc
    /usr/share/info
    /usr/share/man
    Two others that should either be trimmed or eliminated are . . .
    Code:
    /usr/share/locale
    /usr/share/zoneinfo
    /usr/share/locale provides locale information, so that users can see the system in their own languages, currency formats, etc. /usr/share/zoneinfo provides timezone definitions, so that users can see local time and perform timezone conversions. Both of these could certainly be trimmed down -- a server which is going to be administered by a single person does not need locale information for languages that person does not speak; and a server which will be used in one place, and does not do complex time-related applications (e.g. calendaring) will never use more than one timezone definitions.

    However, removing all of the documentation, the locale, and timezone information only reduces the size of the Debian root filesystem that much, so I also deleted a bunch of not-required libraries and packages. If you miss them, you can install them using apt-get(8).

    I ended up using this packages list: debian-sarge-128mb-mipsel-packages.txt

    output of my df -h & free -m

    Code:
    root@wl500g-router:/# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/scsi/host0/bus0/target0/lun0/part1
                          112M   78M   29M  74% /
    root@wl500g-router:/# free -m
                 total       used       free     shared    buffers     cached
    Mem:            13         12          1          0          0          5
    -/+ buffers/cache:          6          7
    Swap:           10          1          9
    root@wl500g-router:/#
    IIIVX = ( X - V ) - III = II = 2

  2. #2
    Join Date
    Dec 2003
    Location
    Russian Federation
    Posts
    8,356
    Just to let you know: 1.9.2.7-4 includes ipv6 and has fdisk and e2fsprogs.
    So, it's better to pack your image as tar.gz and include an info on partitioning disks to the how-to, as even 128MB flash drives could be different.

  3. #3
    Join Date
    Apr 2005
    Location
    Amsterdam
    Posts
    14
    Quote Originally Posted by Oleg
    Just to let you know: 1.9.2.7-4 includes ipv6 and has fdisk and e2fsprogs.
    So, it's better to pack your image as tar.gz and include an info on partitioning disks to the how-to, as even 128MB flash drives could be different.
    I am aware of the fact that this howto isn't capable of handling slightly different setups. As soon as I have time to test 1.9.2.7-4, I will update the howto and include information on partitioning the stick and tarball's.
    IIIVX = ( X - V ) - III = II = 2

  4. #4
    Great stuff... but I have a conundrum.

    I can see usbdevfs:

    [admin@mouser root]$ ls /proc/bus/usb/
    001 devices drivers

    But usbdevfs doesn't seem to appear in the chrooted environment:

    [admin@mouser admin]$ ls /tmp/harddisk/debian-distro/proc/bus/
    pci usb
    [admin@mouser admin]$ ls /tmp/harddisk/debian-distro/proc/bus/usb/
    [admin@mouser admin]$

    Do you have any suggestions as to how I can execute the Debian software
    and access usbdevfs?

    edit: someone on #wrt54g suggested -obind with mount, which seems to have done the trick.
    Last edited by rinco; 07-06-2005 at 14:13.

  5. #5
    Join Date
    Apr 2005
    Location
    Amsterdam
    Posts
    14
    Quote Originally Posted by rinco
    edit: someone on #wrt54g suggested -obind with mount, which seems to have done the trick.
    Indeed, either way you can mount /proc and /dev from within the chrooted enviroment, or perform a binded mount. I'm glad you liked this :-)
    IIIVX = ( X - V ) - III = II = 2

  6. #6
    Hi iiivx,
    I am a bit lazy with cleaning, so I would like to take a 1024MB USB stick, but the cdebootstrap command failes with "E: Couldn't install root!" after extracting the last package. What is going wrong?

    Darkstar.

  7. #7
    Join Date
    Apr 2005
    Location
    Amsterdam
    Posts
    14
    Quote Originally Posted by Darkstar
    Hi iiivx,
    I am a bit lazy with cleaning, so I would like to take a 1024MB USB stick, but the cdebootstrap command failes with "E: Couldn't install root!" after extracting the last package. What is going wrong?

    Darkstar.
    The cdebootstrap command is expected to fail, since you aren't bootstrapping on a mipsel machine. Thus it cannot execute the binaries it want's to execute. Read the tutorial on the wiki, it should help you enough to get something up and running.
    IIIVX = ( X - V ) - III = II = 2

  8. #8
    Ok, got this. But I have another question: Is it possible to boot into the Debian distribution in order to start the desired services via the /etc/rcX.d/... framework?

    Darkstar.

  9. #9
    Unfortunately the wiki is not acessible right now?! I really would like to try the debian on the wl500g...
    Do you still plan to post an image of debian without the partition table ?

    What can you do exactly with it? Can in the chrooted environment thttpd and mysql be run? mysql seems to be avaible in debian mipsel package....

    Thanks for your help.

    Rainer

  10. #10
    i have done everything the wy you explaind
    but after i add this command
    mount /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/harddisk
    i get this error
    mount: mount point /tmp/harddisk does not exist
    i don't know what i'm doin wrong,

    i'm using olegs latest firmware version

    thx hunter

  11. #11
    Join Date
    Apr 2004
    Location
    Netherlands
    Posts
    1,308
    Quote Originally Posted by rdk
    Unfortunately the wiki is not acessible right now?! I really would like to try the debian on the wl500g...
    Wiki is running fine here: http://wiki.wl500g.info/

  12. #12
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    6
    Hello
    Thanks for the great tutorial. It worked fine for me.
    But now i have a little problem:
    after "apt-get update; apt-get dist-upgrade" i have very little space left for other packages. So is there a way to resize the image???
    I use a 6GB Harddisk and Olegs Firmware 1.9.2.7-6b.

  13. #13
    Join Date
    Apr 2004
    Location
    Netherlands
    Posts
    1,308
    If you attach your USB device to a PC, you can use Partition Magic for that or otherwise Ranish Partition Manager.

  14. #14
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    6
    Hello
    Thanks for your answer Styno. Partition Magic is telling me that the harddisk is defectiv and i cant do anything except creating a new partition.
    iiivx wrote that the image includes a partiton table. Is there no easy way to change that?? I guess i should ask google

  15. #15
    I installed Debian onto a 256MB USB disk, everything is working great.
    The output of 'df -h' is as follows:

    root@Asus:/# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/scsi/host0/bus0/target0/lun0/part1
    112M 78M 29M 74% /
    root@Asus:/#

    What I understand from this is that only half of the size of my USB disk is used.
    Is it possible to extend the size of this partition to use every available space that is still on the USB disk? If so, how can I do this?


    Regards,

    Molski

Page 1 of 4 123 ... LastLast

Similar Threads

  1. Printing through port 9101 with debian
    By Faberic in forum WL-500g Q&A
    Replies: 9
    Last Post: 23-06-2005, 08:54
  2. Debian Install Help Please
    By Madar in forum WL-HDD Custom Development
    Replies: 45
    Last Post: 10-06-2005, 22:35

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •