Hi,
I'm using libguestfs 1.42,
When I run the following python3 commands on a rhel7.8:
print(g.ls('/sys'))
print(g.sh('ls /sys'))
I get:
[]
block
bus
class
dev
devices
firmware
fs
hypervisor
kernel
module
power
It seems that g.ls('/sys') is chrooted correctly.
But g.sh('ls /sys') isn't.
I came across this behavior when I used g.command(['grub2-mkconfig',
'-o',
'....']) on rhel7.8 and it didn't produce the correct linuxefi/initrdefi
entries in grub, since in rhel7.8 the uefi detection algorithm is checking
in bash '[ -d /sys/firmware/efi ]'.
https://src.fedoraproject.org/rpms/grub2/blob/71e0fb4ea646071ec86e4a65bb2...
I thought I could simply g.mkdir_p('/sys/firmware/efi') - but that created
a fake dir in my chrooted environment, where grub2-mkconfig somehow was
inspecting the real /sys as demonstrated in the above 'ls' example.
Any ideas on why sh jailbreaks the chroot? is /sys set through some
environment variable?
Thanks!