Install DVR server on Ubuntu without giving it sudo

I purchased the subscription and would like to temporary install on my linux laptop (plan to install for rpi4-with-external-usb later) but under a temporary user account w/o admin rights for security concerns. When I ran the "curl -f -s https://getchannels.com/dvr/setup.sh | sh" it wanted sudo rights. Is there way to install without sudo? I thought it said it can be installed as a normal user service and not a system-wide service?

Yes, you can indeed install it without root permissions.

However, the install script isn't that flexible, and root permissions are still wanted for installing the service files. If you can wait a day or so I can provide you with a script that will download the latest, install it to the current user's $HOME, and then create a user unit for running/managing the server.

That would be great. I suspect most users that install on linux would prefer this solution.
Thank you very much.

Are you looking to fully install and manage Channels only as a non-root user, or are you merely looking to run the server as a non-root user? The former is what I thought you were asking for, but the latter is probably closer to what most users expect of their servers: installed to the system by root, but run as an unprivileged user.

That is correct, for now I want to only install and manage Channels as a non-root user (it has other user account with confidential files). Later on I'll install it on a rpi4 using the normal install method which won't have any confidential files.
Thanks.

1 Like

All right, here's a modification for installing solely as a local user. When you run the setup.sh script, set the DOWNLOAD_ONLY environment variable so that you are only downloading the files and not trying to install anything to the system directories:

cd; curl -fs https://getchannels.com/dvr/setup.sh | DOWNLOAD_ONLY=1 sh

Run that command from a terminal opened to your user's home directory. Then, instead of running the install-linux.sh script, use these commands:

mkdir -p $HOME/.config/systemd/user
cat > $HOME/.config/systemd/user/channels-dvr.service << EOF
[Unit]
Description=Channels DVR
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
WorkingDirectory=$HOME/channels-dvr
StandardOutput=append:$HOME/channels-dvr/data/channels-dvr.log
StandardError=inherit
ExecStart=$HOME/channels-dvr/latest/channels-dvr
Restart=always
RestartSec=10
LimitNOFILE=8192
OOMScoreAdjust=-500

[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now channels-dvr
sudo loginctl enable-linger `whoami`

This will create a user unit, install it to your user's home directory, and then enable and start the Channels DVR server.

The last line uses sudo, but it is necessary to allow the server to start automatically at boot. Otherwise, the server will not start until you have actually logged in as the user installing the server. If never running sudo is necessary, then just leave that last line off, and then each time to reboot the Pi you'll need to login as your user in order to start it off.

2 Likes

Thanks racameron!!, But have a few questions.

  1. what is the purpose of the "cd;" in the first command to run? Should I create a channels-dvr directory and use that as the target for this cd command? I am thinking you meant that I should cd to the "channels-dvr" directory created by the curl right?
  2. How do I start the server manually (w/o the sudo at the end, although likely use both). Guessing its a "systemctl" cmd but not sure of the args or what the pwd should be.
    Thanks.

Running the first command gives the following for the sudo password again...
tvdvr@n5110:~$ cd; DOWNLOAD_ONLY=1 curl -fs https://getchannels.com/dvr/setup.sh | sh
Downloading Channels DVR 2019.11.19.2312 (linux-x86_64) to /home/tvdvr/channels-dvr......
NOTE: Your root password is required to install Channels DVR as a service.
NOTE: Please enter it at the prompt below.
[sudo] password for tvdvr:

The initial cd command is to put you in your user's $HOME. The DOWNLOAD_ONLY=1 portion tells the Channels' setup.sh script that you are downloading to only download the Channels files, but not to install them. setup.sh will create the channels-dvr directory for you and populate it as well.

Here's the breakdown of the additional shell commands:

  • mkdir -p $HOME/.config/systemd/user
    Create the directory needed to hold the user unit.
  • cat > $HOME/.config/systemd/user/channels-dvr.service << EOF ... EOF
    Generate the unit file and put it in your user unit directory.
  • systemctl --user daemon-reload
    Tell systemd to rescan its files, so it knows about the newly installed user unit for Channels DVR.
  • systemctl --user enable --now channels-dvr
    This tells systemd to both enable the unit file (meaning, set it up to start at boot), and start it immediately so you don't have to have until the next boot for it to start (--now).
  • sudo loginctl enable-linger `whoami`
    Tell systemd to allow the enabled user units to start at boot, without requiring the user to login first.

If you truly want to absolutely avoid using sudo, then leave off the last two commands:

systemctl --user enable --now channels-dvr
sudo loginctl enable-linger `whoami`

and instead replace them with this single command:

systemctl --user start channels-dvr

Also, each time you wish to start the Channels DVR server after a reboot you will need to relaunch it with the command above.

(Note, I must have missed a line while copy-and-pasting the unit file, so I have modified my post above to include it. I mistakenly forgot the [Unit] section heading of the service unit file.)

1 Like

I realized that when double-checking the script I ran it locally instead of running it exactly as I posted. (I fixed the original post, so it is now correct up there, too.) The environment needs to be set immediately before calling sh, so use this instead:

cd; curl -fs https://getchannels.com/dvr/setup.sh | DOWNLOAD_ONLY=1 sh

Here's the output from my system:

[robert@walkure ~]$ cd; curl -fs https://getchannels.com/dvr/setup.sh | DOWNLOAD_ONLY=1 sh
Downloading Channels DVR 2019.11.19.2312 (linux-x86_64) to /home/robert/channels-dvr......
Channels DVR has been downloaded.

I just ctrl-c out of the sudo prompt and ran the rest of the cmds and its started. I now in the webui interface trying to get my legacy HDHR channels to be detected but stays as 0.

Its says the following but I don't have tvOS or iOS but I did update my HDHR using the Linux hdhomerun_config_gui and ran a scan... but still shows 0 for channels.... any ideas on what to try next.?

Please use the Channels app on tvOS or iOS to update this legacy HDHR to the latest firmware (if available), and then scan for channels.

Ah, you're using an old Dual it seems. I'm not sure about the requirements for a channel scan with that device, as it was pretty much the last of the old "legacy" tuners. I believe that by scanning from the iOS or tvOS clients will handle the scan.

Otherwise, you'll need to do it from Windows. But that's a whole different set of problems. At least you've got the server installed and running now.

I'll send a new support help for my no channels on DUAL hdhr.
Thanks so much for the help racameron!!!