`От: Dan McDonald <danmcd@omniti.com><br>Дата: Wednesday, July 1, 2015 19:43<br>> <br>> > On Jul 1, 2015, at 9:20 AM, Jim Klimov <jim@cos.ru> wrote:<br>> > <br>> > The corresponding part of the script (and exact command-lines <br>> involved) are here:<br>> > <br>> > <br>> > ...<br>> > <br>> > { echo "===== <br>> Updating PKG software itself"<br>> > <br>> ### This clause should fail if no 'pkg' updates were available, <br>> or if a<br>> > <br>> ### chrooted upgrade attempt with the new 'pkg' failed - both <br>> ways fall<br>> > <br>> ### through to altroot upgrade attempt<br>> > if <br>> /usr/bin/pkg -R "$BENEW_MNT" update --no-refresh --accept --deny-<br>> new-be --no-backup-be pkg; then \<br>> > echo "===== Updating the image with new PKG software via chroot"<br>> > chroot "$BENEW_MNT" /usr/bin/pkg -R / image-update --no-refresh --accept --deny-new-be --no-backup-be<br>> > <br>> else false; fi; } || \<br>> > { echo "===== <br>> Updating the image with old PKG software via altroot"<br>> > <br>> /usr/bin/pkg -R "$BENEW_MNT" image-update --no-refresh --accept -<br>> -deny-new-be --no-backup-be; } || \<br>> > { echo "===== <br>> Updating the image with old PKG software via altroot and allowed <br>> refresh"> /usr/bin/pkg -R "$BENEW_MNT" image-update --accept --deny-new-be --no-backup-be; }<br>> <br>> Can you run these, one at a time, by hand, so we all can see the <br>> exact output per command that's run? It'll help at least <br>> me get a better bead on what's wrong.<br>> <br>> Thanks,<br>> Dan<br><br><br>Most of the output was in the screenshot just above that, and I guess I found a workaround <br>that should suffice (will test more today), but for the sake of completeness, here goes:<br><br><br>The old BE was OmniOS bloody updated a month ago (20150602Z070407), new one with an updated pkg program was made yesterday, starting as the old one's clone (export BENEW=omnios-20150701Z065339-test) and the relevant tree was mounted into "/a" with my splitroot scripts from github:<br><br><br><br>###############################<br><br><br>:; ./beadm-mount.sh<br>omnios-20150701Z065339-test does not exist or appear to be a valid BE.<br>Please check that the name of the BE provided is correct.<br>=== Will clone omnios-20150602Z070407 into omnios-20150701Z065339-test, ok? Using these settings:<br>BENEW=omnios-20150701Z065339-test<br>BENEW_DS=rpool/ROOT/omnios-20150701Z065339-test<br>BENEW_MNT=/a<br>BENEW_MPT=/a<br>BEOLD=omnios-20150602Z070407<br>BEOLD_DS=rpool/ROOT/omnios-20150602Z070407<br>BEOLD_MNT=/<br>BEOLD_MPT=/<br>EXCLUDE_ATTRS='org.opensolaris.libbe:uuid|canmount|mountpoint'<br>RPOOL=rpool<br>RPOOLALT=<br>RPOOL_ROOT=rpool/ROOT<br>RPOOL_SHARED=rpool/SHARED<br> (Press ENTER or CTRL+C)<br><br><br>Created successfully<br>=== Created omnios-20150701Z065339-test based on omnios-20150602Z070407<br>=== Trying to replicate ZFS attributes from original to new BE...<br>===== ''<br>org.opensolaris.libbe:policy=static<br>org.openindiana.caiman:install=ready<br>===== '/opt'<br>compression=gzip-9<br>===== '/opt/local'<br>compression=gzip-9<br>===== '/usr'<br>compression=gzip-9<br>===== '/usr/local'<br>compression=gzip-9<br>===== '/var'<br>compression=gzip-9<br>===== '/var/db'<br>===== '/var/db/pkgin'<br>===== '/var/pkg'<br>compression=gzip-9<br>===== '/var/pkg/publisher'<br>=== Replicated custom ZFS attributes<br>Mounted successfully on: '/a'<br>=== Mounted omnios-20150701Z065339-test at /a<br>rpool/ROOT/omnios-20150701Z065339-test 153387008 721348 124154515 1% /a<br>rpool/ROOT/omnios-20150701Z065339-test/usr 153387008 758981 124154515 1% /a/usr<br>rpool/ROOT/omnios-20150701Z065339-test/usr/local 153387008 28 124154515 1% /a/usr/local<br>rpool/ROOT/omnios-20150701Z065339-test/opt 153387008 1207927 124154515 1% /a/opt<br>rpool/ROOT/omnios-20150701Z065339-test/opt/local 153387008 811058 124154515 1% /a/opt/local<br>rpool/ROOT/omnios-20150701Z065339-test/var 153387008 18600 124154515 1% /a/var<br>rpool/ROOT/omnios-20150701Z065339-test/var/db 153387008 33 124154515 1% /a/var/db<br>rpool/ROOT/omnios-20150701Z065339-test/var/db/pkgin 153387008 665190 124154515 1% /a/var/db/pkgin<br>rpool/ROOT/omnios-20150701Z065339-test/var/pkg 153387008 38370 124154515 1% /a/var/pkg<br>rpool/ROOT/omnios-20150701Z065339-test/var/pkg/publisher 153387008 9364 124154515 1% /a/var/pkg/publisher<br>=== BE clone completed!<br><br><br>=== To upgrade from upstream do:<br>pkg -R "/a" image-update --deny-new-be --no-backup-be && touch "/a/reconfigure" && bootadm update-archive -R "/a" && beadm umount "omnios-20150701Z065339-test"<br><br><br>TS="`date -u "+%Y%m%dZ%H%M%S"`"<br>zfs snapshot -r "rpool/SHARED@postupgrade-$TS"<br>zfs snapshot -r "rpool/ROOT/omnios-20150701Z065339-test@postupgrade-$TS"<br><br><br>beadm activate "omnios-20150701Z065339-test"<br>===<br><br><br>INFO: Unmounting any previous traces (if any - may fail), just in case<br>=== Unmounting BE omnios-20150701Z065339-test under '/a'...<br>===== beadm-unmounting omnios-20150701Z065339-test (/a)...<br>Unmounted successfully<br>Mounted successfully on: '/a'<br>BE Active Mountpoint Space Policy Created<br>omnios-20150701Z065339-test - /a 15.0K static 2015-07-01 17:09<br>===== lofs-mount '/tmp' at '/a/tmp'<br>===== lofs-mount '/proc' at '/a/proc'<br>===== lofs-mount '/dev' at '/a/dev'<br>===== lofs-mount '/devices' at '/a/devices'<br>===== lofs-mount '/var/adm' at '/a/var/adm'<br>===== lofs-mount '/var/cores' at '/a/var/cores'<br>===== lofs-mount '/var/crash' at '/a/var/crash'<br>===== lofs-mount '/var/log' at '/a/var/log'<br>===== lofs-mount '/var/mail' at '/a/var/mail'<br>===== lofs-mount '/var/spool/clientmqueue' at '/a/var/spool/clientmqueue'<br>===== lofs-mount '/var/spool/mqueue' at '/a/var/spool/mqueue'<br>===== lofs-mount '/var/tmp' at '/a/var/tmp'<br><br><br>BE Active Mountpoint Space Policy Created<br>omnios-20150701Z065339-test - /a 15.0K static 2015-07-01 17:09<br>rpool/ROOT/omnios-20150701Z065339-test 153387008 721348 124154491 1% /a<br>rpool/ROOT/omnios-20150701Z065339-test/usr 153387008 758981 124154491 1% /a/usr<br>rpool/ROOT/omnios-20150701Z065339-test/usr/local 153387008 28 124154491 1% /a/usr/local<br>rpool/ROOT/omnios-20150701Z065339-test/opt 153387008 1207927 124154491 1% /a/opt<br>rpool/ROOT/omnios-20150701Z065339-test/opt/local 153387008 811058 124154491 1% /a/opt/local<br>rpool/ROOT/omnios-20150701Z065339-test/var 153387008 18600 124154491 1% /a/var<br>rpool/ROOT/omnios-20150701Z065339-test/var/db 153387008 33 124154491 1% /a/var/db<br>rpool/ROOT/omnios-20150701Z065339-test/var/db/pkgin 153387008 665190 124154491 1% /a/var/db/pkgin<br>rpool/ROOT/omnios-20150701Z065339-test/var/pkg 153387008 38370 124154491 1% /a/var/pkg<br>rpool/ROOT/omnios-20150701Z065339-test/var/pkg/publisher 153387008 9364 124154491 1% /a/var/pkg/publisher<br>/tmp 14744832 16 14744816 1% /a/tmp<br>/proc 0 0 0 0% /a/proc<br>/dev 0 0 0 0% /a/dev<br>/devices 0 0 0 0% /a/devices<br>/var/adm 124172025 3071 124168954 1% /a/var/adm<br>/var/cores 5241366 19 5241347 1% /a/var/cores<br>/var/crash 5242880 19 5242861 1% /a/var/crash<br>/var/log 124173841 337 124173504 1% /a/var/log<br>/var/mail 124173921 114 124173807 1% /a/var/mail<br>/var/spool/clientmqueue 2096461 26 2096435 1% /a/var/spool/clientmqueue<br>/var/spool/mqueue 2096392 30 2096362 1% /a/var/spool/mqueue<br>/var/tmp 124515436 360944 124154491 1% /a/var/tmp<br><br><br>=== SUCCESS, (un)mounting operations completed for BE 'omnios-20150701Z065339-test' at '/a'<br><br><br>###############################<br><br><br><br><br>So, the tree above is mounted. Updating pkg under /a altroot itself (note the script does this via "pkg -R /a update pkg", but in the example below I do it via chroot to verify it generally works for this):<br><br><br><br>###############################<br><br>:; chroot /a /usr/bin/pkg -R / update pkg<br>WARNING: The boot environment being modified is not the active one. Changes<br>made will not be reflected on the next boot.<br><br><br> Packages to update: 1<br> Create boot environment: No<br>Create backup boot environment: Yes<br><br><br>DOWNLOAD PKGS FILES XFER (MB) SPEED<br>Completed 1/1 16/16 0.3/0.3 183k/s<br><br><br>PHASE ITEMS<br>Removing old actions 1/1<br>Updating modified actions 18/18<br>Updating package state database Done<br>Updating package cache 1/1<br>Updating image state Done<br>Creating fast lookup database Done<br>Reading search index Done<br>Updating search index 1/1<br>###############################<br><br><br>Now, trying to update packages inside that altroot in different ways...<br><br><br>What the script tries in the chroot:<br><br>###############################<br><br>:; chroot /a /usr/bin/pkg -R / image-update --no-refresh --accept --deny-new-be --no-backup-be<br>Creating Plan (Package planning: 425/427): /<br>pkg update: The proposed operation cannot be performed on a live image.<br>###############################<br><br><br>Trying to cheat with a non-verbatim "/" altroot string in the chroot:<br><br>###############################<br><br>:; chroot /a /usr/bin/pkg -R /// image-update --no-refresh --accept --deny-new-be --no-backup-be<br>pkg update: The proposed operation cannot be performed on a live image.<br>###############################<br><br><br>Trying the two other ways the script attempts (original BE's old pkg over a new BE's packages)<br><br>###############################<br><br>:; /usr/bin/pkg -R /a image-update --no-refresh --accept --deny-new-be --no-backup-be<br><br>Checking that pkg(5) is up to date -<br><br><br><br>WARNING: pkg(5) appears to be out of date, and should be updated before<br>running update. Please update pkg(5) by executing 'pkg install<br>pkg:/package/pkg' as a privileged user and then retry the update.<br>###############################<br><br><br>###############################<br><br>:; /usr/bin/pkg -R /a image-update --accept --deny-new-be --no-backup-be<br>WARNING: pkg(5) appears to be out of date, and should be updated before<br>running update. Please update pkg(5) by executing 'pkg install<br>pkg:/package/pkg' as a privileged user and then retry the update.<br>###############################<br><br><br><br><br>Finally, reading through the sources at /usr/bin/pkg and /usr/lib/python2.*/vendor-packages/pkg/ I tracked the error message to decision points to is_liveroot() to obscure envvars and/or configuration settings that cause some boolean regarding required new BE's to be true or false regardless of package-reboot settings.<br><br><br>Here is a piece which made me think it is intended for debug and so might not be a piece of committed API (would love to be wrong on this point): https://java.net/projects/ips/sources/pkg-gate/content/src/tests/api/t_bootenv.py#62<br><br><br>So, using PKG_LIVE_ROOT envvar, but no -R for altroot - no banana:<br><br>###############################<br><br>:; PKG_LIVE_ROOT=/ chroot /a /usr/bin/pkg image-update --no-refresh --accept --deny-new-be --no-backup-be<br>pkg update: The proposed operation cannot be performed on a live image.<br>###############################<br><br><br><br>Using both PKG_LIVE_ROOT envvar and -R for altroot - this is what ultimately succeeded, though only with a non-verbatim-"/" root directory string in this envvar:<br><br>###############################<br>:; PKG_LIVE_ROOT=/ chroot /a /usr/bin/pkg -R / image-update --no-refresh --accept --deny-new-be --no-backup-be<br>pkg update: The proposed operation cannot be performed on a live image.<br><br><br>:; PKG_LIVE_ROOT=/// chroot /a /usr/bin/pkg -R /// image-update --no-refresh --accept --deny-new-be --no-backup-be<br><br> Packages to remove: 1<br>Packages to install: 2<br> Packages to update: 424<br> Services to change: 1<br><br><br>DOWNLOAD PKGS FILES XFER (MB) SPEED<br>SUNWcs 1/427 476/7699 6.4/418.8 1.1M/s^C<br><br><br><br><br><br>:; PKG_LIVE_ROOT=/// chroot /a /usr/bin/pkg -R / image-update --no-refresh --accept --deny-new-be --no-backup-be<br> Packages to remove: 1<br>Packages to install: 2<br> Packages to update: 424<br> Services to change: 1<br><br><br>DOWNLOAD PKGS FILES XFER (MB) SPEED<br>SUNWcs 1/427 96/7699 1.2/418.8 516k/s^C<br>###############################<br>
`