-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DSM6: adduser command not working [$100] #2216
Comments
Annoyingly, this issue disappears after you run I don't know what's up with this. It almost looks like something got corrupted during the migration. Some package users have vanished without a trace. |
I was looking at the "privilege" file (/conf) for the DSM6 Download Station package. Not sure if this was how the DSM5.x package was but I see things like:
See full file: https://gist.github.com/GoodOmens83/2d465ef7adbfce045820 The resource file (in the same folder) seems to have a section for creating a database:
|
More info: On top of that, DSM runs There are Synology packages that create their own user, e.g DownloadStation, but of course Synology has packed whatever it is into a binary... The source may be available, but I haven't spent much time in searching. |
That makes sense - I looked all through the packages for any sort of reference to creating a user and that code I pulled out was as close as I could find. I also noticed Synology spcifically calls the |
A little bit of email history. I got the response that the request was forwarded to the engineering team. Now DSM 6 has landed and I asked again (3/2016) for documentation about DSM 6 user management changes. Hopefully this time my request will be answered and we will have a proper solution for system users. |
wow - run everything as root 👎 :) |
And I also sent in a request just after my last comment... @GoodOmens83 Passing on a valid shell to |
So I've got an answer, @GoodOmens83 was on the good track: there is a configuration file that tells DSM to run that package as a dedicated user with the same name of the package itself.
|
Ok, that actually works. After a bit of trial and error, a user was created during package installation. Not sure, but it seems there could be some limitations for the account name (max length or maybe certain characters are not accepted, had some trouble getting it going at first). The user shows up as a |
Something to consider if we get this to work: prepend the user with |
Reading through the DSM Developer Manual i really don't get wiser at all. They suggest using
Checking /etc/passwd i only see users with uid higher then some high value showing up on the system internal list. I would guess, if we add an user it would be to the system internal list, or does it even matter. I guess some logic of user creation also applies to group creation... however this looks even more mysterious. Some groups show up, some don't |
What are those other methods? Why does Synology have to be so mysterious about something so simple. |
The available developer guide is outdated, and doesn't contain anything related to new features of DSM6. Quote from Synology rep: My interpretation of the cryptic sentence wrt the other methods is that it's probably a reference to the new DSM6 method to create system users (which presumably was being developed at the time), or less likely, to our use of busybox's As for the mysteriousness, learn to love it ;) |
Maybe reach out to @kevinfang over here: https://github.com/SynologyOpenSource/pkgscripts-ng Seems to be putting up DSM6 related things to making packages. Poked around the various things on https://github.com/SynologyOpenSource but didn't find anything groundbreaking. But I'm guessing they are tied to Synology, Inc. Or at least all of their copyrights mention Synology, Inc. as the owner.... |
I've made enough progress to know how to create system users 'the DSM6 way': without documentation, it's just tedious and it takes longer. The main issue is that the approach Synology has taken is quite error-prone, and there's no leeway. For example, anything incorrect in the JSON and the package install will fail. The end result could be that the previous package version is uninstalled, but the updated package isn't installed...which means data loss. On top of that, we'll have to remove our old system users during preupgrade (or something), seeing as system users created via busybox aren't recognized as valid...which means another install failure, but with a cryptic message this time. And the list goes on... |
Hello! Sorry I don't have your developer skills so I maybe saying something stupid or that you have already tried but don't you have access to the synology commands like synouser --add or synogroup --add ? I am scripting the default configuration of my NAS this way. |
@Dr-Bean You used the command addgroup to add the user to the sc-..... group. |
|
Ok, thanks for the info. |
I have no experience with programming, but am an enthousiat user of Synocommunity. Is it not possible to make a new package that reinstates the missing commands? Much like the Nano package does (https://synocommunity.com/package/nano) ? |
@madcowGit It's not a question of reinstating. Synology has made changes that prevent us from using anything else than their commands. |
It seems that the only way is via SSH with the command synouser and editing the file /etc/passwd, I do manually to be able to install any server. Maybe you can make an installation script to run as root. |
@Intrapixel there is already an official solution and @Dr-Bean is working hard on it to move most of our Packages to the DSM 6 compatible solution (see dsm6 branch) so we already know how to do it... but still have to do it for every package and if i remember corretly there still is some server side stuff to handle afterwards. so it might be a while till DSM6 Packages will be available. |
Concerning the issue with the I didn't tried it, but it seems to do the trick by looking at the code of |
@zebulon501 The issue isn't adding entries into |
is this related to deluge showing 'stoped' state in package manger? But yet it still runs and I can access it just fine via web ui and daemon |
I don't know if it is any help but I just post it here. I have created a package that will install and run under DSM 6 and that will add the user that is created by DSM via the privilege file to the group "sc-media". Here is the script:
|
@BenjV Thanks for searching. The main issue is to gain control on user creation and remove to get packages able to upgrade from 5.2 to 6.0. I am looking at the way MariaDB package declares its service user |
Creating of users is done via the privilege file in the config folder:
Adding extra users can be done with the same script as I posted before by replacing the "synogroup" command with the "synosuser" command |
@BenjV Sure but there are still some troubles to get any package upgraded properly: a DSM 5.2 package may have created "user" at installation and after upgrade to DSM 6, package upgrade with privilege may create a "userXYZ" instead of reusing "user". As far as I understood that is the reason why @Dr-Bean looks for a way to manage user by script. Package MariaDB does not have "privilege" file (or I have not found it) and its service user is "mysql", so not the same as package name. And I found no place where synouser or synogroup is used. So remains the question how this "mysql" service user is created. |
Just replace the "PackageUserName" with "mysql" . If you don't understand how a package for DSMS 6 must look like I suggest to read this. |
Any news on this @Dr-Bean ? :) |
I would like to thank the longevity of this issue for motivating me to switch to Docker. |
Turns out that the reason users aren't created on DSM6 is due to the fact that
adduser
can't be found. It seems that the correct PATH isn't set, so the file(s) can't be found.We can solve this in a number of ways:
adduser
and similar commands. E.g.PATH=${PATH} adduser [..]
. Yeah...probably not ;)postinst
andpreuninst
(some kind of genericsetpath
call maybe? Could tie in with some type ofcommon.sh
approach)ADDUSER = "${INSTALL_DIR}/bin/adduser"
.Somewhat of a pain because we have multiple packages that don't bundle their own busybox, but use e.g. Python's (which keeps those packages
noarch
), but otherwise it should work.This applies to
adduser
,deluser
,delgroup
. There may be other commands that I didn't think of.@SynoCommunity/developers?
There is a $100 open bounty on this issue. Add to the bounty at Bountysource.
The text was updated successfully, but these errors were encountered: