User avatar
NPDedyukhin
Posts: 30
Joined: Fri Sep 20, 2019 3:23 am
Location: RU

Connect to Yandex disk

Fri Sep 20, 2019 4:07 am

Good afternoon!

Recently, I needed to connect a Yandex drive to my project in order to increase the space for files.

When Raspberry starts, as intended, the Yandex drive should automatically mount.

I am using a Raspbian Stretch.

The problem is that after completing all the steps described in the manual for connecting the drive, the device stops starting (nothing happens).

I follow these steps:

pi@raspberrypi:~ $ sudo rm -Rf /var/lib/apt/lists

pi@raspberrypi:~ $ sudo rpi-update

pi@raspberrypi:~ $ sudo apt-get update && sudo apt-get upgrade -y

pi@raspberrypi:~ $ sudo reboot

pi@raspberrypi:~ $ uname -a && lsb_release -a && arch

I install Davfs2 package on the Raspbian system:

pi@raspberrypi:~ $ sudo apt-get install davfs2 -y

Add the current user to the group:

pi@raspberrypi:~ $ sudo usermod -a -G davfs2 pi

pi@raspberrypi:~ $ sudo mkdir /media/yandexdisk

pi@raspberrypi:~ $ sudo chmod 4755 /sbin/mount.davfs

pi@raspberrypi:~ $ sudo chown -R pi:pi /media/yandexdisk/

pi@raspberrypi:~ $ sudo nano /etc/davfs2/secrets

I enter the username and password from Yandex Disk:

/media/yandexdisk raspberrytest 010892ded

I register a line for automatically mounting a Yandex drive when Raspberry boots:

pi@raspberrypi:~ $ sudo nano /etc/fstab

(most likely there is an error)

https://webdav.yandex.ru /media/yandexdisk davfs gid=pi,uid=pi,auto 0 0

pi@raspberrypi:~ $ sudo mount -a

I check how the Raspbian system sees the mounted Yandex drive:

pi@raspberrypi:~ $ df -h | grep /media

Sees well:

https://webdav.yandex.ru 10G 79M 10G 1% /media/yandexdisk

After rebooting, the device stops loading.

I ask you to help me with this if you know what the problem is.
Respectfully,
Nikita Dedyukhin

bjtheone
Posts: 716
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Connect to Yandex disk

Fri Sep 20, 2019 11:44 am

Very likely it is trying to mount the drive early in the boot process before everything required is up and available. This is also a common issue with with real rust hard drives. If it always is mountable via the command line and will not mount automatically at boot up, your options likely boil down to delay the mount attempt, or mount it after the system is fully up. You obviously know how to to that manually. You could automate it via a startup script that runs late in the boot process, or cron .

User avatar
B.Goode
Posts: 10100
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Connect to Yandex disk

Fri Sep 20, 2019 11:47 am

Welcome to the Raspberry Pi forums.

Yandex seems to be a Russian Internet Services provider? So is a 'yandex drive' a form of cloud data storage?


Perhaps it would be useful to link to the instructions or tutorial you are following?

You are using an outdated and superceded version of the Raspbian Operating System.

I would be distrustful of any instructions that arbitrarily instruct to run rpi-update.


Maybe your problem at reboot is as simple as trying to mount the networked drive before the Network stack has become available? There is a configuration option in the raspi-config utility that might help with that.

bjtheone
Posts: 716
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Connect to Yandex disk

Fri Sep 20, 2019 2:05 pm

I assume given the age of the distro, that was part of a generic "get your Pi up to date" instruction set. However, "rpi-update" will update your Pi to the latest firmware. Said firmware may not be entirely stable. While I would not automatically rule out an instruction set that suggested that command I would skip over the rpi-update.

One of the big issues is that folks blindly follow instructions, without validating the source, or considering what said instructions are actually going to do. If the instructions come from an RPT engineer you are likely good to go. If they come from some random unvalidated site on the internet, perhaps caution should be exercised. The one saving grace is that it is actually fairly difficult to kill the hardware, so worse case you are losing all your data and previous OS configuration, which is why backups are such a good idea.

renice123
Posts: 180
Joined: Tue Oct 15, 2019 3:56 pm

Re: Connect to Yandex disk

Tue Oct 15, 2019 4:08 pm

I also use Yandex.Disk and I must say that I am observing some problems related to the peculiarity of Yandex. In particular, these are periodic “freezes” of the mounted partition.
The second feature of working with Yandex.Disk is that upon rebooting, the system will try to “unmount” the remote service, which will take a lot of time. Therefore, I did not do automatic mounting at boot, but I downloaded either from rc.local (in the last Debian there are some features!), Or a script.
Also, before turning off the Yandex.disk system, the disk must be unmounted (you can write a script).
The mount script is very simple, I took it from a famous forum and rewrote it a bit.
Yes, you need to install expect - so that at startup, the password for the Yandex request is automatically entered.

Here is the script.

#!/usr/bin/expect
spawn mount.davfs https://webdav.yandex.ru /home/pi/yandex/
expect "Username:"
send "***********@yandex.ru\r"
expect "Password:"
send "***********\r"
expect eof


Instead of ***********, enter the address (in the first line) and password (in the second)

[Moderator translated this from russian using google translate, please dont use russian in english section]

aunderrednua
Posts: 1
Joined: Tue Oct 15, 2019 6:16 pm

Re: Connect to Yandex disk

Tue Oct 15, 2019 6:26 pm

If you want to connect Yandex.disk during the system boot (via fstab) you need to add the '_netdev' parameter to the fstab line, so that it waited for the network interface before trying to connect to network drive. But this way is not troublefree, as, in case Yandex.disk is for some reason is not accessible during the boot, the system will halt and will not boot even with everything correct in fstab. I would recommend using either the above script, or autofs, or rclone, which will connect the webdav resource when you need it.

GD0017
Posts: 1
Joined: Mon Nov 04, 2019 9:03 am

Re: Connect to Yandex disk

Mon Nov 04, 2019 9:10 am

Hello!
Found a solution?
I have the same problem:
In my opinion, everything is in:
!!!!! sudo nano / etc / fstab:
I just did this:

sudo apt-get install davfs2
sudo mkdir /mnt/ya.disk
sudo chmod -R 777 /mnt/ya.disk
sudo mount -t davfs https://webdav.yandex.ru /mnt/ya.disk -o uid = pi, gid = pi, rw, file_mode = 0777, dir_mode = 0777
After entering the command, you will be asked to enter the username and password for the Yandex.Disk account.
sudo dpkg-reconfigure davfs2 !!! Answer Yes to the question.
sudo usermod -aG davfs2 pi
sudo nano / etc / davfs2 / secrets
At the end of the file, add:
https://webdav.yandex.ru login password
• login - your Yandex.Disk account login;
• password - your password from the Yandex.Disk account;
Ctrl + O Ctrl + X
sudo nano / etc / fstab
at the end of the file:
https://webdav.yandex.ru /mnt/ya.disk davfs rw, noexec, auto, user, async, _netdev, uid = pi, gid = pi 0 0
sudo reboot

After that, it stopped hanging at boot. Unsubscribe, pliz, if this option helps you.

[moderator translation from this Russian original, please only post English texts here, or I have to move this thread to the Russian section!]
Привет!
Нашёл решение?
У меня такая же проблема :evil: :evil:
По-моему всё в:
!!!!! sudo nano /etc/fstab :evil: :evil: :evil: :evil:
Я сейчас так сделал:

sudo apt-get install davfs2
sudo mkdir /mnt/ya.disk
sudo chmod -R 777 /mnt/ya.disk
sudo mount -t davfs https://webdav.yandex.ru /mnt/ya.disk -o uid=pi,gid=pi,rw,file_mode=0777,dir_mode=0777
После ввода команды, вас попросят ввести логин и пароль от аккаунта Яндекс.Диска.
sudo dpkg-reconfigure davfs2 !!!На вопрос отвечаем Yes.
sudo usermod -aG davfs2 pi
sudo nano /etc/davfs2/secrets
В конец файла добавим:
https://webdav.yandex.ru login password
• login - ваш логин аккаунта Яндекс.Диск;
• password - ваш пароль от аккаунта Яндекс.Диск;
Ctrl + O Ctrl + X
sudo nano /etc/fstab
в конец файла:
https://webdav.yandex.ru /mnt/ya.disk davfs rw,noexec,auto,user,async,_netdev,uid=pi,gid=pi 0 0
sudo reboot


!!! И ещё один момент: Галочку поставь "Пуск/параметры/Raspberry Pi Configuration - System - Network at Boot: "V" Wait for nework


После этого перестало зависать при загрузке. Отпишись, плиз, если этот вариант тебе поможет.

User avatar
NPDedyukhin
Posts: 30
Joined: Fri Sep 20, 2019 3:23 am
Location: RU

Re: Connect to Yandex disk

Mon Apr 20, 2020 4:24 pm

GD0017 wrote:
Mon Nov 04, 2019 9:10 am
Hello!
Found a solution?
I have the same problem:
In my opinion, everything is in:
!!!!! sudo nano / etc / fstab:
I just did this:

sudo apt-get install davfs2
sudo mkdir /mnt/ya.disk
sudo chmod -R 777 /mnt/ya.disk
sudo mount -t davfs https://webdav.yandex.ru /mnt/ya.disk -o uid = pi, gid = pi, rw, file_mode = 0777, dir_mode = 0777
After entering the command, you will be asked to enter the username and password for the Yandex.Disk account.
sudo dpkg-reconfigure davfs2 !!! Answer Yes to the question.
sudo usermod -aG davfs2 pi
sudo nano / etc / davfs2 / secrets
At the end of the file, add:
https://webdav.yandex.ru login password
• login - your Yandex.Disk account login;
• password - your password from the Yandex.Disk account;
Ctrl + O Ctrl + X
sudo nano / etc / fstab
at the end of the file:
https://webdav.yandex.ru /mnt/ya.disk davfs rw, noexec, auto, user, async, _netdev, uid = pi, gid = pi 0 0
sudo reboot

After that, it stopped hanging at boot. Unsubscribe, pliz, if this option helps you.

[moderator translation from this Russian original, please only post English texts here, or I have to move this thread to the Russian section!]
Привет!
Нашёл решение?
У меня такая же проблема :evil: :evil:
По-моему всё в:
!!!!! sudo nano /etc/fstab :evil: :evil: :evil: :evil:
Я сейчас так сделал:

sudo apt-get install davfs2
sudo mkdir /mnt/ya.disk
sudo chmod -R 777 /mnt/ya.disk
sudo mount -t davfs https://webdav.yandex.ru /mnt/ya.disk -o uid=pi,gid=pi,rw,file_mode=0777,dir_mode=0777
После ввода команды, вас попросят ввести логин и пароль от аккаунта Яндекс.Диска.
sudo dpkg-reconfigure davfs2 !!!На вопрос отвечаем Yes.
sudo usermod -aG davfs2 pi
sudo nano /etc/davfs2/secrets
В конец файла добавим:
https://webdav.yandex.ru login password
• login - ваш логин аккаунта Яндекс.Диск;
• password - ваш пароль от аккаунта Яндекс.Диск;
Ctrl + O Ctrl + X
sudo nano /etc/fstab
в конец файла:
https://webdav.yandex.ru /mnt/ya.disk davfs rw,noexec,auto,user,async,_netdev,uid=pi,gid=pi 0 0
sudo reboot


!!! И ещё один момент: Галочку поставь "Пуск/параметры/Raspberry Pi Configuration - System - Network at Boot: "V" Wait for nework


После этого перестало зависать при загрузке. Отпишись, плиз, если этот вариант тебе поможет.
Good day.

Yes, that helped.
Thanks! ;)
Respectfully,
Nikita Dedyukhin

Return to “Beginners”