MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

Archive for the ‘Ubuntu’ Category

MySQL on Ubuntu

without comments

Working with my students to create an Ubuntu virtual environment for Python development with the MySQL database. After completing the general provisioning covered in this older post, I’d recommend you create a python symbolic link before installing the MySQL-Python driver.

sudo ln -s /usr/bin/python3 /usr/bin/python

You install the Python development driver with the following:

sudo apt-get -y install python3-mysql.connector

Create a python_connect.py file to test your Python deployment’s ability to connect to the MySQL database:

#!/usr/bin/python
 
# Import the library.
import mysql.connector
from mysql.connector import errorcode
 
try:
  # Open connection.
  cnx = mysql.connector.connect(user='student', password='student',
                                host='localhost',
                                database='sakila')
 
  # Print the value.
  print("Database connection resolved.")
 
# Handle exception and close connection.
except mysql.connector.Error as e:
  if e.errno == errorcode.ER_ACCESS_DENIED_ERROR:
    print("Something is wrong with your user name or password")
  elif e.errno == errorcode.ER_BAD_DB_ERROR:
    print("Database does not exist")
  else:
    print(e)
 
# Close the connection when the try block completes.
else:
  cnx.close()

You should change the file permissions of the python_connect.py to read-write-execute as owner, and read-execute as group and other with the following command:

chmod 755 python_connect.py

Then, you can test your python_connect.py program from the local directory with the following command:

./python_connect.py

You see the following output if it works:

Database connection resolved.

As alway, I hope those looking for a code complete solutionk

Written by maclochlainn

July 14th, 2023 at 2:29 pm

Ubuntu Desktop 22.04

without comments

I finally got around to installing Ubuntu Desktop, Version 22.04, on my MacBook Pro 2014 since OS X stopped allowing upgrades on the device in 2021. While I replaced it in 2021 with a new MacBook Pro with an i9 Intel Chip. The Ubuntu documentation gave clear instructions on how to create a bootable USB drive before replacing the Mac OS software..

Unfortunately, networking was not well covered. It left me with two questions:

  • How to configure Ubuntu Desktop 22.04 to the network?

    You need to use an RJ45 network cable (in this case also an RJ45 to Thunderbolt adapter) and reboot the OS. It will automatically configure your DCHP connection.

  • How to configure Wifi for Ubuntu Desktop 22.04?

    You need to download and install a library, which is covered below.

After the Ubuntu Desktop installation, I noticed it didn’t provide any opportunity to update the software or configure the network. It also was not connected to the network. I connected the MacBook Pro to a physical Internet cable and rebooted the Ubuntu OS. It recognized the wired network. Then, I upgraded the installed libraries, which is almost always the best choice.

At this point, I noticed that the libraries to enable a WiFi connection were not installed. So, I installed the missing Wifi libraries with this command:

sudo apt-get install dbms bcmwl-kernel-source

After you’ve installed the bcmwl-kernel-source libraries, navigate to the top right where you’ll find a small network icon. Click on the network icon and you’ll see the following dialog. Click on your designated Wifi, enter the password and you’ll have a Wifi connection.

As always, I hope this note helps those trying to solve a real world problem.

Written by maclochlainn

May 23rd, 2023 at 1:52 am

Find a string in files

with 2 comments

From time to time, folks ask questions about how to solve common problems in Linux or Unix. Today, the question is: “How do I find a list of files that contain a specific string?” There are two alternatives with the find command, and the following sample searches look for files that contain a sqlite3 string literal.

  • Search for only the file names:
find . -type f | xargs grep -li sqlite3

Or, the more verbose:

find . -type f -exec grep -li sqlite3 /dev/null {} +
  • Search for the file names and text line:
find . -type f | xargs grep -i sqlite3

Or, the more verbose:

find . -type f -exec grep -i sqlite3 /dev/null {} +

Don’t exclude the /dev/null from the verbose syntax or you’ll get the things you lack permissions to inspect or that raise other errors. I don’t post a lot of Linux or Unix tips and techniques, and you may find this site more useful to answer these types of questions:

Unix & Linux Stack Exchange web site

As always, I hope this helps those you land on the blog page.

Written by maclochlainn

April 18th, 2015 at 2:39 pm

Handling Bash Parameters

with 2 comments

Bash shell or shells in general hang on details. An ex-student was trying to sort something out in Learning the bash Shell, 3rd Edition, which isn’t on my short list of good shell scripting books. I concur more or less with the comment on Amazon.com that there are too few examples in the book. I think the free examples here may serve folks in lieu of a book.

Anyway, the student’s problem involved processing multiple word parameters in an array. They were confused about how to handle ${*}, ${@} "${*}" and "${@}" when assigning them into an array for subsequent processing. By the way, I did find a decent explanation of the concept on Page 89 in my copy of the book. Though my copy is a 2nd Edition.

Here’s a dressed up sample of what they were attempting to do:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
 
# Print header information.
echo "Begin Program!"
echo ""
 
# Count the call parameters.
echo "Count call parameters [" ${#} "]"
echo ""
 
# Declare an array of delimited parameters.
ARRAY=(${@})
 
# Declare a numeric constant of array elements.
ELEMENTS=${#ARRAY[@]}
 
# Does the parameter account agree with array elements.
if [[ ${#} = ${#ARRAY[@]} ]]; then
  echo "Parameters match exploded array elements."
else
  echo "Parameters ["${#}"] don't match exploded array elements ["${ELEMENTS}"]."
fi
 
# Echo line break.
echo ""
 
# Echo the parameter list.
for (( i = 0; i < ${ELEMENTS}; i++ )); do
  echo "  ARRAY["${i}"]=["${ARRAY[${i}]}"]"
done
 
# Print footer information.
echo ""
echo "End Program!"

With the ARRAY=(${@}) assignment on line #12, they exploded the elements into individual words. They thought that the IFS (Internal Field Separator) environment variable was defined wrong but it wasn’t.

They called the program like this from the command-line:

sample.sh "Me too" "You too"

Then, they got this syntax and were surprised.

Begin Program!
 
Count call parameters [ 2 ]
 
Parameters [2] don't match exploded array elements [4].
 
  ARRAY[0]=[Me]
  ARRAY[1]=[too]
  ARRAY[2]=[You]
  ARRAY[3]=[too]
 
End Program!

They were close. The ARRAY=(${@}) assignment on line #12. There attempt to fix it with ARRAY=(${*}) led nowhere because it’s more or less the same and explodes into 4 words. To their credit, they put quotes around it like this ARRAY=("${*}") and got two parameters but one array element, as shown below:

Begin Program!
 
Count call parameters [ 2 ]
 
Parameters [2] don't match exploded array elements [1].
 
  ARRAY[0]=[Me too You too]
 
End Program!

What they needed was ARRAY=("${@}") on line #12 to explode quote delimited parameters. Here’s a complete working example of the final code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
 
# Print header information.
echo "Begin Program!"
echo ""
 
# Count the call parameters.
echo "Count call parameters [" ${#} "]"
echo ""
 
# Declare an array of delimited parameters.
ARRAY=("${@}")
 
# Declare a numeric constant of array elements.
ELEMENTS=${#ARRAY[@]}
 
# Does the parameter account agree with array elements.
if [[ ${#} = ${#ARRAY[@]} ]]; then
  echo "Parameters match exploded array elements."
else
  echo "Parameters ["${#}"] don't match exploded array elements ["${ELEMENTS}"]."
fi
 
# Echo line break.
echo ""
 
# Echo the parameter list.
for (( i = 0; i < ${ELEMENTS}; i++ )); do
  echo "  ARRAY["${i}"]=["${ARRAY[${i}]}"]"
done
 
# Print footer information.
echo ""
echo "End Program!"

Changing that one element yields their desired output:

Begin Program!
 
Count call parameters [ 2 ]
 
Parameters match exploded array elements.
 
  ARRAY[0]=[Me too]
  ARRAY[1]=[You too]
 
End Program!

As always, I hope this helps some folks.

Written by maclochlainn

January 2nd, 2011 at 1:40 am

Ubuntu VMWare Tools Install

with 6 comments

Rebuilding new reference environments on my MacPro, I started with Ubuntu 10.04.01 LTS (64 bit), I had to recall the step to install VMWare Tools. It’s quite simple but I know my students may need the steps to configure a VMWare virtual machine and it may benefit others. While this Ubuntu help page is a good start it isn’t a step-by-step configuration guide.

  1. Navigate to the VMWare Menu, choose Virtual Machine and in the drop down menu Install VMWare Tools. This will mount a virtual CD in the Ubuntu virtual machine.
  2. Open a terminal session by choosing Applications, within the drop down choose Accessories, and in the subsequent drop down choose Terminal. It will launch a terminal session for command-line entry. The screen shot will look like the following.

  1. From the command-line perform the following tasks:
cd /media/VM*
cp VMwareTools*.gz /tmp
cd /tmp
gunzip VMwareTools*.gz
tar -xvf VMwareTools*.tar
cd vmware-tools-distrib
sudo ./vmware-install.pl

  1. After starting the vmware-install.pl, accept all the default prompts. Alternatively, as Josh points out enter the following to skip the prompts:
sudo ./vmware-install.pl --default
  1. After the configuration completes, you’re prompted to restart the X-Windows. The easiest way is to reboot. You click on the upper right corner to get the drop down menu to restart Ubuntu. A screen shot follows.

This completes the VMWare Tools installation on Ubuntu but unfortunately, you may need to setup the network connection. In a couple instances, the Ubuntu installation appears to have corrupted the VMWare networking process. The result is that the DNS setup on Ubuntu didn’t work.

When the Ubuntu /etc/resolv.conf file is empty. You should first restart the VMWare network. This can be done without rebooting your native Mac OS X. Open a Terminal session, and navigate to the following directory and restart the VMWare network or use this command with backquoting.

sudo /Library/Application\ Support/VMware\ Fusion/boot.sh  --restart

If your Ubuntu /etc/resolv.conf file is empty, you can manually edit it. The last line in this sample depends on your IP subnet. I’ve entered it by assuming that you’re on 192.168.75.0 to 192.168.75.255 with a 255.255.255.0 network mask. You can refer to this prior post for the details on how you find your VMWare NAT subnet.

When your Ubuntu /etc/resolv.conf file is empty, add these values:

# Generated by NetworkManager
domain localdomain
search localdomain
nameserver 192.168.75.2

Hope this helps some folks.

Written by maclochlainn

November 1st, 2010 at 8:57 pm

Posted in Linux,Ubuntu

What a VMWare Thrill …

with 2 comments

I’d upgraded from VMWare Fusion 2 to 3 and taken care of most instances. A NASTY surprise awaited me when I tried to upgrade my Linux installations this morning.

You MUST to uninstall VMWare tools from your repository of Linux operating systems before upgrading your VMWare Fusion or ESX server. If you don’t, you can’t access the console because the drivers make the console look like this:

Perhaps I missed this note when, as an early adopted I opted to move straight to VMWare Fusion 3. I would have complied with these instructions to avoid this headache.

All that’s required now, is that: (a) I export 500 GBs worth of virtual machines to another machine running VMWare Fusion 2; (b) Individually start each machine and run the uninstall VMWare Tools command individually; and, (c) Shutdown and reposition all virtual machines on the original server.

As stated in the note, the command to remove it is:

/usr/bin/vmware-tools-uninstall.pl

Click on the note in the event the link fails to resolve, which would mean the note vanishes into oblivion some day in the future …

While I’ve another machine that’s not yet upgraded, this is a major inconvenience. It’s a shame that the Linux components don’t install automatically. It’s a shame that the install didn’t say something like, “Don’t do this if you’ve Linux virtual machines, unless you’ve removed their VMWare Tools installation.”

Another word to the wise, you don’t get the Linux Tools automatically when you download the product. The software prompts you to download the additional components when you attempt to launch a Linux environment. A cruel irony since by the time you see the prompt, you can’t! This is a change from the prior upgrade process.

Yes, haste makes waste but now I know. In the future, treat all VMWare upgrades like those from Microsoft test, re-test, re-authenticate in a small way before upgrading. Do you think VMWare really want to send that message to its customer base?

I got back to this tonight, and thanks to Red Hat’s Session Manager I was able to fix the Red Hat VMs. Launching it, I simply switched to the Failsafe Terminal and ran the following command, as per the note:

# /usr/bin/vmware-uninstall.pl

After that, I rebooted. Then, installed (mounted the VMWare Tools disk) from the VMWare Fusion menu. Opening a terminal as root, I then re-installed and configured VMWare Fusion. Those are done. As more time allows, I’ll update about the others.

I’m now reconfiguring the network since the VMWare Fusion 2 bridged at a 172.16.153 subdomain and VMWare Fusion 3 bridges at a 172.16.123 subdomain.

Written by maclochlainn

February 6th, 2010 at 11:49 am

sudo conferred powers

with 3 comments

Coming from Solaris Unix and Red Hat Linux to Ubuntu, Mac OS X and other distributions of Linux was interesting a couple years ago. The fact that you couldn’t su to the root account was tedious. It didn’t take too long (a couple momentes) to recall that I could assume those privileges in a shell, like:

admin_user@machine_name:~$ sudo sh
#

Naturally, this avoids entering sudo before a series of commands and makes administering any box simpler. It should work on all distributions but I’ve not checked ALL of them because they’re too numerous anymore. I know it works on the Mac OS X, Ubuntu, and now Fedora distributions.

Today, I got a kick from the message provided by Fedora 10 when you assume root permissions. It’s been over 20 years since I got that lecture on an AT&T box at First Interstate Bank. I imagine that any equivalent box to that is in a museum, while that bank was acquired by Wells Fargo in the early 1990s. The message from Fedora is just too funny to pass on making a comment. Here’s the screen shot:

SuperUserPowers

Hope it brought a smile to some faces …

Written by maclochlainn

December 6th, 2009 at 12:59 pm

Posted in Linux,Mac,Ubuntu

Aborting hung VMWare

without comments

Customizing the toolbar is one of the things that I’ve found important in using VMWare Fusion to test various Linux distributions. It’s nice they put Suspend by default on the toolbar but it would be nicer still if they put Shut Down. I got tired of looking for the PID to manually kill the virtualization from the Terminal command line. It is so much easier to add a Shut Down widget before trying to install VMWare Tools because that’s where some distributions hang.

Here are the steps to customize the toolbar:

1. Right click on the toolbar before running the VMWare instance, and you’ll see this context menu. Choose the Customize Toolbar… choice from the list.

vmwarecustomize1

2. The prior step lets you customize the toolbar though the following menu option dialog. Just click on the icon you want and drag it on to the toolbar. I’d suggest dragging Shut Down and Full Screen on to the toolbar.

vmwarecustomize2

I prefer putting the Shut Down to the left of the Suspend button, like this:

vmwarecustomize3

Hope this helps somebody.

Written by maclochlainn

April 11th, 2009 at 1:39 pm

Overriding SQL*Plus ed

with 6 comments

I was looking for a cool post to point my students to about overriding the ed tool in SQL*Plus but couldn’t find one. A number of posts showed how to set vi as the default editor in Linux or Unix but none showed how to replace Microsoft Notepad with something else. Instructions for both operating environments are here.

Linux or Unix:

This is simple because all you need to do is open a terminal session and type the following command:

# which -a vi

vi is typically a symbolic link to /usr/bin/vi, and it points to /usr/bin/vim in many cases, like Linux or Mac OS X. You can now add that to your SQL*Plus session interactively by typing:

SQL> define _editor=vi

You can set this in your Oracle Database 10g or 11g home, or in the Oracle Database Instant Client. It is found in the $ORACLE_HOME/sqlplus/admin/glogin.sql file, and example is noted at the end of this blog.

Windows:

This is actually quite easy but different releases of Windows provide different behaviors. Some of those behaviors provide alternatives that don’t work in all Windows releases. The off-beat approaches let you launch the alternate editor but they don’t always edit the active buffer. The ones I’ve chosen to show you should work in all Windows releases, but let me know if they don’t in your environment.

1. Install the editor(s) you want to use. I’ve installed and tested GVIM (a vi editor) and Notepad++ on Windows XP and Vista with Oracle Database 10g and 11g.

2. Add the directory path to these products to your system path. This takes four steps. First, you open your System Properties dialog box. Click the Environment Variables button to set an environment variable.

systemproperties

In the Environment Variables dialog box, you should select the PATH variable from the System variables list. Click the Edit button to change the PATH variable.

systemenvironmentvariables

Add the following in the Edit System Variable dialog box. You should note that you use a semi-colon to separate path elements in Windows (not a colon like Linux or Unix). After you add the editor path, click the OK button. You can append any number of editors if you’ve got a bunch that you like to use.

systempathedit

You should now click the OK button on the Environment Variables and System Properties dialog boxes in turn. Now you can open any command prompt and type the executable name to run the program, like gvim72.exe.

3. The Oracle Database 10g and 11g expect the executable for the default or override ed (editor) utility exists in the %SystemRoot%\System32 directory, which is the C:\WINDOWS\System32 directory. Copy only the executable, like GVIM.EXE, to the C:\WINDOWS\System32 directory.

4. You can now interactively type the following each time you log into the database at the SQL command prompt:

SQL> define _editor=gvim

Alternatively, you can place that command in the following file:

%ORACLE_HOME%\sqlplus\admin\glogin.sql

It is run each time you login to the database. The file would look like this if you wanted to run gvim as your override editor, which means when you type ed to change the SQL buffer file. The SQL buffer file contains the last SQL statement executed. That file is named afiedt.buf, which stands for A File Eidtor Buffer (debunked by Niall in the comment, the AFI stands for AFI Advanced Friendly Interface). As pointed to by Laurent’s comment, you should change the file extension to take advantage of GeSHi (Generic Syntax Highlighter) for your code.

5. After you’ve done all that. If you’d like to include your USER name and TNS alias, you can run the following command interactively or put it in your glogin.sql script. Caution, this only works for Oracle 10g forward.

SQL> SET sqlprompt _user"@"_connect_identifier>

This sets the SQLPROMPT to the following for a user account named STUDENT at the standard orcl TNS alias:

STUDENT@orcl>

The rules for setting the SQLPROMPT aren’t intuitive. You can only use one set of double quotes. In the preceding example, the quotes surround the @ symbol between two SQL*Plus macros, which are the _USER and _CONNECT_IDENTIFIER. There’s no magic in that symbol and you can replace it with another. When you want text before, in between, and after a macro or two, you surround the whole thing with double quotes, and allow a white space before macros or use single quotes around string literals.

The white space example works like this:

SQL> SET sqlprompt "SQL: _user at _connect_identifier>"

This sets the SQLPROMPT to the following for a user account named STUDENT at the standard orcl TNS alias:

SQL: STUDENT at orcl>

The nested single quotes example works like this:

SQL> SET sqlprompt "'SQL:'_user at _connect_identifier>"

This sets the SQLPROMPT to the following for a user account named STUDENT at the standard orcl TNS alias:

SQL:STUDENT at orcl>

The single quotes around the SQL: lets you remove the space between the colon and user name. I’ve never seen a way to control case for the macro return values but there may be one. Perhaps somebody will add a comment about it. If you put more than two double quotes in the descriptor passed to SQLPROMPT environment variable, SQL*Plus raises an SP2-0735 error.

6. Here is a sample of the glogin.sql file:

--
-- Copyright (c) 1988, 2005, Oracle.  All Rights Reserved.
--
-- NAME
--   glogin.sql
--
-- DESCRIPTION
--   SQL*Plus global login "site profile" file
--
--   Add any SQL*Plus commands here that are to be executed when a
--   user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
--   This script is automatically run
--
-- Define the override or default editor.
define _editor=gvim
-- Set the edit file to allow GeSHI highlighting.
SET editfile=afiedt.sql
-- Set the SQL*Plus prompt to show user and TNS Alias.
SET sqlprompt "'SQL:'_user at _connect_identifier>"

Hope this helps a few folks stuck with Windows as the operating system for Oracle.

Written by maclochlainn

January 19th, 2009 at 1:08 am

VMWare Fusion 2.0.1 & Ubuntu 8.10, oops …

with 3 comments

It seemed like a good day to test VMWare Fusion 2.0.1 on my Mac, but while it works well with Microsoft Windows XP VM, it doesn’t work as well with Ubuntu 8.04.1 or 8.10 VM. It wasn’t too surprising to see that VMWare Tools (VMwareTools-7.9.3-128865.tar.gz) don’t work with Ubuntu 8.04.1. There’s a mismatch between the gcc compiler and the kernel. You need gcc 4.2.3 to compile the kernel but gcc 4.2.4 to compile the modules for VMWare Tools.

You see it right away when the VMWare Tools script prompts you to compile the vmmemctl modules, like this:

None of the pre-built vmmemctl modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vmmemctl module
for your system (you need to have a C compiler installed on your system)?
[yes] 
 
Using compiler "/usr/bin/gcc". Use environment variable CC to override.
 
Your kernel was built with "gcc" version "4.2.3", while you are trying to use
"/usr/bin/gcc" version "4.2.4". This configuration is not recommended and
VMware Tools may crash if you'll continue. Please try to use exactly same
compiler as one used for building your kernel. Do you want to go with compiler
"/usr/bin/gcc" version "4.2.4" anyway? [no]

At this point, upgrading Ubuntu appears ideal. Upgrading was tedious, and resulted in two failures. The first failure requires you shut down the instance by using the VMWare Fusion menu – Virtual Machine, Shut Down Guest. Don’t expect it to work as fast as it did in 2.0.0, at least with Ubuntu.

The second failure is that vsock.o can’t be made due to missing header files. That’s really as good as it gets because a fresh install produces the same error. The failure shown is:

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vsock-only'
make -C /lib/modules/2.6.27-7-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.27-7-generic'
  CC [M]  /tmp/vmware-config0/vsock-only/linuxaf_vsock.o
  CC [M]  /tmp/vmware-config0/vsock-only/driverLog.o
  CC [M]  /tmp/vmware-config0/vsock-only/util.o
/tmp/vmware-config0/vsock-only/linux/util.c: In function 'VSockVmciLogPkt':
/tmp/vmware-config0/vsock-only/linux/util.c:157: warning: format not a string literal and no format arguments
  CC [M]  /tmp/vmware-config0/vsock-only/linuxaf_vsock.o
  LD [M]  /tmp/vmware-config0/vsock-only/vsock.o
  MODPOST 1 modules
WARNING: "VMCIDatagram_CreateHnd" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIDatagram_DestroyHnd" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIEvent_Subscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCI_DeviceGet" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIEvent_Subscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIDevice_Get" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIMemcpyFromQueueV" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIQueuePair_Detach" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCI_GetConextID" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIDatagram_Send" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIQueuePair_Alloc" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIEvent_Unsubscribe" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
WARNING: "VMCIMemcpyToQueueV" [/tmp/vmware-config0/vsock-only/vsock.ko] undefinied!
  CC      /tmp/vmware-config0/vsock-only/vsock.mod.o
  LD [M]  /tmp/vmware-config0/vsock-only/vsock.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.27-7-generic'
cp -f vsock.ko ./../vsock.o
make: Leaving directory `/tmp/vmware-config0/vsock-only'
Unable to make a vsock module that can be loaded in the running kernel:
insmod: error inserting '/tmp/vmware-config0/vsock.o': -1 Unknown symbol in module
 
There is probably a slight difference in the kernel configuration beetween the
set of C header files you specified and your running kernel. You may want to
rebuild a kernel based on that directory, or specify another directory.
 
The VM communication interface socket family is used in conjunction with the VM
communication interface to provide a new communication path among guests and
host. The rest of this software provided by VMWare Tools is designed to work
independently of this feature. If you with to have the VSOCK feature you can
install the driver by running the vmware-config-tools.pl again after making sure
that gcc, binutils, make and the kernel sources for your running kernel are
installed on your machine. These packages are available on your distribution's
installation CD.
[ Press the Enter key to continue.]

Wouldn’t it be nice if they pointed to a specific file. It didn’t take much effort to find them, after all it’s Linux. I found that they’re defined in the vmci_queue_pair.h and vmciGuestKernelAPI.h files. Those files are found inside the vsock-only.tar file. You can find the vsock-only.tar file in the vmware-tools-distrib/lib/modules/source directory. You can read more about the Virtual Machine Communication Interface on VMWare’s web site.

The only pre-built VMWare Fusion 2.0.1 pre-built tool modules for Ubuntu are compatible with the listed kernels. Unfortunately, as noted above they don’t work because of a gcc difference.

bld-2.6.24-16-i386generic-Ubuntu8.04
bld-2.6.24-16-i386server-Ubuntu8.04
bld-2.6.24-16-i386virtual-Ubuntu8.04
bld-2.6.24-16-x86_64generic-Ubuntu8.04
bld-2.6.24-16-x86_64server-Ubuntu8.04
bld-2.6.24-19-i386generic-Ubuntu8.04.1
bld-2.6.24-19-i386server-Ubuntu8.04.1
bld-2.6.24-19-i386virtual-Ubuntu8.04.1
bld-2.6.24-19-x86_64generic-Ubuntu8.04.1
bld-2.6.24-19-x86_64server-Ubuntu8.04.1

The only question I’m left with is do I troubleshoot this or downgrade VMWare back to 2.0.0? I’m inclined to the latter given the lack of energy in the VMWare forum.

Ultimately, this was fixed with the next release of VMWare. They simply lag a bit in getting the libraries straight. In fact, I ran into a similar problem with Ubuntu 9.04 and the page.c file. I hacked it and got everything working but really, you should probably just use the last release of Ubuntu a little longer because VMWare looks to lag release by about 4 months.

Written by maclochlainn

November 23rd, 2008 at 12:02 am

Posted in Mac,Ubuntu,VMWare