5

I had been using Ubuntu for a period of time, and had faced this problem:

I am using ubuntu 14.10 right now and have Steam installed in my /home/user/.steam folder. When i was copying the .steam folder in my home directory and the progress bar was near the end it says a message indicating "Can't copy a special file steam.pipe", more or less sounds like that.

I had faced this problem since using Ubuntu 14.04, but i know this is not distro / release issue but rather a file copying problem. Fortunately I can manage this problem by using command in my .steam folder:

sudo cp -f ./steam.pipe /[destination]

Eventually, just by this day, i can't copy this file using the command above. The terminal just stuck at:

Idad@IdadComp:/home/Idad/.steam$sudo cp -f ./steam.pipe /[destination]

and did not back to

Idad@IdadComp:/home/Idad/.steam$

indicating that the copy process not done.

My question is, how could i copy this steam.pipe file?

I had tried:

  1. Running nautilus in super user mode, but still failed.
  2. Try to compress and decompress this file at destination folder, but error at decompressing steam.pipe file.
  3. And also read this link How to copy or (quickly-and-easily) backup a "special file"?, but gained no result.

Thanks in advance for your help. :)

Idad
  • 51
  • 1
  • 1
  • 5

2 Answers2

7

As muru says, you shouldn't have to back up steam.pipe. Steam should be able to re-create it if it is missing. However, when backing up your ~/.steam folder, you should check if you also have a ~/.local/share/Steam folder. If so, you'll probably want to back it up too. It usually contains most of the files associated with a Steam installation, including your installed Steam games.

I have written the rest of this answer in case:

  • You want to know why you had trouble copying it with Nautilus and cp.
  • You want to know how to copy files like steam.pipe, in case you do ever need to do so.

The executive summary is that you should use rsync for your backups. See below for details, explanation, and alterantives.


Why steam.pipe Is Special

steam.pipe is a FIFO, a.k.a. a named pipe:

ek@Io:~/.steam$ ls -l steam.pipe
prw------- 1 ek ek 0 Mar  7 20:12 steam.pipe
ek@Io:~/.steam$ file steam.pipe
steam.pipe: fifo (named pipe)

FIFOs are not a regular files, but instead are special filesystem entries that one may interact with as though they are files. Writing to the FIFO stores data in memory, where it remains until the FIFO is read from. Reading from a FIFO obtains data in the order they were written (so it is First In, First Out).

Why You Had Trouble Copying It

There are actually two distinct behaviors that one might want, when attempting to copy a FIFO. Which one you want depends on the situation.

  • You might want to duplicate the FIFO, i.e., make another FIFO. (In this context, that's what you want.)
  • You might want to read data from the FIFO, i.e., copy its contents. (This might not seem like "copying," but remember, this is analogous to what happens when you copy a file--the file is opened, its data are read, and the same data are written to a new file.)

You tried two programs:

  • Nautilus automatically detects special entries such as FIFOs, refuses to copy from them, and warns you that it has done so.
  • cp reads data from the FIFO, rather than making a copy of the FIFO itself. If there are no data in the FIFO, cp stalls until some process writes to it.

Making Copies of Special Files (like FIFOs)

To duplicate a FIFO, you can use rsync with the --specials flag:

ek@Io:~$ cd steam-backup
ek@Io:~/steam-backup$ rsync --specials ~/.steam/steam.pipe .
ek@Io:~/steam-backup$ ls -l steam.pipe
prw------- 1 ek ek 0 Apr 22 11:43 steam.pipe

That's if you want to copy it separately. To copy a whole folder for archival purposes--that is, where you want most things to be the way they were before, so it works properly when restored--you can use rsync -a:

rsync -a .steam/ steam-backup

For more information about rsync, see "rsync" in the Ubuntu help wiki, the upstream rsync website, and man rsync (which explains specifically what the -a flag does).

cp is well suited for simple use cases, but I suggest rsync for making backups.

Specials Can Be Archived, Too

Another way to back up a folder is to make an archive of it with tar, and that will also automatically preserve FIFOs (i.e., they will be recreated on extraction):

ek@Io:~$ tar cvJf steam-backup.tar .steam
.steam/
.steam/registry.vdf
.steam/sdk32
.steam/bin64
.steam/root
.steam/steam_install_agreement.txt
.steam/steam
.steam/steam.pipe
.steam/steam.pid
.steam/bin
.steam/sdk64
.steam/bin32

Re-making the FIFO Manually

If you were missing a FIFO (either in a backup, or in general) and need to restore it, you can just create a new one with mkfifo.

You'll want to create it with the correct permissions. Running ls -l on steam.pipe shows a permissions mask of prw-------. p just means it's a named pipe (FIFO). The rest means it's readable and writable by its owner and has no other permissions (see FilePermissions for details). The octal permissions mask is thus 600 (or 0600), so you'll want to pass -m 600 to mkfifo:

ek@Io:~/steam-backup$ mkfifo -m 600 steam.pipe
ek@Io:~/steam-backup$ ls -l steam.pipe
prw------- 1 ek ek 0 Apr 22 12:09 steam.pipe

Duplicating a FIFO Doesn't Duplicate Its "Contents"

This is not a problem for backups, but you should know that duplicating a FIFO (for example, with rsync) just makes a new FIFO like it. If there are data in the FIFO ready to be read, the data will not be available in the new FIFO.

The reason this is not a problem for backups is that FIFOs are not for long-term storage. They're not really even for storage at all. Data in a FIFO are not written to disk, and when a process writes to a FIFO, the write is not even reported to the process as successful until the data have been read. (Similarly, if a process reads from a FIFO with no data in it, the read will stall until data are written.)

You can see this in action, and also get a better sense of how FIFOs work, by making one of your own and experimenting with it. You can create a new FIFO foo with default permissions with mkfifo foo, and redirect text to it with a command like echo 'Hello, world!' > foo. This will stall, as nothing has read the text yet. Then, in another terminal (e.g., another Terminal tab) read the text with cat foo and see what happens in each terminal.

Eliah Kagan
  • 117,780
  • 1
    I should start working on a "Collected Edition of Answers by Eliah Kagan". – muru Apr 22 '15 at 16:52
  • Awesome explanation, it is just answering my question exactly. And now I understand why my cp process is like "hanging" and not prompt anything when I try to copy the .pipe file. And I just installed 15.04 Ubuntu version, re-backed up the .steam file to my /home folder. And it's miraculously running without a hash. : D And sure, I'll try using rsync as you mentioned above. Thanks a lot! – Idad Apr 25 '15 at 04:10
  • what about cp command? It is said it can copy content of fifos. How come? – Soner from The Ottoman Empire May 01 '19 at 22:38
  • by the way rsync has an option for fifos. – Soner from The Ottoman Empire May 01 '19 at 22:41
2

You shouldn't copy it. The steam.pid and steam.pipe files are created by Steam as required. These two files should be excluded from backups.

muru
  • 197,895
  • 55
  • 485
  • 740
  • Ah, I see. But I'm still courious at this time, So is there a way to copy this kind of file? Or it is really can not be copied at all? Because when we exclude steam.pipe file in backup, as we know steam.sh can not be runned, and we must reinstall steam to get his .pipe file back. And that's ~200MBs redownload ; ). Thanks in advance. – Idad Apr 22 '15 at 14:08
  • @Idad what are you talking about? I just deleted steam.pipe and Steam had no problems recreating it on startup. – muru Apr 22 '15 at 14:08
  • Strange, I used to get error when launching steam without steam.pipe. I will try it and report you back. Thanks in advance : ) – Idad Apr 22 '15 at 14:10
  • Ah yes, it can as you say! How could it be. Okay I think your comment will close and complete my qouestion. Thanks for answering :D – Idad Apr 22 '15 at 14:12
  • 1
    @Idad Do you remember if the error you got in the past specifically mentioned that steam.pipe was missing? – Eliah Kagan Apr 22 '15 at 14:13
  • @EliahKagan Well im 70% sure it said steam.pipe, it was long time ago maybe about six months past when I using 14.04. Since then whenever i upgreade or new-install a distro I used to reinstall steam from mainline ubuntu apt. Just for this recent 2 months I can copy the steam.pipe and use direct copy backup for the steam folder and it's content.

    I plan to do a distro upgrade tomorrow, now my steam folder and it's game were backed up using direct copy to an external HDD.

    I'll report you guys if there is any error regarding this steam.pipe file. Thanks four your kind responses :D.

    – Idad Apr 22 '15 at 14:25