omniosorg / pkg5

Image Packaging System
https://omnios.org/
Other
11 stars 55 forks source link

clone/system-unconfigure issue on illumos-gate development build #349

Closed rcgoodfellow closed 3 years ago

rcgoodfellow commented 3 years ago

Greetings,

I've hit an issue with cloning ipkg zones running a development build of illumos. I've narrowed this issue down to /usr/lib/brand/ipkg/system-configure. That file appears to come from this repo hence the issue report here.

When I tried to clone a zone from a development build of Illumos-gate, I would get an error saying Zone: unconfigure failed. After a bit of digging I found that this was coming from /usr/lib/brand/ipkg/{clone,system-unconfigure}. I added the -x ksh flag to the top of each of these files to get output and replaced the zlogin redirect within system-unconfigure from /dev/null to a file in the /tmp directory so I could actually see what's going on. The output of those failed runs with -x set is available here.

What's happening here is in system-unconfigure a sed is running on /etc/ssh/sshd_config but /etc/ssh does not exist so the command is failing and derailing the whole zone clone.

As a quick workaround which allows the clone to succeed, I did the following

diff --git a/system-unconfigure.orig b/usr/lib/brand/ipkg/system-unconfigure
index 681a25a..48f8c21 100755
--- a/system-unconfigure.orig
+++ b/usr/lib/brand/ipkg/system-unconfigure
@@ -191,7 +191,9 @@ reset_init_default
 blank_root_pw
 clear_logs
 disable_ldap
-reset_ssh_config
+if [[ -d $ALTROOT/etc/ssh ]]; then
+    reset_ssh_config
+fi

 # Vim hints
 # vim:ts=4:sw=4:et:fdm=marker

However, it's not clear to me if this is a reasonable thing to do, or if it's a treatment of a symptom that's ignoring a deeper issue.

hadfl commented 3 years ago

thanks for the bug report.