Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hosts file?

Featured Replies

Does unraid have a "Hosts file"  I'm trying to get a Plex plugin working and not sure what the issue is and thought it might be that.  Someone wrote a Plugin for NHL hockey finally.  I don't want to post a link to it for certain reasons.

  • Community Expert

There is /etc/hosts but I've never heard of anyone needing to edit it.

  • Author
10 hours ago, trurl said:

There is /etc/hosts but I've never heard of anyone needing to edit it.

ok, I don't see /etc/hosts on the flash drive.  What am I doing wrong?

Edited by squirrellydw

10 minutes ago, squirrellydw said:

ok, I don't see /etc/hosts on the flash drive.  What am I doing wrong?

 

/etc/hosts are for obvious reasons not on the flash drive. Take a step back and look at the path again ;-)

  • Author
4 minutes ago, saarg said:

 

/etc/hosts are for obvious reasons not on the flash drive. Take a step back and look at the path again ;-)

I'm confused, if the Hosts file isn't on the flash drive where would it be?  Not talking about the one on my computer but on unraid

  • Community Expert

It is actually a part of the operating system that gets installed in the RAM of your server as it unzips the bz* files in the root of your Flash Drive. 

 

You need to go the command line to actually find the hosts file at /etc/hosts.  To get to the command line, log in on the console or via a PuTTY session from your PC. You will need to learn some Linux Commands at this point to do but a google search should get a link to a introductory text. 

  • Author

thanks, so I found it and trying to add an IP to it but it doesn't seem to save it.  

sudo nano /etc/hosts

control x  and Y to save but when I look at the hosts file again what I added isn't there

 

 

  • Community Expert

I question whether this is the solution for whatever your (secret) problem is. Hosts just gives names to IPs, sort of an override of DNS. Usually any time you need to specify a network location you can just use the IP instead of the name, Have you tried that?

  • Author

@trurl I sent you a PM.  If you don't want to respond I understand.  If I could do the same thing through my router that would be great

Edited by squirrellydw

do you mean this  Plex NHL it's no secret they have it on the plex forums

Edited by ijuarez

  • Author

no that one is old

1 minute ago, squirrellydw said:

no that one is old

 

Well it can't be that secretive if a simple google search found it. Anyhow are you using the plex plugin (who's) or a docker?

  • Community Expert
1 hour ago, squirrellydw said:

thanks, so I found it and trying to add an IP to it but it doesn't seem to save it.  

sudo nano /etc/hosts

control x  and Y to save but when I look at the hosts file again what I added isn't there

 

 

 

Nano is confusing on what actually causes the file to updated.   On exiting,  You have to agree to save  the changes.   Use the following command to see if the date and time have been updated   

ls -al /etc

 

  • Author

any other way to modify the hosts file other than Nano?

  • Author

I think this might be the problem, after I type Y its asking "A File Name to Write"  see attached, what do I pick.

what do I pick.png

  • Author

lol wow I feel stupid, thanks

Quick check though is that if you're running a Plex docker, then you have to start / stop the container for the local version of hosts that it uses to re-grab the one that unRaid uses.  IE:  You're going to have to make a separate hosts file on the flash drive and then edit /boot/config/go and add the line

 

cp /boot/hosts  /etc/hosts

 

before the line that has emhttp  in it so that it'll take effect with every boot.

  • Author

so just create a text document, call it Hosts and put it on the root of the flash drive and edit the Go file.

 

Why won't the default one work if the IP is added to it.  So confusing 

Because the default one is unpacked from bzroot at boot, overriding any changes you made.  Any changes made to the "OS" are non-persistent across reboots, bzroot contains all the OS files and are unpacked to RAM.

Edited by CHBMB

  • Community Expert

You have to understand that unRAID does NOT run from the Flash Drive.  The OS is stored in the files on that Drive and the actual OS is loaded into RAM --- think of it as a RAM disk --- and that unRAID uses those files in RAM to actually run the system.  (Basically, unRAID uses Flash drive to initially load the OS into RAM and grabs some information from a few files in the config folder to modify some default settings. This takes most MB's about two minutes to do.  The Flash Drive is basically unaccessed by the OS until you are ready to shut the system down.  It will then write  a Flag bit to a file in the config folder to indicate a proper shutdown.)

 

If you want to modify a built-in configuration file, you have to do it every time that the OS loads.  Most folks who do this simply copy the modified file from the RAM disk file to a folder on the Flash Drive and put a line in the go file as Squid suggested.

 

Another way to thing about it is that the Flash Dive in unRAID is what the DVD Installation Disk is to Windows.  And that RAM Disk is to unRAID as the hard drive  (C:\)  is to Windows!

7 hours ago, Squid said:

Quick check though is that if you're running a Plex docker, then you have to start / stop the container for the local version of hosts that it uses to re-grab the one that unRaid uses.  IE:  You're going to have to make a separate hosts file on the flash drive and then edit /boot/config/go and add the line

 

cp /boot/hosts  /etc/hosts

 

before the line that has emhttp  in it so that it'll take effect with every boot.

 

No, don't do that !!!

 

The hosts file is dynamically generated by unRAID to ensure it contains the proper entries, do NOT overwrite this file.

 

You can however add entries to the hosts file from your go file:

 

echo "[ip] [name]" >> /etc/hosts

 

For example

echo "192.168.111.10 hostname.mydomain.com" >> /etc/hosts

 

 

6 hours ago, bonienl said:

 

No, don't do that !!!

 

The hosts file is dynamically generated by unRAID to ensure it contains the proper entries, do NOT overwrite this file.

 

You can however add entries to the hosts file from your go file:

 

echo "[ip] [name]" >> /etc/hosts

 

For example


echo "192.168.111.10 hostname.mydomain.com" >> /etc/hosts

 

 

Only problem then with appending the entries within go is that you can't guarantee when in the boot process unRaid creates the file.  OP would be better off setting up a user script (set to run at array start) with the appropriate echo command.

  • Community Expert

A better alternative might be to request that LimeTech provide for the appending of a user generated hosts file to the default one that LimeTech provides.  This could be done in much the same manner as is currently done with the  smb-extra.conf  file. 

 

Of course, this will require that someone with a truly vested interest in acquiring such an feature make the request and support that request with valid reasons for its need. 

  • Author
10 hours ago, Squid said:

Only problem then with appending the entries within go is that you can't guarantee when in the boot process unRaid creates the file.  OP would be better off setting up a user script (set to run at array start) with the appropriate echo command.

 

would you like to mike that script?  I have no idea how to do that.  I could fill in the IP and name if you tell me where to put it.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.