snipe-it
snipe-it copied to clipboard
Cannot restore backup
Debug mode
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
Hello,
I had to delete my Snipe-IT container because I wanted to add some more information to the container as a label. When I recreated the container, all the information was still there but all the uploaded images were gone (not a problem and was in the back of my mind). For this reason, I wanted to restore the previously created backup but this did not work. Via the website I always received an HTTP Error 500 and when restoring in the container using PHP artisan the error that the file was not found. I used the relative as well as the absolute file path.
KR, BlackRose01
Reproduction steps
- Log In on the Snipe-It Webpage and go to Setting/Backups
- Restore backup
- Exec into the container
docker exec -ti snip /bin/bash
- Restore the uploads via
php artisan snipeit:restore /var/www/html/storage/app/backups/snipe-it-manual-backup-2023-08-23-13-10-31.zip
Expected behavior
Restore all information and images, so that they can be used.
Screenshots
Restore from Bash
Restore from Website
Snipe-IT Version
v6.1.2 build 10938 (g32747cafd)
Operating System
Official Docker Image
Web Server
Official Docker Image
PHP Version
8.1.2-1ubuntu2.13 | Laravel: 8.83.22
Operating System
Windows 11
Browser
Opera GX
Version
LVL5 (core: 100.0.4815.82)
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
Are you sure you wish to restore from the given backup file? This can lead to MASSIVE DATA LOSS! (yes/no) [no]:
> yes
1/107 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 0%
ErrorException
fopen(public/uploads/assets/assets): Failed to open stream: No such file or directory
at app/Console/Commands/RestoreFromBackup.php:304
300▕ foreach ($interesting_files as $pretty_file_name => $file_details) {
301▕ $ugly_file_name = $za->statIndex($file_details['index'])['name'];
302▕ $fp = $za->getStream($ugly_file_name);
303▕ //$this->info("Weird problem, here are file details? ".print_r($file_details,true));
➜ 304▕ $migrated_file = fopen($file_details['dest'].'/'.basename($pretty_file_name), 'w');
305▕ while (($buffer = fgets($fp, self::$buffer_size)) !== false) {
306▕ fwrite($migrated_file, $buffer);
307▕ }
308▕ fclose($migrated_file);
1 app/Console/Commands/RestoreFromBackup.php:304
fopen()
+13 vendor frames
15 artisan:35
Illuminate\Foundation\Console\Kernel::handle()
Additional context
Fresh Snipe-IT container but old database container
We normally use a special Docker volume to handle the various uploads, so you should be able to throw away the container and replace it, and if you mount that volume, the various attached files should just show up.
The path public/uploads/assets/assets
seems a little weird, I don't know what's going on there.
You may want to take a look at your ZIP file and see if it has that strange assets/assets/ structure as well? And/or take a look at the filesystem on your docker container.
Mhh... But I don't know where the path public/uploads/assets/assets
is coming from. If you have a look on top in the image Restore from Bash then you can see that I don't choose this path.
I genuinely don't know where it would be getting that path from. Maybe something weird with paths in windows? If you open your backup zip, do you see an assets/assets
folder?
Hello all,
I am having this issue too. I have examined my backup.
Here is my folder path var\www\html\snipeit\public\uploads\assets\
Under the assets folder, it appears that there are images that are in there, but no folder or file called assets.
Currently, there are some images that are in the assets folder. I have tried creating this path var\www\html\snipeit\public\uploads\assets\assets\ but that seems to fail as well. It does look like I was getting a little bit further than @BlackRose01, my process seems to fail at 96/159.
Notes about my env: I am attempting to migrate from a Virtual Machine where Snipe-IT is currently running to a docker environment. The VM and the docker env are both linux. The VM is running 5.0.13-prebuild The Docker Container is running the latest version of snipe-IT
I should also note that it appears to have restored bits and pieces of the application. For example, AD authentication, and our login banner.
Same issue here on v6.2.3 vanilla system
Try this...it worked for me... I think, restore should create folders itself...
mkdir -p /var/www/html/public/uploads/assets/
php artisan snipeit:restore /full/path/to/your/backup.zip
Greets
Chris Ti An
Same issue here on v6.2.3 vanilla system
Try this...it worked for me... I think, restore should create folders itself...
mkdir -p /var/www/html/public/uploads/assets/ php artisan snipeit:restore /full/path/to/your/backup.zip
Greets
Chris Ti An
saviour!!