Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu Server fails #2

Open
phsimons opened this issue Nov 28, 2020 · 63 comments
Open

Ubuntu Server fails #2

phsimons opened this issue Nov 28, 2020 · 63 comments

Comments

@phsimons
Copy link

Hello,
I am very interested in trying this.
I am trying ubuntu-20.04.1-live-server-arm64.iso and would like to perform a install. so I also created a DMG. But it does not seems to launch the installer ... do you have an idea what I am doing wrong ?

I use the following parameters
./vftool -k /Users/simonph/Desktop/Ubuntu/UbuntuServer/vmlinuz -i /Users/simonph/Desktop/Ubuntu/UbuntuServer/initrd -d /Users/simonph/Desktop/Ubuntu/VM.dmg -c /Users/simonph/Desktop/Ubuntu/UbuntuServer/ubuntu-20.04.1-live-server-arm64.iso

Screenshot 2020-11-28 at 11 41 42

And here is the console

Screenshot 2020-11-28 at 11 42 21

@sylvainfilteau
Copy link

How did you obtain the kernel and initrd files ? I'm trying to find this since yesterday 😅

@phsimons
Copy link
Author

You can find vmlinuz and initrd inside the iso image. (I used Keka to mount it). For the vmlinuz, you have to copy it, then rename it as .gz and extract.

@sylvainfilteau
Copy link

Did you do anything to the initrd file ?

@phsimons
Copy link
Author

no

@sylvainfilteau
Copy link

if you type exit at the prompt, it may give you some insight at what is going on.

@phsimons
Copy link
Author

Probably missing some -a but which ones
Screenshot 2020-11-29 at 09 27 53

@sylvainfilteau
Copy link

try with -a "console=hvc0 root=/dev/vda1" I think it needs other arguments to work well because right now the text is all messed up. But thats progress

@phsimons
Copy link
Author

I have tried that , but nothing appears on the /dev/ttys now
Screenshot 2020-11-29 at 14 49 29

@rossbachp
Copy link

rossbachp commented Nov 29, 2020

I got this after connect with screen /dev/ttys002 waiting message:

HOME/Library/Developer/Xcode/DerivedData/vftool-gifyyerhcgkkioeipwnxidpgzatn/Build/Products/Debug/vftool \
  -k $HOME/develop/UbuntuServer/vmlinuz \
  -i $HOME/develop/UbuntuServer/initrd \
  -d $HOME/VM/VM-Ubuntu.dmg \
  -c $HOME/develop/UbuntuServer/ubuntu-20.04.1-live-server-arm64.iso \
  -a "console=hvc0 root=/dev/vda1"
2020-11-29 16:51:40.132 vftool[18633:1749335] vftool (v0.1 25/11/2020) starting
2020-11-29 16:51:40.132 vftool[18633:1749335] +++ kernel at file:///Users/peter/develop/UbuntuServer/vmlinuz, initrd at file:///Users/peter/develop/UbuntuServer/initrd, cmdline 'console=hvc0 root=/dev/vda1', 1 cpus, 512MB memory
2020-11-29 16:51:40.132 vftool[18633:1749335] +++ fd 3 connected to /dev/ttys002
2020-11-29 16:51:40.132 vftool[18633:1749335] +++ Waiting for connection to:  /dev/ttys002
2020-11-29 16:54:06.674 vftool[18633:1749335] +++ Attaching disc file:///Users/peter/VM/VM-Ubuntu.dmg
2020-11-29 16:54:06.675 vftool[18633:1749335] --- Couldn't open disc at file:///Users/peter/VM/VM-Ubuntu.dmg
2020-11-29 16:54:06.675 vftool[18633:1749335] +++ Attaching CDROM file:///Users/peter/develop/UbuntuServer/ubuntu-20.04.1-live-server-arm64.iso
2020-11-29 16:54:06.675 vftool[18633:1749335] +++ Configuration validated.
2020-11-29 16:54:06.675 vftool[18633:1749335] +++ canStart = 1, vm state 0
2020-11-29 16:54:06.718 vftool[18633:1751389] --- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

How I am create the disc /Users/peter/VM/VM-Ubuntu.dmg ?

@rossbachp
Copy link

Create an empty disc with the MacOS disk utility. The virtual machine failed to start!

@evansm7
Copy link
Owner

evansm7 commented Nov 29, 2020

Hi all (I'm late to the thread, real life intervened) :) I've just tried an ubuntu-server ISO again, and can re-create. Two things to note:

  • The default RAM size (512MB) is too low for the ubuntu initrd -- passing -m 2048 solves the (initrd) prompt issue that @phsimons reported.
  • The ubuntu installer is unusable as @xiaolait and @sylvainfilteau note. (Even hitting ^T for simple mode, it's getting random keypress inputs.)

Notes on installers:

  • Ubuntu-server boots, but the terminal is unusable.
  • Debian install kernel/initrd on the debian-10.6.0-arm64-netinst.iso doesn't appear to have virtio drivers, so is a no-go. I installed Debian using debootstrap (see below).
  • Fedora-33 boots, but then seems to crash (it immediately terminates/init halts the system).
  • openSUSE-Tumbleweed-NET-aarch64-Current.iso (as of 28Nov20) installer boots nicely, is colourful and is usable, except has minor terminal issues: I keep having to hit tab/return to get the package download bargraphs to update.

However.... I don't believe running the installers is as easy as it sounds at this stage: once the packages are installed to your disc.img, then you'll need to fish out a kernel/initrd from the installed image, back to macOS, to boot it. (The initrd and likely the kernel will be different to those the installer uses.)

For this reason, enduring a chicken & egg situation and solving with another Linux box is IMO the easiest route currently. For example, installing Ubuntu or Debian using debootstrap, something like:

  • Create a disc image, partitions, rootfs
  • Mount root on say /mnt
  • debootstrap --arch=arm64 --foreign stable /mnt as root
    While that's cooking, build a mainline arm64 kernel (which won't need an initrd to boot debian, at least). When debootstrap is finished, the kernel/disc.img can be booted in a VM, and debootstrap --second-stage used to finish the installation (plus some manual stuff, like creating /etc/fstab, /etc/hosts, tzdata/locales). There are Debian/Ubuntu debootstrap directions on le net...

That doesn't help anyone that's desperate to use CentOS/Fedora etc. :) Anyone know if they have a debootstrap equivalent?

Finally: legend has it that there will be an EFI-related boot method in future, which may pave the way to booting ISOs (or even OVMF/edk2) directly, and that removes all of this faffing around with finding kernels/initrds. Hopefully a future macOS release will provide, here.

@evansm7
Copy link
Owner

evansm7 commented Nov 29, 2020

Create an empty disc with the MacOS disk utility. The virtual machine failed to start!

Oh dear -- I haven't seen this error before. The disc simply needs to be a file that exists and is of the size you want to use. For example, dd if=/dev/zero of=my_disc.img bs=1024k count=20480 makes a 20GB file of zeros.

But, see my previous message -- at this stage it is probably easiest to use Virtualization.framework/vftool with a disc image that is pre-installed elsewhere, unfortunately. Someone suitably motivated could perhaps write a script to extract kernels/initrds from a distribution install ISO, run the installer and then re-extract kernels/initrd from the installed disc, perhaps.

I'll see if I can recreate that error, though, how odd.

@phsimons
Copy link
Author

Thanks for the extended explanations ...
indeed Ubuntu-server boots, but the terminal is unusable.
Screenshot 2020-11-29 at 20 14 05

Screenshot 2020-11-29 at 19 21 47

But at this point isn't there a way to ssh in the VM and continue the install ?

@droidix
Copy link

droidix commented Nov 29, 2020

I've had good luck with the Ubuntu cloud images linked by a kind user on the MacRumors forums [1]:

Let's assume you place all of these files in a linux directory under your home directory. Prepare the kernel:

mv ubuntu-20.04-server-cloudimg-arm64-vmlinuz-generic vmlinux.gz
gunzip vmlinux.gz

The initrd (just renaming for convenience):

mv ubuntu-20.04-server-cloudimg-arm64-initrd-generic initrd

And finally, the disk image:

tar xvfz ubuntu-20.04-server-cloudimg-arm64.tar.gz
mv focal-server-cloudimg-arm64.img disk.img

With these being cloud images, I want to disable cloud-init, set the root password, generate some SSH host keys, and configure DHCP. To work on the disk image, we'll boot the virtual machine without specifying the root to the Linux command line.

vftool -k vmlinux -i initrd -d disk.img -m 1024 -a "console=hvc0"

In another terminal, use screen to attach to the tty. The VM will finish booting and drop to an (initramfs) prompt. Then run:

mkdir /mnt
mount /dev/vda /mnt
chroot /mnt

touch /etc/cloud/cloud-init.disabled

echo 'root:root' | chpasswd

ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519

cat <<EOF > /etc/netplan/01-dhcp.yaml 
network:
    renderer: networkd
    ethernets:
        enp0s1:
            dhcp4: true
    version: 2
EOF

exit
umount /dev/vda

Kill the VM with CTRL+C in the terminal you ran vftool and then run it again, but this time specifying the root to the kernel:

vftool -k vmlinux -i initrd -d disk.img -m 1024 -a "console=hvc0 root=/dev/vda"

You can now connect with screen and login to the root user with root as the password. You can also ssh into the VM if you configure your public key. Show the IP address via ip addr show | grep "inet 192"

@rossbachp
Copy link

Great Job!

Works for me..... Congratulation....

Boot Init Ubuntu VM

Boot Ubuntu VM

First Login

@nicoolaj
Copy link

Works well, thanks

@PraneetNeuro
Copy link

PraneetNeuro commented Dec 1, 2020

Got to install Ubuntu server on a disk image but not able to boot into it. Tried passing command line arguments to set root directory, doesn't seem to work. Got any idea? stuck on initramfs.

@rossbachp
Copy link

rossbachp commented Dec 1, 2020

I use this to install the initramfs

mkdir /mnt
mount /dev/vda /mnt
chroot /mnt

touch /etc/cloud/cloud-init.disabled

echo 'root:root' | chpasswd

echo "m1silicon" >/etc/hostname
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519

cat <<EOF > /etc/netplan/01-dhcp.yaml 
network:
    renderer: networkd
    ethernets:
        enp0s1:
            dhcp4: true
    version: 2
EOF

exit
umount /dev/vda

CTRL-C inside the VM

Then boot with disk:

$ vftool -k vmlinux -i initrd -d ubuntu-20.04-disk.img -m 1024 -a "console=hvc0 root=/dev/vda"

@rossbachp
Copy link

rossbachp commented Dec 1, 2020

How I can expand or add a filesystem?

apt-get update
# crash with no space at filesystem...
df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              460708       0    460708   0% /dev
tmpfs              98816   10608     88208  11% /run
/dev/vda         1286424 1270040         0 100% /
tmpfs             494076       0    494076   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs             494076       0    494076   0% /sys/fs/cgroup
/dev/loop0         50048   50048         0 100% /snap/core18/1936
/dev/loop1         27520   27520         0 100% /snap/snapd/9730
/dev/loop2         61312   61312         0 100% /snap/lxd/18152
tmpfs              98812       0     98812   0% /run/user/0

@nicoolaj
Copy link

nicoolaj commented Dec 1, 2020

I did this with qemu-img installed using brew
To increase the disk by 50Gb
qemu-img resize disk.img +50G

Then, you will need to resize the fs

@rossbachp
Copy link

You install the emu with rosetta 2 intel brew?

I got the installation error at ny arm brew installation?

==> /opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed /private/tmp/sphinx-doc--MarkupSafe-20201201-12738-1vhhiv8
Last 15 lines from /Users/peter/Library/Logs/Homebrew/sphinx-doc/15.pip:
    requirement.install(
  File "/opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 856, in install
    six.reraise(*exc.parent)
  File "/opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/lib/python3.9/site-packages/pip/_vendor/six.py", line 703, in reraise
    raise value
  File "/opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/lib/python3.9/site-packages/pip/_internal/operations/install/legacy.py", line 74, in install
    runner(
  File "/opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py", line 273, in runner
    call_subprocess(
  File "/opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-req-build-ltp9y04v/setup.py'"'"'; __file__='"'"'/private/tmp/pip-req-build-ltp9y04v/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-x3k5bx1n/install-record.txt --single-version-externally-managed --compile --install-headers /opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/include/site/python3.9/MarkupSafe Check the logs for full command output.
WARNING: You are using pip version 20.2.4; however, version 20.3 is available.
You should consider upgrading via the '/opt/homebrew/Cellar/sphinx-doc/3.3.1_1/libexec/bin/python -m pip install --upgrade pip' command.
Removed build tracker: '/private/tmp/pip-req-tracker-292f1dnh'

Do not report this issue to Homebrew/brew or Homebrew/core!


Error: You are running macOS on a arm64 CPU architecture.
We do not provide support for this (yet).
Reinstall Homebrew under Rosetta 2 until we support it.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
unsupported configuration.

@rossbachp
Copy link

I install qemu with rosetta 2.

I resize the image:'

$ qemu-img resize ubuntu-20.04-disk.img +50G
WARNING: Image format was not specified for 'ubuntu-20.04-disk.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
Image resized.
$ ls -l
total 45735352
drwxr-xr-x   8 peter  staff          256  1 Dez 06:38 .
drwxr-xr-x  12 peter  staff          384  1 Dez 05:06 ..
-rw-r--r--   1 peter  staff          170 24 Nov 00:41 README
-rw-r--r--   1 peter  staff     27702569 24 Nov 00:39 initrd
-rw-r--r--   1 peter  staff  55081697280  1 Dez 18:59 ubuntu-20.04-disk.img
-rw-r--r--   1 peter  staff    471734209 24 Nov 00:42 ubuntu-20.04-server-cloudimg-arm64.tar.gz
-rw-r--r--   1 peter  staff  21474836480  1 Dez 06:38 vm_disc.img
-rw-r--r--   1 peter  staff     30382464 24 Nov 00:39 vmlinux

But after start inside the ubuntu vm the resizing isn't available:

df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              975012       0    975012   0% /dev
tmpfs             201676     736    200940   1% /run
/dev/vda         1286424 1262040      8000 100% /
tmpfs            1008376       0   1008376   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs            1008376       0   1008376   0% /sys/fs/cgroup
/dev/loop0         27520   27520         0 100% /snap/snapd/9730
/dev/loop1         50048   50048         0 100% /snap/core18/1936
/dev/loop2         61312   61312         0 100% /snap/lxd/18152
tmpfs             201672       0    201672   0% /run/user/0

@rossbachp
Copy link

The disk info show that the image can grow...

qemu-img info ubuntu-20.04-disk.img
image: ubuntu-20.04-disk.img
file format: raw
virtual size: 51.3 GiB (55081697280 bytes)
disk size: 1.31 GiB

@rossbachp
Copy link

Ahh!
I forgot the "resize2fs /dev/vda" inside the ubuntu fs... :)

@PraneetNeuro
Copy link

PraneetNeuro commented Dec 1, 2020

Were you able to boot into the disk? I always end up with the live version? If so, how did you manage to get it boot from the disk as the root! Any help is very much appreciated!

@rossbachp
Copy link

Now docker is running at the vm.
Install the docker cli (Rosetta) and use an docker ssh context.
Docker Engine is now directly available via at my Visual Studio Code.

Container Hacking is possible at the M1....

Can I help to document the setup?

@rossbachp
Copy link

Were you able to boot into the disk? I always end up with the live version? If so, how did you manage to get it boot from the disk as the root! Any help is very much appreciated!

It is a two phase boot process.

Frist boot with RAM disk and create the /dev/vda manually without login
Second boot with disk (add the root=/dev/vda parameter), is a normal boot with login

@PraneetNeuro
Copy link

Thanks a ton! But if I reboot won’t I lose the changes since we’re not writing the changes! Correct me if I’m wrong! Can you walk me through the process? That’d be of great help

@mibosshard
Copy link

mibosshard commented Dec 3, 2020

a few days ago I created a turn-key ready bundle containing SimpleVM and Ubuntu. the image works with vftool, too:
https://github.com/mibosshard/SimpleVM/releases/download/20201128/SimpleVM_Ubuntu.zip
https://github.com/mibosshard/SimpleVM/releases

I also made a binary of vftool:
https://github.com/mibosshard/vftool/releases/download/20201126/vftool.zip
https://github.com/mibosshard/vftool/releases

@dguerri
Copy link

dguerri commented Dec 3, 2020

fwiw, it's not necessary to install qemu (and homebrew on rosetta).
Just appending data on the cloud image is enough.
I used truncate -s 20G focal-server-cloudimg-arm64.img (truncate needs to be installed, for instance via macports), but a plain >> should be enough

Then:

root@ubuntu:~# resize2fs /dev/vda
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/vda is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 3
The filesystem on /dev/vda is now 5242880 (4k) blocks long.

root@ubuntu:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            953M     0  953M   0% /dev
tmpfs           197M  740K  197M   1% /run
/dev/vda         20G  1.3G   19G   7% /
tmpfs           985M     0  985M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           985M     0  985M   0% /sys/fs/cgroup
/dev/loop0       27M   27M     0 100% /snap/snapd/10243
/dev/loop1       49M   49M     0 100% /snap/core18/1936
tmpfs           197M     0  197M   0% /run/user/0
/dev/loop2       60M   60M     0 100% /snap/lxd/18152

@rpvilao
Copy link

rpvilao commented Dec 10, 2020

Hi,

I've started with the finestructure tutorial and ended up here. I also tried with the image, vmlinuz, and initrd posted in a previous comment and I am always getting a
--- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

My files:

focal-server-cloudimg-arm64.img: Linux rev 1.0 ext4 filesystem data, UUID=ede099f5-61df-4eb8-a811-c8aea1d942eb, volume name "cloudimg-rootfs" (extents) (64bit) (large files) (huge files)
initrd: LZ4 compressed data (v0.1-v0.9)
ubuntu-20.04-server-cloudimg-arm64.tar.gz: gzip compressed data, last modified: Tue Dec  1 16:59:03 2020, from Unix, original size modulo 2^32 1395660800
vmlinuz: Linux kernel ARM64 boot executable Image, little-endian, 4K pages

Command:
./vftool -k vmlinuz -i initrd -d focal-server-cloudimg-arm64.img -m 2048 -a "console=hvc0"

Output:

2020-12-10 17:22:25.113 vftool[30069:402845] vftool (v0.1 25/11/2020) starting
2020-12-10 17:22:25.114 vftool[30069:402845] +++ kernel at vmlinuz -- file:///Users/rpvilao/Images/ubuntu/, initrd at initrd -- file:///Users/rpvilao/Images/ubuntu/, cmdline 'console=hvc0', 1 cpus, 1024MB memory
2020-12-10 17:22:25.114 vftool[30069:402845] +++ fd 3 connected to /dev/ttys002
2020-12-10 17:22:25.114 vftool[30069:402845] +++ Waiting for connection to:  /dev/ttys002
2020-12-10 17:22:40.058 vftool[30069:402845] +++ Attaching disc focal-server-cloudimg-arm64.img -- file:///Users/rpvilao/Images/ubuntu/
2020-12-10 17:22:40.058 vftool[30069:402845] +++ Configuration validated.
2020-12-10 17:22:40.058 vftool[30069:402845] +++ canStart = 1, vm state 0
2020-12-10 17:22:40.083 vftool[30069:402850] --- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

Any clues on what might be happening? Thanks!

@pgib
Copy link

pgib commented Dec 10, 2020

@rpvilao Are you in a tmux session by chance?

@rpvilao
Copy link

rpvilao commented Dec 10, 2020

@pgib thanks for replying. I am using a regular terminal session (zsh)

@rpvilao
Copy link

rpvilao commented Dec 10, 2020

@pgib your question gave me an idea... I opened the terminal using rosetta (to make it work with brew), without rosetta it works thanks :)

@evansm7
Copy link
Owner

evansm7 commented Dec 10, 2020

I've enabled the "Discussions" GitHub feature which may be of use to capture some of the good info people have provided in this issue. I've noticed a bunch of Linux setup questions posed as vftool issues -- strictly we should create issues only for vftool bugs/requests (otherwise bugs are likely to get lost). I'm glad folks are helping each other out (thanks!), so the wiki/discussions should be a useful place to do this (and would make general Linux tips/info easier to find).

@shroomist
Copy link

I'm unfortunate to run into

2020-12-12 14:20:53.002 vftool.bin[4205:81177] +++ fd 3 connected to /dev/ttys002
2020-12-12 14:20:53.002 vftool.bin[4205:81177] +++ Waiting for connection to:  /dev/ttys002
2020-12-12 14:20:56.184 vftool.bin[4205:81177] +++ Attaching disc vm/focal-server-cloudimg-arm64.img
2020-12-12 14:20:56.185 vftool.bin[4205:81177] +++ Configuration validated.
2020-12-12 14:20:56.185 vftool.bin[4205:81177] +++ canStart = 1, vm state 0
2020-12-12 14:20:56.211 vftool.bin[4205:81192] --- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

when attempting to connect with screen. no tmux or rosetta.
any hints to debugging this?

@bdruth
Copy link

bdruth commented Dec 13, 2020

@shroomist iTerm? it uses tmux, if so ...

@Damenly
Copy link

Damenly commented Dec 14, 2020

Does anyone feel that the IO speed in the Ubuntu OS is too slow? It shouldn't be related to the image.

@mibosshard
Copy link

Does anyone feel that the IO speed in the Ubuntu OS is too slow? It shouldn't be related to the image.

yep, definitely slower than it should be...
https://twitter.com/mibosshard/status/1337903596235616256

@TheTechnobear
Copy link

hey @rossbachp , Ive followed your guide - all works fine.
except, as soon as I try to use apt-get install I get

[code]
Setting up flash-kernel (3.98ubuntu12) ...
flash-kernel: deferring update (trigger activated)
Processing triggers for flash-kernel (3.98ubuntu12) ...
Unsupported platform.
dpkg: error processing package flash-kernel (--configure):
installed flash-kernel package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
flash-kernel
E: Sub-process /usr/bin/dpkg returned an error code (1)
[/code]

any thoughts?

@Damenly
Copy link

Damenly commented Dec 15, 2020

Another way to resize image(without qemu):

cp ubuntu.img ubuntu2.img 
cp ubuntu.img ubuntu3.img 

truncate -s 40G ubuntu.img
# attach ubuntu2.img as /dev/vda,  ubuntu3.img as /dev/vdb, and ubuntu.img as /dev/vdc
# /dev/vdc is the 40GB img 

vftool -k vmlinux -i initrd -d ubuntu2.img -d ubuntu3.img -d ubuntu.img -m 4096 -a "console=hvc0 root=/dev/vda init=/bin/bash"

#attach to the  tty using screen
# ...
mkfs.ext4 -L cloudimg-rootfs /dev/vdc 
mount -o ro /dev/vdb /home
mount /dev/vdc /mnt
cp -ar /home/* /mnt/
umount /mnt /home

#shutdown the VM by killing the vtftool.

rm ubuntu2.img ubuntu3.img

Then we have the ubuntu.img in 40GB size.

@tommythorn
Copy link

tommythorn commented Dec 15, 2020

I did it way simpler using dd to append 20 GB of zeros to the img file (truncate may work just as well), booted the VM, and used resize2fs to resize the filesystem (live!).

@wxyz202
Copy link

wxyz202 commented Dec 25, 2020

I try the ubuntu server installer.

  • With screen attaching the pts, the terminal is unusable.
  • With arg "-t 0", if add cfmakeraw for STDIN_FILENO, the terminal works!

@PraneetNeuro
Copy link

I try the ubuntu server installer.

  • With screen attaching the pts, the terminal is unusable.

  • With arg "-t 0", if add cfmakeraw for STDIN_FILENO, the terminal works!

Check out my repo project-mendacius

@kanav99
Copy link

kanav99 commented Dec 25, 2020

Following exaclty #2 (comment) on Macbook Pro 2019 (Intel) using zsh. I get the error everyone else is getting -

➜  linux ../Projects/vftool/build/vftool -k vmlinux -i initrd -d disk.img -m 2048 -a "console=hvc0"

2020-12-25 22:41:09.230 vftool[8442:220049] vftool (v0.3 10/12/2020) starting
2020-12-25 22:41:09.231 vftool[8442:220049] +++ kernel at vmlinux, initrd at initrd, cmdline 'console=hvc0', 1 cpus, 2048MB memory
2020-12-25 22:41:09.231 vftool[8442:220049] +++ fd 3 connected to /dev/ttys001
2020-12-25 22:41:09.231 vftool[8442:220049] +++ Waiting for connection to:  /dev/ttys001
2020-12-25 22:41:11.551 vftool[8442:220049] +++ Attaching disc disk.img
2020-12-25 22:41:11.551 vftool[8442:220049] +++ Configuration validated.
2020-12-25 22:41:11.551 vftool[8442:220049] +++ canStart = 1, vm state 0
2020-12-25 22:41:11.586 vftool[8442:220073] --- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

Any help would be super appreciated!

@jasmas
Copy link

jasmas commented Dec 30, 2020

I'm having the issue where the VM will not start as well.
I notice the following two sandbox errors just before vftool exits after I connect to the tty:

Sandbox: com.apple.Virtua(8285) deny(1) syscall-unix 220
Sandbox: com.apple.Virtua(8285) deny(1) syscall-unix 338

Could these be related?
This appears to be an issue with focal because I can boot bionic fine.

@eugene-s
Copy link

eugene-s commented Jan 12, 2021

I've found the solution for the problem with:

--- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

I was trying to update the network configuration file:

sudo nano /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist
        <key>Shared_Net_Address</key>
        <string>192.168.64.1</string>
        <key>Shared_Net_Mask</key>
        <string>255.255.255.0</string>

The first vmnet had been 192.168.64.1, after running vftool the IP address was increased to 192.168.65.1 and it started failing on running. When I've changed the IP to 192.168.64.1, it started working again. Maybe you need to clean up the file /var/db/dhcpd_leases.

I suggest making backups before doing changes in those files.

@jedahan
Copy link

jedahan commented Jan 12, 2021

I made a small makefile that does the bare minimum in downloading, extracting, and running vftool for ubuntu images, in case that's helpful.

Just a heads up - if your vm immediately exits, make sure you have downloaded the arm64 ubuntu image, not the amd64 ubuntu image if you are on an M1 mac. Spent an embarrassingly long time with that small issue.

https://gist.github.com/6fd8908936b30f19f8d1a025a40417ae

@PraneetNeuro
Copy link

Check out https://github.com/PraneetNeuro/Project-Mendacius allows you to download images based on the architecture and a user friendly gui based tool

@wxyz202
Copy link

wxyz202 commented Jan 21, 2021

Check out https://github.com/PraneetNeuro/Project-Mendacius allows you to download images based on the architecture and a user friendly gui based tool

Is there a way to make share folders between host and guest?

@adrian-azad
Copy link

For the people with the VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start} error, It is possible that you have a problem with the files you provide, for example you forgot to gunzip vmlinuz
At least that was my problem 🤦

@mungler
Copy link

mungler commented Apr 15, 2021

In case it helps anyone, as I was tearing my hair out a bit trying to get a consistent setup on Intel and ARM Macs, for our developers... it seems the intel vmlinuz file is compressed differently to the ARM one and does NOT need uncompressed before use.

If it helps anyone, here's the full steps for setting up an ubuntu 20.04 server on both intel and arm macs:

https://gist.github.com/mungler/c7f67bbb27ddbac01d30a1727c0346b5

@AlexGri
Copy link

AlexGri commented Feb 15, 2022

This comment solved my issue

#22 (comment)

@Awelways
Copy link

Awelways commented May 19, 2023

I have met an error when I first start the VM by vftool, can you guys have some available solutions? THX!!
Error massage: " VM start error: Error Domain=VZErrorDomain Code=2 "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests