Hello, I’ve been using raspbian with kodi for my media center. Due to several reasons, I decided to install osmc and turn it in to a more fully featured os (for web browsing and general usage) rather than turning raspbian into a media center.
Anywho, I’ve been using a script combined with a line in inittab that automatically signs in and runs said script of the first tty in order to automount my storage directory. I’ve done it this way because using the rc.local file and fstab have both proven themselves incapable of waiting on a network connection.
However, inittab appears to be missing from osmc… can anyone tell me how I can get inittab back or accomplish this task another way?
Device: Rasp Pi 2
Installation media: SDcard class 10 16gb
Storage Device: SMB
OSMC version: 2015.7-1
OSMC uses systemd. systemd does not use the inittab file. If you do enable ‘wait-for-network’ systemd service and make a basic systemd unit (oneshot) with ‘Exec’ running your script, and depend on the wait-for-network unit, then OSMC will run it at boot after network is up
No need for any scripts, just use the right mount options in fstab.
Do use noauto,x-systemd.automount
Do not use _netdev,auto
Also do enable wait for network.
This will create a systemd automount unit that will defer mounting until first access (a bit like autofs) and when it does need to mount it will wait for the network to be up.
Should work fine.
Thank you both, I’m completely certain that both of your tips are helpful. I’ve gone back to putting the lines in fstab regardless of the recommendations I’ve been given by others. So I setup fstab as follows:
//192.168.1.11/Storage/Movies /home/osmc/Movies cifs sec=ntlm,username="Family",password="secret",uid=1000,gid=1000,iocharset=utf8,noauto,x-systemd.automount
... several more mount points here
I then ran the command:
sudo systemctl enable systemd-networkd-wait-online.service
That appears to have worked because it gave an output that it was creating a symlink to the file (I’m just now learning about systemctl but previous attempts failed with an error so I have to assume creating a symlink means it worked)
So I ‘sudo reboot’. Now I can’t ssh into the box. If I ping, however, it does reply. Those are the only settings that I changed since the last bootup
Btw. If I am remembering correctly, systemctl enable x-systemd.automount failed… Maybe I’m missing something here. Thank you for your help so far!
You enabled the wrong service. You want to enable connman-wait-for-network.service not systemd-networkd-wait-online.service - we use connman to manage the network not systemd’s built in network manager.
You can also enable it by selecting “wait for network” in the networking GUI, hence my reference to enabling “wait for network”. (I assumed you have looked at the networking GUI before)
So reverse the changes you made and try this way. You can get a local console by exiting Kodi then pressing ESC when the splash screen appears.
Also, x-systemd.automount is not a service that you can enable (it’s not a service at all) it is only an fstab mount option. Here is where it is documented, in the fstab section:
Be careful to add the nofail option to your mount as well - otherwise if it can’t be mounted it will prevent the system from booting.