mktape error: Structure of MAM incorrect size: 1016

GNU General Public License Linux disk based Virtual Tape Library
Developed by Mark Harvey - markh794@gmail.com
To get started, go to: http://sites.google.com/site/linuxvtl2/

mktape error: Structure of MAM incorrect size: 1016

Postby nia » Thu Dec 17, 2009 10:48 pm

mktape fails in mhvtl version 0.18.1 :


Code: Select all
+ [ ! -f /opt/vtl/ULT009L1 ]
+ su vtl -c 'mktape -s 500 -t data -m ULT009L1 -d LTO1'
Structure of MAM incorrect size: 1016
User avatar
nia
Forum Founder
 
Posts: 242
Joined: Sat Dec 12, 2009 12:51 pm
Location: MI, USA

Re: mktape error: Structure of MAM incorrect size: 1016

Postby w_r52 » Tue Dec 22, 2009 12:22 am

I am hving the same issue aslo .. mktape is broken in version 0.18.1.
w_r52
Member
 
Posts: 20
Joined: Thu Dec 17, 2009 2:35 pm

Re: mktape error: Structure of MAM incorrect size: 1016

Postby rami766 » Fri Jan 08, 2010 2:01 pm

This is not happening for me when using (Fedora 12) 2.6.31.9-174.fc12.x86_64 !
Rami
rami766
Member
 
Posts: 39
Joined: Sat Aug 14, 2010 12:04 am

Re: mktape error: Structure of MAM incorrect size: 1016

Postby nia » Fri Jan 08, 2010 10:34 pm

I think we are getting that in version 0.18.1 Development version (mhvtl-2009-12-15.tgz (Note: Same features as 0.16-11 / 2009-12-16.tgz), however it is not doing the same in Fedora 12 as you mentioned.

I actually got it to work and start finally .. /usr/bin/make_vtl_media was fine. I have to modify a couple of things in /etc/init.d/mhvtl script that were giving errors when starting mhvtl as:

Script did not like the code chown -R $USER:$USER /dev/mhvtl0[0-9], so changed it to the following for now:
Code: Select all
        # Now correct file permissions..
        chown -R $USER:$USER /dev/mhvtl0
        chown -R $USER:$USER /dev/mhvtl1
        chown -R $USER:$USER /dev/mhvtl2
        chown -R $USER:$USER /dev/mhvtl3
        chown -R $USER:$USER /dev/mhvtl4



And
make_vtl_media $USER was returning the wrong code, so it will exit before starting the mhvtl, although it works fine by itself. So, I removed the exit statement in the code for now.

Code: Select all
        # Build Library media
        make_vtl_media $USER
        #if [ $? != 0 ]; then
        #       echo "make_vtl_media failed.."
        #       exit 1
        #fi



Code: Select all
[root@vtl]# /etc/init.d/mhvtl start
vtltape: version 0.18.1
vtltape: version 0.18.1
vtltape: version 0.18.1
vtltape: version 0.18.1
vtllibrary: version 0.18.1
vtllibrary process PID is 9655

[root@vtl]# lsscsi -g
[1:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda   /dev/sg0
[2:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0   /dev/sg1
[3:0:0:0]    mediumx SPECTRA  PYTHON           5500  /dev/sch0  /dev/sg6
[3:0:1:0]    tape    QUANTUM  SDLT600          5500  /dev/st0   /dev/sg2
[3:0:2:0]    tape    QUANTUM  SDLT600          5500  /dev/st1   /dev/sg3
[3:0:3:0]    tape    IBM      ULT3580-TD4      5500  /dev/st2   /dev/sg4
[3:0:4:0]    tape    IBM      ULT3580-TD4      5500  /dev/st3   /dev/sg5
~nia
User avatar
nia
Forum Founder
 
Posts: 242
Joined: Sat Dec 12, 2009 12:51 pm
Location: MI, USA

Re: mktape error: Structure of MAM incorrect size: 1016

Postby bartoque » Sat Jan 09, 2010 6:58 am

nia wrote:I actually got it to work and start finally .. /usr/bin/make_vtl_media was fine. I have to modify a couple of things in /etc/init.d/mhvtl script that were giving errors when starting mhvtl as:


Same here on 0.16.11. Even with above changes (however changing chown command for /dev/mhvtl[0-9] devs was not needed in my case) when trying to run mhvtl 0.16.11 (running Ubuntu 9.10 within VMware) mktape still causes the "MAM incorrect size" error when the /etc/init.d/mhvtl script is started. Even though now the vtl processes start (as startup doesn't exit anymore when experiencing the make_vtl_media script issue that is caused by mktape), devices are created and lsscsi shows the devices created by the default setup. But without media being created in /opt/vtl/ it is not very useful...

mktape error also occurs without using any params.
Code: Select all
# mktape
Structure of MAM incorrect size: 1016
bartoque
Registered
 
Posts: 4
Joined: Sat Jan 09, 2010 4:52 am

Re: mktape error: Structure of MAM incorrect size: 1016

Postby planetsurfer » Sat Jan 09, 2010 10:48 am

Hi,

I have the same issue on centos 5.4 i586 mhvtl-0.16-11 and mhvtl-0.18-1.

# mktape
Structure of MAM incorrect size: 1016


Any ideas?
Thank

Kevin
planetsurfer
Registered
 
Posts: 2
Joined: Sat Jan 09, 2010 10:09 am

Re: mktape error: Structure of MAM incorrect size: 1016

Postby nia » Sat Jan 09, 2010 2:27 pm

No idea yet, I am trying to get a word on this from the Developer.
If you can try other Linux distribution as Fedora12 for now, will get you thru this error. Others may work also.
Last I tried, Fedora 12 on Sun VirtualBox got mhvtl-0.18-1all running.
~nia
User avatar
nia
Forum Founder
 
Posts: 242
Joined: Sat Dec 12, 2009 12:51 pm
Location: MI, USA

Re: mktape error: Structure of MAM incorrect size: 1016

Postby frank » Sat Jan 09, 2010 2:53 pm

Hi there,

I got the same error for "mhvtl-0.16-11" using Ubuntu 9.10 Netbook Remix. I used http://sites.google.com/site/linuxvtl2/mhvtl-2009-12-16.tgz?attredirects=0.

For some time I was puzzled, because I checked several scripts and the source code and didn't find
any hint. But the hint is the error message itself.

"mktape error: Structure of MAM incorrect size: 1016"

It just says, that the MAM (Medium Auxiliary Memory) structure has an incorrect size. Looking into
"[...]/mhvtl-0.16/usr/mktape.c" in line 216, there's a check that makes sure that the program exits (and returns 2)
if the MAM structure's size is less than 1024 bytes. It returns the error message above for this error.

Code: Select all
216    if (sizeof(struct MAM) != 1024) {
217        printf("Structure of MAM incorrect size: %d\n",
218            (int)sizeof(struct MAM));
219        exit(2);
220    }


"mktape" also returns this error if called directly, so the error is not induced by parameters. So I checked
the includes for a definition of the MAM structure. I found it in "[...]/mhvtl-0.16/usr/vtllib.h". It starts in line
316, but the interesting thing is located in line 371. There, a padding ist defined to fill up the structure's size
to 1024 bytes.

Code: Select all
370   /* Pad to keep MAM to 1024 bytes */
371   uint8_t pad[1024 - 888];


Now the quick and dirty solution, if the MAM structure has a size of 1016 bytes, but should have 1024, the padding
is too small (8 bytes are missing). Hence one has to correct this by changing the difference "1024 - 888" to
"1024 - 880".

Code: Select all
370     /* Pad to keep MAM to 1024 bytes */
-371    uint8_t pad[1024 - 888];
+371    uint8_t pad[1024 - 880];


You can also count the number of bytes the data part of the MAM structure takes (but remember, "uint16_t"
is defined as "unsigned int", and on 32 Bit machines an "int" has 4 Bytes. See http://linux.die.net/man/3/uint32_t for details.). You should get a total size of 880 bytes for the data part.

After recompiling, it worked for me (and should also work for you). Changing only the init script to not
evaluate the return value of "mktape" may not solve this problem completely, because the virtual tapes are not
created then, as "bartoque" already mentioned.

I didn't compile "mhvtl-0.18-1", but as the code for the MAM structure is identical to "mhvtl-0.16-11", I
assume that it will produce the same error.

Best regards,
Frank
frank
Registered
 
Posts: 2
Joined: Sat Jan 09, 2010 1:19 pm

Re: mktape error: Structure of MAM incorrect size: 1016

Postby planetsurfer » Sat Jan 09, 2010 5:06 pm

Frank,

Thanks for that. It works fine now.

Cheers

Kevin
planetsurfer
Registered
 
Posts: 2
Joined: Sat Jan 09, 2010 10:09 am

Re: mktape error: Structure of MAM incorrect size: 1016

Postby bartoque » Sat Jan 09, 2010 9:30 pm

Works as stated by frank (nice job!). After first performing a "make clean" recompiling with the altered vtlib.h did the trick.
bartoque
Registered
 
Posts: 4
Joined: Sat Jan 09, 2010 4:52 am

Next

Return to MHVTL Discussion Forums

Who is online

Users browsing this forum: d_y19, Google [Bot], rami766 and 0 guests