Following setting up a Debian chroot on the Pre, I wanted to be able to ssh into the chroot. This sets that up, including starting Debian's ssh on boot.

Actually, I went a step further and hooked Debian's rc3.d init scripts into the Pre's webOS boot process, so all services installed in Debian will start on boot. So as a bonus, cron, at, etc will also work.

Since the Pre's EVDO IP address changes all the time, dynamic DNS is needed if you want to ssh in over EVDO. I used ez-ipupdate to handle that. (If you didn't want to ssh via EVDO, you could omit that part, and add "-i eth0" to both the firewall rules below.)

  1. Use novacom and the cable to get a root shell, and chroot /media/debian
  2. Install ssh: apt-get install openssh-server openssh-client
  3. Hook Debian init scripts into webOS startup:
     cat > /media/pre-root/etc/event.d/debian_start <<EOF
     # start Debian services after webOS boot is complete to avoid delaying that
     start on stopped finish
         echo "Starting Debian services..."
         chroot /media/debian /etc/init.d/rc 2
     end script
  4. Edit /etc/rc.local and add these commands to it:
     # Add firewall rule to allow SSH access on port 22,
     # both wifi and EVDO.
     iptables -D INPUT -p tcp --dport 22 -j ACCEPT || true
     iptables -I INPUT -p tcp --dport 22 -j ACCEPT
  5. If you want to easily be able to determine the phone's address while it's on wifi, you can use mDNS (hostname.local): apt-get install avahi-daemon
  6. Install ez-ipupdate: apt-get ez-ipupdate
  7. Follow the prompts to configure ez-ipupdate to use dyndns or your preferred dyanmic DNS service. When it asks if ppp is used, say yes.
  8. Edit /etc/ez-ipupdate/default.conf and make sure the interface is set to 'ppp0' (See Debian bug #536512 for why you need to do this currently.)
  9. Hook ez-ipupdate into webOS's ip-up script, so it is run whenever the address changes:
     echo '#!/bin/sh' > $HOOK
     echo '/usr/sbin/chroot /media/debian /etc/ppp/ip-up.d/ez-ipupdate >/dev/null 2>&1 || true' >> $HOOK
     chmod a+x $HOOK
  10. Reboot the Pre. Now is a good time to learn that Orange+Sym+R on the keypad is equivilant to ctrl-alt-del. :-) The ssh daemon should be started automatically.


  • Enable avahi for mdns for wifi.
  • Cleanly stop Debian services on shutdown. Problem with doing this is that I can't just run '/etc/init.d/rc 0', because that will kill every process in webOS too, and hang the phone. It'd need a very custom runlevel to be set up in Debian.