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

Failed to start from systemd #23

Open
timxx opened this issue Mar 4, 2018 · 3 comments
Open

Failed to start from systemd #23

timxx opened this issue Mar 4, 2018 · 3 comments

Comments

@timxx
Copy link
Contributor

timxx commented Mar 4, 2018

Can not run with systemctl --user start bing-wallpaper.service as README mentioned

status from systemctl --user status bing-wallpaper.service

Process: 1389 ExecStart=/workspace/projects/linux-bing-wallpaper/bing-wallpaper zh-CN true (code=exited, status=2)
Main PID: 1389 (code=exited, status=2)

Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Service hold-off time over, scheduling restart.
Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Scheduled restart job, restart counter is at 5.
Mar 04 18:27:47 ooxx systemd[476]: Stopped Bing Wallpaper of the Day as your Linux Desktop's wallpaper.
Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Start request repeated too quickly.
Mar 04 18:27:47 ooxx systemd[476]: bing-wallpaper.service: Failed with result 'exit-code'.
Mar 04 18:27:47 ooxx systemd[476]: Failed to start Bing Wallpaper of the Day as your Linux Desktop's wallpaper.

logs from journalctl --user-unit bing-wallpaper.service

Mar 04 18:27:45 ooxx systemd[476]: Started Bing Wallpaper of the Day as your Linux Desktop's wallpaper.
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: panic: strconv.ParseBool: parsing "": invalid syntax
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: goroutine 1 [running]:
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: main.check(0x6d76e0, 0xc420086d20)
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: /workspace/projects/linux-bing-wallpaper/bing-wallpaper.go:26 +0x4a
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: main.detect_de(0x92b9bcca1072ffa6, 0x8)
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: /workspace/projects/linux-bing-wallpaper/bing-wallpaper.go:57 +0x522
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: main.main()
Mar 04 18:27:45 ooxx bing-wallpaper[1359]: /workspace/projects/linux-bing-wallpaper/bing-wallpaper.go:359 +0x74
Mar 04 18:27:45 ooxx systemd[476]: bing-wallpaper.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 04 18:27:45 ooxx systemd[476]: bing-wallpaper.service: Failed with result 'exit-code'.
Mar 04 18:27:46 ooxx systemd[476]: bing-wallpaper.service: Service hold-off time over, scheduling restart.
Mar 04 18:27:46 ooxx systemd[476]: bing-wallpaper.service: Scheduled restart job, restart counter is at 1.
Mar 04 18:27:46 ooxx systemd[476]: Stopped Bing Wallpaper of the Day as your Linux Desktop's wallpaper.

It seems that go can't get XDG_CURRENT_DESKTOP env when starts from systemd because I do have that env (XDG_CURRENT_DESKTOP=XFCE), it works when run the binary directly. LoL

OS: ArchLinux x64 with xfce4 desktop

@marguerite
Copy link
Owner

can you please add:
log.Println(os.Getenv(“XDG_CURRENT_DESKTOP”))

before:

de := strings.ToLower(os.Getenv("XDG_CURRENT_DESKTOP"))

run go build again, then the systemd service to check what the log say?

I am on KF5, and it’s good...

@timxx
Copy link
Contributor Author

timxx commented Mar 4, 2018

I add log.Println("hello" + os.Getenv("XDG_CURRENT_DESKTOP") + ">>"),
and grep the log

Mar 04 20:43:22 ooxx bing-wallpaper[1633]: 2018/03/04 20:43:22 hello>>

My systemd version is 237.64... Tested serveral other env, all is empty. LoL

@timxx
Copy link
Contributor Author

timxx commented Mar 5, 2018

Found a solution from ArchWiki

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

No branches or pull requests

2 participants