跳到主要内容
版本:0.17.0+

vmware howto

installation

the storage screenshot of installation start

picture 1

configuration

cpu

PR: 12 processors (Is it enough? And will it affect the host?)

memories

PR: 11G for vm, 5G for host (Is it enough? And will it affect the host?)

disk storage

500G. Since the size of AOSP is about more than 200G, so 500G, which is double, is reasonable for that need.

⚠️ However, we'd better pre-allocate the disk space for speed, and if we set it later, the machine transfer time would be costly!

Update at 2022-01-24:

picture 2

You see, the 500G pre-allocated disk takes up more than 600G, when I just download the AOSP mirror, how could it be?

The answer becomes clear: The so-called pre-allocated disk size doesn't mean the full size of the disk to be used, but to be only the core running disk size of virtual machine, so that it's unnecessary to pre-allocate a huge size (such as 500G) for it!!!

Hence, I would just delete the mirror, and re-install one, with no option for pre-allocated size, since I remembered on stackoverflow or anywhere other it said there has no or slight efficiency effect on whether we enable or disable the option pre-allocate.

⚠️ And after I just did nothing to the vmware settings (i.e. 20Gb for vmware), and tried to install the AOSP, it warns me that the disk space is not enough. So We still need to allocate a big enough disk space, but not a pre-allocated one!

FIXME: Space not enough!

picture 3

但是就很奇怪,因为我重新分配过磁盘大小,理论上来说应该是够的:

picture 4

算了,暂时没时间研究这个问题了,我先同步再创建一个更大的新的镜像试试吧,顺带验证默认的 shell 支持不支持# xxx# !IMPORTANT xxx.

disk type

I searched the difference between different bus types, and it seems that it's better for me to use the default choice of scsi.

picture 6

ref:

vmware best practice

retina solution

!!!tip 1. 有些帖子说要安装vmware tools,但我看我的 vmware 里应该是已经有了,因为当我想点那个按钮的时候,显示的是reinstall vmware tools,此外,这个按钮必须是启动了虚拟机后才会可点,而且启动后也不一定可点…… 2. 忘了。。

First, check the use full solution for retina display, otherwise the screen is 模糊的(像素化)了。 picture 2

However, the cost is that all the text or icons then look too tiny, so that can't be used.

The solution is to set the solution of the system and the display scale:

picture 3

Then the screen looks real!

But there is still a drawback, that is each time switch the view, the scale would goes back. To solve this, if the virtual machine is a Mac, then adjust the solution via:

// mac terminal
sudo defaults write /Library/Preferences/com.apple.windowserver DisplaysolutionEnabled -bool true

However, if it's a ubuntu, I don't know how to realize it now. PR: ubuntu solution.

At last, the retina solution under full-screen mode:

picture 4

FIXME: retina solution of default scale size

ref:

explain why ubuntu conflicts with the retina since it's not for high-dpi screen.

it's useful when start a mac vmware on a mac.

config keyboards

1. ✨ mac host key

We can specify whether to enable mac host keyboard shortcuts. picture 1

However, before we do that, we should consider about it carefully that should you sacrifice your ubuntu experience for the mac multi-tasks or to sacrifice your mac experience for a pure ubuntu use.

Although there is one option for us to specify which command key for ubuntu, I failed to let it work.

A possible resolution is to config file place: ~/.vmware/preference.ini, see: 1. not found config file: sanbarrow.com 2. not found config file: How to change or disable hotkey for VMware Player? - Super User

However(updated@2022-02-12):

不需要替换文件!(也很难找到)

只要在 vmware 的键盘中,添加一个 Command -> Ctrl 的映射即可!

然后一切都是如此的丝滑!

妙啊!(折磨了我一个月了 😢)

picture 5

2. copy paste

!!!warning OUTDATED: use command -> ctrl map ! Since the copy paste in linux, are default triggered by the combined key of ctrl + shift, so we can specify the key map:

<img alt="picture 2" src="https://mark-vue-oss.oss-cn-hangzhou.aliyuncs.com/notes-1642344159090-57a3cfb0715bd2f3e9bdc354eb4e34a77b668719d9b0a1084423e9823b10c794.png" />

ref to [How to Copy Paste in Terminal in Ubuntu and Other Linux](https://itsfoss.com/copy-paste-linux-terminal/#:~:text=On%20Ubuntu%20and%20many%20other,pasting%20text%20in%20the%20terminal.)

And in fact, since the default select / copy / paste actions in ubuntu is triggered by `ctrl` by default, I can accept to use `ctrl A/C/V` in vm to avoid annoying different problems caused by command.

Only need to map Command to Ctrl! (updated@2022-02-12)

vpn proxy

In normal circumstance, the net is okay.

However, since I use clashx, I can visit outer net in my mac, which is a problem that the virtual machine can not share with the foreign net with the host.

1. know what's your ip and vpn port of host machine

picture 4

2. ensure the net type in vm

picture 5

3. specify the vpn manually in vm

picture 3

share files between host(mac) and guest(ubuntu)

BEST-PRACTICE: use vmhgfs-fuse and auto-complete supported

sudo mkdir -p /mnt/hgfs
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other

ref:

resolution 1. use /mnt/~

there are a few of disadvantages:

  1. Every time, it needs to re-activate using sudo vmhgfs-fuse .host:/ /mnt/ (although we can config it in the zsh/bash rc file)
  2. It only supports to fetch the host files within the vmware, which means it's uneasy to directly operate on host (not equally designed, or maybe there is another way)
  3. FIXME: When using in the vmware, I found there is no auto-completion for files on host.

mount host user folder to guest (transfer file from guest to host)

After a little of search, I found the easiest way is:

sudo vmhgfs-fuse .host:/ /mnt/

After this, there is one directory (my mac user folder mark) merging up under the ubuntu /mnt folder.

And then I can easily to transfer files from vmware to mac.

ref:

umount user folder in guest

sudo umount /mnt

Then the folders under /mnt would go.

ref:

TODO: transfer file from host to guest

TODO: the scp resolution

ref:

vmware bugfix

vmware

感觉这个官方解决方案 "An error occurred while consolidating disks" when deleting one or more snapshots or consolidate disks (2150414) 是合适的,就是不知道具体怎么弄:

resolution 1. Free up space on the datastore(s) holding the virtual machine configuration files and virtual disks.

resolution 2. Alternatively, increase the size of the datastore on which the virtual machine is located. For more information, see the vSphere Storage guide.

picture 28


基于 Reclaiming disk space from thin provisioned VMDK files on ESXi (2136514) 尝试了一下,结果把磁盘给塞满了……

picture 27

picture 26

ref:

fuse: bad mount point 'mnt/hgfs': Transport endpoint is not connected

sshfs - fuse: bad mount point `/mnt': Transport endpoint is not connected - Ask Ubuntu 启发,先取消挂载,再重新挂载即可。

sudo umount -l /mnt/hgfs
sudo vmhgfs-fuse .host:/ /mnt/hgfs

vmware ubuntu filesystem startup

initramfs problem

problem:

picture 166

resoluton:

picture 167

  1. 先用fsck -yf /dev/sda1自动修复文件系统
  2. exit就可以重新登录了

oK:

picture 165

ref:

Stuck at fsck "/dev/sda1: clean xxx/xxx files [...] " after upgrade to Ubuntu 16 from 14

problem:

picture 1

reason:

disk is full, and we need to free some space.

resolution:

  1. Ctrl + Alt + F1 or F2 into tty2 login
  2. df -h says /dev/sda1 is 100% used
  3. delete some files, e.g. I deleted android-8 dir of 100+ MB size
  4. reboot, and the problem is gone.

ref:

✅ vmware change super key, so that the command key won't make the ubuntu react as 'showing all the active applications'

解决方案:直接把command键映射到ctrl键即可。

ref

disk storage not enough since there are too many deleted versions

picture 4

Step 0.1. enable usb driver disk manage (read/write permission)

defaults write com.apple.Finder AppleShowAllFiles TRUE

Step 0.2. umount driver

sudo umount /Volumes/T7

ref:

Step 0.3. unplug and plug driver

重新插拔 usb

Step 1. find and go to target driver

cd /Volumes/T7

Step 2. go to trash dir under driver

cd .Trashes/501

Step 3. list all the trash files and rm them (need permission)

sudo ls -la

sudo rm -rf ...

picture 5

run emulator on ubuntu vmware

FIXME: unable to run emulator after building AOSP

A possible resolution may be to lunch full-eng && m which is suggested in Unable to run emulator after building AOSP, and now I am testing this solution.

ref:

FIXME: emulator: WARNING: system partition size adjusted to match image file (3083 MB > 800 MB)

A possible resolution:

 emulator -partition-size XXX # XXX is the desired size(MB)

However, maybe my system is limited since when the size exceeds 2048MB, another problem would arise up....

ref:

FIXME: Error "context mismatch in svga_sampler_view_destroy" running GUI programs on Ubuntu in a VM

In vmware player - Error "context mismatch in svga_sampler_view_destroy" running GUI programs on Ubuntu in a VM - Stack Overflow, it suggests me to set SVGA_VGPU10=0 or to uncheck the Accelerate 3D Graphics, but all in vain...

FIXME: TSC frequency mismatch between VM and host

ref:

BEST-PRACTICE: disable side channel mitigations for performance

  1. power off virtual machine
  2. disable side channel mitigations

picture 3

ref: