Hello guys, I installed openhabian before and everything worked well till yesterday.
Now I have this when I power the raspberry . and I have no idea why since everything was working well.
It would be an idea to type journalctl -xb
to find out what it going on.
Did you try to type systemctl default
?
Yes I typed system default still got emergency mode. Also keeps on getting this message
Openhabian seems very unstable
It looks to me that you SD card is bust.
Why tho ? Everything was working fine. I use 32gb classes 10 sandisk ultra
It doesn’t matter. How old is it?
Brand new bought it just for openhabian. For a college project. Does it mean I have to strat from scratch?? Again ?? The due date is soon . will I lose everything I did so far?? I am so sick of this. Is there an alternative to openhab? Something more reliable ?
I suggest that you format your card and start again.
You maybe be able to access your data by plugging the card into a pc.
Can’t I just write some code on the SD with my PC. To help it
Maybe.
Doubt it.
Look on the raspberry pi forum. Nothing to do with OH
Can I use use a classe 4 sd this time ??
PS: I formated the main part of the SD. (Not the boot) now the raspberry says end kernel panic not syncing vfs unable to mount root fs on unknown block (179.2)
Lots of alternatives but your problem is with Raspbian and the RPi, not openHAB itself. And of course you would have to start over and learn everything again. AND it won’t actually solve your problem since openHAB isn’t the cause.
Then it probably isn’t worn out. Have you pulled powere from the RPi at any point without properly shutting it down? That can corrupt your SD card.
You can mount the SD card to a machine that supports the Linux file system and get your files off of the SD card. Then you should start from scratch. You have no idea what files were corrupted or how many files were corrupted. It will take WAY longer to find the files that need to be replaced than it will to just rebuild.
But copy the files you have worked on (OH config files, OH userdata) first.
Everything is gone now. Boot just has some config files. Everything important is in the other partition, the one you just blew away.
You have no choice now but to start over. This time keep good backups. Personally I keep all my OH configs in git.
How do you do that?
Sigh, I can’t find the posting where I already wrote this up.
OK, here is the quick and dirty description.
I run Gogs in a Docker container on one of my VMs. This is a light weight GitHub sort of server. GitLab is more popular and there are others. Lots of people just use GitHub or Bitbucket but I’m too lazy to encrypt or otherwise exclude sensitive information like plain text passwords, locations, etc. so I just host my own server. But it is possible to just set up a server using git alone.
https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
OK, now you have a git server. Something off the OH server where the configs go.
I have it somewhat easy for my main setup because I’m running in Docker. This lets me put both conf and userdata in the same parent folder and I can check that whole folder into git. My /opt/openhab folder looks like this:
rich@argus:/o/openhab2 (master) ✗ ls -la
total 48
drwxrwxrwx 8 openhab openhab 4096 May 21 19:18 ./
drwxr-xr-x 11 root root 4096 Mar 15 14:33 ../
drwxrwxr-x 2 openhab openhab 4096 May 26 2017 addons/
drwxrwxr-x 15 openhab openhab 4096 Apr 26 15:41 conf/
drwxrwxrwx 8 openhab openhab 4096 Jun 6 10:49 .git/
-rw-rw-r-- 1 openhab openhab 65 Nov 20 2017 .gitignore
drwxr-xr-x 3 openhab openhab 4096 May 26 2017 .java/
-rw-rw-r-- 1 openhab openhab 49 May 26 2017 nma.api
-rw-rw-r-- 1 rich rich 7657 Jan 9 13:40 org.ops4j.pax.logging.cfg
-rw-rw-r-- 1 openhab openhab 0 May 26 2017 README.md
drwx------ 4 rich rich 4096 Nov 20 2017 .Trash-1000/
drwxrwxr-x 15 openhab openhab 4096 May 30 14:08 userdata/
Since I’m running in Docker, addons, conf, .java (Nest 1.x puts some files here), and userdata get mounted as volumes into the container.
The trick is there is a whole bunch of stuff in userdata you don’t want to check into git (persistence files, cache, tmp, etc). So here is my .gitignore
rich@argus:/o/openhab2 (master) ✗ cat .gitignore
userdata/*
!userdata/etc
!userdata/jsondb
userdata/jsondb/backup
So that means ignore everything in userdata
but include userdata/etc
and userdata/jsondb
but not userdata/jsondb/backup
.
This effectively puts everything I’m likley to edit in OH config into git.
When I need to rebuild my OH for some reason I would start a fresh OH container with empty folders mounted into the container. OH will populate userdata with all the relevant files. Then I’ll stop OH, git clone
my repo into this root folder, and start the container again. The bindings will need to be reinstalled but I have this defined in addons.cfg so that happens automatically. If I weren’t using addons.cfg and configuring everything in conf/services files , I might need to add the userdata/config folder as well. But for now I do.
Now I also have a mini installation of OH running at my dad’s house. This one is installed via openHABian so I had to do a little manipulation first.
Once installed I stopped OH. Then created an /opt/openhab2
folder and copied the /etc/openhab2
to /opt/openhab2/conf
and copied /var/lib/openhab2
to /opt/openhab2/userdata
. I check /opt/openhab2
as described above with the same .gitignore.
Then I create symbolic links so /etc/openhab2
points to /opt/openhab2/conf
and /var/lib/openhab2
points to /opt/openhab2/userdata
.
sudo ln -s /opt/openhab2/userdata /var/lib/openhab2
When ever I make significant changes I just need to run:
sudo -u openhab git add .
sudo -u openhab git commit -m "Describe what changed and why"
sudo -u openhab git push
In Gogs it looks like this: