Okay – a wild guess:
The disk image (root.img
) inside qubes-template-fedora-36-4.0.6-202205270243.noarch.rpm
and qubes-template-debian-11-4.0.6-20220117156.noarch.rpm
, uses a block size of 512 … and the logical volume they are imported into (via import_data_with_size
) uses a block size of 4096 …
Edit: dang - the forum software does not allow me to post a [partial] solution in it’s own post (“You have posted 3 times - wait for someone else to write something”), so I have to edit this one - and miss the people that uses mail to interact with the forum :-/
Okay - I’m now closer to get Qubes OS running on the Macbook Pro (A1708) - with just a little help, the initial setup completes and installs running cubes … but it’s a hack!!
The main issue seems to be the 512 vs 4096 block size - the image from the rpm
files needs a new partition table to work.
To do this, I added a input(" .. ")
to /usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py
to have time to recreate the partition table:
$ cat /media/sdb1/Qubes/patch.txt
--- /usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py.orig 2022-11-29 01:00:00.000000000 +0100
+++ /usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py 2022-12-28 16:29:24.421991360 +0100
@@ -96,6 +96,27 @@
root_size = get_root_img_size(source_dir)
root_path = os.path.join(source_dir, 'root.img')
+
+ print("Go to the files in:")
+ print(root_path)
+ print("fdisk root.img")
+ print("fdisk -b 4096 root.img")
+ print(" g")
+ print(" w")
+ print("fdisk -b 4096 root.img")
+ print(" n")
+ print(" size: +200M")
+ print(" n")
+ print(" size: +2M")
+ print(" n")
+ print(" <use defaults> -- do *not* change the data")
+ print(" t")
+ print(" part: 1 -- type 1")
+ print(" t")
+ print(" part: 2 -- type 4")
+
+ input("Press enter, when ready")
+
if os.path.exists(root_path + '.part.00'):
input_files = glob.glob(root_path + '.part.*')
with subprocess.Popen(['cat'] + sorted(input_files),
$
(the print("...")
is just there to remind myself what needs to be done).
Eg: To install debian-11-minimal
will require 2 terminals - one that will look like:
[root@dom0 ~]# qvm-template install qubes-template-debian-11-minimal-0\:4.0.6-202108191622.rpm
Installing template 'debian-11-minimal'...
debian-11-minimal: Importing data
Go to the files in:
/var/tmp/tmpxkm5fw9m/var/lib/qubes/vm-templates/debian-11-minimal/root.img
fdisk root.img
fdisk -b 4096 root.img
g
w
fdisk -b 4096 root.img
n
size: +200M
n
size: +2M
n
<use defaults> -- do *not* change the data
t
part: 1 -- type 1
t
part: 2 -- type 4
Press enter, when ready
and the second where the root.img
is manipulated:
[root@dom0 ~]# cd /var/tmp/tmpxkm5fw9m/var/lib/qubes/vm-templates/debian-11-minimal/
[root@dom0 debian-11-minimal]# mv root.img.part.00 _root.img.part.00
[root@dom0 debian-11-minimal]# cat _root.img.part.00 | tar xf -
[root@dom0 debian-11-minimal]# fdisk root.img
Welcome to fdisk (util-linux 2.35.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk root.img: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F4796A2A-E377-45BD-B539-D6D49E569055
Device Start End Sectors Size Type
root.img1 2048 411647 409600 200M EFI System
root.img2 411648 415743 4096 2M BIOS boot
root.img3 415744 20971486 20555743 9.8G Linux filesystem
Command (m for help): q
[root@dom0 debian-11-minimal]# fdisk -b 4096 root.img
Welcome to fdisk (util-linux 2.35.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
GPT PMBR size mismatch (20971519 != 2621439) will be corrected by write.
Command (m for help): g
Created a new GPT disklabel (GUID: 6F6FA40B-9D5E-E742-9845-331182635433).
The device contains 'gpt' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Command (m for help): w
The partition table has been altered.
Syncing disks.
[root@dom0 debian-11-minimal]# fdisk -b 4096 root.img
Welcome to fdisk (util-linux 2.35.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition number (1-128, default 1):
First sector (256-2621434, default 256):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (256-2621434, default 2621434): +200M
Created a new partition 1 of type 'Linux filesystem' and of size 200 MiB.
Command (m for help): n
Partition number (2-128, default 2):
First sector (51456-2621434, default 51456):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (51456-2621434, default 2621434): +2M
Created a new partition 2 of type 'Linux filesystem' and of size 2 MiB.
Command (m for help): n
Partition number (3-128, default 3):
First sector (51968-2621434, default 51968):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (51968-2621434, default 2621434):
Created a new partition 3 of type 'Linux filesystem' and of size 9.8 GiB.
Partition #3 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): t
Partition number (1-3, default 3): 1
Partition type (type L to list all types): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.
Command (m for help): t
Partition number (1-3, default 3): 2
Partition type (type L to list all types): 4
Changed type of partition 'Linux filesystem' to 'BIOS boot'.
Command (m for help): w
The partition table has been altered.
Syncing disks.
[root@dom0 debian-11-minimal]#
After this, the image root.img
should work and the installer can import it (so press “Enter” in the first terminal).
The hack also allowed me to install fedora-36
, whonix-gw-16
and whonix-ws-16
from the Qubes-4.1.20221224-kernel-latest-x86_64.iso
image. The steps were:
- Run the installer
- After the reboot, quit the initial setup without changing anything
- Patch
/usr/lib/python3.8/site-packages/qubesadmin/tools/qvm_template_postprocess.py
in a terminal from dom0
.
- Open a second terminal in
dom0
and run sudo /usr/libexec/initial-setup/initial-setup-graphical
When the second termnial asks you to fix root.img
files, do so in the first terminal. Note:
If there is several root.img.part.0X
files in the folder, rename all of them, and cat
them in order:
# mv root.img.part.00 _root.img.part.00
# mv root.img.part.01 _root.img.part.01
# mv root.img.part.02 _root.img.part.02
# mv root.img.part.03 _root.img.part.03
# cat _root.img.part.0{0,1,2,3} | tar xf -
I’ve probably missed a simple solution somewhere (and totally b0rked something) with this Frankenstein
approach … so any hints/suggestions will be appreciated!
Now I need to figure out how to get the WiFi going …