SOLVED accidentally deleted nginx from root...

Status
Not open for further replies.

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Indeed, but can the devs do anything about that?

I'm all for the user bearing the consequences of his error, but I also think that if the devs can make a change that (1) prevents or mitigates that error, and (2) does not break the rest of the system, that should be considered. A couple of candidate changes might be (a) remove the pkg binary from the base install, or (b) do 'pkg lock' on the base system packages. I don't know enough about the FreeBSD package system to know the ramifications of (b)--it seems it would prevent inadvertent removal, but I don't know what else (if anything) it might break. I'd guess that (a) is probably too drastic of a change.

@neatfreak made a mistake, and fortunately for him, there's a fairly straightforward path to fix it. But if the system can do something to keep future users from making that mistake, shouldn't that be considered?

I think I'd be resistant to losing the package manager. As an appliance in a business environment, FreeNAS isn't going to be getting constantly updated. For example, downing a filer that's serving VM's means that all the VM's either need to be shut down or migrated off first. So when you have something like the next inevitable OpenSSL catastrophe, and you really want to address that one single vuln, having the package manager there means you could address that one issue, just by updating the package, without being forced into a massive operation that involves a jarring firmware upgrade and also a reboot.

As for locking, as I mentioned before, that's one highly specific fix to address one very narrow error a user could make, and it probably makes it a lot more complicated to do upgrades, etc., since the current paradigm for upgrades involves taking a snapshot and then upgrading things in place. I agree it could be done, but it seems like a lot of work to prevent a narrow user-error case.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
I can do more dumb UNIX tricks in a minute than you can fix with a month of coding
If we had a "quote of the day" you sir would be the winner. :D
 

neatfreak

Dabbler
Joined
Sep 5, 2015
Messages
35
Do a clean install, upload a saved copy of your config file, and you'll be good to go.

lol this thread got out of hand, sorry for the late reply, im sick in bed so i didnt have time to check and do anything on the NAS.

as others already tried it didnt work with just rebooting the system, and i have a question is there a way to get a config file, because i never made one. In the console setup i cant really do anything i tried pressing numbers to even reboot and that failed so i tried to do a backup but that doesnt work either.

should this work?
mount /dev/ufs/FreeNASs4 /mnt

File is called freenas-v1.db
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Are you able to ssh to the server? If so, you'll find 30 backups of the config file in /var/db/system--it's backed up every time you make a change to the configuration. Copy the most recent one to one of your shares, and copy it over to a client computer that way. For that matter, since I don't think your config file is bad, you can find the current one at /data/freenas1-v1.db.

One of the options at the console menu takes you to the shell; I forget which one though. That should allow you to do the same thing if you can't ssh in.
 

neatfreak

Dabbler
Joined
Sep 5, 2015
Messages
35
Are you able to ssh to the server? If so, you'll find 30 backups of the config file in /var/db/system
ya i ssh'd into my freenas and i get this

Code:
[root@freenas] /var/db/system# ll
total 81
drwxr-xr-x  11 root  wheel    13 Sep 22 18:04 ./
drwxr-xr-x  18 root  wheel  1080 Sep 28 18:45 ../
drwxr-xr-x   2 root  wheel     2 Sep 17 00:56 configs-5ece5c906a8f4df886779fae5cade8a5/
drwxr-xr-x   2 root  wheel     2 Sep 16 10:50 configs-bf937a0da5564cb596eff5f8aba08500/
drwxrwxr-x   2 root  wheel     3 Sep 22 18:25 cores/
-rw-r--r--   1 root  wheel    67 Sep 19 14:53 nfs-stablerestart
-rw-r--r--   1 root  wheel    67 Sep 28 18:30 nfs-stablerestart.bak
drwxr-xr-x   2 root  wheel     2 Sep 17 00:56 rrd-5ece5c906a8f4df886779fae5cade8a5/
drwxr-xr-x   2 root  wheel     2 Sep 16 10:50 rrd-bf937a0da5564cb596eff5f8aba08500/
drwxr-xr-x   4 root  wheel    28 Sep 28 18:44 samba4/
drwxr-xr-x   3 root  wheel     3 Sep 17 00:56 syslog-5ece5c906a8f4df886779fae5cade8a5/
drwxr-xr-x   2 root  wheel     2 Sep 16 10:50 syslog-bf937a0da5564cb596eff5f8aba08500/
drwxr-xr-x   2 root  wheel    11 Sep 17 13:02 update/
[root@freenas] /var/db/system#


im guessing the ones i need are named configs? i find strange because it says total 81 but i only see 11 files in this folder.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Looks like I lied--or more accurately, FreeNAS doesn't save those config backup files any more. Based on when my last backup is, I'd say it stopped with the 20150415 update. Wonder why it stopped.

Anyway, we're back to using the current config. It's still in /data/freenas-v1.db. And set up a regular script to make copies of your config database--@cyberjock has one in the Guides section that seems to work pretty well.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Yeah, normally I'm all about preventing users from doing "dumb" things, but this is something you can't fix. The seatbelts come off when you go to the CLI, and what you do there is your own damn fault and nobody elses. Luckily the fix is easy to implement.
 

neatfreak

Dabbler
Joined
Sep 5, 2015
Messages
35
It's still in /data/freenas-v1.db.

great thanks copied that one over. will do a reinstall now, and once its up and running i will set up a script.

Yeah, normally I'm all about preventing users from doing "dumb" things, but this is something you can't fix. The seatbelts come off when you go to the CLI, and what you do there is your own damn fault and nobody elses. Luckily the fix is easy to implement.
agreed.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
should this work?
Didn't see that previously. No, it won't work with 9.3 due to the ZFS filesystem on the boot device. It would work with 9.2.x and prior versions.
 

neatfreak

Dabbler
Joined
Sep 5, 2015
Messages
35
It worked, thanks so much...everybody! :)

I didnt do a new install, i just downloaded the lastest freenas iso and pressed on upgrade and then it asked me if i want to use to old config file and i pressed yes, and it booted after the upgrade. the WebGUI works etc.

thanks again and sorry for this "dumb" problem.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Well, live and learn. There were other ways to fix it as well, but what you did was probably the best.
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
I'm glad you got things working. I was wondering why no one suggested booting into a previous snapshot. Is that a bad idea?
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
I'm glad you got things working. I was wondering why no one suggested booting into a previous snapshot. Is that a bad idea?
I'm guessing it would work, too.
The only disadvantage that immediately pops into mind is the potential need to redo whatever config changes happened since the previous update was executed.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I'm glad you got things working. I was wondering why no one suggested booting into a previous snapshot. Is that a bad idea?

It assumes there's a previous snapshot, and/or leaves a boogered-up copy laying around that might inadvertently be booted into someday, etc. I haven't spent enough time characterizing what goes on during an install/upgrade to be able to magically know what's supposed to be guaranteed to be available for all combinations of possible user actions, and I like suggesting things I know work.
 
Status
Not open for further replies.
Top