chown in persistent home


Forum: DSL Ideas and Suggestions
Topic: chown in persistent home
started by: mikshaw

Posted by mikshaw on April 22 2008,12:41
/etc/init.d/dsl-config, line 267:
Code Sample
   260          if [ -d "/mnt/$MYHOME$HOME" ]; then
   261             mount --bind "/mnt/$MYHOME$HOME" "$HOME/"
   262          else
   263             mkdir -p "/mnt/$MYHOME$HOME"
   264             mount --bind "/mnt/$MYHOME$HOME" "$HOME/"
   265             tar -C /KNOPPIX/etc/skel -cf - . | tar -C "$HOME" -xf -
   266             printf 'wm: %s\nicons: %s\n' "$DESKTOP" "$ICONS" > "$HOME"/.desktop
   267             chown -Rh "$USER".staff "$HOME"
   268          fi


To me this looks like chown occurs only if the home directory does not already exist, but for some reason it seems to happen every time I boot.  I had a suspicion this was happening, but never actually looked into it until this morning.  Everything in my home directory is dsl.staff, even though I know positively that yesterday it wasn't.

I keep all my work files, including mydsl extensions, in a persistent home. Every time I package an extension I have to chown the files even if I'd already done it last time i worked on that project.  If I'm currently working on an extension and compress it to test, if I shut down, go to bed, and then decide I need to make a change the next day, I have to chown the files all over again.

It's not just the extensions, though. I also have a peculiar way of doing a partially persistent /root. Some of root's configuration files are linked to or copied from files in a subdirectory of /home/dsl, and they should belong to root. There are also a couple of system files that are copied from a subdirectory in home. This is done from bootlocal, so I can always chown them after the copy, but I shouldn't need to do this.

So....is this happening to anyone else with a persistent home?
My boot options:
root=/dev/hda3 vga=791 knoppix_name=KNOPPIX-4.2.3 dsl syslog legacy noswap noacpi noapm dma noscsi frugal home=hda4 mydsl=hda4/home/dsl/mydsl host=bungle

Perhaps there's a conflict with using mydsl inside home?

In any case, it doesn't seem like I'm doing anything technically wrong, so this might be considered a bug report, or at least a suggestion of something to look into.

Posted by lucky13 on April 22 2008,12:57
Isn't this one of the changes made to accommodate the user cheatcode?

Edit: Why not change it to:
Code Sample
chown -Rh 1000:1000 "$HOME"

so that ownership doesn't change based on names of user.group?

Posted by mikshaw on April 22 2008,15:35
That would require a remaster, wouldn't it?
But I am interested in knowing what difference 1000:1000 has. Is that a special uid/gid?

In any case, there shouldn't be a chown of any kind on a persistent directory once the directory has been set up and chowned the first time. If you change user and have the same partition for a persistent home, the home directory wouldn't be the same as the previous one anyway, so the user boot option should not have any influence on file ownership after the first boot.

Maybe I'm missing some vital information.  As I said above, the script looks to me like it should already be doing this properly, but for some reason all files in /home/dsl always end up dsl.staff every time I reboot.  I've also seen times when I'd get messages saying that the system couldn't change ownership of certain files in /home/dsl, which was the first time I noticed the autochown.

Fortunately -h was included, or I'd be seriously pissed =o)

Posted by ^thehatsrule^ on April 22 2008,17:16
Quote
But I am interested in knowing what difference 1000:1000 has. Is that a special uid/gid?
iirc I've seen most interactive user id/groups start at 1000.  So since the default (first) is dsl.staff, it is 1000:1000.  LSB says it can start at 500: < http://refspecs.freestandards.org/LSB_3.2....ge.html >

Posted by lucky13 on April 22 2008,17:17
If it's set on numerical ownership, it doesn't matter if you're user dsl or user mikshaw or user foo. It wouldn't need to be remastered if Robert changes the script.
Posted by mikshaw on April 22 2008,17:33
I don't think you're following me, though. The issue is not who it's being chowned to, regardless of whether it's numeric or not.  The problem I'm having is that chown is being done at all. Once a persistent home is created, the chown should not ever be done after that, for that particular home directory.  So there is something else that needs to be fixed.  Whether it be in dsl-config or if there is something I need to change on my end I don't yet know, but as far as I can tell this has been happening only since DSL 4.something (maybe just 4.2).

I'll study dsl-config more closely and compare to older versions and see if I can find something.

Posted by mikshaw on April 22 2008,19:12
I've gone through dsl-config several times, and it tells me I'm crazy.  The chown command shouldn't be running. The persistent home gets mounted properly, so the chown should never come into play.

I give up.
I'm just going to mount my persistent home from bootlocal like I used to until I find out what's going on. Considering I share a /home partition with another distro, doing it that way is more convenient anyway...I can set it up to mount hda4 to /home instead of binding hda4/home/dsl to /home/dsl

Posted by roberts on April 22 2008,22:40
When additional user support was added, additional scripts run at boot time in the rc level including /etc/init.d.desktop.lua and /etc/init.d/adduser_final.sh. Likely it is there that I need to check if a persistent home is used and then bail out.
Posted by mikshaw on April 23 2008,11:51
That information definitely helps =O)

There is a chown in desktop.lua, but it applies only to /opt/.mydsl_menu/

adduser_final.sh is the culprit. It chowns the home directory indiscriminately.

Sorry about the misplaced thread, by the way. It was originally a suggestion thread until I realized that I had misread dsl-config.

Posted by florian on April 23 2008,14:18
Quote

To me this looks like chown occurs only if the home directory does not already exist, but for some reason it seems to happen every time I boot.  I had a suspicion this was happening, but never actually looked into it until this morning.  Everything in my home directory is dsl.staff, even though I know positively that yesterday it wasn't.


Just to confirm that I noticed a similar thing one or two months ago. On an old computer on which I used to boot a HD frugal DSL with a persistent home, I used to see everytime a few chown error message at start up before I could even login. Even though I was wondering what was going on, I didn't have a close look at the problem then.

Posted by mikshaw on April 25 2008,10:59
florian: I've wondered quite a bit how that could be, and the only thing I could come up with is that some directory that is chowed (likely the mydsl directory) is on a read-only partition. I believe the error showed for me when I was testing another machine.  I think I might have stored the mydsl extensions in the root partition.  Can't recall for sure, but it seems like a read-only filesystem is the only thing that could prevent root from changing ownership of a local file.
Posted by roberts on April 25 2008,18:41
Sharing your home directory with multiple users is not SOP nor is having a read-only home directory.

Trying to be accomodating to such is again going to add much complexity. Even the default permissions on /home/dsl is such that group is set to staff.

Traditional hard drive installations or hybrids (persistent home) is not really the focus of DSL. Tyring to accomodate this would mean having to know if this action is the first attempt both dynamically or upon boot.

Not sure if effort is worth the results given other pending tasks.

Posted by mikshaw on April 25 2008,20:42
Quote
nor is having a read-only home directory
It was, if I'm assuming correctly, the mydsl directory, not the home directory. It's possible that on the other machine I had dumped a few extensions on the root partition, and DSL may have tried to chown that directory.  I can't recall for sure, though. I haven't seen that error on my main box, which has a writable mydsl directory.

Posted by roberts on April 25 2008,23:22
The difference between 4.x and 3.x is the fact that mydsl needs to be writable as user. This is the result from trying to lessen the use of sudo and the requirment of copying or moving extensions as root or via a su'ed emelfm. It is also the reason that, for pendrives, the filesystem used needs to support permissions. These changes were announced back in the early 4.x series.
Posted by mikshaw on April 29 2008,21:48
Silly thing....I just thought of a very easy way to keep my work files' ownerships intact. I just moved the work directory to /mnt/hda4/work and make a /home/dsl/work symlink. It's all still on the same partition and just as easy to access, but now won't get chowned =o)
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.