[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] libguestfs! help!



On Wed, Aug 29, 2012 at 11:34:51AM +0800, 周涛 wrote:
> i try it in my environment,it allways throws the exception :
> com.redhat.et.libguestfs.LibGuestFSException: sh: /bin/sh: Exec format error
> then i try the following programs, "Exec format error" still happens:
> String cmd1 = "chkconfig --add tomcat";
> g.sh(cmd1);
> String cmd2 = "/sbin/chkconfig --add tomcat";
> g.sh(cmd2);
> String[] cmd = new String[] {"/sbin/chkconfig", "--list"};
> g.command(cmd);
> but i can execute the command in system, could show me the reason, Thanks!

Well it's something to do with the guest being either a much older or
much newer version of Linux than the host, or perhaps it's a different
architecture (32 vs 64 bits?), or not even Linux at all.

The way to solve this is to use a firstboot script:

> From: Richard W.M. Jones
> Date: 2012-08-28 00:39
> To: libguestfs redhat com
[...]
> However to run the command it may be better to run the command using a
> "firstboot" script.  See:
> 
>   http://libguestfs.org/guestfs.3.html#running-commands
>   http://libguestfs.org/virt-sysprep.1.html#firstboot-
> 
> (Note that the ability to use firstboot scripts was only added very
> recently to virt-sysprep).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]