Anyone got Nightshade to work in Linux?

Hi all,

" What about Mac GPU, Mac Intel, non-NVidia GPU support? What about Linux machines? Other versions?
Yes we would love to do all this to support different platforms. Unfortunately now there are quite a few Glaze and Nightshaded related projects running in parallel in our lab, and our time is spread very thin. We did plan on an open source version of some sort. That will probably come, but it is lower priority compared to expanding GPU support for more artists."

I was a little disappointed when I went to check out Nightshade and it was not supporting Linux users. I believe more people deserve the right to defend their IP no matter their OS. Does anyone know if this can be emulated through wine?

I’m on Nobara 39 KDE btw.

Cheers.

I don’t know it too, but why don’t you try it? If you get it working, spread the word and tell us about your way to success, if not, wipe it from your disk.

Michelist

1 Like

I’m not sure. Wine doesn’t really emulate Anything (it’s right in the name) and since nightshade seems to interface directly with the graphics card I have my doubts. But it also makes me wonder why Linux support is so hard since the device API should be the same. Guess the only way to find out is to try.

1 Like

I consulted a senior programmer and Linux user on this and it turns out my best bet is to dust off my old copy of windows and create a virtual machine.

Never done that before, I’m curious to see whether I can at least get it working like that. I know there a few people here who are waiting on some of this kind of info before they go ahead and feel safe to upload and promote themselves. (So to those people; don’t give up, I’m pretty determined to document this and provide some info here).

-s

You probably run into a similar issue with a VM, because hosts normally don’t expose their hardware directly to the guest system. That means you only have a virtual graphics adapter in the VM instead of your actual graphics card, and nightshade needs direct access to your graphics card. I know that some virtualization environment can pass hardware through nowadays but I don’t know which ones and how well it works.

2 Likes

I would suggest you to ask/request the developers of nightshade to provide linux support. Let them know that artists too use linux. And if they want to help artists fight AI, something which they advertise openly, they can’t be selective about which artists to help. They are still thinking like the corporate they are supposedly fighting, thinking about the market size of the users (customers). At that point of time it is not doing social good but tapping into the demand of the market like corporates do.

3 Likes

Hi, I haven’t tested it myself, but doesn’t Nightshade also run on the CPU? That would probably run with Wine just fine. Have you tried it?

EDIT: I tried Wine 6.0 and 9.0 and both run into some problems starting the app. I’m not too experienced with this, but it doesn’t ā€œjust workā€.

1 Like

@raghukamath

Yep, I sent them a message some time ago. No reply in all this time.
Next step with them would probably be to organise a list of signatures from this and other community art sites to plead with them. Since they also refuse to open source; which ironically gives more power to AI companies who will have time to come up with preventative measures while the rest of us are wondering how to get started.

But yeah I 100% agree, I want to see someone democratise protection instead of withholding it from a sizeable demographic.

Everyone should feel safe. I’m sitting here witholding a huge collection of art instead of sharing it here on the community. Many are the same.

I hoped it would not come to us having to duel boot windows.

@YRH

Thank you very much for your time.

I’m getting the feeling that duel booting is the only way we can access NightShade from Linux… Otherwise there’s glaze which is kind of strict about the structure of what you upload and a bit of a concern for privacy despite what they promise.

There IS a github dedicated to collecting available code for image IP protection right here: GitHub - conditionWang/Data_Centric_AI_IP_Protection: This is the repository that introduces research topics related to protecting intellectual property (IP) of AI from a data-centric perspective. Such topics include data-centric model IP protection, data authorization protection, data copyright protection, and any other data-level technologies that protect the IP of AI.

However the last time I tried to share it, my comment wound up in the big AI meta thread that most people are avoiding… So I won’t go at great length.

In short, I’m giving it my ongoing investigation. I have already had my programming friend look over it and agree that this is something that Artists will take security in if we set it up. The Question is of how feasible it is; he’s begging me just to duel boot!

The problem is a lot of people still have their heads buried in the sand. A lot of very clever people who if they lifted it out; would save artists from career jeopardy all over the world. We cannot keep folding these discussions down to a difficult to look at, zero point of discussion.

We gotta face this harsh reality with careful thought and consideration and ensure all our smartest people can see what is available.

-S

Do you mean the ā€˜WebGlaze’ service they offer on the developer’s website?

I’ve only been reading about this recently, but I think it’s important to clarify for anyone who isn’t familiar with the project; Both Glaze and Nightshade are developed by the same team and (as far as I’ve understood it) are designed to be used in tandem. Both are available as downloadable apps (but not for Linux :confused:).

I also learnt there’s an art site called Cara which can apply Glaze and Nightshade (not sure if the latter is available yet) to your uploads. I haven’t signed up for it myself but it looks interesting. The format reminds me of Artstation:

https://cara.app/explore

On a related note - Glaze was recently updated to version 2.0. There was an article about it on Muddy Colors:

https://www.muddycolors.com/2024/04/glaze-2-0/

5 Likes

Hi, I’m glad Cera exists, but wondering how long it will be till we have to seriously start reconsidering our fear of approaching development of our own solutions. Every portfolio site has its roots in the priority of providing a safe place to upload work.

I believe we should acknowledge those options, maybe use those services until they change their tones, but how long until we just go for the ultimate solution where privacy is air tight?

Personally that’s why I was hoping for Nightshade or some alternative. But I’m talking to a programmer friend of mine about taking some code from an IP protection GitHub and building an add-on for Krita.

It’s just talk ATM. Better than no talk. I’d rather take action instead of letting strangers alone with the sacred duty of protecting my work.

4 Likes

Glaze do work on linux for me through Wine, though you need to install cuda libraries to your Wine prefix here https://github.com/SveSop/nvidia-libs.
Though same restrictions as Windows version, NVIDIA GPUs only.

I recommend you run Wine through Bottles, and download the release version of the nvidia libs in the github link I’ve sent.
Wine version I use is Caffe 9.7
Run the bottles install script as guided in the github readme.

I think this applies too with nightshade, as I think the foundation of both apps are the same.

5 Likes

SWEET. I mean to find time to test this as well, so I’ll report back here about it when I do.

Thanks for letting us know :slight_smile:

1 Like

Confirmed, applies too with nightshade, but dang nightshade is a ram munching beast

1 Like

I just came across this thread because I was wondering the same thing!

Happy to report that it worked perfectly for me in Wine, pretty much out of the box. (Glad to have no need for a VM.) This was true for both Glaze and Nightshade.

Performance was fine, even just using my CPU. (You need an Nvidia card to take advantage of your GPU, at least for now.) It took me somewhere between 10 and 20 minutes to glaze an image, depending on the intensity/quality settings.

Here’s a quick guide for others who come across this thread for what worked for me:

Glaze/Nightshade on Linux

Context: I’m running PopOS 22.04, AMD GPU (Radeon RX 7600). Your mileage may vary!

Steps:

  1. Download Wine ā€œBottlesā€. You can use another Wine wrapper, but Bottles worked great for me. I installed via their official flatpak.
  2. Create a new bottle with default settings. (I used ā€œApplicationā€ for the profile and soda-9.0-1 for the runner – both the defaults.)
  3. Download Glaze and/or Nightshade. (For the rest of the steps I’ll refer to ā€œGlazeā€ only, but the process is identical for both.)
  4. Unzip the contents of the downloaded zip file somewhere inside your bottle. Sub-steps below.
    a. From inside the Bottle ā€œDetailsā€, click the ā€œthree dotsā€ button. Click ā€œBrowse filesā€ to open the file structure of your bottle. (This is essentially a mini Windows file structure.)
    b. Unzip Glaze somewhere within this structure. (Without doing this, I got errors about missing python libraries when I tried to run it.) I stuck it on my fake-Windows desktop. Relative to the bottle file system, that’s: drive_c/users/steamuser/Desktop/
  5. In your Bottle, click ā€œRun Executableā€ and navigate to the directory you just unzipped, and select the Glaze.exe file. This will be a long annoying path which you can more easily grab from your file manager with Ctrl+L (at least using Nautilus). (Mine was, e.g.: ~/.var/app/com.usebottles.bottles/data/bottles/bottles/GlazeNightshade/drive_c/users/steamuser/Desktop/Glaze/Glaze.exe)
  6. Run it!

Some other notes:

  • You can create a shortcut in Bottles to make it quicker/easier to run, or create a .desktop file to integrate it more directly with your (Linux) desktop, etc.
  • It’s easiest to move the images you want to Glaze inside the bottle file structure as well, so they’re easy to grab from within the Glaze UI.
  • Speaking of the Glaze UI – it’s not great. One little annoyance for me was the ā€œoutputā€ field – this is asking for a directory, which is not clear from the UI.

My take on the end results (Glaze in general, not Linux-related)

To be honest, I wasn’t too happy with the output. Glaze and Nightshade essentially work by adding ā€œnoiseā€ to your images. At least in my tests so far, this results in images that simply appear… lower quality. To put it bluntly: ugly :face_with_diagonal_mouth:

I’m not sure this is worth the trade-off for me currently, especially given the back-and-forth of successful attacks against these techniques, and the time and energy required to Glaze/Nightshade an image. (And to re-Glaze/re-Nightshade as new versions come out.)

The extent of the ā€œdamageā€ depends on your specific images and style, however, as well as your particular Glaze/Nightshade settings. It’s definitely worth trying out for yourself! As long as you’re aware of the trade-offs and shortcomings of these tools, that is. (Of which there are many.)

1 Like

It’s also worth noting that there is currently no real evidence that these techniques actually prevent AI learning or poison the data model.

Yup, quite so. In fact, there’s a decent amount of evidence to the contrary. This paper (ā€œAdversarial Perturbations Cannot Reliably Protect Artists From Generative AIā€) is very interesting to read in that respect.

The newest version of Glaze (2.1 as of now) apparently takes this paper’s findings into account to increase protection, but there are also examples (on Reddit, e.g.) of people able to ā€œbreakā€ that too, with a bit more effort. (This is the back-and-forth I meant in my post above.)

On a meta note, I’m also not super happy with the fact that the tools are closed-source. You download these black-box tools, which in turn then download several gigabytes of ā€œsupport filesā€, and then you use these to do ā€œsomethingā€ – a very time- and energy-intensive process – to your files. Next step: spread these files across the internet! What could go wrong?! :smiling_face_with_tear:

Not that I actually think there’s anything nefarious going on with Glaze/Nightshade currently. But I’d never know if there was. It could be spreading malware, mining bitcoin, whatever. If I were a ā€œbad actorā€, I’d sure see these tools as a ripe plum.

So yeah, if the Glaze devs ever read this: open-source your tools! And digitally sign your releases. Increase security and transparency, please :grinning_face:

3 Likes

you said it

It’s more to protect yourself against mass scraping, and if they have to put effort to break every piece of art you post at some point most will give up.

Still a win if you ask me.

Edit: I am on fedora and Nightshade crashes during the process and glaze straight up kills the cpu and reboots >.<

1 Like

When you fight fire with fire, all you have left will be scorched earth.

Been thinking abt trying this since last year, was very happy to bookmark the thread a few weeks back and finally followed suite c:

I used a Dell XPS 15 9560 because of its Nvidia GPU. I created a fresh install of Pop! OS 22.04 because they ship an installer pre-configured with Nvidia drivers and have a strong track-record re: hybrid-graphics.

I ran into a few additional issues. Some were situational, and it was a few days ago now, but I’ll try to reconstruct a complete list from my browsing and shell history.

Issue #1: The Nvidia variant did not include drivers for my GPU:

NVRM: installed in this system is not supported by open NVRM: nvidia.ko because it does not include the required GPU NVRM: System Processor

18:50:31 (ERROR) Unable to load libGLX_nvidia.so.0

This would have been OK, but some daemon was calling modprobe in such a tight spinlock that CPU usage was pinned to 100%. The IO of writing modprobe failures to the system log exacerbated the CPU contention. Fans whirred, the desktop stuttered and froze, programs went unresponsive, downloads needed resumed regularly, commands like ls hung for dozens of seconds. This started in the Live ISO, and persisted through the install process, downloading Glaze & co., etc., until I figured out that it wasn’t just excpt. poor drive / dongle performance.

sudo apt install nvidia-driver-495

# Updates org.freedesktop.Platform.GL.nvidia (libGLX_nvidia.so.0)
flatpak update

Issue #2: io.elementry.appstore sucked

Slow/unresponsive, especially before fixing Issue #1 but also after. I eventually learned to use the flatpak command-line instead:

flatpak install --user bottles com.usebottles.bottles

Issue #3: Python in the Bottle

Had to install it via the Windows installer.

Issue #4: Vulkan?*

* Could have been a symptom of Issue #1.

Required Vulkan Extension VK_KHR_surface Not Supported

sudo dpkg --add-architecture i386 # Just in case ig
sudo apt install libvulkan1 libvulkan1:i386

Issue #5: Expose working directories

Necessary for NS/G to find various DLLs (and probably the images you’re working on).

flatpak override --user --filesystem="~/Downloads/Glaze" com.usebottles.bottles
flatpak override --user --filesystem="~/Downloads/Nightshade" com.usebottles.bottles

Issue #6: Not enough RAM (for Glaze esp.)

Just made a huge swapfile on internal storage.

Issue #7(+): ntlm_auth, python-accelerate, & remaining Nvidia issues

0024:err:winediag:ntlm_check_version ntlm_auth was not found. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
0024:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems

Haven’t fixed, must be present in wine prefix ig…


python-accelerate would have improved CPU speed / lowered memory use, but python -m ensurepip didn’t work so I gave up.


And we got this going on:

002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -r" (2).
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  156 (NV-GLX)
  Minor opcode of failed request:  43 ()
  Serial number of failed request:  235
  Current serial number in output stream:  236

I’m not sure which of the remaining issues is responsible, but we’re still running on CPU. Ah well.

It was helpful to know how to run NS/G from the command-line, for stdout/stderr:

flatpak run --command=bottles-cli com.usebottles.bottles run -b $BOTTLE -p Glaze

It’d be really cool if I could see for myself how well these hold up to cropping, re-scaling, compression, and blurring (which I’ll look into c:). If it demonstrates some effectiveness and resilience, I’ll be quite happy to accept these artifacts – every effort counts. Thanks to everyone else in this thread, a first-hand ā€œworks for me!ā€ was all I needed to here to push through these issues c:

It helped that I’ve eg. packaged software for distros before, or I might have given up @ any of these issues. Hope my notes and specific distro can be useful.

2 Likes

Oh man, I can’t believe what a different experience we had, haha. Bummer you had to jump through so many hurdles but I’m glad you got it working :sweat_smile:

I wonder if it’s mainly the GPU difference that made my experience so painless? I’ve had my share of nvidia-related issues in Linux over the years – this is my first AMD card and so far it’s been so hassle-free.

In any case… thanks for documenting all this!

1 Like