Skip to content

added sudo and some error fix language #883

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion source/getting-started/autostart-systemd.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If the preceding command returns the string `systemd`, you are likely using `sys
If you want Home Assistant to be launched automatically, an extra step is needed to setup `systemd`. You need a service file to control Home Assistant with `systemd`. If you are using a Raspberry Pi with Raspbian then replace the `[your user]` with `pi` otherwise use your user you want to run Home Assistant. `ExecStart` contains the path to `hass` and this may vary. Check with `whereis hass` for the location.

```bash
$ su -c 'cat <<EOF >> /etc/systemd/system/home-assistant@[your user].service
$ sudo su -c 'cat <<EOF >> /etc/systemd/system/home-assistant@[your user].service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo su looks always a bit wired. This will only work if the user is listed in the /etc/sudoers file which is no a lot of systems not the case. If this is Rapbian specific then we should mention that and keep the guide generic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sudo is Raspbian specific (I think)... but it caused me much consternation... So I would propose we have something to indicate that you may need to run as sudo if using raspbian.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In another PR (#873) we were talking about a Troubleshooting page for Rasbian. I think that this should be added there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bionutrient sudo is defiantly not specific to Raspbian or Linux for that part. It's a command that let's you execute a command with escalated privileges.

The su command when ran without specifying a user will default to the root user and is often called the superuser command(a bit misleading).

In this case your escalating privileges to root to run another command as root.
I think(haven't tested) that you could replace the command in question with

$ sudo cat <<EOF >> /etc/systemd/system/home-assistant@[your user].service

[Unit]
Description=Home Assistant
After=network.target
Expand Down Expand Up @@ -63,6 +63,13 @@ $ sudo systemctl status home-assistant@[your user] -l
[...]
```

IF, you get an error message, and it fails to start Home Assistant, double check that your ExecStart=/usr/bin/hass points to the correct location...it's likely ExecStart=/usr/local/bin/hass If you didn't update it correctly, you may have to remove the home-assistant@pi.service file and then start over at the top of this instruction set using the correct directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the same style here and embed stuff like ExecStart= with `. It would also be possible to simple move and edit the file.

...it's likely ExecStart=/usr/local/bin/hass If you looks a bit misplaced.


'''bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to use three `.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. got it

$ sudo rm /etc/systemd/system/home-assistant@pi.service
$ sudo systemctl --system daemon-reload
'''

To get Home Assistant's logging output, simple use `journalctl`.

```bash
Expand Down