hughsie / colord

Making color management just work
GNU General Public License v2.0
74 stars 50 forks source link

colormgr import-profile fails with "The profile was not added in time" #140

Open kokoko3k opened 2 years ago

kokoko3k commented 2 years ago

Hi, i'm unable to import any profile i make with my newly created user.

[plasmauser@Gozer ~]$ LC_ALL=C ls ~/.local/share/icc/x11-colors.icc 
ls: cannot access '/home/plasmauser/.local/share/icc/x11-colors.icc': No such file or directory
[plasmauser@Gozer ~]$ cp /usr/share/color/icc/colord/x11-colors.icc /tmp/
[plasmauser@Gozer ~]$ colormgr import-profile /tmp/x11-colors.icc
The profile was not added in time
[plasmauser@Gozer ~]$ ls ~/.local/share/icc/x11-colors.icc 
/home/plasmauser/.local/share/icc/x11-colors.icc
[plasmauser@Gozer ~]$ colormgr find-profile-by-filename x11-colors.icc
profile filename 'x11-colors.icc' does not exist

System is running Plasma and on my old user colord can import profile without problems.

[plasmauser@Gozer ~]$ pacman -Q colord plasma-desktop plasma-framework
colord 1.4.6-1
plasma-desktop 5.24.4-1
plasma-framework 5.92.0-2
[plasmauser@Gozer ~]$ uname -a
Linux Gozer 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux

I've seen various random reports of this issue from past years, but the issue has never been addressed. Any advice?

Thanks.

kokoko3k commented 2 years ago

Nevermind, it is probably because the configured colord systemd service has PrivateTmp=yes. installing profiles from other directories seems to work. -EDIT- Nope, it seems to fail randomly:

[plasmauser@Gozer ~]$ colormgr import-profile /home/plasmauser/x11-colors.icc 
Object Path:   /org/freedesktop/ColorManager/profiles/icc_3db30267eaefa6719553abe530f6a889_plasmauser_1013
Owner:         plasmauser
Title:         X11 Colors
Type:          named-color
Colorspace:    lab
Scope:         temp
Gamma Table:   No
System Wide:   No
Filename:      /home/plasmauser/.local/share/icc/x11-colors.icc
Profile ID:    icc-3db30267eaefa6719553abe530f6a889
Metadata:      CMF_version=1.4.6
Metadata:      CMF_binary=cd-create-profile
Metadata:      CMF_product=colord
Metadata:      License=CC0
Metadata:      FILE_checksum=3db30267eaefa6719553abe530f6a889
[plasmauser@Gozer ~]$ colormgr find-profile-by-filename x11-colors.icc
Object Path:   /org/freedesktop/ColorManager/profiles/icc_3db30267eaefa6719553abe530f6a889_plasmauser_1013
Owner:         plasmauser
Title:         X11 Colors
Type:          named-color
Colorspace:    lab
Scope:         temp
Gamma Table:   No
System Wide:   No
Filename:      /home/plasmauser/.local/share/icc/x11-colors.icc
Profile ID:    icc-3db30267eaefa6719553abe530f6a889
Metadata:      CMF_version=1.4.6
Metadata:      CMF_binary=cd-create-profile
Metadata:      CMF_product=colord
Metadata:      License=CC0
Metadata:      FILE_checksum=3db30267eaefa6719553abe530f6a889
[plasmauser@Gozer ~]$ colormgr delete-profile /org/freedesktop/ColorManager/profiles/icc_3db30267eaefa6719553abe530f6a889_plasmauser_1013
[plasmauser@Gozer ~]$ colormgr import-profile /home/plasmauser/x11-colors.icc 
The profile was not added in time
[plasmauser@Gozer ~]$ colormgr import-profile /home/plasmauser/temp_profile.icc 
The profile was not added in time
[plasmauser@Gozer ~]$ cp /home/plasmauser/temp_profile.icc /home/plasmauser/temp_profile2.icc
[plasmauser@Gozer ~]$ colormgr import-profile /home/plasmauser/temp_profile2.icc 
The profile /home/plasmauser/.local/share/icc/temp_profile2.icc already exists
[plasmauser@Gozer ~]$ colormgr import-profile /home/plasmauser/temp_profile.icc 
The profile was not added in time
[plasmauser@Gozer ~]$ colormgr find-profile-by-filename temp_profile2.icc
Object Path:   /org/freedesktop/ColorManager/profiles/icc_5c3c17562b726e337ebf2f47aac018cf_plasmauser_1013
Owner:         plasmauser
Format:        ColorSpace..
Title:         C
Qualifier:     RGB..
Type:          display-device
Colorspace:    rgb
Scope:         temp
Gamma Table:   Yes
System Wide:   No
Filename:      /home/plasmauser/.local/share/icc/temp_profile2.icc
Profile ID:    icc-5c3c17562b726e337ebf2f47aac018cf
Metadata:      FILE_checksum=5c3c17562b726e337ebf2f47aac018cf
[plasmauser@Gozer ~]$ colormgr delete-profile /org/freedesktop/ColorManager/profiles/icc_5c3c17562b726e337ebf2f47aac018cf_plasmauser_1013
[plasmauser@Gozer ~]$ colormgr import-profile /home/plasmauser/temp_profile.icc 
The profile was not added in time
Doomsdayrs commented 1 year ago

I have had this same issue

Doomsdayrs commented 1 year ago

For me, it is not just a newly created user.

Fedora 37, GNOME 43.

I created calibration files, attempting to import them immediately leads to a "The profile was not added in time"

Doomsdayrs commented 1 year ago
$ colormgr import-profile aoc-2250WG5.icm
[sudo] password for doomsdayrs: 
The profile was not added in time
CdMain: failed to profile from filename: failed to load file: Error opening file /home/doomsdayrs/.local/share/icc/aoc-2250WG5.icm: Permission denied
hughsie commented 1 year ago

/home/doomsdayrs/.local/share/icc/aoc-2250WG5.icm: Permission denied

Is the file being created by another user or has the directory got the wrong permissions?

Doomsdayrs commented 1 year ago

/home/doomsdayrs/.local/share/icc/aoc-2250WG5.icm: Permission denied

Is the file being created by another user or has the directory got the wrong permissions?

Nope, it is my file, and the directory is fine (I even tried my home directory)

Opening up gcm-viewer throws this error after importing.

(gcm-viewer:53807): GnomeColorManager-WARNING **: 12:12:54.218: failed to connect to profile: Failed to connect to missing profile /org/freedesktop/ColorManager/profiles/icc_3f4f1fcb130f0d32a7280f60c389a7ae_doomsdayrs_1000

This xml file is the raw data from the ICC file, I modified it to include a profile ID as the original copy did not include one.

This is what it says when turning back into an icc file

$ iccFromXml aoc-2250WG5.xml aoc-2250WG5.icc 
Profile parsed.  Profile is invalid, but saved correctly
Warning! - Unknown NULL: Unregistered CMM signature.
NonCompliant! - redColorantTag::XYZ - XYZNumber: Negative Z value!

So I thought for a bit that it was the icc file, but my next experiment eliminates this misconception.

Taking a ICC file from /usr/share/color/icc/colord/ such as blue, turning it into xml, editing the profile id, turning it back into an icc file, and importing it, leads to the same issue.

Nov 18 12:17:47 crystalie colord[1742]: CdMain: failed to profile from filename: failed to load file: Error opening file /home/doomsdayrs/.local/share/icc/test.icc: Permission denied
(gcm-viewer:58923): GnomeColorManager-WARNING **: 12:20:37.311: failed to connect to profile: Failed to connect to missing profile /org/freedesktop/ColorManager/profiles/icc_599cc656fd0a9e90023aed9e442ee671_doomsdayrs_1000
hughsie commented 1 year ago

Is colord-kde installed?

Doomsdayrs commented 1 year ago

Is colord-kde installed?

This is a gnome environment?

hughsie commented 1 year ago

Ohh kokoko3k (the reporter) was running KDE. /home/doomsdayrs/.local/share/icc/aoc-2250WG5.icm sounds like it doesn't have the correct permissions set.

Diablo-D3 commented 1 year ago

This issue still exists.

In my case, it does not seem to be a permissions issue, the ICC file I'm trying to add is 644. Are there other permission issues I need to be aware of?

Edit: 1) The file is in ~/.local/share/icc/, all four directories in that path are 755. 2) If I symlink it to /usr/share/color/icc/colord, it still doesn't appear. 3) If the file is copied to /usr/share/color/icc/colord, it appears in the list(!). 5) If I chown root.root the file in ~/.local/share/icc/, it still doesn't appear. 6) If I chown root.root it, then colormgr import-profile it still says The profile was not added in time

jansol commented 1 year ago

I doubt it's a problem with the permissions of the .icc file itself, colormgr import-profile /tmp/myprofile.icc fails the same way even though /tmp is 0777 and the .icc file is 0666.

sedimentation-fault commented 10 months ago

This problem seems to have multiple, deeper reasons (in addition to the ones already mentioned), which the error message

"The profile was not added in time"

effectively covers from sight:

In the following I will describe my attempts at resolving it. At the end, I succeeded. :satisfied:

:arrow_right:NOTE: Since I don't use GNOME or KDE (I use fvwm 2.6.5), I have to resort to xiccd to start and communicate with colord. YMMV.

The profile I was trying to add was taken from a Windows installation on the same machine. In order to keep things tidy, I gather the color profiles from sources other than the installed programs in /usr/local/share/color/icc/.

So we start by trying to add such a profile as user XXX:

Following the Gentoo Wiki instructions I did:

colormgr import-profile /usr/local/share/color/icc/YYYYYY.icm | grep "Profile ID"

This produced...nothing. :disappointed:

Indeed

colormgr import-profile /usr/local/share/color/icc/YYYYYY.icm

said:

The profile was not added in time

Huh? :open_mouth:

:bulb: Reason 1

strace shows that the process is stuck at

setxattr("/home/XXX/.local/share/icc/YYYYYY.icm", "user.DOSATTRIB", "\0\0\4\0\4\0\0\0Q\0\0\0 \0\0\0Q\"\256\235:\f\332#-\374\255\235:\f\332\1", 32, 0) = 0

and times out with

poll([{fd=3, events=POLLIN}], 1, 4998) = 0 (Timeout)

Searching for

linux setxattr user.DOSATTRIB

brought up Some files on Samba shares are displayed as folders. Reading there, it inspired me to query the "extended attributes" of the ICC profile I was trying to add:

getfattr /usr/local/share/color/icc/YYYYYY.icm
getfattr: Removing leading '/' from absolute path names
# file: usr/local/share/color/icc/YYYYYY.icm
user.DOSATTRIB

So, obviously, colormgr is trying to set this extended attribute, user.DOSATTRIB, and times out. This attribute is obviously there because I copied the file to a SAMBA folder and moved it from there to /usr/local/share/color/icc/.

:arrow_right: Solution

To resolve this, I removed the extended attribute using the command

setfattr -x user.DOSATTRIB /usr/local/share/color/icc/*.icm

Now the command

strace colormgr import-profile /usr/local/share/color/icc/YYYYYY.icm

gets stuck at

utimensat(AT_FDCWD, "/home/XXX/.local/share/icc/YYYYYY.icm", [{tv_sec=1698787857, tv_nsec=667847000} /* 2023-10-31T22:30:57.667847000+0100 */, {tv_sec=1453082666, tv_nsec=177633000} /* 2016-01-18T03:04:26.177633000+0100 */], 0) = 0

and timeouts again:

poll([{fd=3, events=POLLIN}], 1, 4998) = 0 (Timeout)

:disappointed::disappointed:::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed:

:bulb: Reason 2

There was no display/monitor listed in the output of

colormgr get-devices

:arrow_right: Solution

Start

xiccd &

This starts the "X color management daemon" xiccd, whiich starts colord automatically.

:arrowright:NOTE: In case you are stuck without colord running and have no GNOME or KDE and are asking yourself "How on earth shall I start colord?"_, this is the way to go - xiccd!

Now, the display is there:

colormgr get-devices

Object Path:   /org/freedesktop/ColorManager/devices/xrandr_DP_2_XXX_500
Owner:         XXX
...
Type:          display
Enabled:       Yes
Embedded:      Yes
Scope:         temp
Colorspace:    rgb
Device ID:     xrandr-DP-2
...
Metadata:      XRANDR_name=DP-2
Metadata:      OwnerCmdline=xiccd

...but now the printers are missing! :rage:

:arrow_right: Solution

Restart cupsd (in Gentoo, you use rc-service if you don't use systemd - YMMV):

rc-service cupsd restart

Now

colormgr import-profile /usr/local/share/color/icc/YYYYYY.icm

says:

The profile /home/XXX/.local/share/icc/YYYYYY.icm already exists

so, again, the suggested

colormgr import-profile /usr/local/share/color/icc/YYYYYY.icm | grep "Profile ID"

will not print anything. You have to delete the profile and re-create it. For this, you need to know its ID, so you have to list the profiles:

colormgr get-profiles

This brings up a long list of all installed profiles, i.e. not only just the one you added in /home/XXX/.local/share/icc/ above, but also all profiles under /usr/share/color/icc/colord/. The one you want to delete is this:

Object Path:   /org/freedesktop/ColorManager/profiles/icc_41bfb3d0032a4dbd1b9c41fd27cf0560_XXX_500
Owner:         XXX
Format:        ColorSpace..
Title:         ZZZZZZ
Qualifier:     RGB..
Type:          display-device
Colorspace:    rgb
Scope:         temp
Gamma Table:   No
System Wide:   No
Filename:      /home/XXX/.local/share/icc/YYYYYY.icm
Profile ID:    icc-41bfb3d0032a4dbd1b9c41fd27cf0560
Metadata:      FILE_checksum=41bfb3d0032a4dbd1b9c41fd27cf0560

You must use its Profile ID:

colormgr delete-profile icc-41bfb3d0032a4dbd1b9c41fd27cf0560

This produces no errors, BUT THE FILE IS NOT DELETED! Next time you restart xiccd,

colormgr get-profiles

will show the deleted profile! :rage: Plus: xiccd does NOT search /usr/local/share/color/icc - it searches /usr/share/color/icc ONLY. :disappointed::disappointed::disappointed:

:arrow_right: Solution

You MUST also physically delete the local .icm file

rm /home/XXX/.local/share/icc/YYYYYY.icm

and re-import it:

colormgr import-profile /usr/local/share/color/icc/YYYYYY.icm | grep "Profile ID"

Again, no output. :disappointed: You have to restart xiccd... :disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed::disappointed:

OK, screw it! :rage:

We have imported the ICC profile and we know its Profile ID:

icc-41bfb3d0032a4dbd1b9c41fd27cf0560

by inspecting the output of colormgr get-profiles and searching for the brand of your machine (e.g. 'ASUS'):

colormgr get-profiles | less

Continue with the Device IDs, as the Wiki says:

colormgr get-devices | grep "Device ID"

Device ID:     cups-CUPS-PDF
Device ID:     cups-ABCABCABC
Device ID:     xrandr-DP-2

So our display is xrandr-DP-2. Associate the profile with it:

colormgr device-add-profile xrandr-DP-2 icc-41bfb3d0032a4dbd1b9c41fd27cf0560

and make that profile the default one for that device (i.e. for the display in question (as you might have more than one)):

colormgr device-make-profile-default xrandr-DP-2 icc-41bfb3d0032a4dbd1b9c41fd27cf0560

Verify the association has been made correctly:

colormgr device-get-default-profile xrandr-DP-2

Object Path:   /org/freedesktop/ColorManager/profiles/icc_41bfb3d0032a4dbd1b9c41fd27cf0560_XXX_500
Owner:         XXX
Format:        ColorSpace..
Title:         ZZZZZZ
Qualifier:     RGB..
Type:          display-device
Colorspace:    rgb
Scope:         temp
Gamma Table:   No
System Wide:   No
Filename:      /home/XXX/.local/share/icc/YYYYYY.icm
Profile ID:    icc-41bfb3d0032a4dbd1b9c41fd27cf0560
Metadata:      FILE_checksum=41bfb3d0032a4dbd1b9c41fd27cf0560

Success! Finally! Correct colors! :satisfied::fireworks::fireworks::fireworks::champagne::cocktail: