evansm7 / vftool

A simple macOS Virtualisation.framework wrapper
MIT License
994 stars 68 forks source link

Ubuntu Server fails #2

Open phsimons opened 3 years ago

phsimons commented 3 years ago

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 commented 3 years ago

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

phsimons commented 3 years ago

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 commented 3 years ago

Did you do anything to the initrd file ?

phsimons commented 3 years ago

no

sylvainfilteau commented 3 years ago

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

phsimons commented 3 years ago

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

sylvainfilteau commented 3 years ago

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 commented 3 years ago

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

rossbachp commented 3 years ago

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 commented 3 years ago

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

evansm7 commented 3 years ago

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:

Notes on installers:

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:

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Great Job!

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

Boot Init Ubuntu VM Boot Ubuntu VM First Login
nicoolaj commented 3 years ago

Works well, thanks

PraneetNeuro commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

PraneetNeuro commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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
pgib commented 3 years ago

I managed to get things up and running following these instructions, so thanks so much to everyone who contributed!

For me, DNS resolution doesn't work out of the box. The default in /etc/resolv.conf is 127.0.0.53, and even doing basic things like trying to install a package failed at the DNS resolution. For now, I've just replaced the symlink with a basic file that uses DNS servers I know to work, and it seems like there are some considerably more complex but probably more technically correct systemd approaches. (I'm coming from the FreeBSD world.)

Lastly, in case anyone else runs into this, if you're a tmux user, it seems like you have to start the VM from outside of tmux. If you start it inside tmux, it starts up okay, but as soon as you try to connect to tty using screen, it bails:

2020-12-03 14:30:09.666 vftool[8771:542552] +++ Configuration validated.
2020-12-03 14:30:09.667 vftool[8771:542552] +++ canStart = 1, vm state 0
2020-12-03 14:30:09.690 vftool[8771:542558] --- VM start error: Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start" UserInfo={NSDebugDescription=The virtual machine failed to start}

Starting the VM using the exact same command from outside of tmux works fine. (Attaching via screen from inside tmux works fine.)

evansm7 commented 3 years ago

Great work everyone! Glad to see the various guides -- anyone wish to do a wiki page perhaps?

@pgib, that's a good find w.r.t. the startup failure (I hadn't been able to recreate it when it was reported before). What I'm thinking regarding the console is to provide some other switch to fall back to using "stdio" for the console instead of creating a pty/requiring attaching to /dev/ttyblah. This would give immediate startup and print output to the console, and might help this issue, but wouldn't really give a usable terminal -- so would be most useful once installed and after you can SSH in. Or, as a fallback, acquire a pty but don't wait for a connection.

I'll also have a look at adding multiple discs, something I've wanted too. May get some time at the weekend, hang in there.

Thanks for trying vftool and persisting, and helping each other. 👍

-M

natew commented 3 years ago

So this all works and I can boot into it and make changes, but once I quit vftool everything is lost. I can still reboot into it, but any changes made aren't persisted. Is this intended? Any way to persist changes so I can turn this into an always-on daemon even after restart?

PraneetNeuro commented 3 years ago

That’s because the initrd image that you’re using is hard coded to boot into the live version, to install, attach a block device, try it with Ubuntu server, extract the initrd image from the installation and use it, even then the Initramfs doesn’t support virtio block devices out of the box, you need to generate a new one to get it working.

natew commented 3 years ago

@PraneetNeuro thanks for the tips, any guide / github / reference for doing that? I'm not super familiar with linux/virtio/intramfs at all.

PraneetNeuro commented 3 years ago
  1. Download and use the Ubuntu server image as it supports a non GUI based installation i.e command line installation
  2. Install qemu-img through homebrew and create a disk image of desired size where you’d be installing the OS
  3. You’ll have to modify the source to add a block storage device attachment which is off virtio type

Initrd is used to set up the initial RAM layout before the kernel is loaded onto the memory

Vmlinuz is the compressed version of the kernel which is initially loaded into the ram

Both of these images are available in the iso image of Ubuntu under the Casper directory but the initramfs provided with the iso doesn't support booting from a disk which has Ubuntu installed

  1. Proceed with the given images of initrd and vmlinuz in the ISO for the installation, the installation will be successful

  2. Mount the vdb2 partition of the disk and extract the initrd present at the root of the partition in any means of your choice, say SCP

  3. This initrd will support booting from the disk but doesn’t have virtio driver support and won’t support the virtual disk that we have out of the box

  4. Generate the initramfs with virtio block storage support from a usable Ubuntu server system or VM and use it as the initrd image

Make sure to pass in the argument root=/dev/vdb

ctolsen commented 3 years ago

I wrote an end-to-end guide on how to get vftool running with Docker on M1, which seems to be the goal of many in this thread. Here!

rossbachp commented 3 years ago

I wrote a blog post of my journey to a silicon container vm :)

Containerized the apple silicon

PraneetNeuro commented 3 years ago

Check my repo out, definitely more user friendly and is a bit easier with regards to the disk management https://github.com/PraneetNeuro/Project-Mendacius

rpvilao commented 3 years ago

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 commented 3 years ago

@rpvilao Are you in a tmux session by chance?

rpvilao commented 3 years ago

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

rpvilao commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

Damenly commented 3 years ago

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

mibosshard commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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.