You are not logged in.
Any ideas why attempting to run the ./bin/i3status-gpu.py shell script fails?
❯ ls -lAh .bin/i3status-gpu.py
-rwxr-xr-x 1 james users 1.9K Dec 8 2020 .bin/i3status-gpu.py
❯ whoami
james
❯ ./.bin/i3status-gpu.py
zsh: permission denied: ./.bin/i3status-gpu.py
❯ sudo !!
❯ sudo ./.bin/i3status-gpu.py
[sudo] password for james:
sudo: unable to execute ./.bin/i3status-gpu.py: Permission denied
So, I'm finally moving my home folder to a dedicated drive on this box I've had running since 2017. I was lazy when I set it up, so /home and / are on the same partition.
I've tried both rsync and cp as below (with several variants on the rsync flag). I edit fstab to have /mnt/lima mount to /home (shadowing what's on the root partition) and reboot after running one of the below.
sudo rsync -avAXUH --info=progress2,stats2 /home/* /mnt/lima/
sudo rsync -alH --info=progress2,stats2 /home/* /mnt/lima/
sudo rsync -a --info=progress2,stats2 /home/* /mnt/lima/
sudo cp -a /home/* /mnt/lima
When logging into my account and starting X, I'll get an error in the i3bar space saying "Error: status_command is not executable (exit 126)" (caused by above), along with this one when opening a terminal:
[ERROR]: gitstatus failed to initialize.
Your Git prompt may disappear or become slow.
Run the following command to retry with extra diagnostics:
GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start POWERLEVEL9K
If this command produces no output, add the following parameter to ~/.zshrc:
GITSTATUS_LOG_LEVEL=DEBUG
With this parameter gitstatus will print additional information on error.
Last edited by Subject-17 (2022-06-27 19:31:53)
Offline
What is the shebang used in the script?
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online
linux can mount partitions with the "noexec" flag. In that case, nothing read from it can be executed, you'd have to explicitly use the binary used in the shebang to run scripts.
If you do not want that, change the mount flags.
Edit: "user" and "users" flag imply noexec. https://man.archlinux.org/man/core/util … mount.8.en
Last edited by progandy (2022-06-27 19:28:04)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
What is the shebang used in the script?
Shebang is
#!/usr/bin/env python3
Script contents are as follows:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ref: https://github.com/i3/i3status/blob/master/contrib/wrapper.py
#
# To use it, ensure your ~/.i3status.conf contains this line:
# output_format = "i3bar"
# in the 'general' section.
# Then, in your ~/.i3/config, use:
# status_command i3status | ~/.bin/i3status-gpu.py
# In the 'bar' section.
import sys, subprocess
import json
def gpu_info():
return subprocess.getoutput('nvidia-smi --query-gpu=gpu_name,pstate,utilization.gpu,utilization.memory,temperature.gpu --format=csv,noheader').strip()
def print_line(message):
""" Non-buffered printing to stdout. """
sys.stdout.write(message + '\n')
sys.stdout.flush()
def read_line():
""" Interrupted respecting reader for stdin. """
# try reading a line, removing any extra whitespace
try:
line = sys.stdin.readline().strip()
# i3status sends EOF, or an empty line
if not line:
sys.exit(3)
return line
# exit on ctrl-c
except KeyboardInterrupt:
sys.exit()
if __name__ == '__main__':
# Skip the first line which contains the version header.
print_line(read_line())
# The second line contains the start of the infinite array.
print_line(read_line())
while True:
line, prefix = read_line(), ''
# ignore comma at start of lines
if line.startswith(','):
line, prefix = line[1:], ','
j = json.loads(line)
# insert information into the start of the json, but could be anywhere
# CHANGE THIS LINE TO INSERT SOMETHING ELSE
j.insert(0, {
'full_text': ' '.join(f"{gpu.strip().replace(',', '').replace('GeForce','').replace('P8', '').replace(' %','%')}°C" for gpu in gpu_info().split('\n')),
'name': 'gpu',
'color': '#3A85FF'
})
# and echo back new encoded json
print_line(prefix+json.dumps(j))
Offline
linux can mount partitions with the "noexec" flag. In that case, nothing written to it can be executed, you'd have to explicitly use your shell binary to run scripts.
If you do not want that, change the mount flags.
The following is my fstab entry when attempting to use the new drive as /home
/dev/mapper/lima /mnt/lima btrfs rw,relatime,nofail,ssd,space_cache=v2,user 0 0
Offline
Edit: "user" and "users" flag imply noexec. https://man.archlinux.org/man/core/util … mount.8.en
OHHHH! Thank you, this is not the first time I've been bitten by that.
Last edited by Subject-17 (2022-06-27 19:27:00)
Offline
Just rebooted after removing
user
from fstab entry, everything seems to work now. Thanks to @progandy for the ID-10T check. Now to remember how to close a topic.
Last edited by Subject-17 (2022-06-27 19:31:07)
Offline
You don't close a topic - you mark it as solved...
https://wiki.archlinux.org/title/Genera … ow_to_post
Offline
I see it seems this is very finicky I would have made a backup of everything and reinstalled.......
CPU: Intel Pentium Silver N5000 (4)
OS: Arch Linux x86_64
Kernel: 5.15.50-1-lts
Offline