Home     Chat     Forums     IPTV Archive

Solution: chown: invalid user: www-data:www-data

Posted January 10, 2010 – 21:20 in: Nullamatix, syndicated

light_logo_170px Ran into this issue after getting rid of the www-data user and group. The solution is simple and doesn’t involve adding the account/group, assuming the objective is to run Lighttpd as a different user (not www-data). If the intention is to run Lighttpd with the www-data account, simply add the account. Otherwise, keep reading…

The Issue

[599][nullamatix ~]:# aptitude install package-x
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be installed:
  package-x
The following partially installed packages will be configured:
  lighttpd lighttpd-mod-magnet
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 220kB of archives. After unpacking 1028kB will be used.
Writing extended state information... Done
Get:1 http://ftp.us.debian.org lenny/main package-x [220kB]
Fetched 220kB in 0s (446kB/s)
Preconfiguring packages ...
Selecting previously deselected package package-x.
(Reading database ... 23009 files and directories currently installed.)
Unpacking package-x (from .../package-x_i386.deb) ...
Processing triggers for man-db ...
Setting up lighttpd (1.4.25-1) ...
chown: invalid user: `www-data:www-data'
dpkg: error processing lighttpd (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of lighttpd-mod-magnet:
 lighttpd-mod-magnet depends on lighttpd (= 1.4.25-1); however:
  Package lighttpd is not configured yet.
dpkg: error processing lighttpd-mod-magnet (--configure):
 dependency problems - leaving unconfigured
Setting up package-x (lenny3) ...
Adding group `package-x' (GID 119) ...
Done.
Adding system user `package-x' (UID 117) ...
Adding new user `package-x' (UID 117) with group `package-x' ...
Not creating home directory `/var/run/package-x.
Starting package-x: package-x.
Errors were encountered while processing:
 lighttpd
 lighttpd-mod-magnet
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up lighttpd (1.4.25-1) ...
chown: invalid user: `www-data:www-data'
dpkg: error processing lighttpd (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of lighttpd-mod-magnet:
 lighttpd-mod-magnet depends on lighttpd (= 1.4.25-1); however:
  Package lighttpd is not configured yet.
dpkg: error processing lighttpd-mod-magnet (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 lighttpd
 lighttpd-mod-magnet
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
Reading task descriptions... Done         

[600][nullamatix ~]:#

The Solution

Open the Lighttpd postint file and replace www-data with the correct username:group.

[600][nullamatix ~]:# /var/lib/dpkg/info/lighttpd.postinst

There were 2 lines for this particular instance:

# old original
# chown www-data:www-data /var/log/lighttpd /var/run/lighttpd
# chown www-data:www-data /var/cache/lighttpd /var/cache/lighttpd/compress /var/cache/lighttpd/uploads

# new replacement
chown custom-user:custom-group /var/log/lighttpd /var/run/lighttpd
chown custom-user:custom-group /var/cache/lighttpd /var/cache/lighttpd/compress /var/cache/lighttpd/uploads

Save the changes and exit. Now, assuming custom-user and custom-group exist, tell dpkg to reconfigure the packages. The -a flag tells dpkg to reconfigure, “all unpacked but unconfigured packages.”

[601][nullamatix ~]:# dpkg --configure -a
Setting up lighttpd (1.4.25-1) ...
Starting web server: lighttpd.
Setting up lighttpd-mod-magnet (1.4.25-1) ...
[602][nullamatix ~]:#

That’s it, problem solved…

See Also:

  Tags:
Trackbacks are closed, but you can post a comment

Post a Comment

You must be logged in to post a comment.