Invalid cross device link linux

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing packages in Debian-based images with apt fails with «Invalid cross-device link» #38389

Installing packages in Debian-based images with apt fails with «Invalid cross-device link» #38389

Comments

Description

On Debian-based images, installing or upgrading causes an Invalid cross-device link error.

Steps to reproduce the issue:

docker run debian:stable bash -c 'apt update && apt install -y git'

Describe the results you received:

Fetched 24.1 MB in 0s (25.3 MB/s) (Reading database . 6498 files and directories currently installed.) Preparing to unpack . /perl-base_5.24.1-3+deb9u5_amd64.deb . Unpacking perl-base (5.24.1-3+deb9u5) over (5.24.1-3+deb9u4) . dpkg: error processing archive /var/cache/apt/archives/perl-base_5.24.1-3+deb9u5_amd64.deb (--unpack): unable to make backup link of './usr/bin/perl' before installing new version: Invalid cross-device link dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) dpkg: error: error creating new backup file '/var/lib/dpkg/status-old': Invalid cross-device link E: Sub-process /usr/bin/dpkg returned an error code (2) 

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

The issue only appears on my Arch Linux installation, not on my Debian Testing. I guess it could be due to version or distribution parameter differences.

Output of docker version :

Client: Version: 18.09.0-ce API version: 1.39 Go version: go1.11.2 Git commit: 4d60db472b Built: Fri Nov 9 00:05:34 2018 OS/Arch: linux/amd64 Experimental: false Server: Engine: Version: 18.09.0-ce API version: 1.39 (minimum version 1.12) Go version: go1.11.2 Git commit: 4d60db472b Built: Fri Nov 9 00:05:11 2018 OS/Arch: linux/amd64 Experimental: false 

Output of docker info :

Containers: 16 Running: 1 Paused: 0 Stopped: 15 Images: 29 Server Version: 18.09.0-ce Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 9f2e07b1fc1342d1c48fe4d7bbb94cb6d1bf278b.m runc version: 079817cc26ec5292ac375bb9f47f373d33574949 init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 4.19.8-arch1-1-ARCH Operating System: Arch Linux OSType: linux Architecture: x86_64 CPUs: 8 Total Memory: 15.43GiB Name: ir ID: 6KVN:LV25:SUBF:Y54Q:OCMK:JO2H:Y3Q3:JJYJ:LMWO:EATR:RWRJ:74JS Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false 

Additional environment details (AWS, VirtualBox, physical, etc.):

Читайте также:  Exe для linux mint

The text was updated successfully, but these errors were encountered:

Источник

Здравствуйте, господа. Нужна ваша помощь. Всю голову себе переломал.

Есть CentOS. На ней WHM\Cpanel, хотя это и не столь важно. Установлено это все на обычном 20Гб разделе в ext4.

Есть второй раздел, большой, который я разметил так же само в ext4 и подмонтировал в одну из папок в веб директории: /home/USER/public_html/webroot

Все видно, все хорошо, но при попытке заливать файлы через ГУЙ, выдается такое: Upload Canceled: could not copy the file “” to “/home/emailsaas/public_html/webroot/He-_Bv-T-oc.jpg” due to the following error: Invalid cross-device link

Старые файлы редактируются успешно. Но новые не создаются. Права на директории рекурсивно 777, юзера-группу менял.

sealert -a /var/log/audit/audit.log

[root@srv log]# sealert -a /var/log/audit/audit.log -bash: sealert: command not found 

К сожалению этот лог никак не меняется при попытках создать новый файл в той директории. Проверял tail -f в реальном времени.

type=CRED_DISP msg=audit(1537030206.359:381967): pid=35395 uid=0 auid=0 ses=42956 msg='op=PAM:setcred grantors=pam_env,pam_hulk,pam_unix acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=USER_END msg=audit(1537030206.360:381968): pid=35395 uid=0 auid=0 ses=42956 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=CRED_DISP msg=audit(1537030207.104:381969): pid=35410 uid=0 auid=1003 ses=42951 msg='op=PAM:setcred grantors=pam_env,pam_hulk,pam_unix acct="emailsaas" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=USER_END msg=audit(1537030207.106:381970): pid=35410 uid=0 auid=1003 ses=42951 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="emailsaas" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=CRED_DISP msg=audit(1537030210.123:381971): pid=35401 uid=0 auid=1003 ses=42938 msg='op=PAM:setcred grantors=pam_env,pam_hulk,pam_unix acct="emailsaas" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success' type=USER_END msg=audit(1537030210.125:381972): pid=35401 uid=0 auid=1003 ses=42938 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="emailsaas" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success 

похоже на

эту проблему. А как подмонтировано? Вот почему нельзя символическую ссылку было сделать (про тему в интернете)?

А не судьба прочесть причину ошибки такой? У вас файл заливается во временный каталог а потом сипанель пытается сделать на него хардлинк в другой каталог — который у вас примонтирован другой ФС/ Естественно что будет кросс-девайс-линк который делать нельзя.

Читайте также:  Linux while return code

Источник

Вопрос по команде ln. Что пропустил?

Директории находятся в разделах на разных жестких дисках.

Re: Вопрос по команде ln. Что пропустил?

Re: Вопрос по команде ln. Что пропустил?

а что жесткую ссылку создать не получится?

Re: Вопрос по команде ln. Что пропустил?

жёсткие только на одном разделе

Re: Вопрос по команде ln. Что пропустил?

И если я правилно понимаю, то файлы будут писаться и туда и туда. а это не есть то, что нужно. просто на варе место закончилось.

Re: Вопрос по команде ln. Что пропустил?

файлы будут писаться туда куда ссылка символическая указывает 🙂 в саму ссылку не будут 🙂

Re: Вопрос по команде ln. Что пропустил?

Надо: перенести /var/log/ на другой раздел (не перегружая комп) на другой раздел. Для этого:

1. переместить (mv) /var/log на другой раздел. 2. Создать ссылку из другого раздела на /var/log (ln -sd /mailstorage/mailarhive/log /var)

Re: Вопрос по команде ln. Что пропустил?

А что у тебя в /var/log только логи почты?:)
Вообще я так понимаю, что примерно так:

init 1
rsync -a /var/log/ /other/path/log
rm -fr /var/log/
ln -s /other/path/log /var/log

mv /var/log/biglogfiles /other/path/
ln -s /other/path/biglogfile1 /var/log
ln -s /other/path/biglogfile2 /var/log

Re: Вопрос по команде ln. Что пропустил?

>А что у тебя в /var/log только логи почты?:)

нет есть еще немного, но в основном, да.. почта.

на файлы я думал ссылки сделать, но там еще старые логи идут ежедневно в архив. в итоге выходит log.file log.file.1 log.file.1.gz log.file.2.gz . и т.д. все это делает хитрожопый скрипт, в котором разбираться желания нет. итак что, имхо легче и быстрее дернуть всю директорию.

Re: Вопрос по команде ln. Что пропустил?

#cp /var/log/ /mailstorage/mailarchive/
#mv /var/log/ /var/log1
#ln -ds /mailstorage/mailarchive/log/ /var
#rm -rf /var/log1

В общем сделал так. надеюсь сработает.

Re: Вопрос по команде ln. Что пропустил?

> init 1
> .

> rm -fr /var/log/

Лучше не удалять, а переименовать, или переместить куда-нибудь в /tmp, если он находится на одном разделе с /var/log. Тогда можно избежать init 1, ограничившись просто поочерёдным перезапуском демонов, пишущих в /var/log.

Re: Вопрос по команде ln. Что пропустил?

> В общем сделал так. надеюсь сработает.

Посмотри права в /mailstorage/mailarchive/log/

Re: Вопрос по команде ln. Что пропустил?

Жесткие ссылки

Жесткие ссылки живут строго в пределах одного раздела. Нормальное объяснение есть в книжке по юниксу.

Краткое объяснение таково: данные о файле (права, флаги, размещение секторов на диске) хранятся в структуре, называемой inode. Директория — таблица вида (номер inode, имя). Хардлинк — это просто другое имя с тем же inode (убедитесь при помощи ls -i). Нумерация inode на каждом разделе своя. Номер устройства в директории не предусмотрен, ибо возникает слишком много головной боли (например, при монтировании/отмонтировании).

Читайте также:  Установка принтера линукс терминал

Re: Вопрос по команде ln. Что пропустил?

Права проверил. Syslog перезапустил. Вроде все работает.

Источник

I have /home/myuser/Desktop/rc/.netrc file that i want hardlink to /root, ie home directory of root user. When i do: ln /home/user/Destkop/rc/.netrc /root it gives the following error:

but it works when i hardlink the file to myuser‘s home, ie to /home/myuser. So, what’s the problem, why it says invalid cross-devices when there is only one file system here? PS. I am using RHEL6

Are you sure the two directories are on the same filesystem? Run mount | column -t and take a look. Or, run mountpoint -d / , mountpoint -d /home , mountpoint -d user , and mountpoint -d /root . You should get . is not a mountpoint for the last three.

@HaukeLaging: You’re right. /proc/mounts is more likely to show all of the mounts on a system than /etc/mtab , which is where mount pulls its information from. Though, it is worth noting that on many modern systems, /etc/mtab and /proc/mounts are both linked to /proc/self/mounts .

5 Answers 5

it’s most likely that your /home directory isn’t on the same partition as the /root directory.

You can easily check this with cat /etc/fstab hardlinks cannot be created between different partitions, only symlinks can.

It seem to me the BEST way is NOT to use a HARD link but to use a symbolic link instead. You’ll find it to be far less of a hassle and things work just fine. Hard link have some interesting problems if you are not aware of them.

See man ln and checkout the -s option!

Please in general use symbolic links instead of HARD links.

file systems like ext3/ext4 uses i-nodes to store file meta-data (mode, atime, ctime, mtime, uid, gid, size, links_count, acl etc.)

i-node table is a linear array of struct ext4_inode. this struct ext4_inode has field i_links_count. that refers to hard link count.

whenever new hard link to file is created this link_count value of that files i-node is incremented.

-rwxrwxrwx 2 raju raju 287 Aug 23 23:19 /home/raju/test.sh

different volumes have different i-node tables.

directory is flat file that maps file names to an i-node number on the filesystem.

directory entries across the filesystem that reference the same i-node number—these are known as hard links.

directory entry of one filesystem (volume1) can not reference i-node which is on different filesystem (volume2).

so ln fails with invalid cross-device link error.

but you can always create symbolic links to files on different filesystems/ volumes.

symlinks do not use i-node to reference file they use file path names. check link target of symlink.

Источник

Оцените статью
Adblock
detector