edit · history · print

Logging console output in VMWare

After powering down the virtual machine, edit the hardware settings to add a serial port, and direct its output to a file.

Add console=tty0 console=ttyS0 to the kernel command line in /boot/grub/menu.lst (or /etc/lilo.conf). This will make the screen be the primary console, but copy all messages to the serial port as well.

Host <-> Virtual machine access, Linux host

If you are running VMware under Linux, it may be easier to compile and edit on the host machine. The simplest way to do this is by NFS-mounting the virtual machine filesystem:

  1. Enable NFS in your VM kernel: in menuconfig: file systems -> network file systems -> NFS server support. Rebuild your kernel and copy it to /boot/vmlinuz; if you enabled NFS server as a module, then you'll need to do make modules_install to install the modules.
  2. Set up /etc/exports. This entry maps all NFS access to a single user, root. (uid 0, gid 0)

      / *(rw,all_squash,anonuid=0,anongid=0) 
  3. Enable the NFS server on boot - change the SERVICES line in /etc/rc.conf to: SERVICES=(net sshd portmap nfsserver)
  4. Reboot the virtual machine, and then mount its filesystem from the host:

      [pjd@justforkix ~]$ sudo mount 172.16.211.129:/ /mnt/1
      [pjd@justforkix ~]$ mount
       [...]
      172.16.211.129:/ on /mnt/1 type nfs (rw,addr=172.16.211.129) 

(type ifconfig eth0 on the virtual machine to find its IP address)

The virtual machine filesystem may now be accessed on /mnt/1. If you want to do all your development work on the host machine, you can install modules onto the virtual machine with the following command:

  make INSTALL_MOD_PATH=/mnt/1 modules_install

where /mnt/1 is the location the virtual machine filesystem has been mounted on.

Troubleshooting

RPC: Program not registered The NFS server is not running nfssvc: Function not implemented (in /var/log/messages) - NFS server support is not compiled into your kernel or available as a module. mountd[1818]: mount request from unknown host #.#.#.# for / (/) You haven't set up /etc/exports properly. (or you have, but you haven't rebooted yet. In that case, run exportfs -r to resync your exports, and see if it works.)

Host <-> Virtual machine access, Windows host

If you are running a Windows host, you'll want to do your compilation on the virtual machine. However, other than just using the vmware console, there are two ways in which you might wish to access your files on the virtual machine:

  1. Export the files to Windows and edit them there. Either export them via NFS, as above, and install Windows Services for Unix (here), or install Samba on your virtual machine.
  2. Connect to your virtual machine via ssh and do all your work within the VM. Good terminal programs include Putty and rxvt from the Cygwin toolkit. (install both rxvt and openssh)

In the second case you may wish to install another editor besides VI in your virtual machine; you can get the Emacs package here and install it with the pkgadd command.

Note that in addition to enabling the ssh server (add sshd to SERVICES in /etc/rc.conf) you will want to remove the ALL: ALL: DENY line from /etc/hosts.deny, or tcpwrappers will not let you connect to ssh.

edit · history · print
Page last modified on October 16, 2006, at 10:43 PM EST