<div dir="ltr">Hi,<br><br>I don't want to create a lot of spam, but I have also added this discussion to:<br><a href="https://answers.launchpad.net/ubuntu/+question/690575">https://answers.launchpad.net/ubuntu/+question/690575</a><br>and<br><a href="https://askubuntu.com/questions/1237424/install-ubuntu-in-a-file-on-windows-partition-similar-to-wubi-installer">https://askubuntu.com/questions/1237424/install-ubuntu-in-a-file-on-windows-partition-similar-to-wubi-installer</a><br><br>I am not sure where is the proper place to ask this question:<br>--------------------------------------------------------------------------------------------------------<br>I am installing ubuntu in a file on my ntfs windows partition.<br><br>This is quite easy to do:<br>```<br>disable safe boot in bios<br>you might also need to set AHCI SSD interface access<br>boot and run live cd<br>```<br>open a terminal and as root<br>```<br>#mount ntfs partition<br>mount -t ntfs /dev/nvme0n1p3 /mnt<br>#create installation folder<br>mkdir /mnt/ubuntu<br>#create virtual drive<br>mknod /dev/sdx b 7 100<br>#create virtual disk image<br>dd if=/dev/zero of=/mnt/ubuntu/ubuntu.img bs=1G count=256<br>#link the virtual drive to the virtual disk image<br>losetup /dev/sdx /mnt/ubuntu/ubuntu.img<br>```<br><br>and install ubuntu in /dev/sdx like on a separate disk.<br><br>common problems:<br>```<br>/dev/nvme0n1p3 not showing up - these are related to bios settings<br>mount -t ntfs /dev/nvme0n1p3 /host fail to mount - windows partition can be encrypted, so disable from windows (no need to format or reinstall windows)<br>```<br><br>to boot from the new environment I use grub config:<br>```<br>### BEGIN /etc/grub.d/10_linux ###<br>menuentry 'ubuntu' {<br>        rmmod tpm<br>        loopback loop (hd0,gpt3)/ubuntu/ubuntu.img<br>        root=(loop)<br>        linux /boot/vmlinuz-generic root=/dev/sdx rw verbose nosplash<br>        initrd /boot/initrd.img-generic<br>}<br>set timeout_style=menu<br>if [ "${timeout}" = 0 ]; then<br>  set timeout=10<br>fi<br>### END /etc/grub.d/10_linux ###<br>```<br><br>the rmmod tpm is causing mounting loop to hang (grub 2.04)<br><br>on older versions loading ntfs driver was needed (grub 2.02):<br>modprobe ntfs<br><br>this will actually drop the boot process to initramfs shell<br><br>at this point you need to manually add commands to load the image<br>```<br>#create mount point needed by initramfs image<br>mkdir /host<br>#mount ntfs partition<br>mount -t ntfs /dev/nvme0n1p3 /host<br>#create virtual drive<br>mknod /dev/sdx b 7 100<br>#link the virtual drive to the virtual disk image<br>losetup /dev/sdx /host/ubuntu/ubuntu.img<br>#continue boot up<br>exit<br>```<br><br>this can be easily added to an initramfs scripts.<br><br><b>my question is, can we add this functionality to Ubuntu?</b><br><br>I find it easy to do and very useful. I can boot ubuntu in a native environment, but also can move my image around just like a virtual disk image.<br>To move my installation, I just need to follow the same steps on another instance, and just copy my ubuntu.img file from the old instance and overwrite it on the new instance.<br>--------------------------------------------------------------------------------------------------------<br><br>Thank you,<br>Razvan</div>