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

Posted 1231 days ago - Debian

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...

Word Count: 555

Tags: , , ,

Click Here to Submit a Comment

Permalink / Last Modified:

Support Nullamatix.com:

See Also:

  • 04/11/2010 -- Howto: XCache in a Lighttpd Chroot on Debian
    Excerpt: "Whether you're pressed for resources on a virtual/dedicated server, or simply looking for ways to improve web application performance, XCache is guaranteed to produce the desired result. Within minutes of installing XCache: page load times were cut in half, ..."
  • 12/10/2009 -- 529 Attacks in 9 Days: id1.txt, RFI, & More
    Excerpt: "Long time Nullamatix readers know how much I love reviewing log files. Logs can provide detailed incite into not only the overall health of a system, but information one can use to mitigate the risks of automated attacks. In this post, I'll go over a couple ..."
  • 08/14/2009 -- Howto: Tail Lighttpd Logs with Style using Sed
    Excerpt: "Although extremely useful, http server access logs are a mess in their raw form. If you're interested in watching your http server logs in real time with formatting rules and pretty colors, this post is for you. Teh Scr1pt Create a new file to put the l33t ..."
  • 02/11/2008 -- Howto: Setup cron Jobs to Restart Lighttpd & MySQL
    Excerpt: "Over the past couple weeks MySQL crashed when spiked with large amounts of traffic. To remedy this, a cron job has been implemented to simply restart mysql and lighttpd every other day. Here's how it's done. First, if you haven't already, define a cron job ..."

Leave a Reply