maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   View and Edit system files in Ubuntu? (https://talk.maemo.org/showthread.php?t=41395)

DannStarr 2010-01-19 19:24

View and Edit system files in Ubuntu?
 
It's probably really obvious (hopefully) but is there a way that I can view and edit the system files on my n900 using ubuntu?

I've been reading the modding thread and while I have installed midnight commander and used it to add the "Reboot" button with no problems, there are other things I want to mod and play around with like changing wifi logo, battery logo's etc, but I would just feel a lot happier doing this via my laptop.

Anyone have a way?

tnhh 2010-01-19 20:27

Re: View and Edit system files in Ubuntu?
 
I ssh into my N900 to edit files. http://wiki.maemo.org/SSH

SubCore 2010-01-19 20:37

Re: View and Edit system files in Ubuntu?
 
Code:

apt-get install sshfs
in ubuntu

Code:

apt-get install openssh-server
in maemo

then just

Code:

mkdir /media/n900
chown <username> /media/n900
sshfs root@n900.host.or.ip:/home/user /media/n900 -o allow_other

on ubuntu

after testing that it works this way, please set up key authentication for the N900 "user" account. that's much safer than connecting as root.

DannStarr 2010-01-20 04:31

Re: View and Edit system files in Ubuntu?
 
Thanks guys, to do this ssh, do I need a wifi router with active connection to the web?

My only option for web browsing is currently to tether using my trusty N900, so that presumably wouldnt be an option for me...

However, I do still have a BT homehub router, which i guess could still just serve as a LAN, which might be good enough to let me do a SSH?

Hmmm, i must try...

archebyte 2010-01-20 08:44

Re: View and Edit system files in Ubuntu?
 
Quote:

Originally Posted by DannStarr (Post 483540)
Thanks guys, to do this ssh, do I need a wifi router with active connection to the web?

No. You can connect from Ubuntu using SSH via the USB cable. Instructions for N900 setup are here

You would also need to install openssh on the N900.

On the Ubuntu side, modify the /etc/network/interfaces file and add these lines:
Code:

iface usb0 inet static
      address 192.168.2.14
      netmask 255.255.255.0
      broadcast 192.168.2.255

and then restart the interface on the Ubuntu after connecting the cable
Code:

sudo ifup usb0
you should now be able to ping the N900 from Ubuntu (ping 192.168.2.15) and use ssh or sshfs to have full access to the N900's filesystem

DannStarr 2010-01-20 15:23

Re: View and Edit system files in Ubuntu?
 
Quote:

Originally Posted by archebyte (Post 483780)
No. You can connect from Ubuntu using SSH via the USB cable. Instructions for N900 setup are here

You would also need to install openssh on the N900.

On the Ubuntu side, modify the /etc/network/interfaces file and add these lines:
Code:

iface usb0 inet static
      address 192.168.2.14
      netmask 255.255.255.0
      broadcast 192.168.2.255

and then restart the interface on the Ubuntu after connecting the cable
Code:

sudo ifup usb0
you should now be able to ping the N900 from Ubuntu (ping 192.168.2.15) and use ssh or sshfs to have full access to the N900's filesystem


Genius, thank you :)

DannStarr 2010-01-20 16:59

Re: View and Edit system files in Ubuntu?
 
I need more help here, im not quite getting something right.

I followed the set up for the N900 instructions, and I was successfully able to ping my laptop = 100% packets received.

When it came to doing it the other end, pinging my N900 from my laptop doesnt work, I get 100% packets NOT received.

What could be causing this?

Also, I then try to connect via either filezilla or secure shell and cant establish a connection.

I dont fully understand what i'm doing so its probably something really obvious im missing.

DannStarr 2010-01-20 17:03

Re: View and Edit system files in Ubuntu?
 
Errrm, correction to the above.

It seems I can ping my N900 (192.168.2.15) from my N900, but not my laptop (ping 192.168.2.14)

However, when using the laptop, neither address works

SubCore 2010-01-20 17:07

Re: View and Edit system files in Ubuntu?
 
Quote:

Originally Posted by DannStarr (Post 484574)
When it came to doing it the other end, pinging my N900 from my laptop doesnt work, I get 100% packets NOT received.

since 51-1 (PR1.1), the N900 won't respond to pings anymore IIRC.

Quote:

Also, I then try to connect via either filezilla or secure shell and cant establish a connection.
ssh should work (i don't know filezilla), restart your sshd to recognize the "new" usb0 interface by
Code:

sudo gainroot
/etc/init.d/ssh restart


edit:
you did do "ifup usb0" on the N900 as well, right?

DannStarr 2010-01-20 18:00

Re: View and Edit system files in Ubuntu?
 
Ok guys, I've done, and re-done everything suggested here, but when I come to connect via SSH I just get a "Host Unreachable" error.

Checklist on N900:
1. Installed SSH server and Client
2. did what ever this means:

"mkdir /media/n900
chown <username> /media/n900
sshfs root@n900.host.or.ip:/home/user /media/n900 -o allow_other"

3. did "ifup usb0"

Checklist in Ubuntu
1. apt-get install openssh-server - done
2. modified /etc/network/interfaces file to add
"iface usb0 inet static
address 192.168.2.14
netmask 255.255.255.0
broadcast 192.168.2.255"
3. did "ifup usb0"

Still no joy.

SubCore 2010-01-20 18:08

Re: View and Edit system files in Ubuntu?
 
you don't need my sshfs part for USB networking, that's for mounting a remote directory over SSH. and it was supposed to be run on the ubuntu side :)

you didn't set up the usb0 interface on the N900. please read the link archebyte posted again, you have to edit /etc/network/interfaces on the N900 as well.

DannStarr 2010-01-20 19:21

Re: View and Edit system files in Ubuntu?
 
Quote:

Originally Posted by SubCore (Post 484731)
you don't need my sshfs part for USB networking, that's for mounting a remote directory over SSH. and it was supposed to be run on the ubuntu side :)

you didn't set up the usb0 interface on the N900. please read the link archebyte posted again, you have to edit /etc/network/interfaces on the N900 as well.

As far as I can see I have done as archebyte has said. In the link posted on setting up the usb networking it describes the /etc/network file to already be set by default. I viewed this file on my "N900 and it is as described, I cant see where it says I need to modify this file.

SubCore 2010-01-20 19:39

Re: View and Edit system files in Ubuntu?
 
Quote:

Originally Posted by DannStarr (Post 484879)
I viewed this file on my "N900 and it is as described, I cant see where it says I need to modify this file.

ah, alright. if the settings are the same it's ok, i had to edit mine.

hm, dunno what's wrong, then.
post the output of "ifconfig" on both devices (after ifup usb0) here for comparison. also try "lsmod | grep usbnet" under ubuntu after "ifup usb0", maybe your kernel module doesn't get loaded. a firewall on the ubuntu host might also be an issue.

DannStarr 2010-01-20 20:26

Re: View and Edit system files in Ubuntu?
 
Ok, ifconfig on laptop:

dan@dan-laptop:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:a0:d1:65:b1:67
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:27 errors:0 dropped:0 overruns:0 frame:0
TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2928 (2.9 KB) TX bytes:2928 (2.9 KB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:10.214.254.178 P-t-P:10.6.6.6 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:1352 errors:0 dropped:0 overruns:0 frame:0
TX packets:1325 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:405678 (405.6 KB) TX bytes:291798 (291.7 KB)

usb0 Link encap:Ethernet HWaddr b6:5e:7e:e9:d2:2a
inet6 addr: fe80::b45e:7eff:fee9:d22a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:51 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1428 (1.4 KB) TX bytes:1800 (1.8 KB)

wlan0 Link encap:Ethernet HWaddr 00:19:d2:36:36:e6
inet6 addr: fe80::219:d2ff:fe36:36e6/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:657 errors:0 dropped:0 overruns:0 frame:0
TX packets:646 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:209762 (209.7 KB) TX bytes:78529 (78.5 KB)

wmaster0 Link encap:UNSPEC HWaddr 00-19-D2-36-36-E6-33-36-00-00-00-00-00-00-00-00
UP RUNNING MTU:0 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

...... standby for same from N900...

DannStarr 2010-01-20 20:29

Re: View and Edit system files in Ubuntu?
 
From N900

home/user # ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:601 errors:0 dropped:0 overruns:0 frame:0
TX packets:601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:63162 (61.6 KiB) TX bytes:63162 (61.6 KiB)

phonet0 Link encap:UNSPEC HWaddr 15-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MTU:4000 Metric:1
RX packets:9390 errors:0 dropped:0 overruns:0 frame:0
TX packets:4706 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1293112 (1.2 MiB) TX bytes:614868 (600.4 KiB)

upnlink0 Link encap:UNSPEC HWaddr 1B-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MTU:49152 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

usb0 Link encap:Ethernet HWaddr F2:C8:A7:BD:D7:AD
inet addr:192.168.2.15 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3432 (3.3 KiB) TX bytes:2646 (2.5 KiB)

/home/user #

DannStarr 2010-01-20 20:30

Re: View and Edit system files in Ubuntu?
 
From N900

home/user # ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:601 errors:0 dropped:0 overruns:0 frame:0
TX packets:601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:63162 (61.6 KiB) TX bytes:63162 (61.6 KiB)

phonet0 Link encap:UNSPEC HWaddr 15-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MTU:4000 Metric:1
RX packets:9390 errors:0 dropped:0 overruns:0 frame:0
TX packets:4706 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1293112 (1.2 MiB) TX bytes:614868 (600.4 KiB)

upnlink0 Link encap:UNSPEC HWaddr 1B-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP POINTOPOINT RUNNING NOARP MTU:49152 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

usb0 Link encap:Ethernet HWaddr F2:C8:A7:BD:D7:AD
inet addr:192.168.2.15 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3432 (3.3 KiB) TX bytes:2646 (2.5 KiB)

/home/user #

archebyte 2010-01-20 23:10

Re: View and Edit system files in Ubuntu?
 
DanStarr, it looks like the N900 is fully set up and Ubuntu sees the usb0 interface but without an IP. 'sudo ifup usb0' in Ubuntu after connecting the cable. 'ifconfig usb0' on Ubuntu should now show the IP 192.168.2.14.

once the usb0 interfaces on both sides have valid IPs, you can ssh into the N900 from Ubuntu:
ssh root@192.168.2.15

or use sshfs.

archebyte 2010-01-21 08:30

Re: View and Edit system files in Ubuntu?
 
DanStarr, this is bascially the setup required on the client-side (Ubuntu):

1) modify /etc/network/interface per my post above
2) Connect USB cable (on the N900, select PC Suite Mode and execute ifup usb0 as root)
3) verify that the usb0 interface is recognised by running the following command in Ubuntu:
Code:

dmesg
you should see something like this in the last line:
Code:

[295050.409021] usb0: register 'cdc_ether' at usb-0000:00:1d.7-7, CDC Ethernet Device, de:59:f3:a9:fa:fe
4) Start up the usb0 interface with this (on Ubuntu)
Code:

sudo ifup usb0
5) verify that usb0 is up (on Ubuntu)
Code:

archebyte:~$ ifconfig usb0
usb0      Link encap:Ethernet  HWaddr de:59:f3:a9:fa:fe 
          inet addr:192.168.2.14  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::dc59:f3ff:fea9:fafe/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4216 (4.2 KB)  TX bytes:9714 (9.7 KB)

you can now ping the N900 from Ubuntu
Code:

archebyte:~$ ping 192.168.2.15
PING 192.168.2.15 56(84) bytes of data.
64 bytes from n900 (192.168.2.15): icmp_seq=1 ttl=64 time=0.526 ms
64 bytes from n900 (192.168.2.15): icmp_seq=2 ttl=64 time=0.457 ms

6) ssh into the N900 and use the password entered when you install openssh on the N900.
Code:

ssh root@192.168.2.15
7) or use sshfs from Ubuntu using the command above

SubCore 2010-01-21 10:29

Re: View and Edit system files in Ubuntu?
 
Quote:

Originally Posted by DannStarr (Post 485048)
usb0 Link encap:Ethernet HWaddr b6:5e:7e:e9:d2:2a
inet6 addr: fe80::b45e:7eff:fee9:d22a/64 Scope:Link

there's your problem, usb0 should have the IP address you entered in /etc/network/interfaces, 192.168.2.15
it should look the same as usb0 on the N900, with a different "inet addr".

did you do "ifup usb0" beforehand?

DannStarr 2010-01-21 16:39

Re: View and Edit system files in Ubuntu?
 
Wow guys, thanks to your help i'm now in!! and I understand a bit more about how it all works. Thanks...

To my mind, I did everything I needed to do yesterday, i've not really done anything extra today to get it working - I think the problem I had was this "ifup usb0" thing, I may have activated it too soon, possibly on the laptop before plugging the phone in, and then when I would type it in time and time again I would get the message back that it was already activated.

The "obvious" point here was then looking at the output of "ifconfig usb0" when it showed that the command hadnt actually done as it should - likely due to my timing.

Starting fresh today with more of your words of wisdom got it sorted. I was able to confirm that the IP address now appeared in ifconfig, and straight away it worked. :)


All times are GMT. The time now is 10:22.

vBulletin® Version 3.8.8