nbd boot broken >4.0 [patch inside]

Questions related to network booting via PXE
regatus
Posts: 2
Joined: 27 Apr 2014, 23:41

nbd boot broken >4.0 [patch inside]

Postby regatus » 27 Apr 2014, 23:54

current sysresccd builds are not able to use nbd boot.

Code: Select all

Negotiation: ..size = [... some number ...] MBError: Exported device is too big for me. Get 64-bit machine :-(


the nbd-client in the initramfs has been updated to version 3.2, but the syntax in the "init" script is still the old one. since nbd version 3 there's an commandline option change:

Code: Select all

# old, pre 3.0:
nbd-client -N port server nbd_device

# new, post 3.0:
nbd-client server port nbd_device


post 3.0 use the "-N" option for naming exports

sysresccd 4.0 not affected, but 4.2 is.
Last edited by regatus on 04 May 2014, 09:06, edited 1 time in total.

gernot
Posts: 1127
Joined: 07 Apr 2010, 16:19

Re: nbd boot broken >4.0

Postby gernot » 30 Apr 2014, 09:27

Yes, i can second this.
If i change the nbd-client call to oldstyle in the init file the system boot after calling ". init" again.
Test this from the failsafe shell.

I did also some tests with a config file and exported /tftpboot/sysrcd.dat with the name "2000". In this case i get the negotiation error.
Looks like the file size negotiation is bad. The server send the size in bytes while the client see the number as Megabytes.

Gernot

regatus
Posts: 2
Joined: 27 Apr 2014, 23:41

Re: nbd boot broken >4.0

Postby regatus » 03 May 2014, 12:23

i've done some patching and testing:
* removal of port option, since nbd =>3.0 uses default port 10809
* added name based exports and chose "sysresccd" as export name, but we could make this name part of the nbd-url

would be great if a sysresccd developer would take a look and include this in the current beta

initramfs patch

Code: Select all

--- init.old    2014-05-03 12:09:38.489969569 +0000
+++ init        2014-05-03 12:16:45.049969416 +0000
@@ -1054,7 +1054,6 @@
 {
     nbdurl=$(echo ${NBDBOOT} | sed -e 's!nbd://!!g')
     NBD_SERVER=$(echo "${nbdurl}" | sed 's/:.*//')
-    NBD_PORT=$(echo "${nbdurl}" | sed 's/.*://')

     REAL_ROOT="nbd"
     NBD_DEVICE="/dev/nbd0"
@@ -1071,11 +1070,11 @@
     fi

     good_msg "Setting up the NBD boot device..."
-    if ! ${NBD_PROG} -N "${NBD_PORT}" "${NBD_SERVER}" "${NBD_DEVICE}" -persist
+    if ! ${NBD_PROG} "${NBD_SERVER}" "${NBD_DEVICE}" -name sysresccd -persist
     then
-        sysresccd_panic "Error: nbd-client failed to connect to ${NBD_SERVER}:${NBD_PORT}"
+        sysresccd_panic "Error: nbd-client failed to connect to ${NBD_SERVER}"
     else
-        good_msg "nbd-client successfully connected to ${NBD_SERVER}:${NBD_PORT}"
+        good_msg "nbd-client successfully connected to ${NBD_SERVER}"
     fi

     cmd="mount -t squashfs -o ro ${NBD_DEVICE} ${SQUASHFSMNT}"


update for documentation:

Code: Select all

# /etc/nbd-server/config
[generic]
   user = nbd
   group = nbd
[sysresccd]
   exportname = /path/to/sysrcd.dat

er2nai0G
Posts: 1
Joined: 07 Jan 2015, 18:46

Re: nbd boot broken >4.0 [patch inside]

Postby er2nai0G » 07 Jan 2015, 18:52

Still found in 4.4.1

Modified above patch, so the export is also taken from the nbdurl.

Something like this:

Code: Select all

netboot=nbd://192.168.178.199:systemrescuecd-x86-4.4.1.iso_sysrcd.dat


With this in nbd-server configuration:

Code: Select all

[systemrescuecd-x86-4.4.1.iso_sysrcd.dat]
    exportname = /srv/tftp/boot/linux/systemrescuecd/4.4.1/sysrc.dat
    listenaddr = 0.0.0.0
    readonly = true



Code: Select all

--- a/init   2015-01-07 19:18:25.360703752 +0100
+++ b/init   2015-01-07 19:24:39.405047122 +0100
@@ -1054,7 +1054,7 @@ sysresccd_stage2_nbd()
 {
     nbdurl=$(echo ${NBDBOOT} | sed -e 's!nbd://!!g')
     NBD_SERVER=$(echo "${nbdurl}" | sed 's/:.*//')
-    NBD_PORT=$(echo "${nbdurl}" | sed 's/.*://')
+    NBD_EXPORT=$(echo "${nbdurl}" | sed 's/.*://')
 
     REAL_ROOT="nbd"
     NBD_DEVICE="/dev/nbd0"
@@ -1071,11 +1071,11 @@ sysresccd_stage2_nbd()
     fi
 
     good_msg "Setting up the NBD boot device..."
-    if ! ${NBD_PROG} -N "${NBD_PORT}" "${NBD_SERVER}" "${NBD_DEVICE}" -persist
+    if ! ${NBD_PROG} "${NBD_SERVER}" "${NBD_DEVICE}" -name "${NBD_EXPORT}" -persist
     then
-        sysresccd_panic "Error: nbd-client failed to connect to ${NBD_SERVER}:${NBD_PORT}"
+        sysresccd_panic "Error: nbd-client failed to connect to ${NBD_SERVER}:${NBD_EXPORT}"
     else
-        good_msg "nbd-client successfully connected to ${NBD_SERVER}:${NBD_PORT}"
+        good_msg "nbd-client successfully connected to ${NBD_SERVER}:${NBD_EXPORT}"
     fi
 
     cmd="mount -t squashfs -o ro ${NBD_DEVICE} ${SQUASHFSMNT}"


(Also documentation in http://www.sysresccd.org/Sysresccd-manu ... rk_booting
mentions old style port usage shortly.)

luisguillenc
Posts: 1
Joined: 11 Feb 2015, 16:08

Re: nbd boot broken >4.0 [patch inside]

Postby luisguillenc » 11 Feb 2015, 18:30

Thanks for the patch.

I tested in version 4.5.1 and remains broken.
I do not understand why they do not fix this bug. This bug is easy to solve and makes absolutely unusable boot via nbd.

regards

echo083
Posts: 7
Joined: 20 Jun 2012, 23:47

Re: nbd boot broken >4.0 [patch inside]

Postby echo083 » 14 Sep 2015, 18:35

Hello,

I'm using nbd for netboot so I'm stuck with latest <4.0.
Please fix if possible.

Thanks

echo083
Posts: 7
Joined: 20 Jun 2012, 23:47

Re: nbd boot broken >4.0 [patch inside]

Postby echo083 » 14 Sep 2015, 20:08

Sorry in fact it's working here my configuration files :

/etc/nbd-server/config

Code: Select all

[generic]
user=nbd
group=nbd

[sysrescd]
exportname=/srv/tftp/sysrescd/sysrcd.dat


in the APPEND line of the file loaded by the tftp client :

Code: Select all

nbdboot=$nbd_server_ip:sysrescd32


replace $nbd_server_ip with your own ip server address and remove any netboot option


Return to “Network Boot via PXE”

Who is online

Users browsing this forum: No registered users and 2 guests