oh sry, but I tried the home directory and get the same error…
go: no packages loaded from /home/nona/go/bin/main
go env is in /home/nona/go, i just forgot to try running it ther to
oh sry, but I tried the home directory and get the same error…
go: no packages loaded from /home/nona/go/bin/main
go env is in /home/nona/go, i just forgot to try running it ther to
Can you show:
ls -la /home/nona/go/bin
I really would have thought main
was the binary; I guess I have no idea what I'm looking at. Can you try from inside the directory:
cd /home/nona/go/bin
./main
I'm puzzled. This is what I did:
git clone [email protected]:GRbit/acupoint-portege-x30.git
cd acupoint-portege-x30
go build # first time will download all other packages it depends on
and that is it, now there's a mmm
executable file in the directory.
It's mmm
because go.mod
says module mmm
.
edit: use git clone https://github.com/GRbit/acupoint-portege-x30.git
.
ls -la /home/nona/go/bin
gives me
drwxr-xr-x - nona 25 Oct 13:54 .
drwxr-xr-x - nona 25 Oct 09:18 ..
.rwxr-xr-x 18M nona 23 Oct 16:10 dlv
.rwxr-xr-x 3.5M nona 23 Oct 16:10 gomodifytags
.rwxr-xr-x 7.1M nona 23 Oct 16:10 goplay
.rwxr-xr-x 27M nona 23 Oct 16:10 gopls
.rwxr-xr-x 11M nona 23 Oct 16:10 gotests
.rwxr-xr-x 5.9M nona 23 Oct 16:10 impl
.rwxr-xr-x 5.5M nona 25 Oct 13:17 main
.rwxr-xr-x 5.5M nona 25 Oct 13:54 main.go
.rwxr-xr-x 13M nona 23 Oct 16:10 staticcheck
i try sudo ./main
and the program runs!!
Bingo!
Okay, so:
sudo mv /home/nona/go/bin/main /usr/local/bin/
After moving it, check if it runs:
sudo main
If it does, edit the systemd
service:
micro /etc/systemd/system/driver.service
Change the ExecStart
line to point to the binary:
ExecStart=/usr/local/bin/main
Then save, exit, reload the daemon and restart the service. *wipes sweat from brow *
Yep that is it. I guess the file name depends how it's compiled. Who cares, it's the one.
I advise to rename it to something meaningful and unlikely to clash with some other binary, if it's going to end up somewhere in PATH.
wtf, it still won't work..
driver.service - My Excellent Go Touchpad Service
Loaded: loaded (/etc/systemd/system/driver.service; enabled; preset: disabled)
Active: failed (Result: core-dump) since Tue 2022-10-25 15:00:11 EDT; 1min 19s ago
Duration: 241ms
Process: 863 ExecStart=/usr/local/bin/main (code=dumped, signal=SEGV)
Main PID: 863 (code=dumped, signal=SEGV)
CPU: 6ms
Oct 25 15:00:11 nona-dynabookportegex50g systemd[1]: Started My Excellent Go Touchpad Service.
Oct 25 15:00:11 nona-dynabookportegex50g main[863]: on_library_load [436]: XOpenDisplay failure!
Oct 25 15:00:11 nona-dynabookportegex50g main[863]: load_input_helper [1883]: XkbGetKeyboard failed to locate a valid keyboard!
Oct 25 15:00:11 nona-dynabookportegex50g systemd[1]: driver.service: Main process exited, code=dumped, status=11/SEGV
Oct 25 15:00:11 nona-dynabookportegex50g systemd[1]: driver.service: Failed with result 'core-dump'.type or paste code here
Running the program again gives: go: no packages loaded from /usr/local/bin/main
. What's happening here? Do I have to install go packages each time on reboot? O_o Running the mmm
file I copied from the git also gives the same error.
Running with sudo main
gives this?
I don’t know!
Can you show output of:
sudo journalctl -r -u driver.service
Meanwhile I try to make sense of Getting error: load_input_helper [1883]: XkbGetKeyboard failed to locate a valid keyboard! · Issue #304 · go-vgo/robotgo · GitHub , looks like the problem.
edit: nothing very useful there.
Running with sudo main gives this?
Okay,, I messed up xD. I tried go run out of habit, but just sudo /usr/local/bin/main
makes it work fine.
Output of sudo journalctl is....
Oct 25 15:00:11 nona-dynabookportegex50g systemd[1]: driver.service: Failed with result 'core-dump'.
Oct 25 15:00:11 nona-dynabookportegex50g systemd[1]: driver.service: Main process exited, code=dumped, status=11/SEGV
Oct 25 15:00:11 nona-dynabookportegex50g main[863]: load_input_helper [1883]: XkbGetKeyboard failed to locate a valid keyboard!
Oct 25 15:00:11 nona-dynabookportegex50g main[863]: on_library_load [436]: XOpenDisplay failure!
Oct 25 15:00:11 nona-dynabookportegex50g systemd[1]: Started My Excellent Go Touchpad Service.
-- Boot c449a909120247cbaa7e32581ac6025f --
Oct 25 14:59:30 nona-dynabookportegex50g systemd[1]: driver.service: Failed with result 'core-dump'.
Oct 25 14:59:30 nona-dynabookportegex50g systemd[1]: driver.service: Main process exited, code=dumped, status=11/SEGV
Oct 25 14:59:29 nona-dynabookportegex50g main[150178]: load_input_helper [1883]: XkbGetKeyboard failed to locate a valid keyboard!
Oct 25 14:59:29 nona-dynabookportegex50g main[150178]: on_library_load [436]: XOpenDisplay failure!
Oct 25 14:59:29 nona-dynabookportegex50g systemd[1]: Started My Excellent Go Touchpad Service.
Oct 25 13:46:26 nona-dynabookportegex50g systemd[1]: driver.service: Failed with result 'exit-code'.
Oct 25 13:46:26 nona-dynabookportegex50g systemd[1]: driver.service: Main process exited, code=exited, status=1/FAILURE
Oct 25 13:46:26 nona-dynabookportegex50g touchpad.sh[879]: usr/local/bin/main.go:11:2: no required module provides package github.com/go-vgo/robotgo: go.mo>
Oct 25 13:46:26 nona-dynabookportegex50g systemd[1]: Started My Excellent Go Touchpad Service.
-- Boot 4de14ce6133044a09e342d21186419a6 --
Oct 25 13:36:53 nona-dynabookportegex50g systemd[1]: driver.service: Failed with result 'exit-code'.
Oct 25 13:36:53 nona-dynabookportegex50g systemd[1]: driver.service: Main process exited, code=exited, status=1/FAILURE
Oct 25 13:36:52 nona-dynabookportegex50g touchpad.sh[763]: go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Oct 25 13:36:52 nona-dynabookportegex50g systemd[1]: Started My Excellent Go Touchpad Service.
-- Boot a7d466c30eae41928248197dd3efcc2b --
Oct 25 13:34:31 nona-dynabookportegex50g systemd[1]: driver.service: Failed with result 'exit-code'.
Oct 25 13:34:31 nona-dynabookportegex50g systemd[1]: driver.service: Main process exited, code=exited, status=1/FAILURE
Oct 25 13:34:31 nona-dynabookportegex50g touchpad.sh[770]: go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Oct 25 13:34:31 nona-dynabookportegex50g systemd[1]: Started My Excellent Go Touchpad Service.
sure it’s not go run
in the service file touchpad.sh
?
my service file is
[Unit]
Description=My Excellent Go Touchpad Service
[Service]
Type=simple
ExecStart=/usr/local/bin/main
[Install]
WantedBy=multi-user.target
also, I have a terrible bug now. running sudo main
makes the touchpad work, BUT once I close the terminal, it ends the drive process and doesn't run anymore. previously, when I ran main.go, it worked even when I closed the terminal.
When run from terminal, the process will be a child of the terminal and go down with it.
But, (assuming fish
shell), whatever & ; disown
will run whatever
detached from the terminal and it will survive it.
This only matters when running manually, you may as well leave the terminal open while testing.
It's of no consequence for the service, in that case main
or whatever we want to call it will be managed by systemd
and stay up.
I wonder if it is starting too early? Try to change
WantedBy=multi-user.target
to
WantedBy=graphical.target
Save, reload daemon, restart service, reboot…
Still no dice... same error as last time.
Oct 25 15:42:34 nona-dynabookportegex50g main[772]: on_library_load [436]: XOpenDisplay failure!
Oct 25 15:42:34 nona-dynabookportegex50g main[772]: load_input_helper [1883]: XkbGetKeyboard failed to locate a valid keyboard!
Does it run as the right user tho?
How can I check that? I gave it root permissions if it helps.
Try add User=nona
and Group=nona
under [Service]
, and /usr/bin/sudo
to the ExecStart
command (assuming nona is your username).
Since services run as root by default, sudo shouldn't prompt for a password.
There are subtle differences between root and sudo that I do not understand well, and here the command works in terminal with sudo but not as a service so it may be that. Or not .
I get a bad setting error when I use systemctl status.... How do I add /usr/bin/sudo
? I already have an execstart comand, the one that runs the main file. o_o
I mean, change it to ExecStart=/usr/bin/sudo /usr/local/bin/main
.