User:Stuart
From Openmoko
m |
m (→Dropbear) |
||
(26 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
+ | Just a list of rather random comments used mainly as a bloc notes for me. Please send me any | ||
+ | comments -- Stuart Pook. | ||
+ | |||
+ | === /etc/network/interfaces === | ||
The entry in /etc/network/interfaces. I use /30 as my home network is 192.168.0.0/24. I have a local nameserver. | The entry in /etc/network/interfaces. I use /30 as my home network is 192.168.0.0/24. I have a local nameserver. | ||
Line 27: | Line 31: | ||
</pre> | </pre> | ||
+ | Well, [http://pkg-fso.alioth.debian.org/freerunner/install.sh install.sh] - v3.0, from [http://wiki.debian.org/DebianOnFreeRunner wiki.debian.org] fails. | ||
− | + | <pre># HOSTNAME=stuart INST_MIRROR=http://ftp.fr.debian.org/debian QI=true LOCALEPURGE=true ./install.sh --no-partitioning --swap-size 128 --part1-fs ext3 --with-tasks GAMES,NET,WEB,WIFI,COM all | |
− | + | [...] | |
− | < | + | |
− | + | ||
− | + | ||
P: Configuring package apt | P: Configuring package apt | ||
P: Configuring helper cdebootstrap-helper-apt | P: Configuring helper cdebootstrap-helper-apt | ||
Line 41: | Line 43: | ||
that you have to download install-info_4.13a.dfsg.1-4_armel.deb in the middle of the installation. | that you have to download install-info_4.13a.dfsg.1-4_armel.deb in the middle of the installation. | ||
<pre> | <pre> | ||
− | HOSTNAME=stuart QI=true | + | HOSTNAME=stuart QI=true INST_MIRROR=http://ftp.fr.debian.org/debian LOCALEPURGE=true /home/root/install.sh --no-partitioning --swap-size 128 --part1-fs ext3 format mount |
mkdir /mnt/debian/var /mnt/debian/var/cache /mnt/debian/var/cache/bootstrap/ | mkdir /mnt/debian/var /mnt/debian/var/cache /mnt/debian/var/cache/bootstrap/ | ||
wget http://ftp.debian.org/debian/pool/main/t/texinfo/install-info_4.13a.dfsg.1-4_armel.deb | wget http://ftp.debian.org/debian/pool/main/t/texinfo/install-info_4.13a.dfsg.1-4_armel.deb | ||
mv install-info_4.13a.dfsg.1-4_armel.deb /mnt/debian/var/cache/bootstrap/ | mv install-info_4.13a.dfsg.1-4_armel.deb /mnt/debian/var/cache/bootstrap/ | ||
− | HOSTNAME=stuart QI=true | + | HOSTNAME=stuart QI=true INST_MIRROR=http://ftp.fr.debian.org/debian LOCALEPURGE=true /home/root/install.sh --no-partitioning --swap-size 128 --part1-fs ext3 debian apt fso tasks configuration kernel cleanup unmount |
</pre> | </pre> | ||
+ | Make a tar of /mnt/debian so that I don't have to go through all this agian. | ||
+ | |||
+ | == Configuring Debian == | ||
+ | === Touchscreen === | ||
Now I have debian on my SD card but the touchscreen doesn't work. | Now I have debian on my SD card but the touchscreen doesn't work. | ||
http://neil.brown.name/blog/20090212205404 says that it might just be a calibration problem. | http://neil.brown.name/blog/20090212205404 says that it might just be a calibration problem. | ||
+ | <code>apt-get install libts-bin</code> | ||
+ | <code>TSLIB_TSDEVICE=/dev/input/touchscreen0 DISPLAY=:0 /usr/bin/ts_calibrate</code> | ||
+ | |||
+ | Let's read http://www.mail-archive.com/smartphones-userland@linuxtogo.org/msg01205.html which suggests | ||
+ | <pre> | ||
+ | # apt-get remove xserver-xorg-input-synaptics | ||
+ | </pre> | ||
+ | |||
+ | Did <code>apt-get install xserver-xglamo</code> then ran /usr/bin/Xglamo which says | ||
+ | <pre> | ||
+ | Failed to open TSLib device, tried /dev/ts /dev/touchscreen/0 . | ||
+ | Try setting TSLIB_TSDEVICE to valid /dev entry? | ||
+ | </pre> | ||
+ | Ok, a link <code>ln -s input/touchscreen0 /dev/ts</code>. /usr/bin/Xglamo works, update /etc/X11/xorg.conf [[Debian#Xglamo_acceleration]] and I have a touchscreen that works. | ||
+ | === Cleanup === | ||
+ | <pre> | ||
+ | # apt-get remove xserver-xorg-input-wacom | ||
+ | </pre> | ||
+ | |||
+ | === Dropbear === | ||
+ | Dropbear looks for /usr/X11R6/bin/xauth [[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532900 Debian bug]] but xauth is in /usr/bin/xauth and /usr/bin/X11/xauth. Make a symlink. | ||
+ | <pre> | ||
+ | ln -s . /usr/X11R6 | ||
+ | </pre> | ||
+ | |||
+ | Need to read http://wiki.debian.org/DebianOnFreeRunnerTips and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500626 | ||
+ | |||
+ | I replaced dropbear with openssh-server. | ||
+ | |||
+ | === connman === | ||
+ | |||
+ | Install <code>connman</code> and edit /etc/dbus-1/system.d/connman.conf to replace <code>user="root"</code> with <code>group="messagebus"</code> otherwise you get the messages | ||
+ | <pre> | ||
+ | wifi.py 98 wifi WARNING can't use wifi service : org.moblin.connman.Error.PermissionDenied: Permission denied | ||
+ | service.py 128 Service ERROR Can't init service Wifi : org.moblin.connman.Error.PermissionDenied: Permission denied | ||
+ | </pre> | ||
+ | if you do not run as root. | ||
+ | |||
+ | Connman does not appears to start at boot. Try | ||
+ | <pre>cd /etc/rc2.d && mv S01connman S10connman | ||
+ | </pre> | ||
+ | |||
+ | === mokomaze === | ||
+ | Mokomaze does not work if you are not root. To fix (let me know if this is not right) | ||
+ | <pre> | ||
+ | chmod 666 /dev/input/event3 /sys/class/leds/neo1973:vibrator/brightness | ||
+ | </pre> | ||
+ | |||
+ | === rxvt-unicode === | ||
+ | to get a nice small font (but not too small), ~/.Xresources should contain | ||
+ | <pre> | ||
+ | URxvt*font: xft:DejaVu Sans Mono:size=4.0 | ||
+ | </pre> | ||
+ | Vala-terminal is better. | ||
+ | |||
+ | === network configuration when USB pluged-in === | ||
+ | I want to run a program when I plug the USB in. This program will try to workout where | ||
+ | I am and setup the domain and http proxy correctly. A script can be run my creating | ||
+ | <code>/etc/udev/rules.d/00-usb-stuart.rules<code> | ||
+ | <pre> | ||
+ | ENV{POWER_SUPPLY_ONLINE}=="1", KERNEL=="usb", RUN+="/bin/sh -c /etc/network/proxy-setup&" | ||
+ | </pre> | ||
+ | This script is run twice (and perhaps in parallel) so be careful. | ||
+ | |||
+ | === http proxy and /etc/resolv.conf setup === | ||
+ | This is my first script to automatically set the http and ftp proxies. | ||
+ | It also sets the domain so that smtp resolves to a working smtp server. | ||
+ | At the moment I am only using USB networking | ||
+ | and this program will have to be modified if I want to use both at once. | ||
+ | <pre> | ||
+ | #!/bin/dash | ||
+ | # written by Stuart Pook | ||
+ | #(/bin/date; echo "$@"; env) >> /tmp/RUN | ||
+ | |||
+ | usb_ip=$(/sbin/ifconfig usb0 | sed -ne 's/ inet addr:\([0-9.]*\) .*/\1/p') | ||
+ | [ "$usb_ip" ] || exit 1 | ||
+ | |||
+ | rule=OUTPUT | ||
+ | table=nat | ||
+ | |||
+ | domain1=example.org | ||
+ | set -- $(host www-cache-in.$domain1) | ||
+ | machine1=$4 | ||
+ | port1=3128 | ||
+ | if netcat -s $usb_ip -z $machine1 $port1 | ||
+ | then | ||
+ | proxy=$machine1:$port1 | ||
+ | domain=$domain1 | ||
+ | else | ||
+ | proxy=127.0.0.1:8888 | ||
+ | domain=free.fr | ||
+ | fi | ||
+ | date "+nameserver 192.168.0.200%ndomain $domain%n# %c $ACTION $POWER_SUPPLY_ONLINE $SUBSYSTEM $POWER_SUPPLY_NAME" > /etc/resolv.conf | ||
+ | |||
+ | env=/etc/environment | ||
+ | [ -r $env ] && . $env | ||
+ | |||
+ | [ "$http_proxy" ] || exit 1 | ||
+ | |||
+ | set -- $(sed -n -e "s .* $http_proxy " -e 's@http://\([0-9][0-9.]*[0-9]\):\([0-9][0-9]*\)@\1 \2@p' -e q /etc/passwd) | ||
+ | dest=$1 | ||
+ | port=$2 | ||
+ | [ "$dest" -a "$port" ] || exit 1 | ||
+ | iptables -t $table -F $rule | ||
+ | iptables -t $table -I $rule --protocol tcp --dst $dest --dport $port -j DNAT --to-destination $proxy | ||
+ | </pre> | ||
+ | <code>/etc/environment</code> contains a junk http proxy address and iptables is used to redirect this to a remote proxy if one is required or a proxy on the Freerunner. This avoids using the proxy on the Freerunner if a remote proxy is available and allows me to change the proxy for running programs. | ||
+ | <pre> | ||
+ | http_proxy=http://14.255.14.250:542 | ||
+ | ftp_proxy=http://14.255.14.250:542 | ||
+ | </pre> | ||
+ | |||
+ | === wicd Network Manager === | ||
+ | wicd works except thatit uses too much cpu time when the gui is open. [http://wicd.net/punbb/viewtopic.php?pid=2856 forum question] | ||
+ | |||
+ | == references == | ||
+ | [[User:JohnSullivan]] |
Latest revision as of 12:25, 1 October 2009
Just a list of rather random comments used mainly as a bloc notes for me. Please send me any comments -- Stuart Pook.
Contents |
[edit] /etc/network/interfaces
The entry in /etc/network/interfaces. I use /30 as my home network is 192.168.0.0/24. I have a local nameserver.
iptables -A FORWARD --in-interface eth7 -j ACCEPT allow-hotplug eth7 iface eth7 inet static address 192.168.0.200 netmask 255.255.255.252 up iptables -A POSTROUTING -t nat -s 192.168.0.200/30 -j MASQUERADE up echo 1 > /proc/sys/net/ipv4/ip_forward down iptables -D POSTROUTING -t nat -s 192.168.0.200/30 -j MASQUERADE iptables -A FORWARD --out-interface eth7 -j ACCEPT
[edit] Installing Debian
I partitioned by hand because of a problem with fdisk. Changing the type of a partition seems to block with the fdisk from Om 2007.
Disk /dev/mmcblk0: 2032 MB, 2032664576 bytes 4 heads, 16 sectors/track, 62032 cylinders Units = cylinders of 64 * 512 = 32768 bytes Device Boot Start End Blocks Id System /dev/mmcblk0p1 1 57984 1855480 83 Linux /dev/mmcblk0p2 57985 62032 129536 82 Linux swap
Well, install.sh - v3.0, from wiki.debian.org fails.
# HOSTNAME=stuart INST_MIRROR=http://ftp.fr.debian.org/debian QI=true LOCALEPURGE=true ./install.sh --no-partitioning --swap-size 128 --part1-fs ext3 --with-tasks GAMES,NET,WEB,WIFI,COM all [...] P: Configuring package apt P: Configuring helper cdebootstrap-helper-apt E: Internal error: install
http://www.mail-archive.com/smartphones-userland@linuxtogo.org/msg01544.html explains that you have to download install-info_4.13a.dfsg.1-4_armel.deb in the middle of the installation.
HOSTNAME=stuart QI=true INST_MIRROR=http://ftp.fr.debian.org/debian LOCALEPURGE=true /home/root/install.sh --no-partitioning --swap-size 128 --part1-fs ext3 format mount mkdir /mnt/debian/var /mnt/debian/var/cache /mnt/debian/var/cache/bootstrap/ wget http://ftp.debian.org/debian/pool/main/t/texinfo/install-info_4.13a.dfsg.1-4_armel.deb mv install-info_4.13a.dfsg.1-4_armel.deb /mnt/debian/var/cache/bootstrap/ HOSTNAME=stuart QI=true INST_MIRROR=http://ftp.fr.debian.org/debian LOCALEPURGE=true /home/root/install.sh --no-partitioning --swap-size 128 --part1-fs ext3 debian apt fso tasks configuration kernel cleanup unmount
Make a tar of /mnt/debian so that I don't have to go through all this agian.
[edit] Configuring Debian
[edit] Touchscreen
Now I have debian on my SD card but the touchscreen doesn't work.
http://neil.brown.name/blog/20090212205404 says that it might just be a calibration problem.
apt-get install libts-bin
TSLIB_TSDEVICE=/dev/input/touchscreen0 DISPLAY=:0 /usr/bin/ts_calibrate
Let's read http://www.mail-archive.com/smartphones-userland@linuxtogo.org/msg01205.html which suggests
# apt-get remove xserver-xorg-input-synaptics
Did apt-get install xserver-xglamo
then ran /usr/bin/Xglamo which says
Failed to open TSLib device, tried /dev/ts /dev/touchscreen/0 . Try setting TSLIB_TSDEVICE to valid /dev entry?
Ok, a link ln -s input/touchscreen0 /dev/ts
. /usr/bin/Xglamo works, update /etc/X11/xorg.conf Debian#Xglamo_acceleration and I have a touchscreen that works.
[edit] Cleanup
# apt-get remove xserver-xorg-input-wacom
[edit] Dropbear
Dropbear looks for /usr/X11R6/bin/xauth [Debian bug] but xauth is in /usr/bin/xauth and /usr/bin/X11/xauth. Make a symlink.
ln -s . /usr/X11R6
Need to read http://wiki.debian.org/DebianOnFreeRunnerTips and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500626
I replaced dropbear with openssh-server.
[edit] connman
Install connman
and edit /etc/dbus-1/system.d/connman.conf to replace user="root"
with group="messagebus"
otherwise you get the messages
wifi.py 98 wifi WARNING can't use wifi service : org.moblin.connman.Error.PermissionDenied: Permission denied service.py 128 Service ERROR Can't init service Wifi : org.moblin.connman.Error.PermissionDenied: Permission denied
if you do not run as root.
Connman does not appears to start at boot. Try
cd /etc/rc2.d && mv S01connman S10connman
[edit] mokomaze
Mokomaze does not work if you are not root. To fix (let me know if this is not right)
chmod 666 /dev/input/event3 /sys/class/leds/neo1973:vibrator/brightness
[edit] rxvt-unicode
to get a nice small font (but not too small), ~/.Xresources should contain
URxvt*font: xft:DejaVu Sans Mono:size=4.0
Vala-terminal is better.
[edit] network configuration when USB pluged-in
I want to run a program when I plug the USB in. This program will try to workout where
I am and setup the domain and http proxy correctly. A script can be run my creating
/etc/udev/rules.d/00-usb-stuart.rules<code>
ENV{POWER_SUPPLY_ONLINE}=="1", KERNEL=="usb", RUN+="/bin/sh -c /etc/network/proxy-setup&"
This script is run twice (and perhaps in parallel) so be careful.
[edit] http proxy and /etc/resolv.conf setup
This is my first script to automatically set the http and ftp proxies. It also sets the domain so that smtp resolves to a working smtp server. At the moment I am only using USB networking and this program will have to be modified if I want to use both at once.
#!/bin/dash # written by Stuart Pook #(/bin/date; echo "$@"; env) >> /tmp/RUN usb_ip=$(/sbin/ifconfig usb0 | sed -ne 's/ inet addr:\([0-9.]*\) .*/\1/p') [ "$usb_ip" ] || exit 1 rule=OUTPUT table=nat domain1=example.org set -- $(host www-cache-in.$domain1) machine1=$4 port1=3128 if netcat -s $usb_ip -z $machine1 $port1 then proxy=$machine1:$port1 domain=$domain1 else proxy=127.0.0.1:8888 domain=free.fr fi date "+nameserver 192.168.0.200%ndomain $domain%n# %c $ACTION $POWER_SUPPLY_ONLINE $SUBSYSTEM $POWER_SUPPLY_NAME" > /etc/resolv.conf env=/etc/environment [ -r $env ] && . $env [ "$http_proxy" ] || exit 1 set -- $(sed -n -e "s .* $http_proxy " -e 's@http://\([0-9][0-9.]*[0-9]\):\([0-9][0-9]*\)@\1 \2@p' -e q /etc/passwd) dest=$1 port=$2 [ "$dest" -a "$port" ] || exit 1 iptables -t $table -F $rule iptables -t $table -I $rule --protocol tcp --dst $dest --dport $port -j DNAT --to-destination $proxy
<code>/etc/environment contains a junk http proxy address and iptables is used to redirect this to a remote proxy if one is required or a proxy on the Freerunner. This avoids using the proxy on the Freerunner if a remote proxy is available and allows me to change the proxy for running programs.
http_proxy=http://14.255.14.250:542 ftp_proxy=http://14.255.14.250:542
[edit] wicd Network Manager
wicd works except thatit uses too much cpu time when the gui is open. forum question