-
razamatan
i have a bash alias that mounts and encrypted (loopback) file. this worked fine until i upgraded my vm instance from base-64-lts 21.4.1 to 23.4.0. now, it doesn't bother waiting for me to enter the encryption password and just fails to attach the loopback. the alias is this: alias myMount "mount \$(lofiadm -a /enc/file/path -c aes-256-cbc) /mnt/path"
-
razamatan
if i avoid nesting the commands, the alias works as expected and waits for password input on the lofiadm command: lalias workingMount "lofiadm -c aes-256-cbc -a /enc/file/path /dev/lofi/2 && mount /dev/lofi/2 /mnt/path"
-
razamatan
unfortunately, the working way doesn't play nice if something else is using /dev/lofi/2
-
jperkin
lofiadm comes from the platform rather than the image so it's hard to see how that would affect things here
-
jperkin
I'd have a look at any surrounding infrastructure that may have changed at the same time
-
razamatan
looking at lofiadm source in the illumos, nothing seems to have changed except for the Makefile in the last few years:
github.com/illumos/illumos-gate/tree/master/usr/src/cmd/lofiadm
-
razamatan
i verified that bash works fine w/ nested tty read blocking with other commands...
-
razamatan
ok.. i just spun up the old vm instance and it exhibited the correct behavior.. weird
-
razamatan
bash, mount and lofiadm are all the same binaries provided by the platform which is constant between the two vm instances
-
razamatan
would termcap differences cause this?
-
razamatan
ok.. looking at the termcap info using infocmp, there is a difference in the rin value... the old value (that causes the original nested lofiadm to work) is just `rin@` whereas the new vm value is `rin=\E[%p1%dT` which doesn't work. off to learn about termcaps....
-
rmustacc
razamatan: So I wouldn't dig into termcap first for this.
-
rmustacc
There are a bunch of changes in the kernel lofi driver. So can you share the two platforms you changed between?
-
danmcd
Also... is your bash coming from platform (/bin/bash) or pkgsrc (/opt/local/bin/bash)?
-
danmcd
I ask because of the failure mode...
-
danmcd
"now, it doesn't bother waiting for me to enter the encryption password and just fails to attach the loopback."
-
danmcd
This seems like a can't-reach-the-tty problem.
-
danmcd
Platform bash won't change unless you change the platform, which I can't tell if you did that or not, given you also said you updated the zone's image from "base-64-lts 21.4.1 to 23.4.0."
-
danmcd
Knowing if you changed platforms as part of the pkgsrc base is helpful, so if you did, also let us know the platform versions.
-
danmcd
If you use pkgsrc bash, it COULD be something there related to $(SHELL-COMMAND) processing that changed
-
razamatan
danmcd: from platfrom? it's /usr/bin/bash in both cases
-
danmcd
Yeah, so that's platform bash alright. Did you change platforms when you updated your zone's pkgsrc base?
-
razamatan
danmcd: i am actually running a single platform image (joyent_20240125T000404Z) with the old and new vm that can repro this problem
-
danmcd
Ahhh. Interesting.
-
razamatan
very
-
razamatan
set -x bash output is the same flow
-
danmcd
So the old pkgsrc image on this same PI works, but the new pkgsrc image does not?!?
-
razamatan
correct
-
danmcd
These running concurrently on the same physical machine?
-
razamatan
binaries wise, they're all the same, afaiu.. to me, it seems there's something in the vm images that's causing the tty read to fail in the new vm
-
razamatan
yes
-
danmcd
Damn....
-
razamatan
rmustacc: yeah.. the termcap diff was a red herring
-
danmcd
So tell me, what does "pldd `pgrep lofiadm`" say (run it in the same zone) while your lofiadm is asking for a password on the one that works?
-
danmcd
ALSO:
-
danmcd
what does "vmadm get $VM | grep fs_allowed" say for both zones?
-
razamatan
danmcd: fs_allowed is the same between them: "fs_allowed": "ufs,pcfs,tmpfs",
-
danmcd
Had to check.
-
danmcd
pldd? Does it have anything in /opt being linked in? I doubt it, but I have to ask.
-
razamatan
non-working new zone pldd: 38341: lofiadm -c aes-256-cbc -a /zshares/archive/.private /dev/lofi/10
-
razamatan
/usr/sbin/lofiadm
-
razamatan
/lib/libc.so.1
-
razamatan
/usr/lib/libpkcs11.so.1
-
razamatan
/lib/libcryptoutil.so.1
-
razamatan
/usr/lib/security/pkcs11_softtoken.so.1
-
razamatan
/usr/lib/libsoftcrypto.so.1
-
razamatan
/lib/libavl.so.1
-
razamatan
/lib/libmd.so.1
-
razamatan
/lib/libgen.so.1
-
razamatan
working old zone pldd is the same output for the paths. only difference is the pid (39409 instead of 38341)
-
razamatan
the uuid of the two base images is: 85d0f826-0131-11ed-973d-2bfeef68011c and 8adac45a-aca7-11ee-b53e-00151714048c
-
danmcd
Wait... both ask for the password? I thoguht you said the new one doesn't?
-
razamatan
i had to use the workaround approach (non-nested &&) to capture the pgrep lofiadm
-
danmcd
Oh.
-
razamatan
otherwise, it dies too fast
-
danmcd
Yeah... the workaround works... WHY it works is the question. CLearly it's not some /opt library lofiadm is bringing in for some bizarre reason.
-
danmcd
Is your privilege set the same in both zones?
-
razamatan
yes
-
danmcd
So literaly `ppriv $$` on invoking shells on both zones show the same thing.
-
danmcd
Damn.
-
razamatan
danmcd: outside of the bash pid being different, the diffs show nothing else
-
danmcd
Damn.
-
danmcd
So if you utter "lofiadm -c aes-256-cbc -a /enc/file/path" all by itself on a CLI you fail on the 23.4 zone?
-
danmcd
(Trying to minimize the reproduction...)
-
razamatan
no.. it only fails when i nest it inside of a mount: mount $(lofiadm -c ... -a ...) /mnt/path
-
danmcd
Ahhhh so
-
danmcd
echo $(lofiadm -c....)
-
danmcd
succeeds on the 21.4, fails on 23.5 ?
-
danmcd
23.4 I mean ?
-
razamatan
doing it by itself or doing the workaround of serializing the lofiadm and mount works fine
-
razamatan
i'll do the echos
-
razamatan
yeah.. echo repros
-
razamatan
actually.. this may be due to sudo
-
danmcd
WHA?
-
danmcd
You're using sudo?
-
danmcd
hold on...
-
danmcd
I saw no mention of sudo.
-
razamatan
yes.. i omitted it b/c i thought it couldn't possibley repro
-
razamatan
this is my mistake
-
razamatan
1000x apologies
-
danmcd
Oh no worries. I'm glad I could help narrow it down.
-
razamatan
so the main delta in terms of binaries is sudo which does live in the vm image
-
razamatan
really, thank you
-
danmcd
YW, glad to help.
-
danmcd
Gonna go install a USB-key now downstairs. I have to bring this NUC back online after a weekend of failed experiments.
-
razamatan
i'll have to figure out why sudo is so bad... visudo in the new vm image doesn't seem to handle the term correctly...
-
razamatan
gah.. the fix is to disable use_pty in sudo
-
razamatan
the just enabled it by default in the last few months. sorry for the noise folks, and thanks again for the help danmcd. also, thanks in general for a great os!
-
danmcd
YW, and don't forget props to jperkin and rmustacc as well.
-
razamatan
yep