OpenWrt Forum Archive

Topic: Setting up a wl-500gP with Kamikaze (AP-mode, samba, DHCP-Server)

The content of this topic has been archived between 26 Mar 2018 and 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

pivot /mnt /mnt is correct.  It just means make /mnt the new root and put the old root in the new /mnt

"pivot" by itself is not a command...it's a function in /bin/firstboot which is called by the new /sbin/init

Bilkid wrote:

so this:
root@AsusGP:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
none on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /jffs type jffs2 (rw)
/jffs on / type mini_fo (rw)
/dev/scsi/host0/bus0/target0/lun0/part1 on /mnt/sea100 type ext3 (rw)
/dev/scsi/host0/bus0/target0/lun0/part5 on /mnt/sea200 type ext3 (rw)
/dev/scsi/host0/bus0/target0/lun0/part6 on /mnt/sea300 type ext3 (rw)
none on /proc/bus/usb type usbfs (rw)


says I'm not set?

brucebertrand and others, we newbies sure appreciate your help.

I still don't get it though, how can you tell from Bilkid's output that you are booting from the USB memory stick and not the built-in flash?
For example, what does "rootfs on / type rootfs (rw)" indicate?

Update
I've tried booting with and without the memory stick and capturing the output of mount in each case. The only thing differing is:

Booting with memory stick:
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /proc type proc (rw)
none on /rom/sys type sysfs (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
tmpfs on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
/dev/mtdblock3 on /jffs type jffs2 (rw)
/jffs on / type mini_fo (rw)
none on /proc/bus/usb type usbfs (rw)


Booting without memory stick attached:
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
tmpfs on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
/dev/mtdblock3 on /jffs type jffs2 (rw)
/jffs on / type mini_fo (rw)
none on /proc/bus/usb type usbfs (rw)


The single line differing is highlighten. Does this mean I am in fact booting off the stick when it is attached..?


Another comment:
It seems that with Kamikaze 7.07 the memory stick does not show up as /dev/scsi/..., but rather as /dev/sda and /dev/sda1.
Can anyone confirm that this is correct, and that on 7.07 with 2.6.22 you should use /dev/sda or /dev/sda1 instead?
But which one?



Many thanks..

(Last edited by mountaindude on 13 Aug 2007, 19:45)

Some additional info:

The output from logread indicate there is something going wrong during initialization of the memory stick.
Anyone know what the error means?

root@mini:~# logread
r.info kernel: uhci_hcd 0000:00:03.1: UHCI Host Controller
Jan  1 00:01:12 mini user.info kernel: uhci_hcd 0000:00:03.1: new USB bus registered, assigned bus number 2
Jan  1 00:01:12 mini user.info kernel: uhci_hcd 0000:00:03.1: irq 6, io base 0x00000120
Jan  1 00:01:12 mini user.info kernel: usb usb2: configuration #1 chosen from 1 choice
Jan  1 00:01:12 mini user.info kernel: hub 2-0:1.0: USB hub found
Jan  1 00:01:12 mini user.info kernel: hub 2-0:1.0: 2 ports detected
Jan  1 00:01:12 mini user.info kernel: usb 1-1: new full speed USB device using uhci_hcd and address 2
Jan  1 00:01:12 mini user.err kernel: usb 1-1: device descriptor read/64, error -71
Jan  1 00:01:12 mini user.warn kernel: PCI: Enabling device 0000:00:03.2 (0000 -> 0002)
Jan  1 00:01:12 mini user.warn kernel: PCI: Fixing up device 0000:00:03.2
Jan  1 00:01:12 mini user.info kernel: ehci_hcd 0000:00:03.2: EHCI Host Controller
Jan  1 00:01:12 mini user.info kernel: ehci_hcd 0000:00:03.2: new USB bus registered, assigned bus number 3
Jan  1 00:01:12 mini user.info kernel: ehci_hcd 0000:00:03.2: irq 6, io mem 0x40000000
Jan  1 00:01:12 mini user.info kernel: ehci_hcd 0000:00:03.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
Jan  1 00:01:12 mini user.info kernel: usb usb3: configuration #1 chosen from 1 choice
Jan  1 00:01:12 mini user.info kernel: hub 3-0:1.0: USB hub found
Jan  1 00:01:12 mini user.info kernel: hub 3-0:1.0: 4 ports detected
Jan  1 00:01:13 mini user.notice kernel: SCSI subsystem initialized
Jan  1 00:01:13 mini user.info kernel: Initializing USB Mass Storage driver...
Jan  1 00:01:13 mini user.info kernel: usbcore: registered new interface driver usb-storage
Jan  1 00:01:13 mini user.info kernel: USB Mass Storage support registered.
Jan  1 00:01:13 mini user.info kernel: usb 1-1: new full speed USB device using uhci_hcd and address 3
Jan  1 00:01:14 mini user.info kernel: usb 1-1: not running at top speed; connect to a high speed hub
Jan  1 00:01:14 mini user.info kernel: usb 1-1: configuration #1 chosen from 1 choice
Jan  1 00:01:14 mini user.info kernel: scsi0 : SCSI emulation for USB Mass Storage devices
Jan  1 00:01:14 mini user.debug kernel: usb-storage: device found at 3
Jan  1 00:01:14 mini user.debug kernel: usb-storage: waiting for device to settle before scanning
Jan  1 00:01:15 mini user.info : Illegal instruction
Jan  1 00:01:16 mini user.info : /sbin/hotplug-call: /etc/hotplug.d/usb/10-usb-storage: 12: /sbin/usb-storage: Permission denied

Jan  1 00:01:17 mini cron.notice crond[1671]: crond 2.3.2 dillon, started, log level 8
Jan  1 00:01:17 mini authpriv.info dropbear[1675]: Running in background
Jan  1 00:01:19 mini user.notice kernel: scsi 0:0:0:0: Direct-Access     USB 2.0  Flash Disk       2.00 PQ: 0 ANSI: 2
Jan  1 00:01:19 mini user.notice kernel: sd 0:0:0:0: [sda] 517376 512-byte hardware sectors (265 MB)
Jan  1 00:01:19 mini user.notice kernel: sd 0:0:0:0: [sda] Write Protect is off
Jan  1 00:01:19 mini user.debug kernel: sd 0:0:0:0: [sda] Mode Sense: 0b 00 00 08
Jan  1 00:01:19 mini user.err kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:01:19 mini user.notice kernel: sd 0:0:0:0: [sda] 517376 512-byte hardware sectors (265 MB)
Jan  1 00:01:19 mini user.notice kernel: sd 0:0:0:0: [sda] Write Protect is off
Jan  1 00:01:19 mini user.debug kernel: sd 0:0:0:0: [sda] Mode Sense: 0b 00 00 08
Jan  1 00:01:19 mini user.err kernel: sd 0:0:0:0: [sda] Assuming drive cache: write through
Jan  1 00:01:19 mini user.info kernel:  sda1
Jan  1 00:01:19 mini user.notice kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
Jan  1 00:01:19 mini user.debug kernel: usb-storage: device scan complete


/sbin/init is as follows:


#!/bin/sh

boot_dev="/dev/sda1"

# /sbin/udevtrigger

/sbin/hotplug2 --persistent &
echo /sbin/hotplug-call > /proc/sys/kernel/hotplug

# for module in usbcore usb-ohci ehci-hcd uhci-hcd scsi_mod sd_mod usb-storage jbd ext3 ; do {
for module in usbcore ehci-hcd scsi_mod sd_mod usb-storage jbd ext3 ; do {
       insmod $module
}; done

echo "pos 0:" > /blog
date >> /blog
sleep 10s
#mount $boot_dev /mnt -t ext3 -o rw,noatime
umount /dev/sda1

sleep 10s
mount /dev/sda1 /mnt -t ext3 -o rw,noatime
sleep 15s
echo "pos 1:" >> /blog
date >> /blog

# if everything looks ok, do the pivot root
[ -x /mnt/sbin/init ] && {
        echo "pos 1.5:" >> /blog
        date >> /blog
        . /bin/firstboot
        pivot /mnt /mnt
        echo "pos 2:" >> /blog
        date >> /blog
}

echo "pos 3:" >> /blog
date >> /blog
exec /bin/busybox init
echo "pos 4:" >> /blog
date >> /blog

Only thing that ever shows up in the /blog file is

Sat Jan  1 00:00:05 UTC 2000
pos 1:
Sat Jan  1 00:00:41 UTC 2000
pos 3:
Sat Jan  1 00:00:56 UTC 2000

Ok, a lot of time later I have come to realize what was causing my issues. As I've noticed on the forum that others have had similar (same?) problems, I'll write a few lines.

Make sure you edit the config files not only on the router, but also on the USB stick!
Turned out my system booted fine off the stick, but the /etc/config/network file on the stick was the same as the original install when flashing the system, i.e. not reflecting the network setup.
No wonder I couldn'g connect to the router when it had booted with the USB stick....

And oh, I have exactly the same system setup as described in the howto, including same IP numbers. Only difference is that I use fixed IPs on the LAN side of the OpenWRT router, rather than DHCP. Also Wireless is disabled.

Once I made sure the /etc/config/network file on the built-in flash and on the USB stick were the same, all was fine.

Good luck!

Wow, just wanted to say thanks. I updated my router to kamikaze a few weeks back and could not get samba to work for the life of me, even though it worked fine on the same config in whiterussian. Wasn't until I found this tutorial that I noticed it was because of the lack of a line in /etc/hosts.

I followed your usb-stick guide. It seems to boot of from the stick at reboot. But when i run ipkg it reads the native ipkg.conf file and not the /mnt/etc/ipkg.conf file. So my old ipkg.conf resides on the usbstick and i got a new one in /etc.

This is confusing.

root@OpenWrt:/mnt# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
none                        15         0        15   0% /tmp
/dev/mtdblock/4              6         4         2  66% /jffs
mini_fo:/jffs                1         1         0 100% /mnt
/dev/scsi/host0/bus0/target0/lun0/part1       917        21       849   2% /


root@OpenWrt:/mnt# mount
rootfs on / type rootfs (rw)
/dev/root on /mnt/rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
none on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /jffs type jffs2 (rw)
mini_fo:/jffs on /mnt type mini_fo (rw)
/dev/scsi/host0/bus0/target0/lun0/part1 on / type ext3 (rw)
none on /proc/bus/usb type usbfs (rw)

/tmp        none                  9%      1388KiB of 15256KiB
/jffs        /dev/mtdblock/4     66%      4028KiB of 6144KiB
/mnt       mini_fo:/jffs          100%      1216KiB of 1216KiB
/            /dev/scsi/host0/bus0/target0/lun0/part1     3%  24578KiB of 938575KiB

next problem:

root@OpenWrt:~# openvpn --genkey --secret static.key
openvpn: can't load library 'libssl.so.0.9.8'

root@OpenWrt:~# find / -name libssl*
/jffs/usr/lib/libssl.so.0.9.8
/mnt/usr/lib/libssl.so.0.9.8
/tmp/usr/lib/libssl.so.0.9.8

root@OpenWrt:~# openvpn 
openvpn: can't load library 'libssl.so.0.9.8'

its there but openvpn cant find it. So then there is a major problem on my setup or this howto needs a revision.

fixed it:

edit /etc/profile (i prefer nano editor) to:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/bin:/mnt/sbin:/mnt/usr/bin:/mnt/usr/sbin:/mnt/bin:/mnt/sbin
export HOME=/mnt/tmp
export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/usr/lib:/mnt/lib

save and exit. and then run " . /etc/profile " from the shell (without ").

hmm, I think I'm not booting from the usb-stick!?

This is my output from df -m command (just after reboot):

root@OpenWrt:/sbin# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
none                        15         0        15   0% /tmp
/dev/mtdblock/4              6         1         5  13% /jffs
mini_fo:/jffs                2         2         0 100% /
root@OpenWrt:/sbin#

Shouldn't the last line contain the usb device?

This is what mount says;

root@OpenWrt:/sbin# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
none on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /jffs type jffs2 (rw)
mini_fo:/jffs on / type mini_fo (rw)
none on /proc/bus/usb type usbfs (rw)
root@OpenWrt:/sbin#

Any ideas?

are you able to mount your stick, when the router is running?
try a pivot when the stick is already mounted

Yes, no problem to mount the stick during normal run! And I can browse the filesystem that is on it.

Pivot, thats something new for me... whats that? smile
(I'm still learning, will search and read about it, any good links?)

spelth wrote:

are you able to mount your stick, when the router is running?
try a pivot when the stick is already mounted

Have you already read this tutorial? (Section 1, boot from USB-Stick)

OpenWrt does not mount your usb-stick automatically as root-partition.

Pivot uses pivot_root: http://linux.die.net/man/2/pivot_root
and is implemented in /bin/firstboot

Thanks for the info! But I've done exactly what says in the tutorial. The problem might be that the USB-stick does not mount during boot, because its not mounted when I ssh into the router. After mounting it I do pivot with the following command;

root@OpenWrt:/bin# firstboot pivot /mnt /mnt
firstboot has already been run
jffs2 partition is mounted, only resetting files
root@OpenWrt:/bin# df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
none                        15         0        15   0% /tmp
/dev/mtdblock/4              6         0         5   6% /jffs
mini_fo:/jffs                2         2         0 100% /
/dev/scsi/host0/bus0/target0/lun0/part1        62         9        50  15% /mnt
root@OpenWrt:/bin#
spelth wrote:

Have you already read this tutorial? (Section 1, boot from USB-Stick)

OpenWrt does not mount your usb-stick automatically as root-partition.

Pivot uses pivot_root: http://linux.die.net/man/2/pivot_root
and is implemented in /bin/firstboot

What does happen when you run only the pivot_root /mnt /mnt?

Hi,

I've followed this tutorial on a Asus WL500gP running Kamikaze 7.09 but can't boot from the key I'm using. In the tutorial you mention that things are different when using USB1 instead of USB2, I think that my key is USB1 since it's old. When you spoke about things being different with USB1 did you mean when using a router that has USB1 or when using a USB key that uses USB1 ? I am able to mount and write files to the USB key but whenever I try booting off it the unit seems to freeze yet if I insert it after booting I can mount it and use it correctly.

Regards,

John Gillespie

spelth wrote:

But then samba wouldn't start, because it looks for your Router's name and IP.
So wee need to add a line to /etc/hosts
(this is my /etc/hosts: SR-71 is my Router's name)

127.0.0.1 localhost
192.168.2.1 SR-71

Then you should able to ping yourself with

root@SR-71:~# ping sr-71
PING SR-71 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: icmp_seq=0 ttl=64 time=0.7 ms
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=0.4 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=0.4 ms
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=3.7 ms

--- SR-71 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.4/1.3/3.7 ms

If this was successful, you can edit the
/etc/samba/smb.conf
actually, your /tmp is shared.

And now, turn on SAMBA with

/etc/init.d/samba start

thanks smile
i was missing this

Well still problem with Windows Vista ...
And in XP it asks me for user/pass, put root/pass and it didnt worked.

I'm trying to install Samba3

root@OpenWrt:/mnt/disc0_2$ ipkg install samba_3.0.28-2_mipsel.ipk
Installing samba (3.0.28-2) to root...
package samba suggests installing cups
Nothing to be done
An error ocurred, return value: 1.
Collected errors:
ERROR: Cannot satisfy the following dependencies for samba:
         popt readline gnutls openldap-libs

Going to try to install these packages smile

The discussion might have continued from here.