vbox 5.0.24, ubuntu 16.04 on host & guest (myguest) with dynamically allocated VDI.
Why was the VDI usage vastly inconsistent between host and guest, when I checked it below?
$ du -h myguest.vdi # from the host
5G
$ df -h --total # from the guest
... used
...
total ... 2G
#Solution
boot guest to recovery mode [Esc, Enter]
choose drop to root shell [Down, Enter]
go to Maintenance [Enter]
# mount -o remount,ro /dev/sda[id] /
# zerofree /dev/sda[id]
# shutdown -P now
shrink the guest VDI from the host via,
$ VBoxManage modifyhd [guest].vdi --compact
Reference:
https://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvdi
https://unix.stackexchange.com/questions/11100/how-to-make-ext4-filesystem-sparse
http://ubuntuforums.org/archive/index.php/t-908128.html
Related
I am attempting to automate a few things on AWS with one script.
log in and shut down docker-compose then remove all images
copy local files to server
log in and start docker-compose
My script is
#log in and shut down docker-compose then remove all images
ssh -i "~/Documents/AWS-Keys/mykey.pem" ubuntu#XX.XXX.XX.XXX
docker-compose down
docker image prune -f
exit
#copy local files to server
scp -r -i "~/Documents/AWS-Keys/mykey.pem" ./ubuntu ubuntu#XX.XXX.XX.XXX:/home
#log in and start docker-compose
ssh -i "~/Documents/AWS-Keys/mykey.pem" ubuntu#XX.XXX.XX.XXX
docker-compose up -d
exit
I have also tried logout instead of exit, same result.
Running
$ ./upload.sh
The output is:
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1038-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Tue Mar 2 21:52:40 UTC 2021
System load: 0.07
Usage of /: 66.0% of 7.69GB
Memory usage: 36%
Swap usage: 0%
Processes: 115
Users logged in: 1
IPv4 address for xxxxxxxxxxxxxxx: XXX.XX.X.X
IPv4 address for docker0: XXX.XX.X.X
IPv4 address for eth0: XXX.XX.X.XXX
* Introducing self-healing high availability clusters in MicroK8s.
Simple, hardened, Kubernetes for production, from RaspberryPi to DC.
https://microk8s.io/high-availability
3 updates can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable
Last login: Tue Mar 2 21:51:47 2021 from XXX.XX.X.XXX
ubuntu#ip-XXX.XX.X.XXX:~$
After getting some feedback I also tried
ssh -i "~/Documents/AWS-Keys/mykey.pem" ubuntu#XX.XXX.XX.XXX
docker-compose down;
docker image prune -f;
exit
Same result.
My understanding is that you want to run the command on the server, in that case just write it after ssh:
ssh -i "~/Documents/AWS-Keys/mykey.pem" ubuntu#XX.XXX.XX.XXX "docker-compose down ;docker image prune -f"
a longer script you can send via HEREDOC
ssh -i "~/Documents/AWS-Keys/mykey.pem" ubuntu#XX.XXX.XX.XXX <<COMMANDS
docker-compose down
docker image prune -f
COMMANDS
I use VMware and then install qemu on it.
Create img.
$ sudo qemu-img create -f qcow2 mini3.img 5G
Then create a virtual machine.
$ sudo qemu-system-x86_64 -m 1024 -enable-kvm -hda mini3.img -cdrom ./minix_R3.3.0-588a35b.iso -boot d
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
And I turn off this virtual machine and then start the created virtual machine.
$ sudo qemu-system-x86_64 -m 2048 -enable-kvm -hda mini3.img
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
But no success.
Where is the problem?
I would guess that in the first run your OS is booting from cdrom image (minix_R3.3.0-588a35b.iso). In the second run you removed it, and there is only a hard drive image (mini3.img). You probably failed to properly install the OS in the first run to your hard drive image.
When I try to start firefox on ec2 instance (centos/7) via X11, I got an error.
Is there a way to solve this?
I'm already confirmed that other GUI application, sucy as xeyes or eog, can be launched.
Env
ec2 side
OS: Centos 7.3.1611 (Core)
SELinux: Enforcing
xauth version: 1.0.9
xterm version: X.Org 7.6.0(295)
xorg-x11-apps.x86_64: 7.7-6.el7
$ sudo cat /etc/ssh/sshd_config
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
X11UseLocalhost no
UsePrivilegeSeparation sandbox # Default for new installations.
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/libexec/openssh/sftp-server
local side
OS: Mac OS X 10.11.6
XQuartz version: 2.7.11 (xorg-server 1.18.4)
$ sudo cat /etc/ssh/sshd_config
# Apple:
Host *
SendEnv LANG LC_*
Host *
XAuthLocation /opt/X11/bin/xauth
Reproduction scenario
# ec2 side
sudo yum -y install xauth xterm xorg-x11-apps xeyes
exit
# local side
ssh -X fhiyo#ec2-xx-xx-xx-xx.ap-northeast-1.compute.amazonaws.com
# ec2 side
xeyes # OK
sudo yum -y install eog
eog path/to/sample.png # OK
sudo yum -y install firefox
$ firefox
[Parent 20819] WARNING: pipe error (36): Connection reset by peer: file /builddir/build/BUILD/firefox-52.2.0/firefox-52.2.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
###!!! [Parent][MessageChannel] Error: (msgtype=0x46000E,name=PContent::Msg_NotifyLayerAllocated) Channel error: cannot send/recv
...
[Parent 20819] WARNING: FileDescriptorSet destroyed with unconsumed descriptors: file /builddir/build/BUILD/firefox-52.2.0/firefox-52.2.0esr/ipc/chromium/src/chrome/common/file_descriptor_set_posix.cc, line 22
###!!! [Parent][MessageChannel] Error: (msgtype=0x2C0085,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
I had a similar problem when launching Firefox version 52.3.0 with X11 forwarding on CentOS 7 :
WARNING: pipe error (35): Connexion ré-initialisée par le correspondant: file /builddir/build/BUILD/firefox-52.3.0/firefox-52.3.0esr/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 322
And same error (in french) on firefox "Gah, you tab just crash"
To correct this, i tried first to update all the package without success.
So i combined two solutions i found on the net :
1- I opened the "about:config" page (just type about:config in the url field then enter) and changed to "false" the 2 options browser.tabs.config.autostart and browser.tabs.config.autostart2
2- I opened the "about:support" page and click on "Repair Firefox..."
Then it works ! but i still have the following problem : i need to do this each time i relaunch firefox; So i should not close all tabs.
Check your SELinux configuration. In special check that mozilla_plugin_can_network_connect is enabled. You can do: getsebool mozilla_plugin_can_network_connect if answer is off then do setsebool -P mozilla_plugin_can_network_connect=1. Then try again firefox&
When I use timedatectl to set the timezone, it happens
[root#localhost ~]# timedatectl set-timezone "America/New_York"
Failed to set time zone: Access denied
This's my host infomation
Static hostname: rolin
Icon name: computer-vm
Chassis: vm
Machine ID: 699591c5339c2ae6d7e7b25151eaa987
Boot ID: 40dc52c07c85444c9514f7d92a24448e
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.18.2.el7.x86_64
Architecture: x86-64
What can I do now?
The root cause of this problem is probably an SELinux labeling issue. The fix is to relabel the /etc directory:
restorecon -Rv /etc
Then re-run the timedatectl command.
Source: https://access.redhat.com/solutions/3366211 (link requires a RedHat login).
Or if you can't do that for some reason, as a workaround you could temporarily set SELinux to permissive mode, update the time zone, and then re-enable SELinux.
However, that second approach will not fix the underlying problem. A mis-labeling in /etc may well cause other problems down the road.
I find that my /etc/localtime is not a symbolic links pointing to /usr/share/zoneinfo/... .
so I changed that file like this ,it works:
lrwxrwxrwx. /etc/localtime ->../usr/share/zoneinfo/Asia/Shanghai
I used this commands to change timezone for my vicidial server with cent os 7 :
rm /etc/localtime
rm: remove regular file `/etc/localtime'
ln -s /usr/share/zoneinfo/Europe/Rome localtime
date
and you will see that it is changed.
I can't make my VirtualBox VM manually restart after a blackout (it was running before the power went off).
This is the error I get:
vbox#chebasti:~/VirtualBox VMs/DockerRegistry$ VBoxHeadless --startvm "DockerRegistry" -e "TCP/Ports=4444"
Oracle VM VirtualBox Headless Interface 4.0.4
(C) 2008-2011 Oracle Corporation
All rights reserved.
Error: failed to start machine. Error message: UUID {20afee16-bf06-43c4-ab02-770106ce3498} of the medium '/home/vbox/VirtualBox VMs/DockerRegistry/ubuntu-14.04-server-amd64-disk1.vdi' does not match the value {4c6a8bcb-3766-4581-9f45-0de031c65c95} stored in the media registry ('/home/vbox/.VirtualBox/VirtualBox.xml')
I already tried to search the error online and tried to follow different instructions but none worked.
You can find the output of VBoxManage showvminfo DockerRegistry --details here (I did not pasted it here because it is very long).
The output of VBoxManage showhdinfo ubuntu-14.04-server-amd64-disk1.vdi is:
vbox#chebasti:~/VirtualBox VMs/DockerRegistry$ VBoxManage showhdinfo ubuntu-14.04-server-amd64-disk1.vdi
UUID: 4c6a8bcb-3766-4581-9f45-0de031c65c95
Accessible: no
Access Error: UUID {20afee16-bf06-43c4-ab02-770106ce3498} of the medium '/home/vbox/VirtualBox VMs/DockerRegistry/ubuntu-14.04-server-amd64-disk1.vdi' does not match the value {4c6a8bcb-3766-4581-9f45-0de031c65c95} stored in the media registry ('/home/vbox/.VirtualBox/VirtualBox.xml')
Logical size: 0 MBytes
Current size on disk: 0 MBytes
Type: normal (base)
Storage format: VDI
Format variant: dynamic default
In use by VMs: DockerRegistry (UUID: 952200e9-db58-420a-8fe1-ef49523def3d)
Location: /home/vbox/VirtualBox VMs/DockerRegistry/ubuntu-14.04-server-amd64-disk1.vdi
UPDATE
I don't know if it is of any use but here you are the output of VBoxManage showhdinfo \{4d495022-b596-47c0-8f38-f16c6c5d7f63\}.vdi:
vbox#chebasti:~/VirtualBox VMs/DockerRegistry/Snapshots$ VBoxManage showhdinfo \{4d495022-b596-47c0-8f38-f16c6c5d7f63\}.vdi
UUID: 4d495022-b596-47c0-8f38-f16c6c5d7f63
Accessible: yes
Logical size: 0 MBytes
Current size on disk: 564 MBytes
Type: normal (differencing)
Storage format: VDI
Format variant: differencing default
In use by VMs: DockerRegistry (UUID: 952200e9-db58-420a-8fe1-ef49523def3d)
Location: /home/vbox/VirtualBox VMs/DockerRegistry/Snapshots/{4d495022-b596-47c0-8f38-f16c6c5d7f63}.vdi
Auto-Reset: off
I just had this problem with my boot2docker VM after running low on power on my macbook.
$ boot2docker start -v
Using virtualbox driver
2014/09/04 18:00:42 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/09/04 18:00:42 executing: VBoxManage startvm boot2docker-vm --type headless
Waiting for VM "boot2docker-vm" to power on...
VBoxManage: error: UUID {0caf9f04-5159-403a-828c-0dd9be68e1a0} of the medium '/Users/-/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vmdk' does not match the value {07ad4be9-d2d0-4ac5-bb8a-e992e816ed19} stored in the media registry ('/Users/-/Library/VirtualBox/VirtualBox.xml')
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Medium, interface IMedium
What seemed to fix it for me was to "boot2docker stop", remove the .vmdk from VirtualBox Storage settings, run this command (mentioned in http://www.vleeuwen.net/2012/10/virtualbox-uuid-mismatch):
VBoxManage closemedium disk ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vmdk
then reattach the disk and "boot2docker start".
Just leaving a reply for future (unlucky) people.
I couldn't find a solution and even on the VirtualBox forum anybody could help me. I reinstalled the machine.