diff --git a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh index a61ef679..fdc54939 100755 --- a/pi-gen/stage2/04-wrolpi/03-run-chroot.sh +++ b/pi-gen/stage2/04-wrolpi/03-run-chroot.sh @@ -67,8 +67,8 @@ cat >/etc/sudoers.d/90-wrolpi <<'EOF' %wrolpi ALL= NOPASSWD:/usr/bin/systemctl stop wrolpi-app.service %wrolpi ALL= NOPASSWD:/usr/bin/systemctl start wrolpi-app.service %wrolpi ALL= NOPASSWD:/opt/wrolpi/scripts/import_map.sh -%wrolpi ALL= NOPASSWD:poweroff -%wrolpi ALL= NOPASSWD:reboot +%wrolpi ALL= NOPASSWD:/usr/sbin/poweroff +%wrolpi ALL= NOPASSWD:/usr/sbin/reboot EOF chmod 660 /etc/sudoers.d/90-wrolpi diff --git a/scripts/install_debian_11.sh b/scripts/install_debian_11.sh index 06cf957d..62ab4aa1 100755 --- a/scripts/install_debian_11.sh +++ b/scripts/install_debian_11.sh @@ -89,8 +89,8 @@ cat >/etc/sudoers.d/90-wrolpi <<'EOF' %wrolpi ALL= NOPASSWD:/usr/bin/systemctl stop wrolpi-app.service %wrolpi ALL= NOPASSWD:/usr/bin/systemctl start wrolpi-app.service %wrolpi ALL= NOPASSWD:/opt/wrolpi/scripts/import_map.sh -%wrolpi ALL= NOPASSWD:poweroff -%wrolpi ALL= NOPASSWD:reboot +%wrolpi ALL= NOPASSWD:/usr/sbin/poweroff +%wrolpi ALL= NOPASSWD:/usr/sbin/reboot EOF chmod 660 /etc/sudoers.d/90-wrolpi # Verify this new file is valid. diff --git a/scripts/install_raspberrypios.sh b/scripts/install_raspberrypios.sh index 257cef68..7547fbee 100755 --- a/scripts/install_raspberrypios.sh +++ b/scripts/install_raspberrypios.sh @@ -99,8 +99,8 @@ cat >/etc/sudoers.d/90-wrolpi <<'EOF' %wrolpi ALL= NOPASSWD:/usr/bin/systemctl stop wrolpi-app.service %wrolpi ALL= NOPASSWD:/usr/bin/systemctl start wrolpi-app.service %wrolpi ALL= NOPASSWD:/opt/wrolpi/scripts/import_map.sh -%wrolpi ALL= NOPASSWD:poweroff -%wrolpi ALL= NOPASSWD:reboot +%wrolpi ALL= NOPASSWD:/usr/sbin/poweroff +%wrolpi ALL= NOPASSWD:/usr/sbin/reboot EOF chmod 660 /etc/sudoers.d/90-wrolpi # Verify this new file is valid. diff --git a/wrolpi/admin.py b/wrolpi/admin.py index fdfa9290..ebf6397b 100644 --- a/wrolpi/admin.py +++ b/wrolpi/admin.py @@ -156,6 +156,7 @@ async def restart(): cmd = f'{SUDO_BIN} reboot' proc = await asyncio.create_subprocess_shell(cmd, stderr=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE) + stdout, stderr = await proc.communicate() except subprocess.CalledProcessError as e: raise RestartFailed() from e @@ -174,6 +175,7 @@ async def shutdown(): cmd = f'{SUDO_BIN} poweroff' proc = await asyncio.create_subprocess_shell(cmd, stderr=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE) + stdout, stderr = await proc.communicate() except subprocess.CalledProcessError as e: raise ShutdownFailed() from e