General NAS-Central Forums

Welcome to the NAS community
It is currently Fri Oct 20, 2017 1:30 am

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Aug 05, 2015 1:20 am 
Offline

Joined: Wed Aug 05, 2015 1:09 am
Posts: 4
Hi,

I only yesterday hacked my HMNHD CE, enabling SSH and making the apps partition writeable.

Right now I just can't figure out a problem I have with user and group creation. Apparently, /etc is being synced at shutdown so there is no need to meddle with /boot/images/config. I could verify this: If I touch a file into /etc, it stays. I changed /etc/pam.d/su, it stayed. Also, the passwd entry for new users survives the reboot. However, the user group(s) and home folder of my user(s) don't, they are not there anymore after the reboot, and I just can't figure out why or how to avoid this.

Can someone give me a hint what's happening here?

Thanks a lot.

Cheers,
Troja


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 2:24 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6048
With 'home folder' you mean something like /home/<user> ? Or do you mean the entry in /etc/passwd?


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 2:29 pm 
Offline

Joined: Wed Aug 05, 2015 1:09 am
Posts: 4
Yes, I mean the actual home folder in /home/[user]. The entry in passwd is not changing at all, it's staying the way it should.


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 6:54 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6048
The rootfs of an Iomega is actually the initramfs, which is a ramdisk, and volatile by nature. On /etc some file is loopmounted, to give persistent configuration storage. Further on /usr another file is loopmounted, readonly, containing the major part of the firmware.

If you want the home directories to stay you'll have to put them on the data partition (/mnt/pools/A/A0/). Then you can either edit /etc/passwd to match that, or edit /etc/rc.local to exchange /home by a symlink to, for instance /mnt/pools/A/A0/home.

About the groups, can you specify what actually happens?


Top
 Profile  
 
PostPosted: Wed Aug 05, 2015 11:50 pm 
Offline

Joined: Wed Aug 05, 2015 1:09 am
Posts: 4
Thanks for replying.

The file that is loopmounted to /etc is /boot/images/config. As you say yourself, it should give persistent configuration storage and this seems to be the case with most of it.

However, all new entries in /etc/groups are lost after each reboot.

What I do? Simple. I create a new user, i.e. "test", using useradd. This automatically creates:

1. an entry in /etc/passwd with the new user and its group
2. an entry in /etc/group with the new group (=username)
3. a new directory in /home/ with the name of the user

After rebooting the NAS, 2. and 3. are gone.

Your point about the home drive is well taken, I will put it to the data partition. This still leaves the question why the group entry disappears after the reboot..

The same happens to other kind of changes in /etc/group, i.e. adding a user to another group. After the reboot, the changes are lost.


Top
 Profile  
 
PostPosted: Thu Aug 06, 2015 9:06 am 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6048
I guess the file is dynamically regenerated by the backend. A work around could be to store a copy somewhere, and put it back after booting. Problem is that it probably can't be done from rc.local, as the backend isn't finished yet initializing when rc.local runs.

But maybe you could add a group 'triggergroup', and add something like this to rc.local:
Code:
{
while true
do
        if grep triggergroup /etc/groups >/dev/null
        then
                sleep 5
                continue
        fi
        sleep 5 # Give backend time to finish it's stuff
        cp /etc/groups.backup /etc/groups
        exit 0
done
} &



Another option is to make it read only, but it is possible that will give a backend panic, leaving you with a half initialized box.


Top
 Profile  
 
PostPosted: Sun Aug 09, 2015 11:43 pm 
Offline

Joined: Wed Aug 05, 2015 1:09 am
Posts: 4
Hi,

Just wanted to say that I'm still working on this but very busy with other things, will post back soon my results (so far without success, even with your latest suggestion but I have some ideas I'd like to try before asking for help again..).

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group