VMware Cloud Community
Herkuladedrik
Contributor
Contributor

Linux P2V Failed at 98% Converter 6.1

Hello

I'm trying to convert a old physical Linux server to a virtual one.

it keeps failing at 98% with a status :

FAILED: An error occurred during the conversion: 'InitrdNativePatcher failed to generate initrd image: /usr/lib/vmware-converter/initrdGenSuse.sh failed with return code: 1, and message: * /mnt/p2v-src-root/dev has 3 files /sbin/mkinitrd: illegal option -- t * user script returning code 1 * unmounting /mnt/p2v-src-root/dev /mnt/p2v-src-root/proc and /mnt/p2v-src-root/sys ERROR:
failed running mkinitrd vmlinuz-2.6.37.6-24-desktop initrd-2.6.37.6-24-desktop with chroot /mnt/p2v-src-root '

Fejl p2v.png

Any suggestions :smileyconfused:?

12 Replies
AishR
VMware Employee
VMware Employee

This KB should help: VMware Knowledge Base

Reply
0 Kudos
Herkuladedrik
Contributor
Contributor

not sure what to do, that kb doesnt make much sense to me Smiley Happy

Reply
0 Kudos
POCEH
VMware Employee
VMware Employee

Could you share more details? Will be good to upload log-bundle for check too.

Reply
0 Kudos
Herkuladedrik
Contributor
Contributor

here is the log bundle, i dont know if its too many.

what more details is needed ?

Reply
0 Kudos
patanassov
VMware Employee
VMware Employee

Somehow mkinitrd command doesn't understand '-t' option. It should. Perhaps it is a nonstandard mkinitrd?

It is a shell script (though not trivial). As a possible workaround - you may try to tweak it on the source machine so that it doesn't give an error when invoked with '-t' and try the conversion again.

HTH,

Plamen

Herkuladedrik
Contributor
Contributor

Sorry for very late answer ive been sick...

How do i tweek it?, sorry when it comes to this kinda of stuff i really dont know much.

Reply
0 Kudos
patanassov
VMware Employee
VMware Employee

Well, it's a shell script. There should be some function that parses the input arguments and exits with error when found something unrecognised. I haven't looked at it. Probably just adding '-t' as valid option may do the trick. Find someone who understands something in shell scripts, it should be easy to try (though there is no guarantee it will work).

HTH,

Plamen

Reply
0 Kudos
mmartin0926
Enthusiast
Enthusiast

I know this is old, but maybe it'll help someone else who was in the same situation as you and I, as I just ran into this same exact problem the other day.

I was able to modify the mkinitrd script to remove the "-t /dir" options that VMWare passes to it. Apparently, from another mkinitrd command version I found on a SLES server, which uses the "-t" option, its a way to pass a temp directory to mkinitrd. But, the version of the command you and I are using automatically sets this tmp directory.

I simply added these lines below to the top of the script. So, what it does is it loops through the Command line args passed to it and finds the location of "-t" and it removes it. And, since their "-t" expects a directory to go with it, I remove the arg immediately following "-t" as well.

tmp_count=0

n=

for item in "$@" ; do

        ((tmp_count+=1))

        if [ "$item" = '-t' ]; then

                n=$tmp_count

        fi

done

set -- "${@:1:n-1}" "${@:n+2}"

So the loop finds where "-t" is located, at position "n". Then, the "set" command removes from position "n" to "n+2".

You can test this out by adding this command BEFORE the loop:

echo -e "BEFORE:\n$@"

And then add this after the "set" command:

echo -e "AFTER:\n$@"

exit 0

And you'll get something like this:

# ./mkinitrd -v -p /foobar/blahblah -t /temp/dir -k

BEFORE:

-v -p /foobar/blahblah -t /temp/dir -k

AFTER:

-v -p /foobar/blahblah -k

     *Notice all CLI args are still present after the set command, except for "-t /temp/dir"...

Be sure to remove those 3 lines before starting the converter, or else mkinitrd script will simply exit after printing those lines.

Hope that helps!

-Matt

Herkuladedrik
Contributor
Contributor

where is the script located so i can edit it? Smiley Happy

Reply
0 Kudos
patanassov
VMware Employee
VMware Employee

According to the error it is " /sbin/mkinitrd". You can always find it with "which mkinitrd".

There should be some loop in it that parses the arguments, something similar to

while [ $# -gt 0 ]; do

   ...

   case $1 in -v |

      --verbose)

   ...

Add an empty condition to 'swallow' '-t', e.g:

      -t) ;;

Reply
0 Kudos
JFTourignyVictr
Contributor
Contributor

Thanks mmartin0926

Your solution was the fix for me.  Once I added the lines to mkinitrd, I was able to successfylly P2V my server and it boots successfully.

Reply
0 Kudos
baflongar
Contributor
Contributor

Thank u so much for this post . I had trouble with SUSE 13 server for one weather station  , to convert to  VM ...helped me a lot . u rock 🙂

Reply
0 Kudos