2

I installed an infrared receiver sensor and I plan to shutdown my Raspberry running Ubuntu Core using a remote control. The point is: Python and libraries like Rpi.GPIO are installed in an environment 'classic' running in chroot. So, when I run 'sudo shutdown now -h' inside Pyhon at chroot, Ubuntu simply ignores the request.

Is there a way to provide root privileges to chroot to do this task? Is it safe to perform this action from chroot?

There's no way to install Python in root, because 'Ubuntu Core does not use apt-get'

  • -h overridden by --halt did you try sudo shutdown -P now as well? – JoKeR Jul 17 '18 at 12:31
  • also you might wanna check this docs.ubuntu.com/core/en/reference/core-configuration – JoKeR Jul 17 '18 at 12:37
  • "There's no way to install Python in root, because 'Ubuntu Core does not use apt-get'" why do you need apt-get to install python? There are more methods. – Rinzwind Jul 17 '18 at 12:52
2

You need to exit the classic confinement. You can use the "exit" command for this. Then you will be in the basic Ubuntu-Core filesystem confinement, and you can run "shutdown".

As a side-note: I'm running Ubuntu-Core Snappy on a DragonBoard, and it makes me crazy too. For a Raspberry Pi that you're just using as a hobby project, I highly recommend using a regular (i.e. not snap-based) distro, because all of the generic instruction you'll find on the web will have a much greater chance of working.

1

Long time since I fiddled with chroot, but as far as I recall:

Whenever you change root, then the new location becomes the root and you cannot navigate outside of that folder.

You will have to copy the path the command shutdown into your rooted folder in order to use the command.

Also remember if the command is accessing other files, the those will be needed too - including their path.

In any case: the command 'init 0' is probably faster.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.