dpkg replacing files on a FAT filesystem
When you upgrade or reinstall a package with dpkg (and ultimately anything that uses it, like apt-get etc) it backs up the existing files by creating a hard link to the file before replacing it. That way if the unpack fails it can easily put back the existing files. That's great, since it protects the operating system from Bad Things™ happening.
Except... it only works if your filesystem supports hard links. Not all filesystems do - such as FAT filesystems.
I am working on a distribution of Debian for a specific embedded ARM platform, and the boot environment requires that certain files (the kernel included) are on a FAT filesystem so the boot code is able to locate and load them.
When you go to upgrade the kernel package (or any other package that has files in that FAT partition) the install fails with:
dpkg: error processing archive linux-image3.18.11+_3.18.11.2.armadillian_armhf.deb (--install):
unable to make backup link of `./boot/vmlinuz-3.18.11+' before installing new version: Operation not permitted
And the whole upgrade fails.
I have scoured the web, and the only references I can find are specific people with specific problems when doing specific upgrades, the answer to which is usually "Delete /boot/vmlinuz-3.18.11+ and try again", and yes, that fixes that specific problem.
But that's not the answer for me. I am an OS distributor, not an OS user, so I need a way to fix this that doesn't involve the end user manually deleting their kernel files before doing an upgrade. I need a way to tell dpkg to "copy, not hard link" for files on /boot (or all files for all I care, though that would slow down the upgrade operation somewhat), or better yet "If a hard link fails, don't complain, just copy it instead".
I have tried such things as the --force-unsafe-io and even --force-all flags to dpkg, but nothing has any effect.
I need to get this resolved urgently as it's kind of blocking the release of a new version of the OS for this system...
dpkg hard-link fat
add a comment |
When you upgrade or reinstall a package with dpkg (and ultimately anything that uses it, like apt-get etc) it backs up the existing files by creating a hard link to the file before replacing it. That way if the unpack fails it can easily put back the existing files. That's great, since it protects the operating system from Bad Things™ happening.
Except... it only works if your filesystem supports hard links. Not all filesystems do - such as FAT filesystems.
I am working on a distribution of Debian for a specific embedded ARM platform, and the boot environment requires that certain files (the kernel included) are on a FAT filesystem so the boot code is able to locate and load them.
When you go to upgrade the kernel package (or any other package that has files in that FAT partition) the install fails with:
dpkg: error processing archive linux-image3.18.11+_3.18.11.2.armadillian_armhf.deb (--install):
unable to make backup link of `./boot/vmlinuz-3.18.11+' before installing new version: Operation not permitted
And the whole upgrade fails.
I have scoured the web, and the only references I can find are specific people with specific problems when doing specific upgrades, the answer to which is usually "Delete /boot/vmlinuz-3.18.11+ and try again", and yes, that fixes that specific problem.
But that's not the answer for me. I am an OS distributor, not an OS user, so I need a way to fix this that doesn't involve the end user manually deleting their kernel files before doing an upgrade. I need a way to tell dpkg to "copy, not hard link" for files on /boot (or all files for all I care, though that would slow down the upgrade operation somewhat), or better yet "If a hard link fails, don't complain, just copy it instead".
I have tried such things as the --force-unsafe-io and even --force-all flags to dpkg, but nothing has any effect.
I need to get this resolved urgently as it's kind of blocking the release of a new version of the OS for this system...
dpkg hard-link fat
Sounds like time for a wishlist bug. :-)
– Faheem Mitha
Jun 7 '15 at 13:07
add a comment |
When you upgrade or reinstall a package with dpkg (and ultimately anything that uses it, like apt-get etc) it backs up the existing files by creating a hard link to the file before replacing it. That way if the unpack fails it can easily put back the existing files. That's great, since it protects the operating system from Bad Things™ happening.
Except... it only works if your filesystem supports hard links. Not all filesystems do - such as FAT filesystems.
I am working on a distribution of Debian for a specific embedded ARM platform, and the boot environment requires that certain files (the kernel included) are on a FAT filesystem so the boot code is able to locate and load them.
When you go to upgrade the kernel package (or any other package that has files in that FAT partition) the install fails with:
dpkg: error processing archive linux-image3.18.11+_3.18.11.2.armadillian_armhf.deb (--install):
unable to make backup link of `./boot/vmlinuz-3.18.11+' before installing new version: Operation not permitted
And the whole upgrade fails.
I have scoured the web, and the only references I can find are specific people with specific problems when doing specific upgrades, the answer to which is usually "Delete /boot/vmlinuz-3.18.11+ and try again", and yes, that fixes that specific problem.
But that's not the answer for me. I am an OS distributor, not an OS user, so I need a way to fix this that doesn't involve the end user manually deleting their kernel files before doing an upgrade. I need a way to tell dpkg to "copy, not hard link" for files on /boot (or all files for all I care, though that would slow down the upgrade operation somewhat), or better yet "If a hard link fails, don't complain, just copy it instead".
I have tried such things as the --force-unsafe-io and even --force-all flags to dpkg, but nothing has any effect.
I need to get this resolved urgently as it's kind of blocking the release of a new version of the OS for this system...
dpkg hard-link fat
When you upgrade or reinstall a package with dpkg (and ultimately anything that uses it, like apt-get etc) it backs up the existing files by creating a hard link to the file before replacing it. That way if the unpack fails it can easily put back the existing files. That's great, since it protects the operating system from Bad Things™ happening.
Except... it only works if your filesystem supports hard links. Not all filesystems do - such as FAT filesystems.
I am working on a distribution of Debian for a specific embedded ARM platform, and the boot environment requires that certain files (the kernel included) are on a FAT filesystem so the boot code is able to locate and load them.
When you go to upgrade the kernel package (or any other package that has files in that FAT partition) the install fails with:
dpkg: error processing archive linux-image3.18.11+_3.18.11.2.armadillian_armhf.deb (--install):
unable to make backup link of `./boot/vmlinuz-3.18.11+' before installing new version: Operation not permitted
And the whole upgrade fails.
I have scoured the web, and the only references I can find are specific people with specific problems when doing specific upgrades, the answer to which is usually "Delete /boot/vmlinuz-3.18.11+ and try again", and yes, that fixes that specific problem.
But that's not the answer for me. I am an OS distributor, not an OS user, so I need a way to fix this that doesn't involve the end user manually deleting their kernel files before doing an upgrade. I need a way to tell dpkg to "copy, not hard link" for files on /boot (or all files for all I care, though that would slow down the upgrade operation somewhat), or better yet "If a hard link fails, don't complain, just copy it instead".
I have tried such things as the --force-unsafe-io and even --force-all flags to dpkg, but nothing has any effect.
I need to get this resolved urgently as it's kind of blocking the release of a new version of the OS for this system...
dpkg hard-link fat
dpkg hard-link fat
asked Jun 7 '15 at 11:14
MajenkoMajenko
573213
573213
Sounds like time for a wishlist bug. :-)
– Faheem Mitha
Jun 7 '15 at 13:07
add a comment |
Sounds like time for a wishlist bug. :-)
– Faheem Mitha
Jun 7 '15 at 13:07
Sounds like time for a wishlist bug. :-)
– Faheem Mitha
Jun 7 '15 at 13:07
Sounds like time for a wishlist bug. :-)
– Faheem Mitha
Jun 7 '15 at 13:07
add a comment |
1 Answer
1
active
oldest
votes
The behaviour you're seeing is implemented in archives.c in the dpkg source, line 1030 (for version 1.18.1):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
ti->name);
It seems to me that you could handle the link failure by falling back to the rename behaviour used lines 1003 and following; something like (this is untested):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf)) {
debug(dbg_eachfiledetail,"link failed, nonatomic");
nifd->namenode->flags |= fnnf_no_atomic_overwrite;
if (rename(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to move aside '%.255s' to install new version"),
ti->name);
}
I'm not a dpkg expert though... (And there's no option already available in dpkg to provide this behaviour.)
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package'spreinstscript, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.
– Majenko
Jun 7 '15 at 16:29
1
Indeed, that would work; you could also investigatedpkghooks (dpkg --pre-invoke=).
– Stephen Kitt
Jun 7 '15 at 16:57
+1 How are you not adpkgexpert when you know this!
– nikhil
Jun 11 '15 at 20:11
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f208073%2fdpkg-replacing-files-on-a-fat-filesystem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The behaviour you're seeing is implemented in archives.c in the dpkg source, line 1030 (for version 1.18.1):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
ti->name);
It seems to me that you could handle the link failure by falling back to the rename behaviour used lines 1003 and following; something like (this is untested):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf)) {
debug(dbg_eachfiledetail,"link failed, nonatomic");
nifd->namenode->flags |= fnnf_no_atomic_overwrite;
if (rename(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to move aside '%.255s' to install new version"),
ti->name);
}
I'm not a dpkg expert though... (And there's no option already available in dpkg to provide this behaviour.)
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package'spreinstscript, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.
– Majenko
Jun 7 '15 at 16:29
1
Indeed, that would work; you could also investigatedpkghooks (dpkg --pre-invoke=).
– Stephen Kitt
Jun 7 '15 at 16:57
+1 How are you not adpkgexpert when you know this!
– nikhil
Jun 11 '15 at 20:11
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
add a comment |
The behaviour you're seeing is implemented in archives.c in the dpkg source, line 1030 (for version 1.18.1):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
ti->name);
It seems to me that you could handle the link failure by falling back to the rename behaviour used lines 1003 and following; something like (this is untested):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf)) {
debug(dbg_eachfiledetail,"link failed, nonatomic");
nifd->namenode->flags |= fnnf_no_atomic_overwrite;
if (rename(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to move aside '%.255s' to install new version"),
ti->name);
}
I'm not a dpkg expert though... (And there's no option already available in dpkg to provide this behaviour.)
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package'spreinstscript, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.
– Majenko
Jun 7 '15 at 16:29
1
Indeed, that would work; you could also investigatedpkghooks (dpkg --pre-invoke=).
– Stephen Kitt
Jun 7 '15 at 16:57
+1 How are you not adpkgexpert when you know this!
– nikhil
Jun 11 '15 at 20:11
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
add a comment |
The behaviour you're seeing is implemented in archives.c in the dpkg source, line 1030 (for version 1.18.1):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
ti->name);
It seems to me that you could handle the link failure by falling back to the rename behaviour used lines 1003 and following; something like (this is untested):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf)) {
debug(dbg_eachfiledetail,"link failed, nonatomic");
nifd->namenode->flags |= fnnf_no_atomic_overwrite;
if (rename(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to move aside '%.255s' to install new version"),
ti->name);
}
I'm not a dpkg expert though... (And there's no option already available in dpkg to provide this behaviour.)
The behaviour you're seeing is implemented in archives.c in the dpkg source, line 1030 (for version 1.18.1):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
ti->name);
It seems to me that you could handle the link failure by falling back to the rename behaviour used lines 1003 and following; something like (this is untested):
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
if (link(fnamevb.buf,fnametmpvb.buf)) {
debug(dbg_eachfiledetail,"link failed, nonatomic");
nifd->namenode->flags |= fnnf_no_atomic_overwrite;
if (rename(fnamevb.buf,fnametmpvb.buf))
ohshite(_("unable to move aside '%.255s' to install new version"),
ti->name);
}
I'm not a dpkg expert though... (And there's no option already available in dpkg to provide this behaviour.)
edited 8 mins ago
answered Jun 7 '15 at 12:40
Stephen KittStephen Kitt
168k24379457
168k24379457
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package'spreinstscript, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.
– Majenko
Jun 7 '15 at 16:29
1
Indeed, that would work; you could also investigatedpkghooks (dpkg --pre-invoke=).
– Stephen Kitt
Jun 7 '15 at 16:57
+1 How are you not adpkgexpert when you know this!
– nikhil
Jun 11 '15 at 20:11
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
add a comment |
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package'spreinstscript, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.
– Majenko
Jun 7 '15 at 16:29
1
Indeed, that would work; you could also investigatedpkghooks (dpkg --pre-invoke=).
– Stephen Kitt
Jun 7 '15 at 16:57
+1 How are you not adpkgexpert when you know this!
– nikhil
Jun 11 '15 at 20:11
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Certainly packaging my own version of dpkg is a possibility, though I'd prefer not to have the overhead of tracking upstream changes in my version.
– Majenko
Jun 7 '15 at 13:27
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package's
preinst script, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.– Majenko
Jun 7 '15 at 16:29
Ok, I can confirm that this works fine, so it is certainly an option. Another option that occurs to me that may be a possibility is to manually move the offending files in the package's
preinst script, but as the kernel is built by the standard kernel packaging scripts I'm not sure how I'd modify that. Also there wouldn't be an automatic rollback facility.– Majenko
Jun 7 '15 at 16:29
1
1
Indeed, that would work; you could also investigate
dpkg hooks (dpkg --pre-invoke=).– Stephen Kitt
Jun 7 '15 at 16:57
Indeed, that would work; you could also investigate
dpkg hooks (dpkg --pre-invoke=).– Stephen Kitt
Jun 7 '15 at 16:57
+1 How are you not a
dpkg expert when you know this!– nikhil
Jun 11 '15 at 20:11
+1 How are you not a
dpkg expert when you know this!– nikhil
Jun 11 '15 at 20:11
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
raspberrypi kernel is also updated via a similar trick, using dpkg-divert. Taken from raspberrypi.stackexchange.com/questions/51410/…,
– akarapatis
Dec 28 '18 at 8:32
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f208073%2fdpkg-replacing-files-on-a-fat-filesystem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sounds like time for a wishlist bug. :-)
– Faheem Mitha
Jun 7 '15 at 13:07