Per here:
T14a6929335a79ee9-Mb3d5d80fe8c84b45041429cc
It’s a good idea.
Carlos Neira commented on 2025-06-03T15:50:38.298-0400 (edited 2025-06-04T12:52:33.671-0400):
Every unsuccessful attempt (except at line 400, where the failure is used to determine whether the parameter is a URL or a boot stamp) ends with a fatal error, printing the return code of the curl command. We could add the HTTP return code as part of the verbose output in PIADM(8). This would increase the output noise slightly, but that's acceptable (after all, the option is called verbose for a reason). For that, the option -S is used in curl as short for --show-error, which in the manpage states the following:
-S, --show-error
When used with -s, --silent, it makes curl show an error message
if it fails.
This option is global and does not need to be specified for each
use of --next.
Providing --show-error multiple times has no extra effect.
Disable it again with --no-show-error.
Example:
curl --show-error --silent https://example.com
See also --no-progress-meter.
This is the proposed diff:
[root@dev /opt]# diff /usr/sbin/piadm piadm
181c181
< VCURL=( curl -k -f --progress-bar )
---
> VCURL=( curl -k -f -S --progress-bar )
400c400
< vcurl -o "${tdir}/download" "$1"
---
> vcurl -o "${tdir}/download" "$1" 2>/dev/null || echo "$1 seems to be a boot stamp"
In line 9 of the patch, I’m discarding curl’s error output, as in this case, we use the return code to decide whether the input is a URL or a boot stamp.
A test run with the new version using verbose and non-verbose outputs :
[root@dev /opt]# ./piadm -v install 20250417T003918Z zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Attempting download of URL 20250417T003918Z
20250417T003918Z seems to be a boot stamp
Downloading ISO for Platform Image 20250417T003918Z
-=O=- # # # #
curl: (22) The requested URL returned error: 404
ERROR: PI-stamp 20250417T003918Z -- curl exit code 22
[root@dev /opt]# ./piadm install 20250417T003918Z zones
20250417T003918Z seems to be a boot stamp
ERROR: PI-stamp 20250417T003918Z -- curl exit code 22
Results from original code (without this new change)
[root@dev /opt]# ./piadm install 20250417T003918Z zones
ERROR: PI-stamp 20250417T003918Z -- curl exit code 22
[root@dev /opt]# ./piadm -v install 20250417T003918Z zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Attempting download of URL 20250417T003918Z
#=O#- # #
curl: (6) Could not resolve host: 20250417T003918Z
Downloading ISO for Platform Image 20250417T003918Z
-=O#- # # #
curl: (22) The requested URL returned error: 503
ERROR: PI-stamp 20250417T003918Z -- curl exit code 22
To reproduce the error, both sets of tests disable the URL validation for a specific boot stamp by commenting it out. This diff shows what was changed to simulate the error in the original code.
[root@dev /opt]# diff /usr/sbin/piadm piadm
194c194,195
< DEFAULT_URL_PREFIX=https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/
---
> #DEFAULT_URL_PREFIX=https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/
> DEFAULT_URL_PREFIX=https://httpstat.us/503
429,433c430,434
< if ! "${CURL[@]}" "$checkurl" | head | grep -qv "not found" ; then
< eecho "PI-stamp $1" \
< "is invalid for download from $URL_PREFIX"
< usage
< fi
---
> #if ! "${CURL[@]}" "$checkurl" | head | grep -qv "not found" ; then
> # eecho "PI-stamp $1" \
> # "is invalid for download from $URL_PREFIX"
> # usage
> #fi
Carlos Neira commented on 2025-06-05T23:36:42.687-0400 (edited 2025-06-05T23:57:54.742-0400):
We need to revisit this work and spend more time thinking about the exact problem we are trying to solve. The issue is twofold: the first is to make curl(1)'s failures more verbose and helpful to diagnose potential problems; the second, which is a side effect of the first, is the following error message
$ piadm install 20250417T003816Z zones
Unknown file type for /tmp/tmp.TFacye
This error message comes from piadm.sh#L393If the file we are trying to install is not an .iso or .gz, then we end the program with this message.
One way to induce this error is to specify a download URL to PIADM(8) and then SIGTERM curl(1) while it is downloading the PI, here piadm.sh#L400 We are not checking the return value of curl(1). If curl fails for any reason and leaves an incomplete download, the process will continue, and PIADM(8) will try to install this corrupted PI and produce an error, as below.
[root@dev /opt]# piadm -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
0.0%/usr/sbin/piadm: line 183: 17382 Terminated "${VCURL[@]}" "$@"
Installing https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
(downloaded to /tmp/tmp.xfaqFi)
Treating /tmp/tmp.xfaqFi as an ISO file.
cat: input error on /tmp/tmp.NfaOFi/mnt/etc/version/boot: No such device or address
Installing PI
cat: input error on /tmp/tmp.NfaOFi/mnt/platform/etc/version/platform: No such device or address
PI-stamp has boot bits already on /zones/boot
Use piadm remove to remove any old copies.
In the other cases, check curl(1)'s return code, so for example downloading the latest PI and sending SIGTERM is not subject to the symptoms of the described error
[root@dev /opt]# ./piadm install latest zones
./piadm: line 183: 18289 Terminated "${CURL[@]}" "$@"
ERROR: Curl exit code 143
[root@dev /opt]#
But to reproduce the same error reported in the mailing list, we need to induce a corrupted download via curl(1) where the magic byte from the ISO file we are downloading is missing (corrupted/partial download?). Modifying the PIADM(8) achieves this and sending a SIGTERM to curl(1) while it is downloading the ISO reproduces the error described in the mailing list report, using the following diff:
[root@dev /opt]# diff /usr/sbin/piadm piadm.orig
406c406
<
---
> dd if=/dev/zero bs=1 count=5 seek=$((0x8001)) conv=notrunc of=$dload &>/dev/null
[1] Here is the error reproduced:
[root@dev /opt]# ./piadm.orig -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
0.0%./piadm.orig: line 183: 17783 Terminated "${VCURL[@]}" "$@"
Installing https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
(downloaded to /tmp/tmp.o4aYRi)
Unknown file type for /tmp/tmp.o4aYRi
One way to protect ourselves from this type of edge case is to validate the MD5 checksum of the file we download. With this change, this issue will not occur as we will verify the checksum before attempting to install the PI. Here is an example with the new change.
[root@dev /opt]# ./piadm -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
0.0%./piadm: line 183: 18113 Terminated "${VCURL[@]}" "$@"
published_md5sum: 76bc8cee5c8d68c2857049785b6ca6b9
local_md5sum: cf3efd06623e25c51f49e2da5d00f58d
local file does not matches published md5sum
validate_md5sum exit code 3
[root@dev /opt]# ./piadm install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso zones
./piadm: line 183: 18152 Terminated "${CURL[@]}" "$@"
local file does not matches published md5sum
validate_md5sum exit code 3
[root@dev /opt]#
The error described here [1] is what the user is experiencing right now, and by checking the checksums, we will ensure the integrity of the PI that PIADM(8) will process.
Another less involved way to address this issue is to modify the check here piadm.sh#L400 to use curl(1)’s return code to decide if the parameter is a URL or a specific stamp(--head flag maybe, TDB).
The initial premise of making curl(1)'s error more verbose is valuable, but I believe addressing this edge case has value as well, and is the only part in the code that we are blind to curl(1)'s errors.
I already created a DRAFT PR for this change. If we are going with the option for checking checksums, then I’ll add to the PR the changes required to the manpage of PIADM(8).
Carlos Neira commented on 2025-06-09T15:21:38.910-0400 (edited 2025-06-10T17:54:51.549-0400):
After including the latest changes, I performed the following tests
Case 1: Installing a specific stamp (verbose)
[root@smartos-mobile /opt]# ./piadm.new -v install 20250529T000820Z zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Attempting download of URL 20250529T000820Z
##O=# # curl: (6) Could not resolve host: 20250529T000820Z
Downloading ISO for Platform Image 20250529T000820Z
######################################################################################################################## 100.0%
Installing PI 20250529T000820Z
PI-stamp 20250529T000820Z has boot bits already on /zones/boot
Use piadm remove 20250529T000820Z to remove any old copies.
Case 2: Specifying a URL from which to download a platform image.
[root@smartos-mobile /opt]# ./piadm.new -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
######################################################################################################################## 100.0%
Installing https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
(downloaded to /tmp/tmp.sAauJc)
Selecting lone boot pool zones by default.
Treating /tmp/tmp.sAauJc as an ISO file.
Installing PI 20250529T000820Z
PI-stamp 20250529T000820Z has boot bits already on /zones/boot
Use piadm remove 20250529T000820Z to remove any old copies.
Case 3: Specifying a URL from where to download a platform image (SIGTERM curl(1) in the middle of the download)
[root@smartos-mobile /opt]# ./piadm.new -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
0.0%./piadm.new: line 184: 5295 Terminated "${VCURL[@]}" "$@"
published_md5sum: 76bc8cee5c8d68c2857049785b6ca6b9
local_md5sum: ae0895d9d90e283e8c3f813b2b563fb5
local file does not matches published md5sum
validate_md5sum exit code 1
Case 4: Specifying a URL from where to download a platform image (SIGTERM curl(1) in the middle of the download) non verbose
[root@smartos-mobile /opt]# ./piadm.new install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
./piadm.new: line 184: 5331 Terminated "${CURL[@]}" "$@"
local file does not matches published md5sum
validate_md5sum exit code 1
Case 5: Skipping MD5 checksum validation (SIGTERM curl(1) in the middle of downloading a platform image). non verbose
[root@smartos-mobile /opt]# export PIADM_NO_MD5SUM=1
[root@smartos-mobile /opt]# ./piadm.new install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
./piadm.new: line 184: 5370 Terminated "${CURL[@]}" "$@"
cat: input error on /tmp/tmp.ZQaqOc/mnt/etc/version/boot: No such device or address
cat: input error on /tmp/tmp.ZQaqOc/mnt/platform/etc/version/platform: No such device or address
tar: Read error on ./defaults/loader.conf: No such device or address
tar: Read error on ./efiboot.img: No such device or address
tar: Read error on ./forth/beadm.4th: No such device or address
tar: Read error on ./forth/beastie.4th: No such device or address
tar: Read error on ./forth/brand.4th: No such device or address
tar: Read error on ./forth/brand-smartos.4th: No such device or address
tar: Read error on ./forth/check-password.4th: No such device or address
tar: Read error on ./forth/color.4th: No such device or address
tar: Read error on ./forth/delay.4th: No such device or address
tar: Read error on ./forth/efi.4th: No such device or address
tar: Read error on ./forth/frames.4th: No such device or address
tar: Read error on ./forth/loader.4th: No such device or address
tar: Read error on ./forth/logo-smartos.4th: No such device or address
tar: Read error on ./forth/menu.4th: No such device or address
tar: Read error on ./forth/menu.rc: No such device or address
tar: Read error on ./forth/menusets.4th: No such device or address
tar: Read error on ./forth/menu-commands.4th: No such device or address
tar: Read error on ./forth/pcibios.4th: No such device or address
tar: Read error on ./forth/screen.4th: No such device or address
tar: Read error on ./forth/shortcuts.4th: No such device or address
tar: Read error on ./forth/support.4th: No such device or address
tar: Read error on ./forth/version.4th: No such device or address
tar: Read error on ./gptzfsboot: No such device or address
tar: Read error on ./loader: No such device or address
tar: Read error on ./loader.conf: No such device or address
tar: Read error on ./loader.help: No such device or address
tar: Read error on ./loader.rc: No such device or address
tar: Read error on ./loader64.efi: No such device or address
tar: Read error on ./pmbr: No such device or address
tar: Read error on ./triton.png: No such device or address
tar: Read error on ./triton-logo.png: No such device or address
tar: Read error on ./etc/version/platform: No such device or address
tar: Read error on ./i86pc/amd64/boot_archive: No such device or address
tar: Read error on ./i86pc/amd64/boot_archive.gitstatus: No such device or address
tar: Read error on ./i86pc/amd64/boot_archive.hash: No such device or address
tar: Read error on ./i86pc/amd64/boot_archive.manifest: No such device or address
tar: Read error on ./i86pc/kernel/amd64/unix: No such device or address
tar: Read error on ./root.password: No such device or address
mkdir: Failed to make directory "os/"; File exists
[root@smartos-mobile /opt]#
Case 6: Using a custom URL for md5sum.txts (SIGTERM curl(1))
[root@smartos-mobile /opt]# export PIADM_MD5SUM_URL=https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/md5sums.txt
[root@smartos-mobile /opt]# ./piadm.new install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
./piadm.new: line 184: 5574 Terminated "${CURL[@]}" "$@"
local file does not matches published md5sum
validate_md5sum exit code 1
Case 7: Using a custom URL for md5sums.txt (SIGTERM curl(1)) verbose
[root@smartos-mobile /opt]# ./piadm.new -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
0.1%./piadm.new: line 184: 5611 Terminated "${VCURL[@]}" "$@"
published_md5sum: 76bc8cee5c8d68c2857049785b6ca6b9
local_md5sum: f8a5bb80ee6048342d5472e938a340c1
local file does not matches published md5sum
validate_md5sum exit code 1
Carlos Neira commented on 2025-06-11T11:57:43.464-0400 (edited 2025-06-13T10:43:53.363-0400):
This change adds the selection of DIGEST(1) algorithm by the use of an environment variable PIADM_DIGEST_ALGORITHM
Case 9: User selects MD5 using PIADM_DIGEST_ALGORITHM (SIGTERM is delivered to curl(1) mid-flight)
[root@dev /opt]# export PIADM_DIGEST_ALGORITHM=md5
[root@dev /opt]# ./piadm.new -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
./piadm.new: line 184: 10981 Terminated "${VCURL[@]}" "$@" 0.1%
published_checksum: 76bc8cee5c8d68c2857049785b6ca6b9
local_checksum: c96a184c31f4a0f34ced44e0d6c7c165
local file does not matches published checksum
validate_checksum exit code 1
Case 10: User selects a non-existing DIGEST(1) algorithm (SIGTERM is delivered to curl(1) mid-flight)
[root@dev /opt]# export PIADM_DIGEST_ALGORITHM=md99
[root@dev /opt]# ./piadm.new -v install https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250529T000820Z/smartos-20250529T000820Z.iso
0.7%./piadm.new: line 184: 11018 Terminated "${VCURL[@]}" "$@"
digest: unknown algorithm -- md99
checksum failed for /tmp/tmp.L9ayyf, algorithm used: md99
validate_checksum exit code 1
Carlos Neira commented on 2025-06-13T10:52:18.693-0400 (edited 2025-06-13T10:53:48.166-0400):
Case 12: User attempts to download a platform image from an unknown source
[root@dev /opt]# ./piadm.new -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://patches.byteswizards.com/platform-latest.tgz
############################################################################################################################ 100.0%
fetching checksums from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/patches.byteswizards.com/md5sums.txt
Could not get checksum for PI exit code: 1
validate_csum exit code 1
There is a regression in this version. In the past (without checksumming), we were able to fetch any PI from an arbitrary source, and PIADM(8) will do the right thing.
Now, if we are trying to fetch any PI from any source that does not follow the expected convention for retrieving checksums and stamps, it will not pass the checksum validation. This is explained in the GitHub discussion for this PR, which I have pasted here:
This case will fail. PIADM(8) will use the default URL to fetch the md5sums.txt file (https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/<PI STAMP>/md5sums.txt). But that's not the only problem.
The URL https://kebe.com/~danmcd/webrevs/platform-OS-xxxx.tgz does not contain the stamp value in the URL path; we currently rely on this to retrieve the checksum for the file. If the user sets PIADM_NO_SUM=1 and uses this URL to download a PI, then it will download the PI but not checksum it.
For a custom URL to work with checksum validation, it would need to comply with the following :
The stamp value of the PI needs to be placed in the URL segment before the segment that contains the file name of the PI. The current assumption is that the file name value for the PI is in the last segment of the URL.
For example: https://kebe.com/~danmcd/webrevs/20250529T000820Z/platform-OS-20250529T000820Z.tgz
The environment variable PIADM_SUM_URL should be set to the location of the checksum file for the PI.
The checksum file is a text file containing the checksum value and file names separated by a space.
For example :
2a2f0916cdbb9429abeb8cf57e43375b platform-OS-20250529T000820Z.tgz
I'm thinking that we should set PIADM_NO_SUM=1 in the case that a URL is not from a known domain.
If the user requires checksum validation, then PIADM_SUM_URL should be set by the user to the required value.
I think we should enforce checksum validation only for known sources (currently, MNX). If users want to download from unknown domains, they can still do so; however, if they want to validate checksums for their platform images, they can set the required environment variable PIADM_SUM_URL, provided they follow the URL path convention for downloading platform images described above.
Carlos Neira commented on 2025-06-13T18:45:58.903-0400:
Thanks to @Dan McDonald, we have a new file for sums using the sha256 algorithm.
Case 13: User specifies sha256 as the algorithm used to validate checksum and attempts to install an explicit timestamp.
[root@dev /opt]# export PIADM_DIGEST_ALGORITHM=sha256
[root@dev /opt]# ./piadm.new -v install 20250612T001439Z
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL 20250612T001439Z
##O#- # curl: (6) Could not resolve host: 20250612T001439Z
Downloading ISO for Platform Image 20250612T001439Z
############################################################################################################################ 100.0%
Installing PI 20250612T001439Z
Removing old ./os/ directory
Creating new ./os/ directory
Including Platform Image 20250612T001439Z
Including Platform Image 20250529T120932Z
Including Platform Image 20250529T000820Z
Including Platform Image 20250521T191422Z
Including Platform Image 20250519T175805Z
[root@dev /opt]#
Carlos Neira commented on 2025-06-13T19:01:08.948-0400:
case 14: User specifies an invalid digest(1) algorithm
As we expected, this fails, and we could see that the URL has the expected file name for the <algorithm>sums.txt
[root@dev /opt]# export PIADM_DIGEST_ALGORITHM=sha258
[root@dev /opt]# ./piadm.new -v install 20250612T001439Z
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL 20250612T001439Z
##O=# # curl: (6) Could not resolve host: 20250612T001439Z
Downloading ISO for Platform Image 20250612T001439Z
############################################################################################################################ 100.0%
fetching checksums from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250612T001439Z/sha258sums.txt
Could not get checksum for PI exit code: 1
validate_csum exit code 1
Carlos Neira commented on 2025-06-18T09:44:38.166-0400 (edited 2025-06-18T10:32:49.730-0400):
I took the opportunity to make a change when we detect an explicit URL, instead of relying on whether the file was downloaded and the directory was created as a consequence, I used the --head option to only fetch the headers, if it’s able to fetch them then the URL “should be a valid download”, then we start downloading the platform image specified at the URL.
-I, --head
(HTTP FTP FILE) Fetch the headers only. HTTP-servers feature the
command HEAD which this uses to get nothing but the header of a
document. When used on an FTP or FILE URL, curl displays the
file size and last modification time only.
514 # Check if URL exists first
515 vecho "Checking if URL $1 exists"
516 if ! "${CURL[@]}" --max-time 30 --connect-timeout \
517 10 --head "$1" > /dev/null 2>&1; then
518 vecho "URL $1 is not accessible or does not exist"
519 # Fall through to treat as boot stamp
520 else
521 vecho "Downloading from URL $1"
522 if vcurl -o "${tdir}/download" "$1"; then
523 # Recurse with the downloaded file.
524 dload=$(mktemp)
525 mv -f "${tdir}/download" "$dload"
526 /bin/rm -rf "${tdir}"
527 # in case `install` exits out early...
528 ( pwait $$ ; rm -f "$dload" ) &
529 vecho "Installing $1"
Case 15: User tries to download a PI from an explicit URL
Using the new version of PIADM(8) (verbose):
[root@dev /opt]# ./piadm.new -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Checking if URL https://patches.byteswizards.com/platform-latest.tgz exists
Downloading from URL https://patches.byteswizards.com/platform-latest.tgz
################################################################################################################################################################################################################################################################# 100.0%
Installing https://patches.byteswizards.com/platform-latest.tgz
(downloaded to /tmp/tmp.FIayhf)
Selecting lone boot pool zones by default.
Treating /tmp/tmp.FIayhf as an .tgz Platform Image file.
Installing PI 20250521T191422Z
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
Using the new version of PIADM(8) non-verbose:
[root@dev /opt]# ./piadm.new install https://patches.byteswizards.com/platform-latest.tgz
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
Using the new version of PIADM(8), verbose, and sending SIGTERM to curl mid-flight
[root@dev /opt]# ./piadm.new -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Checking if URL https://patches.byteswizards.com/platform-latest.tgz exists
Downloading from URL https://patches.byteswizards.com/platform-latest.tgz
#### 1.9%./piadm.new: line 184: 10888 Terminated "${VCURL[@]}" "$@"
Failed to download from URL https://patches.byteswizards.com/platform-latest.tgz
Downloading ISO for Platform Image https://patches.byteswizards.com/platform-latest.tgz
PI-stamp https://patches.byteswizards.com/platform-latest.tgz is invalid for download from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
[root@dev /opt]#
Using the new version of PIADM(8), non-verbose, and sending SIGTERM to curl mid-flight
[root@dev /opt]# ./piadm.new install https://patches.byteswizards.com/platform-latest.tgz
./piadm.new: line 184: 10917 Terminated "${CURL[@]}" "$@"
PI-stamp https://patches.byteswizards.com/platform-latest.tgz is invalid for download from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
[root@dev /opt]#
Using the old version of PIADM(8) (verbose):
[root@dev ~]# piadm -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://patches.byteswizards.com/platform-latest.tgz
################################################################################################################################################################################################################################################################# 100.0%
Installing https://patches.byteswizards.com/platform-latest.tgz
(downloaded to /tmp/tmp.6sacbd)
Selecting lone boot pool zones by default.
Treating /tmp/tmp.6sacbd as an .tgz Platform Image file.
Installing PI 20250521T191422Z
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
[root@dev ~]#
Using the old version of PIADM(8) (non-verbose):
[root@dev ~]# piadm install https://patches.byteswizards.com/platform-latest.tgz
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
Using the old version of PIADM(8) (verbose):
[root@dev ~]# piadm -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://patches.byteswizards.com/platform-latest.tgz
################################################################################################################################################################################################################################################################# 100.0%
Installing https://patches.byteswizards.com/platform-latest.tgz
(downloaded to /tmp/tmp.B9aAfd)
Selecting lone boot pool zones by default.
Treating /tmp/tmp.B9aAfd as an .tgz Platform Image file.
Installing PI 20250521T191422Z
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
Using the old version of PIADM(8) (verbose), sending SIGTERM to curl mid-flight:
[root@dev ~]# piadm -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://patches.byteswizards.com/platform-latest.tgz
########################## 10.2%/usr/sbin/piadm: line 183: 6369 Terminated "${VCURL[@]}" "$@"
Installing https://patches.byteswizards.com/platform-latest.tgz
(downloaded to /tmp/tmp.JwaQhd)
Selecting lone boot pool zones by default.
File /tmp/tmp.JwaQhd is not an ISO or a .tgz file.
Using the old version of PIADM(8) (non-verbose), sending SIGTERM to curl mid-flight:
[root@dev ~]# piadm install https://patches.byteswizards.com/platform-latest.tgz
/usr/sbin/piadm: line 183: 6435 Terminated "${CURL[@]}" "$@"
File /tmp/tmp.aJakjd is not an ISO or a .tgz file.
[root@dev ~]#
Carlos Neira commented on 2025-06-18T11:46:55.501-0400:
Case 16: User tries to download the latest PI (DEFAULT_URL_PREFIX is pointing to a host that does not exist), non-verbose
New version :
[root@dev /opt]# ./piadm.new install latest
ERROR: Curl exit code 6
Old version:
[root@dev /opt]# ./piadm.orig install latest
ERROR: Curl exit code 6
Case 17: User tries to download the latest PI (DEFAULT_URL_PREFIX is pointing to a host that does not exist), verbose
New version:
[root@dev /opt]# ./piadm.new -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
curl: (6) Could not resolve host: patches.byteswizards.com2
ERROR: Curl exit code 6
Old version:
[root@dev /opt]# ./piadm.orig -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
curl: (6) Could not resolve host: patches.byteswizards.com2
ERROR: Curl exit code 6
Case 18: User attempts to download a platform image using an explicit URL (Hosts returns 403), verbose
New version
[root@dev /opt]# ./piadm.new -v install https://patches.byteswizards.com/403/platform.tgz2
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Checking if URL https://patches.byteswizards.com/403/platform.tgz2 exists
URL https://patches.byteswizards.com/403/platform.tgz2 returned HTTP Status: 403
Downloading ISO for Platform Image https://patches.byteswizards.com/403/platform.tgz2
PI-stamp https://patches.byteswizards.com/403/platform.tgz2 is invalid for download from https://patches.byteswizards.com2/
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
Old version :
[root@dev /opt]# piadm -v install https://patches.byteswizards.com/403/platform.tgz2
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL https://patches.byteswizards.com/403/platform.tgz2
#=O=# # # curl: (22) The requested URL returned error: 403
Downloading ISO for Platform Image https://patches.byteswizards.com/403/platform.tgz2
PI-stamp https://patches.byteswizards.com/403/platform.tgz2 is invalid for download from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
Case 19: User attempts to download a platform image using an explicit URL (Hosts returns 403), non-verbose
New version
[root@dev /opt]# ./piadm.new install https://patches.byteswizards.com/403/platform.t>
PI-stamp https://patches.byteswizards.com/403/platform.tgz2 is invalid for download from https://patches.byteswizards.com2/
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
Old version
[root@dev /opt]# piadm install https://patches.byteswizards.com/403/platform.tgz2
PI-stamp https://patches.byteswizards.com/403/platform.tgz2 is invalid for download from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
Case 20: User attempts to download the latest platform image (curl is sent SIGTERM signal mid-flight), verbose.
New version
[root@dev /opt]# ./piadm.new -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
# 2.0%./piadm.new: line 184: 11841 Terminated "${VCURL[@]}" "$@"
ERROR: Curl exit code 143
Old version
[root@dev /opt]# piadm -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
1.1%/usr/sbin/piadm: line 183: 11865 Terminated "${VCURL[@]}" "$@"
ERROR: Curl exit code 143
Case 21: User attempts to download the latest platform image (curl is sent SIGTERM signal mid-flight), non-verbose.
New version
[root@dev /opt]# ./piadm.new install latest
./piadm.new: line 184: 11891 Terminated "${CURL[@]}" "$@"
ERROR: Curl exit code 143
Old version
[root@dev /opt]# piadm install latest
/usr/sbin/piadm: line 183: 11914 Terminated "${CURL[@]}" "$@"
ERROR: Curl exit code 143
Carlos Neira commented on 2025-06-18T12:14:17.733-0400 (edited 2025-06-18T12:25:22.471-0400):
Case 22: The user attempts to download the latest platform image, but the server returns a HTTP status code 503 (verbose).
New version
[root@dev /opt]# ./piadm.new -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
-#O#- # # curl: (22) The requested URL returned error: 503
ERROR: Curl exit code 22
Old version
[root@dev /opt]# ./piadm.orig -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
-#O#- # # curl: (22) The requested URL returned error: 503
ERROR: Curl exit code 22
Case 23: The user attempts to download the latest platform image, but the server returns a HTTP status code 503 (non-verbose).
New version
[root@dev /opt]# ./piadm.new install latest
curl: (22) The requested URL returned error: 503
ERROR: Curl exit code 22
Old version
[root@dev /opt]# ./piadm.orig install latest
ERROR: Curl exit code 22
Carlos Neira commented on 2025-06-18T12:28:08.067-0400:
Case 24: User attempts to download a timestamp, but the server returns a HTTP code 503 (verbose)
New version
[root@dev /opt]# ./piadm.new -v install 20250612T001439Z
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Checking if URL 20250612T001439Z exists
URL 20250612T001439Z is not accessible or does not exist
Downloading ISO for Platform Image 20250612T001439Z
curl: (22) The requested URL returned error: 503
PI-stamp 20250612T001439Z is invalid for download from https://httpstat.us/503
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
Old version
[root@dev /opt]# ./piadm.orig -v install 20250612T001439Z
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
Selecting lone boot pool zones by default.
Attempting download of URL 20250612T001439Z
##O#- # curl: (6) Could not resolve host: 20250612T001439Z
Downloading ISO for Platform Image 20250612T001439Z
PI-stamp 20250612T001439Z is invalid for download from https://httpstat.us/503
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
Carlos Neira commented on 2025-06-23T17:29:56.450-0400 (edited 2025-06-23T18:38:13.370-0400):
The following environment variables were added to /var/piadm/piadm.conf
PIADM_DIGEST_ALGORITHM
PIADM_NO_SUM
We cannot add PIADM_SUM_URL, as it’s dynamically based on the stamp that the user wants to install with piadm(8).
A simple test to check if the variables from the piadm.conf are being used
[root@dev /opt]# ./piadm.new -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM="md6"
PIADM_NO_SUM="0"
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
############################################################################################################################################################################################################################################################################### 100.0%
curl: (22) The requested URL returned error: 404
fetching checksums from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250612T001439Z/md6sums.txt
Could not get checksum for PI exit code: 1
Cannot validate checksum for latest
This is working as the current environment for the user is the following, which does not contain the PIADM_* environment variables that piadm(8) requires.
[root@dev /opt]# env
MANPATH=/usr/share/man:/smartdc/man:/opt/smartdc/man:/opt/local/man:/opt/tools/man
TERM=tmux-256color
SHELL=/usr/bin/bash
SSH_CLIENT=192.168.124.1 54728 22
SSH_TTY=/dev/pts/2
USER=root
PAGER=less
PATH=/usr/bin:/usr/sbin:/smartdc/bin:/opt/smartdc/bin:/opt/local/bin:/opt/local/sbin:/opt/tools/bin:/opt/tools/sbin:/opt/smartdc/agents/bin
PWD=/opt
LANG=en_US.UTF-8
TZ=UTC
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=192.168.124.1 54728 192.168.124.170 22
PROMPT_COMMAND=echo -ne "\033]0;${HOSTNAME} \007" && history -a
OLDPWD=/root
_=/usr/bin/env
Trying an explicit URL
[root@dev /opt]# ./piadm.new -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM="md6"
PIADM_NO_SUM="0"
Selecting lone boot pool zones by default.
Checking if URL https://patches.byteswizards.com/platform-latest.tgz exists (30s) timeout
Downloading from URL https://patches.byteswizards.com/platform-latest.tgz
################################################################################################################################################################################################################################################################# 100.0%
Installing https://patches.byteswizards.com/platform-latest.tgz
(downloaded to /tmp/tmp.EkaOUd)
Selecting lone boot pool zones by default.
Treating /tmp/tmp.EkaOUd as an .tgz Platform Image file.
Installing PI 20250521T191422Z
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
This does not fail as explicit URLS have no checksum validation.
Carlos Neira commented on 2025-06-24T16:06:03.758-0400 (edited 2025-06-24T16:25:58.598-0400):
The environment variables added to /var/piadm/piadm.conf caused a problem. The values from piadm.conf will always override the environment variables supplied by the user. This has been fixed.
Fix
[root@dev /opt]# cat /var/piadm/piadm.conf
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
[root@dev /opt]# env PIADM_DIGEST_ALGORITHM=md6 ./piadm.new -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
############################################################################################################################################### 100.0%
curl: (22) The requested URL returned error: 404
fetching checksums from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250612T001439Z/md6sums.txt
Could not get checksum for PI exit code: 1
Cannot validate checksum for latest
Old version
[root@dev /opt]# env PIADM_DIGEST_ALGORITHM=md6 ./piadm.new -v install latest
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=md3
PIADM_NO_SUM=0
Selecting lone boot pool zones by default.
Downloading latest SmartOS ISO
############################################################################################################################################### 100.0%
curl: (22) The requested URL returned error: 404
fetching checksums from https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250612T001439Z/md3sums.txt
Could not get checksum for PI exit code: 1
Cannot validate checksum for latest
Case 25: User attempts to download a PI using an explicit URL
[root@dev /opt]# ./piadm.new -v install https://patches.byteswizards.com/platform-latest.tgz
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Selecting lone boot pool zones by default.
Checking if URL https://patches.byteswizards.com/platform-latest.tgz exists (30s) timeout
Downloading from URL https://patches.byteswizards.com/platform-latest.tgz
############################################################################################################################################### 100.0%
Installing https://patches.byteswizards.com/platform-latest.tgz
(downloaded to /tmp/tmp.dRaINf)
Selecting lone boot pool zones by default.
Treating /tmp/tmp.dRaINf as an .tgz Platform Image file.
Installing PI 20250521T191422Z
PI-stamp 20250521T191422Z appears to be already on /zones/boot
Use piadm remove 20250521T191422Z to remove any old copies.
Case 26: User attempts to download a specific PI stamp
[root@dev /opt]# ./piadm.new -v install 20250529T000820Z zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Checking if URL 20250529T000820Z exists (30s) timeout
Downloading from URL 20250529T000820Z
-=O=- # # # # curl: (6) Could not resolve host: 20250529T000820Z
Failed to download from URL 20250529T000820Z
Downloading ISO for Platform Image 20250529T000820Z
############################################################################################################################################### 100.0%
published_checksum: 76bc8cee5c8d68c2857049785b6ca6b9
local_checksum: 76bc8cee5c8d68c2857049785b6ca6b9
Installing PI 20250529T000820Z
PI-stamp 20250529T000820Z has boot bits already on /zones/boot
Use piadm remove 20250529T000820Z to remove any old copies.
[root@dev /opt]#
Case 27: User attempts to download the latest PI
[root@dev /opt]# ./piadm.new -v install latest zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Downloading latest SmartOS ISO
############################################################################################################################################### 100.0%
published_checksum: 4f03ea210c10be6d97262ebd835d5496
local_checksum: 4f03ea210c10be6d97262ebd835d5496
Installing PI 20250612T001439Z
PI-stamp 20250612T001439Z has boot bits already on /zones/boot
Use piadm remove 20250612T001439Z to remove any old copies.
[root@dev /opt]#
Case 27: The user attempts to download a specific PI stamp and selects SHA-256 as the checksum algorithm.
[root@dev /opt]# PIADM_DIGEST_ALGORITHM=sha256 ./piadm.new -v install 20250612T001439Z zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Checking if URL 20250612T001439Z exists (30s) timeout
Downloading from URL 20250612T001439Z
-=O=- # # # # curl: (6) Could not resolve host: 20250612T001439Z
Failed to download from URL 20250612T001439Z
Downloading ISO for Platform Image 20250612T001439Z
############################################################################################################################################### 100.0%
published_checksum: b366b743b60cb7e13da786a59fa986c36b673485f5f21a5052136ad8fa64df84
local_checksum: b366b743b60cb7e13da786a59fa986c36b673485f5f21a5052136ad8fa64df84
Installing PI 20250612T001439Z
PI-stamp 20250612T001439Z has boot bits already on /zones/boot
Checksum matches the published ones at https://us-central.manta.mnx.io/Joyent_Dev/public/SmartOS/20250612T001439Z/sha256sums.txt
d4539f16cad411cd6949d1dbf702e322582095857e12f23812ed0c987ca7319f SINGLE_USER_ROOT_PASSWORD.txt
f2e79a93b66dd70e2654ef6385ef67c2d09d71e45b67fd9c88d612afc1ba767b build.log
ba4991b84dbe76d8c240faf97f3973baa36cd159202fdbf50c77697d5ff54812 changelog.txt
81342b6bec000894609f434109e7d005bf3fafd67c542f2286e8c258ff8456d3 configure-projects
6a84e211a900b3f8f67db7d690627a84c5b68a8e90c9c8b4b919458bbf258aca gitstatus.json
570ae40c4c9da07911d3a9991922061752da769d8017d29aa1aba66431ed3e8a index.html
5d3094b9f3502de1c2d8d247cb1941763e541a9a993579a0e770f3dc935c66b9 platform-release-20250612-20250612T001439Z.tgz
92342ad959398886a78e7e2944d6d080ff217108cfc2af37e266be3a0ef2958a smartos-20250612T001439Z-USB.img.gz
b366b743b60cb7e13da786a59fa986c36b673485f5f21a5052136ad8fa64df84 smartos-20250612T001439Z.iso --> Fetched by piadm(8)
0ff6d37c34da4d1d185a0bfa52011f2d98c2684a729bf5e3da14b2bfa83f6c25 smartos-20250612T001439Z.vmwarevm.tar.gz
b2049228379a8ae9c915c528f88bb14428757c6eb28135dd80d6b75c50bcae6c tests-release-20250612-20250612T001439Z.tgz
Case 28: User installs PI from ISO
[root@dev /opt]# ./piadm.new -v install smartos-20250529T000820Z.iso
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Selecting lone boot pool zones by default.
Treating smartos-20250529T000820Z.iso as an ISO file.
Installing PI 20250529T000820Z
Removing old ./os/ directory
Creating new ./os/ directory
Including Platform Image 20250606T133123Z
Including Platform Image 20250529T120932Z
Including Platform Image 20250529T000820Z
Including Platform Image 20250521T191422Z
Including Platform Image 20250519T175805Z
Carlos Neira commented on 2025-06-24T17:36:11.932-0400:
Case 29: User attempts to download a specific PI stamp, but the host returns a 503 HTTP error code.
[root@dev /opt]# PIADM_DIGEST_ALGORITHM=sha256 ./piadm.new -v install 20250612T001439Z zones
Version 1 of /var/piadm/piadm.conf
The following file contents have been configured:
PIADM_CONFIG_VERSION=1
PIADM_DIGEST_ALGORITHM=${PIADM_DIGEST_ALGORITHM:-md5}
PIADM_NO_SUM=${PIADM_NO_SUM:-0}
Checking if URL 20250612T001439Z exists (30s) timeout
Downloading from URL 20250612T001439Z
-=O=- # # # # curl: (6) Could not resolve host: 20250612T001439Z
Failed to download from URL 20250612T001439Z
Downloading ISO for Platform Image 20250612T001439Z
curl: (22) The requested URL returned error: 503
PI-stamp 20250612T001439Z is invalid for download from https://httpstat.us/503
Usage: piadm [-v] <command> [command-specific arguments]
piadm activate|assign <PI-stamp> [ZFS-pool-name]
piadm avail
piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
piadm destroy|remove <PI-stamp> [ZFS-pool-name]
piadm install <source> [ZFS-pool-name]
piadm list <-H> [ZFS-pool-name]
piadm update [ZFS-pool-name]
[root@dev /opt]#
Carlos Neira commented on 2025-06-25T11:08:03.972-0400:
merged to master 1139