oxidecomputer / helios-omicron-brand

A zone brand for Omicron components running under Helios
Mozilla Public License 2.0
4 stars 0 forks source link

Zoneadm install fails without intermediate directories in path construction #1

Open smklein opened 2 years ago

smklein commented 2 years ago

I'm using the following image:

 $ tar -tvf /opt/oxide/cockroachdb.tar.gz 
Decompressing '/opt/oxide/cockroachdb.tar.gz' with '/usr/bin/gzcat'...
-rw-r--r--   0/0       21 Jul 24 01:21 2006 oxide.json
-rwxr-xr-x   0/0        0 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/
-rwxr-xr-x   0/0        0 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/bin
-rwxr-xr-x   0/0   288545560 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/bin/cockroach
-rwxr-xr-x   0/0        0 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/lib
-rwxr-xr-x   0/0   527000 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/lib/libncurses.so.6
-rwxr-xr-x   0/0   642464 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/lib/libgcc_s.so.1
-rwxr-xr-x   0/0   2255976 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/lib/libstdc++.so.6
-rwxr-xr-x   0/0        0 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/sql/
-rw-r--r--   0/0    23537 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/sql/dbinit.sql
-rw-r--r--   0/0      310 Jul 24 01:21 2006 root/opt/oxide/cockroachdb/sql/dbwipe.sql
-rwxr-xr-x   0/0        0 Jul 24 01:21 2006 root/var/svc/manifest/site/cockroachdb/
-rw-r--r--   0/0     1485 Jul 24 01:21 2006 root/var/svc/manifest/site/cockroachdb/manifest.xml

The contents of oxide.json are as follows:

{"v":"1","t":"layer"}

I configured the zone using a pretty normal zonecfg:

pfexec zonecfg -z testzone                                                            
testzone: No such zone configured                                                              
Use 'create' to begin configuring a new zone.  
zonecfg:testzone> create                                                                       
zonecfg:testzone> set brand=omicron1                                                           
zonecfg:testzone> set zonepath=/zones/testzone 
zonecfg:testzone> set autoboot=false           
zonecfg:testzone> set ip-type=exclusive 
zonecfg:testzone> exit 

But when attempting to install the package, I see the following error;

$ pfexec zoneadm -z testzone install /opt/oxide/cockroachdb.tar.gz                      
INFO: omicron: installing zone testzone @ "/zones/testzone"...                                 
INFO: omicron: replicating /usr tree...        
INFO: omicron: replicating /lib tree...        
INFO: omicron: replicating /sbin tree...
INFO: omicron: pruning SMF manifests...        
INFO: omicron: pruning global-only files...                                                    
INFO: omicron: unpacking baseline archive...   
INFO: omicron: unpacking image "/opt/oxide/cockroachdb.tar.gz"...                              
Error: No such file or directory (os error 2) 

As some baseline checks:

For whatever it's worth, pkg info omicron1 shows the following version:

             Name: system/zones/brand/omicron1
          Summary: Oxide omicron1 brand support
         Category: System/Virtualization
            State: Installed
        Publisher: helios-dev
          Version: 1.0.2
           Branch: None
   Packaging Date: January 13, 2022 at 07:23:09 AM
Last Install Time: January 14, 2022 at 12:06:23 AM
             Size: 6.50 MB
             FMRI: pkg://helios-dev/system/zones/brand/omicron1@1.0.2:20220113T072309Z
jclulow commented 2 years ago

Were I to hazard a guess, it's likely because your tar file doesn't include /opt or /opt/oxide directory entries and we're probably not creating missing parent directories automatically. I'll take a look at the code, but if you want a workaround for right now, make sure those entries appear in the archive.

smklein commented 2 years ago

Ah, perfect, that seems to be the fix. I'm manually injecting:

And things appear to be working! (Well, the "install is complete, probably", and what more can I ask for)