Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement --no-dbus option to work in chroot environment #23

Closed
ckotte opened this issue Aug 16, 2018 · 6 comments
Closed

Implement --no-dbus option to work in chroot environment #23

ckotte opened this issue Aug 16, 2018 · 6 comments

Comments

@ckotte
Copy link

ckotte commented Aug 16, 2018

The snap-pac pre transaction hook fails to execute when executed in a chrooted environment.

E.g.: One of my other Arch laptops had an issue during installation and I couldn't boot anymore. I needed to boot a rescue system and chroot into the system. However, I couldn't run pacman. The snap-pac pre transaction hook failed because snapper can't reach the DBUS. I needed to add --no-dbus to the snapper command in the snap-pac script to be able to run pacman again.

snapper_cmd="snapper --no-dbus --config $CONFIG create --type ..."

More information can be found here:
Snapper is broken due to dependency on dbus
Work without DBus

If you want to use the option only in chroot, you could also implement something like this:

if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
  echo "We are chrooted!"
else
  echo "Business as usual"
fi

I haven't checked yet if it really works though.

It looks like the DBUS connection is only there to allow non-root users to use snapper. Since pacman is executed with root permissions, just adding --no-dbus should be sufficient.

@wesbarnett
Copy link
Owner

Please check that this works and solves your issue and return to let me know. Thanks.

@wesbarnett wesbarnett changed the title Implement --no-dbus option Implement --no-dbus option to work in chroot environment Aug 16, 2018
@ckotte
Copy link
Author

ckotte commented Aug 16, 2018

What should I check? I already tested the --no-dbus option.

@wesbarnett
Copy link
Owner

Oh, I thought you said you hadn't checked it if works in the chroot.

@ckotte
Copy link
Author

ckotte commented Aug 16, 2018

I tested it in chroot when I fixed the system some while ago. It's still configured and snapshots are created after package installation/update with --no-dbus.

@wesbarnett
Copy link
Owner

Here's what the snapper manpage says about --no-dbus:

   --no-dbus
       Operate without a DBus connection.

       Use with caution since a running snapperd will not know about modifications made to the system.

I'm hesitant to just add --no-dbus to everything.

@wesbarnett
Copy link
Owner

Adding --no-dbus does allow the snapshot to be taken in chroot, but causes process ID list syntax error with the line running ps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants