Jump to content

System zainstalowany po NFS - jak to ugryźć?


Recommended Posts

Witam

Widziałem parę wpisów @tux-a wskazujących możliwość uruchamiania systemu zainstalowanego na NFS.

Jak to ugryźć?

 

Miałbyś ktoś czas i chęci opisać jakie wpisy winny być w ENV i które oznaczają miejsce systemu na NFS a które nBOX-a?

Pytanie kieruję głównie do @tux-a, który z tego korzysta.

 

set bootdesc_0 USbA
set bootcmd_0 'run bootargs_0; run bootkern_0'
set bootkern_0 'usb reset; ext2load usb 0:1 a5000000 /boot/uImage; bootm a5000000'
set bootargs_0 "set bootargs console=ttyAS0,115200 root=/dev/sda1 rw mem=128m coprocessor_mem=4m@0x10000000,4m@0x10400000 rootdelay=6 init=/bin/devinit"

...

set bootdesc_6 NFS
set bootcmd_6 'run bootargs_6; run bootkern_6'
set bootkern_6 'nfs a5000000 192.168.2.100:/opt/NBOX/release/boot/uImage;bootm a5000000'
set bootargs_6_1 "console=ttyAS0,115200 root=/dev/nfs nfsroot=/opt/NBOX/release,tcp rw ip=192.168.2.200:192.168.2.100:192.168.2.1:255.255.255.0:nbox:eth0:off"
set bootargs_6 "set bootargs $bootargs_6_1 mem=128m coprocessor_mem=4m@0x10000000,4m@0x10400000 nwhwconf=device:eth0,hwaddr:00:11:22:33:44:55 init=/bin/devinit"
[code]

Znalazłem kilka informacji o NFS i konfiguracji ale jak skonfigurować nBOX-a i odwołania w ENV, nie mam pojęcia.

 

Znalazłem trochę informacji na http://www.stlinux.com/u-boot/kernel-booting

 

Booting The Linux Kernel With A NFS Root Filesyste

This example shows how to setup U-Boot, to boot a linux kernel (resident in flash) with an NFS mounted root filesystem. It is assumed that all the network parameters for U-Boot (that is: "ipaddr", "serverip", "gatewayip", "netmask" and "ethaddr") are still correct for linux, and were appropriately setup as per the example in Network Setup. This example will use eth0, with /dev/ttyAS0 as the serial console device, with 128MiB of memory.

 

MB618> setenv hostname my-target
MB618> setenv ip ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
MB618> setenv nfsroot nfsroot=/opt/STM/STLinux-2.3/devkit/sh4/target
MB618> setenv nfsroot ${nfsroot},nfsvers=2,rsize=4096,wsize=8192,tcp
MB618> setenv nwhwconf nwhwconf=device:eth0,hwaddr:${ethaddr}
MB618> setenv bootargs console=ttyAS0,115200 mem=128M
MB618> setenv bootargs ${bootargs} ${ip} ${nwhwconf}
MB618> setenv bootargs ${bootargs} rw root=/dev/nfs ${nfsroot}
MB618> saveenv
Saving Environment to Flash...
Unprotecting Flash...
. done
Un-Protected 1 sectors Erasing Flash...
. done
Erased 1 sectors
Writing to Flash...
........ done
Protecting Flash...
. done
Protected 1 sectors

 

Once the linux command-line parameters are safely saved to non-volatile storage, then the kernel may be booted from flash, and U-Boot will automatically pass the contents of the expanded environment variable "bootargs" to the kernel. This expansion takes place just before control is passed from U-Boot to linux. So, if the kernel is stored in flash at an address of 0xA0060000, then the following is sufficient to boot it.

 

MB618> bootm A0060000
## Booting image at a0060000 ...
Image Name: Linux-2.6.23.17_stm23_0117-mb618
Image Type: SuperH Linux Kernel Image (gzip compressed)
Data Size: 1845268 Bytes = 1.8 MiB
Load Address: 8c001000
Entry Point: 8c002000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting kernel console=ttyAS0,115200 mem=128M ip=164.129.15.15:164.129.15.56:0.0.0.0:255.255.248.0:my-target:eth0:off nwhwconf=device:eth0,hwaddr:AA:00:04:00:0F:0F rw root=/dev/nfs nfsroot=/opt/STM/STLinux-2.3/devkit/sh4/target,nfsvers=2,rsize=4096,wsize=8192,tcp - 0x00000000 - 0 ...
Linux version 2.6.23.17_stm23_0117-mb618-mb618 ([email]products@macaroni.bri.st.com[/email]) (gcc version 4.2.4 (snapshot) (STMicroelectronics/Linux Base 4.2.4-42)) #1 PREEMPT Tue Oct 21 00:43:26 BST 2008   ... (rest omitted)

 

@tux temat wyjaśnił tu http://forum.xunil.pl/index.php/topic,81.msg4696.html#msg4696

Link to comment
Share on other sites

  • 6 months later...

Po NFS bootuje się rootfs. Szukaj co nie tak jest po stronie serwera lub boxa.

 

 

Na początek co masz w /etc/exports?

U mnie dla jednego z boxów siedzi to:

/media/satbox/tuxish	 192.168.1.9(no_root_squash,rw)

Potem sprawdź prawa dostępu oraz użytkownika i grupę czy jest OK. Na koniec czy serwer NFS widać poprawnie a zasoby się montują. Na koniec zerknij po debug co "mówi" u-boot.

Link to comment
Share on other sites

Guest hdmidvb

serwer mam postawiony na rpi

zawartość /etc/exports i prawa pliku

root@raspberrypi:/etc# ls -l /etc/exports

-rw-r--r-- 1 root root 432 Dec 28 10:59 /etc/exports

root@raspberrypi:/etc# cat /etc/exports

# /etc/exports: the access control list for filesystems which may be exported

#              to NFS clients.  See exports(5).

#

# Example for NFSv2 and NFSv3:

# /srv/homes      hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)

#

# Example for NFSv4:

# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)

# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)

#

/srv/nbox 192.168.7.18(no_root_squash,rw)

 

root@raspberrypi:/etc#

Prawa i pliki /srv/nbox

root@raspberrypi:/srv# ls -l

total 4

drwxr-xr-x 21 root root 4096 Dec 23 18:20 nbox

root@raspberrypi:/srv# ls -l nbox/

total 112

drwxr-xr-x  2 root root  4096 Dec 23 18:20 bin

drwxr-xr-x  2 root root  4096 Dec 23 18:20 boot

drwxr-xr-x  8 root root 20480 Dec 23 18:20 dev

drwxr-xr-x  2 root root  4096 Dec 23 18:20 dev.static

drwxr-xr-x 13 root root  4096 Dec 23 18:20 etc

drwxr-xr-x  2 root root  4096 Dec 23 18:20 hdd

drwxr-xr-x  7 root root  4096 Dec 23 18:20 lib

drwx------  2 root root  4096 Dec 23 18:20 lost+found

drwxr-xr-x  5 root root  4096 Dec 23 18:20 media

drwxr-xr-x  6 root root  4096 Dec 23 18:20 mnt

drwxr-xr-x  2 root root  4096 Dec 23 18:20 proc

drwxr-xr-x  2 root root  4096 Dec 23 18:20 ram

-rw-r--r--  1 root root  6344 Dec 23 18:20 readme.txt

-rw-r--r--  1 root root  4764 Dec 23 18:20 release.txt

drwxr-xr-x  3 root root  4096 Dec 23 18:20 root

drwxr-xr-x  2 root root  4096 Dec 23 18:20 sbin

drwxr-xr-x  2 root root  4096 Dec 23 18:20 share

drwxr-xr-x  2 root root  4096 Dec 23 18:20 sys

drwxr-xr-x  2 root root  4096 Dec 23 18:20 tmp

drwxr-xr-x 10 root root  4096 Dec 23 18:20 usr

drwxr-xr-x 12 root root  4096 Dec 23 18:20 var

Wcześniej odpowiednio zmieniłem jak już pisałem boota ustawiająć odpowiednie adresy ip:

ip tunera 192.168.7.X

ip rpi 192.168.7.Y

Link to comment
Share on other sites

Guest hdmidvb

Da się zrobić debug inaczej niż podłączając się pod płyte?

w /boot jest uImage

root@raspberrypi:/srv/nbox/boot# ls -l uImage

-rw-r--r-- 1 root root 1872957 Dec 23 18:20 uImage

Normalnie uruchamiam boxa z pendriva (usbb) i z tego pendriva skopiowałem wszystkie pliki do rpi. Chciałem spróbować jak system chodzi po nfs z czystej ciekawości.

edit:

Debug mówi:

Board: Nbox  [29-bit mode] by FREEBOX

 

 

U-Boot 1.3.1 (Nov  7 2011 - 15:35:30) - stm23_0053

 

DRAM:  128 MiB

NOR:    4 MiB

NAND:  64 MiB

In:    serial

Out:  serial

Err:  serial

Hit any key to stop autoboot:  0

Using MAC Address [shadow=red,left]tajne :)[/shadow]

File transfer via NFS from server 192.168.7.Y; our IP address is 192.168.7.X

Filename '/srv/nbox/boot/uImage'.

Load address: 0xa5000000

Loading: *

ARP Retry count exceeded; starting again

File transfer via NFS from server 192.168.7.Y; our IP address is 192.168.7.X

Filename '/srv/nbox/boot/uImage'.

Load address: 0xa5000000

Loading: *

ARP Retry count exceeded; starting again

Link to comment
Share on other sites

Guest hdmidvb

Wrzuć sekcję NFS od uboota jako CODE.

Chodzi o to?:

set bootdesc_6 NFS
set bootcmd_6 'run bootargs_6; run bootkern_6'
set bootkern_6 'nfs a5000000 192.168.7.Y:/srv/nbox/boot/uImage;bootm a5000000'
set bootargs_6_1 "console=ttyAS0,115200 root=/dev/nfs nfsroot=/srv/nbox,tcp rw ip=192.168.7.X:192.168.7.Y:192.168.7.Z:255.255.255.0:nbox:eth0:off"
set bootargs_6 "set bootargs $bootargs_6_1 mem=128m coprocessor_mem=4m@0x10000000,4m@0x10400000 nwhwconf=device:eth0,hwaddr:${ethaddr} init=/bin/devinit"
set serverip 192.168.7.Y
set ipaddr 192.168.7.X

Link to comment
Share on other sites

Tak na szybko myśląc:

[*]uboot łączy się i pobiera uImage

[*]uboot ładuje uImage

[*]uImage (jądro) odpala DHCP i zonk - brak odpowiedzi i jądro nie wie jak ustawić adresy

Ale mogę się mylić. U mnie od zawsze stał serwer DHCP bo NFS stoi na całym serwerze domowym i jak tuner odpalał się to zawsze dostawał adres IP z DHCP (przypisany do adresu MAC).

Link to comment
Share on other sites

Guest hdmidvb

Próbowałęm parę dystrybucji rpi, parę linuxów na virtual boxie, również na innym switchu, niestety bez sukcesu.

Z tego jak ja widzę log z debuga, to uboot nawet nie potrafi pobrać uImage. Jakby się odpaliło tak jak to robi normalnie to sobie znajdzie przecież dhcp w sieci. Wcześniej ustawiamy ręcznie adresy w uboocie więc dhcp jest teoretycznie niepotrzebne.

Nie potrzeba na serwerze jeszcze czegoś ustawić, np. TFTP? Albo /etc/host.allow albo jakieś inne wpisy jeszcze?

Link to comment
Share on other sites

Spróbuj jeszcze dać w /etc/eports:

/srv/nbox 192.168.7.18(no_root_squash,rw,insecure)

 

I jeszcze sprawdź czy masz poprawne wpisy w env dotyczące sieci:

setenv ipaddr 192.168.7....;
setenv serverip 192.168.7....;
setenv gatewayip 192.168.7....;
setenv gateway 192.168.7....;
setenv netmask 255.255.255.0;

Nie wiem czy to ma znaczenie, ale warto sprawdzić.

 

Kiedyś odpalałem nboxa pod nfs i poszło bez problemu.

Link to comment
Share on other sites

Kiedyś też ktoś miał problem z NFS. Nie pamiętam czy tu na forum niestety.

Czy jest to pełny serwer NFS czy jakaś okrojona wariacja?

 

 

U mnie siedzi dokładnie to:

 

             ###               /       `\   |   |        /       `\            
            #o#o#             /______    |  |   |       /______    `\          
            # V #              .----_)   |  |   |        .---. `\    |         
           #     ##            |         /  |   |        |   |   |   |         
          #       ##           |    ___/'   |   |______  |   |__/'   |         
          Q#      #Q           |   |        |         /  |          /'         
         QQQQ#   #QQQ          |___|        |________/   |________/'           
          QQQ####QQQ                                                           
                                                                              
                             PLD Linux Distribution                           
                        Homepage: http://www.pld-linux.org/                      


   Linux wersja 3.10.10-1, skompilowany #1 SMP Fri Aug 30 00:25:45 CEST 2013
     Jeden procesor AMD Athlon 1GHz, 1008M RAM, łącznie 2000,00 bogomips
                       Działa 37 dni 4 godziny 46 minut
                                     xunil

Dodatkowo:

 

nfs-utils-common-1.2.8-1.i686

nfs-utils-1.2.8-1.i686

 

 

Nie licząc  DHCP, FTP, WWW, PHP, MySQL, MPD, Iptables, Inne

Link to comment
Share on other sites

Guest hdmidvb

Spróbuj jeszcze dać w /etc/eports:

/srv/nbox 192.168.7.18(no_root_squash,rw,insecure)

 

I jeszcze sprawdź czy masz poprawne wpisy w env dotyczące sieci:

setenv ipaddr 192.168.7....;
setenv serverip 192.168.7....;
setenv gatewayip 192.168.7....;
setenv gateway 192.168.7....;
setenv netmask 255.255.255.0;

Nie wiem czy to ma znaczenie, ale warto sprawdzić.

 

Kiedyś odpalałem nboxa pod nfs i poszło bez problemu.

 

Wpis w /etc/exports powinien byc ok bo ręcznie mi się montuje, tzn. z poziomu softu. Co innego z poziomu uboota.

Jak sprawdzić wpisy w env, ewentualnie jak je edytować?

Link to comment
Share on other sites

Nigdy nie próbowałem tego sprawdzać. Jeśli możesz podłączyć sie do DEBUG, to odpal i spróbuj w terminalu

askenv
lub
printenv

A jak nie masz kabla, to po prostu załaduj nowe env, w którym wpiszesz poprawne dane.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...