Error: pin: block was not found locally (offline): ipld: could not find bafybeibjhz

I’m running ipfs daemon and when I tried to pin numerous CIDs using a bash script I get this…

Error: pin: block was not found locally (offline): ipld: could not find bafybeiciowtzyi2zznftcz44ew23ii5vodmpt5hwllta24rxelqrn4tpq4
Error: pin: block was not found locally (offline): ipld: could not find bafybeibp3lm2ywfwj4rcrekp6vzqdo22jmlh7gqflktnwvjsr5hytxq4vm
Error: pin: block was not found locally (offline): ipld: could not find bafybeib2z7ckzq7qo5pw5krdfqo2imzo5o76dylr2mex3qqj3mcvvl6rn4
Error: pin: block was not found locally (offline): ipld: could not find bafybeiadwgpcqgxzmqijndf4ll7tatxsedzuwnqauh5epj46mecskfivtq
Error: pin: block was not found locally (offline): ipld: could not find bafybeig6qkww7gaksmddvmn3n4nrbsnb2gqwjrhluacvc73yytiblf3wdy

My command is ipfs pin add bafybeig6qkww7gaksmddvmn3n4nrbsnb2gqwjrhluacvc73yytiblf3wdy

I googled but no answer apparently. Seems like I’m the first experiencing this :frowning:

Try running ipfs daemon in an other window. :slight_smile:

It says…

ubuntu@ip-172-31-35-57:~$ ipfs daemon
Initializing daemon...
Kubo version: 0.22.0
Repo version: 14
System version: amd64/linux
Golang version: go1.19.12
2023/08/15 01:17:26 failed to sufficiently increase receive buffer size (was: 20                                                                             8 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/w                                                                             iki/UDP-Buffer-Sizes for details.
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/172.31.35.57/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/172.31.35.57/tcp/4001
Swarm announcing /ip6/::1/tcp/4001

Error: serveHTTPApi: manet.Listen(/ip4/127.0.0.1/tcp/5001) failed: listen tcp4 1                                                                             27.0.0.1:5001: bind: address already in use

I realized that people said my daemon is not running. But it is running. Why am I getting the original error?

My daemon now looks like this…

ubuntu@ip:~$ sudo systemctl status ipfs
● ipfs.service - InterPlanetary File System (IPFS) daemon
     Loaded: loaded (/lib/systemd/system/ipfs.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-08-15 01:15:44 UTC; 1min 6s ago
       Docs: https://docs.ipfs.io/
   Main PID: 9542 (ipfs)
      Tasks: 8 (limit: 4667)
     Memory: 71.0M (swap max: 0B)
        CPU: 6.319s
     CGroup: /system.slice/ipfs.service
             └─9542 /usr/local/bin/ipfs daemon --init --enable-gc

Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Swarm announcing /ip4/54.151.228.15/udp/4001/quic-v1/webtransport/certhash/uEiBs>
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Swarm announcing /ip6/::1/tcp/4001
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Swarm announcing /ip6/::1/udp/4001/quic
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Swarm announcing /ip6/::1/udp/4001/quic-v1
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Swarm announcing /ip6/::1/udp/4001/quic-v1/webtransport/certhash/uEiBsDIloU_FsFe>
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: RPC API server listening on /ip4/127.0.0.1/tcp/5001
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: WebUI: http://127.0.0.1:5001/webui
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Gateway server listening on /ip4/127.0.0.1/tcp/8080
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal ipfs[9542]: Daemon is ready
Aug 15 01:15:44 ip-.ap-southeast-1.compute.internal systemd[1]: Started InterPlanetary File System (IPFS) daemon.

Ok, if I kill my ipfs.service and just run ipfs daemon from cli, it works. But I don’t know what’s wrong with my ipfs.service since I followed tutorials online and I’m jut a total noob.

sudo bash -c 'cat >/lib/systemd/system/ipfs.service <<EOL
[Unit]
Description=InterPlanetary File System (IPFS) daemon
Documentation=https://docs.ipfs.io/
After=network.target

StartLimitBurst=5
StartLimitIntervalSec=10

[Service]
MemorySwapMax=0

TimeoutStartSec=infinity

Type=notify
User=ubuntu
StateDirectory=ipfs
Environment=IPFS_PATH="/home/ubuntu"
ExecStart=/usr/local/bin/ipfs daemon --enable-gc
Restart=on-failure
KillSignal=SIGINT
RestartSec=5

[Install]
WantedBy=default.target
EOL'

looks like this worked but it was killed, what about systemctl restart ipfs ?

Oh, I see the user of the daemon and the client is not the same,
You can do mkdir ~/.ipfs && echo "/ip4/127.0.0.1/tcp/5001" > ~/.ipfs/api which is gonna make the CLI always try to use API instead.

I did what you said…

ubuntu@ip-172-31-35-57:~$ mkdir ~/.ipfs && echo "/ip4/127.0.0.1/tcp/5001" > ~/.ipfs/api
mkdir: cannot create directory ‘/home/ubuntu/.ipfs’: File exists
ubuntu@ip-172-31-35-57:~$ ^C
ubuntu@ip-172-31-35-57:~$ echo "/ip4/127.0.0.1/tcp/5001" > ~/.ipfs/api

But I’m still getting the same error.

What do you mean by client not the same, btw? What is the client? My ipfs is installed by user ubuntu. So, there’s a .ipfs folder under /home/ubuntu

Interestingly, I actually have another old IPFS node that was set up by me and running perfectly months ago. But now also suffering from daemon issues. Below shows how the daemon is running and yet IPFS acts like it’s not running.

root@ip-172-31-11-119:~# systemctl status ipfs.service
● ipfs.service - InterPlanetary File System (IPFS) daemon
     Loaded: loaded (/etc/systemd/system/ipfs.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-08-15 04:54:50 UTC; 1min 45s ago
       Docs: https://docs.ipfs.io/
   Main PID: 123712 (ipfs)
      Tasks: 9 (limit: 9503)
     Memory: 209.6M (swap max: 0B)
     CGroup: /system.slice/ipfs.service
             └─123712 /usr/local/bin/ipfs daemon --init --migrate

Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Swarm announcing /ip4/13.215.169.228/udp/4001/quic
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Swarm announcing /ip4/172.31.11.119/tcp/4001
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Swarm announcing /ip4/172.31.11.119/udp/4001/quic
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Swarm announcing /ip6/::1/tcp/4001
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Swarm announcing /ip6/::1/udp/4001/quic
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: API server listening on /ip4/127.0.0.1/tcp/5001
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: WebUI: http://127.0.0.1:5001/webui
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal ipfs[123712]: Daemon is ready
Aug 15 04:54:50 ip-172-31-11-119.ap-southeast-1.compute.internal systemd[1]: Started InterPlanetary File System (IPFS) daemon.
root@ip-172-31-11-119:~# ipfs pin add bafkreifwpfpsrowlztlcma552hp4hclelu6n5g3lioiapikszq57i4al5m
Error: pin: merkledag: not found

you need the daemon running, what happen when you do systemctl start ipfs ?