Ubuntu 16.04 LTS を VMware にインストールしたメモ
所感
- 普通に
apt-get update
すると起動時にエラーが出る(無視できるものかも) - 普通にインストールしただけでは共有フォルダ機能が動かない
- 昔からトラブル多い機能だけど、ちょっとお粗末
環境
- Mac OS X 10.11.5 (英語)
- VMware Fusion 8.1.1
- ubuntu-16.04-server-amd64.iso
手順
-
VMware の File メニューから New
-
Customize Settings でネットワークを Bridged へ変更し、 Printer, Sound Card, Camera などサーバーに不要なデバイスを削除する
- 一旦セーブする必要がある
- Settings 画面
- ホストや別マシンから ssh や http アクセスできるように Network Adapter 画面でデフォルトの
Share with my Mac
(NAT) から Bridged Networking へ変更- NAT の Port Forwarding でも実現できるけれどパッチを適用しないとならないらしい(8.1.1 で修正された とアナウンスされたが治ってない?)
- Remove Printer Port
- Remove Sound Card
- Remove Camera
- Advanced で Power Options の Shut Down を Power Off (hard) に変更
- 最近の VMware Fusion では Virtual Machine メニューを開いて Option キーを押さないとPower Off ができなくなった
- Shut Down は OS 内部からできるし Power Off は Snapshot に戻る時に使いたい
-
- エラーメッセージなど English の方が Google し易い
Region を United States から Japan に変更 (other -> Asia -> Japan)
-
- 仮にこの VM を ESXi に持ってったとしても LVM なしでリサイズできるらしいし
- 構成がシンプルになる
-
大きなパーティション1個とスワップ用のパーティションができるので Yes
- No を選ぶとパーティション設定を調整できる
-
standard system utilities がデフォルトで選択されている。 OpenSSH Server を追加選択(矢印とスペースキーを使う)
- Server 用 ISO なんだから、デフォルトで ssh サーバーはインストールして欲しかった。
-
- 自動的に再起動するが、再起動後に素早く Power Off してスナップショットを取りたい
-
- root ではログインできない
-
パッケージを更新(依存関係が変化しているものも含めて)
$ sudo apt-get dist-upgrade
-
Mac から ssh 経由で実行すると Locale の選択画面が出てきてデフォルトの UTF8 を選択すると以下のエラーが出る
locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory
- これは Mac の LC_CTYPE 環境変数が
UTF-8
だが Linux 側ではその名前の locale が存在しないため(en_US.UTF-8
なら存在する) -
接続元 (Mac) の LC_CTYPE を接続先 (Linux) へ設定しないようにする
-
/etc/ssh/sshd_config 内の
AcceptEnv LANG LC_*
をコメントアウトして ssh サーバーを再起動、 ssh 再接続してからapt-get
を実行$ sudo systemctl restart ssh
-
VMware 画面で実行すると、そもそも Locale の選択画面が出てこない
- これは Mac の LC_CTYPE 環境変数が
-
-
パッケージ更新後の起動時のエラー
[FAILED] Failed to start LXD - container startup/shutdown
を回避-
$ sudo service lxd restart
-
-
dmesg
で確認出来る起動時のエラーpiix4_smbus 0000:00:007.3: SMBus Host controller not enabled!
を回避-
Ubuntu が使おうとしている CPU の機能を VMware が提供していない
$ sudo cp -p /etc/modprobe.d/blacklist.conf /etc/modprobe.d/blacklist.conf.dist
$ sudo vi /etc/modprobe.d/blacklist.conf
-
以下を追加
blacklist i2c-piix4
再起動
-
-
VMware Tools をアップデート
-
open-vm-tools がインストール済みなのに Enable Shared Folders を ON にするとエラー
$ vmware-toolbox-cmd -v 10.0.7.52125 (build-3227872)
-
VMware のドキュメントに従って vmhgfs ドライバーをインストールしても改善しなかった (VMwareTools-10.0.6-3595377)
-
VMware の Virtual Machine メニューから Reinstall VMware Tools を選び Install ボタンを押してから
$ sudo mount /dev/cdrom /media/cdrom $ tar xzf /media/cdrom/VMwareTools-10.0.6-3595377.tar.gz $ sudo vmware-tools-distrib/vmware-install.pl
全てのデフォルト値を受け入れる
このステップを飛ばすと自動マウントされない
インストール済みの
open-vm-tools
を上書きはしないらしい
-
-
github の open-vm-tools から最新の vmhgfs カーネルモジュールをビルドしてインストール(ただし open-vm-tools-desktop はインストールしない)
$ sudo apt-get install git build-essential autoconf libtool $ sudo apt-get install libmspack-dev libglib2.0-dev libprocps4-dev libdumbnet-dev $ git clone https://github.com/vmware/open-vm-tools.git $ cd open-vm-tools/open-vm-tools/ $ git log -n 1 commit 4b745c70aaeaab4adb35fd682a3e60fc7a315ec9 Author: Ravindra Kumar <ravindrakumar@vmware.com> Date: Wed Jun 15 13:14:07 2016 -0700 Added details about open-vm-tools-desktop $ autoreconf -i $ ./configure --without-x --without-pam --without-ssl --without-icu $ make MODULES=vmhgfs $ sudo insmod modules/linux/vmhgfs/vmhgfs.ko $ reboot
これで共有フォルダが /mnt/hgfs に自動マウントされる
-
参考: vmware-install.pl の出力
$ sudo vmware-tools-distrib/vmware-install.pl
The installer has detected an existing installation of open-vm-tools on this
system and will not attempt to remove and replace these user-space
applications. It is recommended to use the open-vm-tools packages provided by
the operating system. If you do not want to use the existing installation of
open-vm-tools and attempt to install VMware Tools, you must uninstall the
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes]
Creating a new VMware Tools installer database using the tar4 format.
Installing VMware Tools.
In which directory do you want to install the binary files?
[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
What is the directory that contains the init scripts?
[/etc/init.d]
In which directory do you want to install the daemon files?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]
The installation of VMware Tools 10.0.6 build-3595377 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]
The file /usr/bin/vmware-hgfsclient that this program was about to install
already exists. Overwrite? [no]
The file /usr/bin/vmhgfs-fuse that this program was about to install already
exists. Overwrite? [no]
The file /sbin/mount.vmhgfs that this program was about to install already
exists. Overwrite? [no]
Initializing...
Making sure services for VMware Tools are stopped.
Stopping VMware Tools services in the virtual machine:
VMware User Agent (vmware-user): done
Unmounting HGFS shares: done
Guest filesystem driver: done
Stopping Thinprint services in the virtual machine:
Stopping Virtual Printing daemon: done
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
insserv: Service cups has to be enabled to start service vmware-tools-thinprint
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
WARNING: The installer initially used the 'udpate-rc.d' to setup the
vmware-tools service. That command cannot be found. Please re-install the
'sysv-rc' package. This script will now attempt to manually setup the
vmware-tools service.The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.
The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.
The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.
The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment. Do you wish
to enable this feature? [yes]
The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.
Would you like to enable VMware automatic kernel modules?
[no]
Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-4.4.0-31-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
Checking acpi hot plug done
Starting VMware Tools services in the virtual machine:
Switching to guest configuration: done
Guest filesystem driver: done
Mounting HGFS shares: done
Starting Virtual Printing daemon: done
The configuration of VMware Tools 10.0.6 build-3595377 for Linux for this
running kernel completed successfully.
Enjoy,
--the VMware team
Found VMware Tools CDROM mounted at /media/cdrom. Ejecting device /dev/sr0 ...