grub won't install
I'm trying to re-install grub from a USB drive. I run the following:
sudo mount /dev/sda6 /mnt
sudo grub-install --root-directory=/mnt /dev/sda
I get the following error:
grub-probe: error: failed to get canonical path of /cow.
can someone explain the error, and how to solve it?
Edit
I'm trying to repair a broken dual-boot system, running from a USB containing linux mint.
grub2
add a comment |
I'm trying to re-install grub from a USB drive. I run the following:
sudo mount /dev/sda6 /mnt
sudo grub-install --root-directory=/mnt /dev/sda
I get the following error:
grub-probe: error: failed to get canonical path of /cow.
can someone explain the error, and how to solve it?
Edit
I'm trying to repair a broken dual-boot system, running from a USB containing linux mint.
grub2
OK, that edit is a step in the right direction. Are we to assume that you already have a Linux system installed? Does it boot fromsda6
? Does my answer here help?
– terdon♦
Oct 21 '13 at 14:34
add a comment |
I'm trying to re-install grub from a USB drive. I run the following:
sudo mount /dev/sda6 /mnt
sudo grub-install --root-directory=/mnt /dev/sda
I get the following error:
grub-probe: error: failed to get canonical path of /cow.
can someone explain the error, and how to solve it?
Edit
I'm trying to repair a broken dual-boot system, running from a USB containing linux mint.
grub2
I'm trying to re-install grub from a USB drive. I run the following:
sudo mount /dev/sda6 /mnt
sudo grub-install --root-directory=/mnt /dev/sda
I get the following error:
grub-probe: error: failed to get canonical path of /cow.
can someone explain the error, and how to solve it?
Edit
I'm trying to repair a broken dual-boot system, running from a USB containing linux mint.
grub2
grub2
edited Dec 29 '13 at 4:11
strugee
8,1441254102
8,1441254102
asked Oct 21 '13 at 13:44
elyashiv
2722519
2722519
OK, that edit is a step in the right direction. Are we to assume that you already have a Linux system installed? Does it boot fromsda6
? Does my answer here help?
– terdon♦
Oct 21 '13 at 14:34
add a comment |
OK, that edit is a step in the right direction. Are we to assume that you already have a Linux system installed? Does it boot fromsda6
? Does my answer here help?
– terdon♦
Oct 21 '13 at 14:34
OK, that edit is a step in the right direction. Are we to assume that you already have a Linux system installed? Does it boot from
sda6
? Does my answer here help?– terdon♦
Oct 21 '13 at 14:34
OK, that edit is a step in the right direction. Are we to assume that you already have a Linux system installed? Does it boot from
sda6
? Does my answer here help?– terdon♦
Oct 21 '13 at 14:34
add a comment |
5 Answers
5
active
oldest
votes
Follow these steps:
Boot into a Live Linux session.
Mount the
/
partition of your installed OS to/mnt
sudo mount /dev/sda6 /mnt
Set up a
chroot
environment:
sudo chroot /mnt
You are now in a "fake" Linux install that treats
/mnt
as/
. This means that all the files necessary for GRUB are in/boot
where the system expects them to be and you can install GRUB just as if you were actually running your installed system:
sudo update-grub
sudo grub-install /dev/sda
Now reboot and you should see the GRUB menu appear normally.
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has aroot-device
option and what do you expect that option to do? Have you set up achroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.
– terdon♦
Oct 21 '13 at 14:19
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
@elyashiv there's not--root-directory
either. Go read my answer here that explains how to reinstall grub.
– terdon♦
Oct 21 '13 at 14:34
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
|
show 1 more comment
Based on what was written, it looks like you're trying to install GRUB to /dev/sda. You do not want to mount the disk.
You're probably looking for:
grub-install /dev/sda
GRUB man page for reference, or you can man grub-install
from your system:
http://linux.die.net/man/8/grub-install
add a comment |
If grub says that it could not resolve canonical path of something, it means that it does not exist or realpath()
failed.
In this case, try:
$ realpath /cow
$ ls -la /cow
If both commands say "cannot find file or directory", then you have to create one.
If the second command works, but the first does not, check why realpath()
does not work. One of the reasons can be that /proc
is not mounted. In some implementations of libc, /proc/self/fd
is used to get canonical path of a file.
add a comment |
I get this error too, and I don't think it happens in a chroot.
Background
I think this is when systemd cannot find the path because it is mounted in a directory. So, the difference is when you setup a chroot you already configure access to hardware, including drives.
Though you can configure this access inside Systemd that does not mean you can configure permissions for those drives the same way.
For instance, I created this file:
/etc/systemd/system/systemd-nspawn@.service.d/override.conf
And it contains these settings:
[Service]
DeviceAllow=char-usb_device rwm
DeviceAllow=char-usb
[Files]
Bind=/var/cache/apt/pkgcache.bin
Bind=/var/cache/apt/srcpkgcache.bin
This still does not work when using grub-install /dev/sda
or update-grub
for a USB on Pi debootstrapped with Debian Stretch. Even using grub-uboot and grub-efi-arm there is still that error the grub-probe
cannot find the canonical path.
Not only that but though update-grub
will see and know what the operating systems are, but interestingly grub-install
does not recognize the Debian operating system is on USB.
Example
root@raspixmc:/home/pi# grub-install /dev/sda
Installing for arm-uboot platform.
grub-install: warning: no hints available for your platform. Expect
reduced performance.
grub-install: warning: WARNING: no platform-specific install was
performed.
Installation finished. No error reported.
root@raspixmc:/home/pi#
Interesting, when I create a chroot and can run update-grub
, even though I am on the operating system that I debootstrapped to the USB itself it does not see its own operating system!
root@raspixmc:/home/pi# mount /dev/sda1 /mnt
root@raspixmc:/home/pi# cd /mnt
root@raspixmc:/mnt# mount --bind /dev dev/
root@raspixmc:/mnt# mount --bind /sys sys/
root@raspixmc:/mnt# mount --bind /proc proc/
root@raspixmc:/mnt# mount --bind /dev/pts dev/pts
root@raspixmc:/mnt# chroot . bin/bash
root@raspixmc:/# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
done
root@raspixmc:/#
It only sees Raspbian. This happens only when trying to install and update GRUB inside the container, but when I exit the chroot.
Watch how it now works because I did not unmount the chroot directories:
/dev dev/
/sys sys/
/proc proc/
/dev/pts dev/pts
From outside the container mind you, I am running this command with grub-uboot
installed on Raspbian and no Grub on the USB containing debootstrapped Debian.
root@raspixmc:/mnt# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
done
root@raspixmc:/mnt#
This does not happen using one of the unofficially available images for Debian ARM, but obviously this is still a customization not yet available for debootstrapping.
Troubleshooting
Really there are times when it is better just to create a path. The only next possibility (and a probable one) is to simply write GRUB. And for that I am just going to read on this page.
https://www.dedoimedo.com/computers/grub-2.html
Another thing I want to share about this issue is a solution that might work, but realize microSD cards are very sensitive. I have been building my own Linux images and learned this fast. The best thing to do is use Qemu whenever you can, but to attempt to clear an old partition table you might try running sgdisk --zap-all
on the drive.
sgdisk --zap-all /dev/sdd
In fact, sometimes if it gives an error the first time and it is not a read-only error, you can run it again and it will finally all the partition tables new or old.
And you can use Qemu to emulate Raspberry Pi on a standard AMD/Intel-based PC. I would recommend it. I know this is more information than pertains to the original post, but I think that is likely how this error is derived. It is the container age.
add a comment |
For anyone struggling with this who is attempting to use a live USB or other means of chroot to reinstall or install grub - I've dealt with this a few times and forgot to document it before although I intended to.
The problem you face is grub doesn't have access to the path you are referring to either as the source (/boot) or the destination (can your system and chroot see /dev/sda for example?) or both. When you prepare to chroot you create bind mounts that are accessible in the chroot environment, or you do so within the chroot using mount -t. There are so many guides online that do it either way.
You need to make sure you bind /dev or just the specific partition(s) containing the boot files in /boot (e.g. /dev/sda1). /boot is either a separate partition or a directory in / The chroot needs access to the drive that you will be (re)installing grub to so do fdisk -l in the chroot to make sure you can see the device listed in the output. Also note, if you don't have a separate boot partition, but you do have a boot directory in /root with the boot files (not just a mount point) then you only have to mount the partition containing root. You then don't have to mount anything to /root/boot.
You also need to make sure you bind the proc fileystem and the sys filesystem, but every guide I've seen has those two. I've just seen /dev missed out sometimes. There might be some cases when you don't need it, but I don't know of them.
tl;dr: make sure you bind mount /dev
Why are you talking aboutchroot
when the question isn't about`` chroot``?
– G-Man
Dec 19 '18 at 4:05
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%2f96977%2fgrub-wont-install%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Follow these steps:
Boot into a Live Linux session.
Mount the
/
partition of your installed OS to/mnt
sudo mount /dev/sda6 /mnt
Set up a
chroot
environment:
sudo chroot /mnt
You are now in a "fake" Linux install that treats
/mnt
as/
. This means that all the files necessary for GRUB are in/boot
where the system expects them to be and you can install GRUB just as if you were actually running your installed system:
sudo update-grub
sudo grub-install /dev/sda
Now reboot and you should see the GRUB menu appear normally.
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has aroot-device
option and what do you expect that option to do? Have you set up achroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.
– terdon♦
Oct 21 '13 at 14:19
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
@elyashiv there's not--root-directory
either. Go read my answer here that explains how to reinstall grub.
– terdon♦
Oct 21 '13 at 14:34
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
|
show 1 more comment
Follow these steps:
Boot into a Live Linux session.
Mount the
/
partition of your installed OS to/mnt
sudo mount /dev/sda6 /mnt
Set up a
chroot
environment:
sudo chroot /mnt
You are now in a "fake" Linux install that treats
/mnt
as/
. This means that all the files necessary for GRUB are in/boot
where the system expects them to be and you can install GRUB just as if you were actually running your installed system:
sudo update-grub
sudo grub-install /dev/sda
Now reboot and you should see the GRUB menu appear normally.
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has aroot-device
option and what do you expect that option to do? Have you set up achroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.
– terdon♦
Oct 21 '13 at 14:19
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
@elyashiv there's not--root-directory
either. Go read my answer here that explains how to reinstall grub.
– terdon♦
Oct 21 '13 at 14:34
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
|
show 1 more comment
Follow these steps:
Boot into a Live Linux session.
Mount the
/
partition of your installed OS to/mnt
sudo mount /dev/sda6 /mnt
Set up a
chroot
environment:
sudo chroot /mnt
You are now in a "fake" Linux install that treats
/mnt
as/
. This means that all the files necessary for GRUB are in/boot
where the system expects them to be and you can install GRUB just as if you were actually running your installed system:
sudo update-grub
sudo grub-install /dev/sda
Now reboot and you should see the GRUB menu appear normally.
Follow these steps:
Boot into a Live Linux session.
Mount the
/
partition of your installed OS to/mnt
sudo mount /dev/sda6 /mnt
Set up a
chroot
environment:
sudo chroot /mnt
You are now in a "fake" Linux install that treats
/mnt
as/
. This means that all the files necessary for GRUB are in/boot
where the system expects them to be and you can install GRUB just as if you were actually running your installed system:
sudo update-grub
sudo grub-install /dev/sda
Now reboot and you should see the GRUB menu appear normally.
edited Oct 21 '13 at 15:20
answered Oct 21 '13 at 14:06
terdon♦
128k31249423
128k31249423
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has aroot-device
option and what do you expect that option to do? Have you set up achroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.
– terdon♦
Oct 21 '13 at 14:19
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
@elyashiv there's not--root-directory
either. Go read my answer here that explains how to reinstall grub.
– terdon♦
Oct 21 '13 at 14:34
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
|
show 1 more comment
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has aroot-device
option and what do you expect that option to do? Have you set up achroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.
– terdon♦
Oct 21 '13 at 14:19
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
@elyashiv there's not--root-directory
either. Go read my answer here that explains how to reinstall grub.
– terdon♦
Oct 21 '13 at 14:34
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
I'm trying to install from the usb device. any way, I tried also without mounting - same error. can you explain the error?
– elyashiv
Oct 21 '13 at 14:11
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has a
root-device
option and what do you expect that option to do? Have you set up a chroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.– terdon♦
Oct 21 '13 at 14:19
@elyashiv please edit your question and explain what it is you are attempting. Are you attempting to rescue a broken system? Are you booting a live system from the USB? If so, tell us. What OS are you using? What makes you think GRUB has a
root-device
option and what do you expect that option to do? Have you set up a chroot
environment? Whenever you ask a question, you need to explain exactly what t is you are trying to do, we can't guess.– terdon♦
Oct 21 '13 at 14:19
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
oops, I meant -root-directory
– elyashiv
Oct 21 '13 at 14:30
@elyashiv there's not
--root-directory
either. Go read my answer here that explains how to reinstall grub.– terdon♦
Oct 21 '13 at 14:34
@elyashiv there's not
--root-directory
either. Go read my answer here that explains how to reinstall grub.– terdon♦
Oct 21 '13 at 14:34
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
look at the first answer here
– elyashiv
Oct 21 '13 at 15:13
|
show 1 more comment
Based on what was written, it looks like you're trying to install GRUB to /dev/sda. You do not want to mount the disk.
You're probably looking for:
grub-install /dev/sda
GRUB man page for reference, or you can man grub-install
from your system:
http://linux.die.net/man/8/grub-install
add a comment |
Based on what was written, it looks like you're trying to install GRUB to /dev/sda. You do not want to mount the disk.
You're probably looking for:
grub-install /dev/sda
GRUB man page for reference, or you can man grub-install
from your system:
http://linux.die.net/man/8/grub-install
add a comment |
Based on what was written, it looks like you're trying to install GRUB to /dev/sda. You do not want to mount the disk.
You're probably looking for:
grub-install /dev/sda
GRUB man page for reference, or you can man grub-install
from your system:
http://linux.die.net/man/8/grub-install
Based on what was written, it looks like you're trying to install GRUB to /dev/sda. You do not want to mount the disk.
You're probably looking for:
grub-install /dev/sda
GRUB man page for reference, or you can man grub-install
from your system:
http://linux.die.net/man/8/grub-install
answered Oct 21 '13 at 14:17
tamarintech
34014
34014
add a comment |
add a comment |
If grub says that it could not resolve canonical path of something, it means that it does not exist or realpath()
failed.
In this case, try:
$ realpath /cow
$ ls -la /cow
If both commands say "cannot find file or directory", then you have to create one.
If the second command works, but the first does not, check why realpath()
does not work. One of the reasons can be that /proc
is not mounted. In some implementations of libc, /proc/self/fd
is used to get canonical path of a file.
add a comment |
If grub says that it could not resolve canonical path of something, it means that it does not exist or realpath()
failed.
In this case, try:
$ realpath /cow
$ ls -la /cow
If both commands say "cannot find file or directory", then you have to create one.
If the second command works, but the first does not, check why realpath()
does not work. One of the reasons can be that /proc
is not mounted. In some implementations of libc, /proc/self/fd
is used to get canonical path of a file.
add a comment |
If grub says that it could not resolve canonical path of something, it means that it does not exist or realpath()
failed.
In this case, try:
$ realpath /cow
$ ls -la /cow
If both commands say "cannot find file or directory", then you have to create one.
If the second command works, but the first does not, check why realpath()
does not work. One of the reasons can be that /proc
is not mounted. In some implementations of libc, /proc/self/fd
is used to get canonical path of a file.
If grub says that it could not resolve canonical path of something, it means that it does not exist or realpath()
failed.
In this case, try:
$ realpath /cow
$ ls -la /cow
If both commands say "cannot find file or directory", then you have to create one.
If the second command works, but the first does not, check why realpath()
does not work. One of the reasons can be that /proc
is not mounted. In some implementations of libc, /proc/self/fd
is used to get canonical path of a file.
answered Mar 10 '18 at 15:29
Sauron
12
12
add a comment |
add a comment |
I get this error too, and I don't think it happens in a chroot.
Background
I think this is when systemd cannot find the path because it is mounted in a directory. So, the difference is when you setup a chroot you already configure access to hardware, including drives.
Though you can configure this access inside Systemd that does not mean you can configure permissions for those drives the same way.
For instance, I created this file:
/etc/systemd/system/systemd-nspawn@.service.d/override.conf
And it contains these settings:
[Service]
DeviceAllow=char-usb_device rwm
DeviceAllow=char-usb
[Files]
Bind=/var/cache/apt/pkgcache.bin
Bind=/var/cache/apt/srcpkgcache.bin
This still does not work when using grub-install /dev/sda
or update-grub
for a USB on Pi debootstrapped with Debian Stretch. Even using grub-uboot and grub-efi-arm there is still that error the grub-probe
cannot find the canonical path.
Not only that but though update-grub
will see and know what the operating systems are, but interestingly grub-install
does not recognize the Debian operating system is on USB.
Example
root@raspixmc:/home/pi# grub-install /dev/sda
Installing for arm-uboot platform.
grub-install: warning: no hints available for your platform. Expect
reduced performance.
grub-install: warning: WARNING: no platform-specific install was
performed.
Installation finished. No error reported.
root@raspixmc:/home/pi#
Interesting, when I create a chroot and can run update-grub
, even though I am on the operating system that I debootstrapped to the USB itself it does not see its own operating system!
root@raspixmc:/home/pi# mount /dev/sda1 /mnt
root@raspixmc:/home/pi# cd /mnt
root@raspixmc:/mnt# mount --bind /dev dev/
root@raspixmc:/mnt# mount --bind /sys sys/
root@raspixmc:/mnt# mount --bind /proc proc/
root@raspixmc:/mnt# mount --bind /dev/pts dev/pts
root@raspixmc:/mnt# chroot . bin/bash
root@raspixmc:/# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
done
root@raspixmc:/#
It only sees Raspbian. This happens only when trying to install and update GRUB inside the container, but when I exit the chroot.
Watch how it now works because I did not unmount the chroot directories:
/dev dev/
/sys sys/
/proc proc/
/dev/pts dev/pts
From outside the container mind you, I am running this command with grub-uboot
installed on Raspbian and no Grub on the USB containing debootstrapped Debian.
root@raspixmc:/mnt# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
done
root@raspixmc:/mnt#
This does not happen using one of the unofficially available images for Debian ARM, but obviously this is still a customization not yet available for debootstrapping.
Troubleshooting
Really there are times when it is better just to create a path. The only next possibility (and a probable one) is to simply write GRUB. And for that I am just going to read on this page.
https://www.dedoimedo.com/computers/grub-2.html
Another thing I want to share about this issue is a solution that might work, but realize microSD cards are very sensitive. I have been building my own Linux images and learned this fast. The best thing to do is use Qemu whenever you can, but to attempt to clear an old partition table you might try running sgdisk --zap-all
on the drive.
sgdisk --zap-all /dev/sdd
In fact, sometimes if it gives an error the first time and it is not a read-only error, you can run it again and it will finally all the partition tables new or old.
And you can use Qemu to emulate Raspberry Pi on a standard AMD/Intel-based PC. I would recommend it. I know this is more information than pertains to the original post, but I think that is likely how this error is derived. It is the container age.
add a comment |
I get this error too, and I don't think it happens in a chroot.
Background
I think this is when systemd cannot find the path because it is mounted in a directory. So, the difference is when you setup a chroot you already configure access to hardware, including drives.
Though you can configure this access inside Systemd that does not mean you can configure permissions for those drives the same way.
For instance, I created this file:
/etc/systemd/system/systemd-nspawn@.service.d/override.conf
And it contains these settings:
[Service]
DeviceAllow=char-usb_device rwm
DeviceAllow=char-usb
[Files]
Bind=/var/cache/apt/pkgcache.bin
Bind=/var/cache/apt/srcpkgcache.bin
This still does not work when using grub-install /dev/sda
or update-grub
for a USB on Pi debootstrapped with Debian Stretch. Even using grub-uboot and grub-efi-arm there is still that error the grub-probe
cannot find the canonical path.
Not only that but though update-grub
will see and know what the operating systems are, but interestingly grub-install
does not recognize the Debian operating system is on USB.
Example
root@raspixmc:/home/pi# grub-install /dev/sda
Installing for arm-uboot platform.
grub-install: warning: no hints available for your platform. Expect
reduced performance.
grub-install: warning: WARNING: no platform-specific install was
performed.
Installation finished. No error reported.
root@raspixmc:/home/pi#
Interesting, when I create a chroot and can run update-grub
, even though I am on the operating system that I debootstrapped to the USB itself it does not see its own operating system!
root@raspixmc:/home/pi# mount /dev/sda1 /mnt
root@raspixmc:/home/pi# cd /mnt
root@raspixmc:/mnt# mount --bind /dev dev/
root@raspixmc:/mnt# mount --bind /sys sys/
root@raspixmc:/mnt# mount --bind /proc proc/
root@raspixmc:/mnt# mount --bind /dev/pts dev/pts
root@raspixmc:/mnt# chroot . bin/bash
root@raspixmc:/# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
done
root@raspixmc:/#
It only sees Raspbian. This happens only when trying to install and update GRUB inside the container, but when I exit the chroot.
Watch how it now works because I did not unmount the chroot directories:
/dev dev/
/sys sys/
/proc proc/
/dev/pts dev/pts
From outside the container mind you, I am running this command with grub-uboot
installed on Raspbian and no Grub on the USB containing debootstrapped Debian.
root@raspixmc:/mnt# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
done
root@raspixmc:/mnt#
This does not happen using one of the unofficially available images for Debian ARM, but obviously this is still a customization not yet available for debootstrapping.
Troubleshooting
Really there are times when it is better just to create a path. The only next possibility (and a probable one) is to simply write GRUB. And for that I am just going to read on this page.
https://www.dedoimedo.com/computers/grub-2.html
Another thing I want to share about this issue is a solution that might work, but realize microSD cards are very sensitive. I have been building my own Linux images and learned this fast. The best thing to do is use Qemu whenever you can, but to attempt to clear an old partition table you might try running sgdisk --zap-all
on the drive.
sgdisk --zap-all /dev/sdd
In fact, sometimes if it gives an error the first time and it is not a read-only error, you can run it again and it will finally all the partition tables new or old.
And you can use Qemu to emulate Raspberry Pi on a standard AMD/Intel-based PC. I would recommend it. I know this is more information than pertains to the original post, but I think that is likely how this error is derived. It is the container age.
add a comment |
I get this error too, and I don't think it happens in a chroot.
Background
I think this is when systemd cannot find the path because it is mounted in a directory. So, the difference is when you setup a chroot you already configure access to hardware, including drives.
Though you can configure this access inside Systemd that does not mean you can configure permissions for those drives the same way.
For instance, I created this file:
/etc/systemd/system/systemd-nspawn@.service.d/override.conf
And it contains these settings:
[Service]
DeviceAllow=char-usb_device rwm
DeviceAllow=char-usb
[Files]
Bind=/var/cache/apt/pkgcache.bin
Bind=/var/cache/apt/srcpkgcache.bin
This still does not work when using grub-install /dev/sda
or update-grub
for a USB on Pi debootstrapped with Debian Stretch. Even using grub-uboot and grub-efi-arm there is still that error the grub-probe
cannot find the canonical path.
Not only that but though update-grub
will see and know what the operating systems are, but interestingly grub-install
does not recognize the Debian operating system is on USB.
Example
root@raspixmc:/home/pi# grub-install /dev/sda
Installing for arm-uboot platform.
grub-install: warning: no hints available for your platform. Expect
reduced performance.
grub-install: warning: WARNING: no platform-specific install was
performed.
Installation finished. No error reported.
root@raspixmc:/home/pi#
Interesting, when I create a chroot and can run update-grub
, even though I am on the operating system that I debootstrapped to the USB itself it does not see its own operating system!
root@raspixmc:/home/pi# mount /dev/sda1 /mnt
root@raspixmc:/home/pi# cd /mnt
root@raspixmc:/mnt# mount --bind /dev dev/
root@raspixmc:/mnt# mount --bind /sys sys/
root@raspixmc:/mnt# mount --bind /proc proc/
root@raspixmc:/mnt# mount --bind /dev/pts dev/pts
root@raspixmc:/mnt# chroot . bin/bash
root@raspixmc:/# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
done
root@raspixmc:/#
It only sees Raspbian. This happens only when trying to install and update GRUB inside the container, but when I exit the chroot.
Watch how it now works because I did not unmount the chroot directories:
/dev dev/
/sys sys/
/proc proc/
/dev/pts dev/pts
From outside the container mind you, I am running this command with grub-uboot
installed on Raspbian and no Grub on the USB containing debootstrapped Debian.
root@raspixmc:/mnt# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
done
root@raspixmc:/mnt#
This does not happen using one of the unofficially available images for Debian ARM, but obviously this is still a customization not yet available for debootstrapping.
Troubleshooting
Really there are times when it is better just to create a path. The only next possibility (and a probable one) is to simply write GRUB. And for that I am just going to read on this page.
https://www.dedoimedo.com/computers/grub-2.html
Another thing I want to share about this issue is a solution that might work, but realize microSD cards are very sensitive. I have been building my own Linux images and learned this fast. The best thing to do is use Qemu whenever you can, but to attempt to clear an old partition table you might try running sgdisk --zap-all
on the drive.
sgdisk --zap-all /dev/sdd
In fact, sometimes if it gives an error the first time and it is not a read-only error, you can run it again and it will finally all the partition tables new or old.
And you can use Qemu to emulate Raspberry Pi on a standard AMD/Intel-based PC. I would recommend it. I know this is more information than pertains to the original post, but I think that is likely how this error is derived. It is the container age.
I get this error too, and I don't think it happens in a chroot.
Background
I think this is when systemd cannot find the path because it is mounted in a directory. So, the difference is when you setup a chroot you already configure access to hardware, including drives.
Though you can configure this access inside Systemd that does not mean you can configure permissions for those drives the same way.
For instance, I created this file:
/etc/systemd/system/systemd-nspawn@.service.d/override.conf
And it contains these settings:
[Service]
DeviceAllow=char-usb_device rwm
DeviceAllow=char-usb
[Files]
Bind=/var/cache/apt/pkgcache.bin
Bind=/var/cache/apt/srcpkgcache.bin
This still does not work when using grub-install /dev/sda
or update-grub
for a USB on Pi debootstrapped with Debian Stretch. Even using grub-uboot and grub-efi-arm there is still that error the grub-probe
cannot find the canonical path.
Not only that but though update-grub
will see and know what the operating systems are, but interestingly grub-install
does not recognize the Debian operating system is on USB.
Example
root@raspixmc:/home/pi# grub-install /dev/sda
Installing for arm-uboot platform.
grub-install: warning: no hints available for your platform. Expect
reduced performance.
grub-install: warning: WARNING: no platform-specific install was
performed.
Installation finished. No error reported.
root@raspixmc:/home/pi#
Interesting, when I create a chroot and can run update-grub
, even though I am on the operating system that I debootstrapped to the USB itself it does not see its own operating system!
root@raspixmc:/home/pi# mount /dev/sda1 /mnt
root@raspixmc:/home/pi# cd /mnt
root@raspixmc:/mnt# mount --bind /dev dev/
root@raspixmc:/mnt# mount --bind /sys sys/
root@raspixmc:/mnt# mount --bind /proc proc/
root@raspixmc:/mnt# mount --bind /dev/pts dev/pts
root@raspixmc:/mnt# chroot . bin/bash
root@raspixmc:/# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
done
root@raspixmc:/#
It only sees Raspbian. This happens only when trying to install and update GRUB inside the container, but when I exit the chroot.
Watch how it now works because I did not unmount the chroot directories:
/dev dev/
/sys sys/
/proc proc/
/dev/pts dev/pts
From outside the container mind you, I am running this command with grub-uboot
installed on Raspbian and no Grub on the USB containing debootstrapped Debian.
root@raspixmc:/mnt# update-grub
Generating grub configuration file ...
Found Raspbian GNU/Linux 9 (stretch) on /dev/mmcblk0p2
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
done
root@raspixmc:/mnt#
This does not happen using one of the unofficially available images for Debian ARM, but obviously this is still a customization not yet available for debootstrapping.
Troubleshooting
Really there are times when it is better just to create a path. The only next possibility (and a probable one) is to simply write GRUB. And for that I am just going to read on this page.
https://www.dedoimedo.com/computers/grub-2.html
Another thing I want to share about this issue is a solution that might work, but realize microSD cards are very sensitive. I have been building my own Linux images and learned this fast. The best thing to do is use Qemu whenever you can, but to attempt to clear an old partition table you might try running sgdisk --zap-all
on the drive.
sgdisk --zap-all /dev/sdd
In fact, sometimes if it gives an error the first time and it is not a read-only error, you can run it again and it will finally all the partition tables new or old.
And you can use Qemu to emulate Raspberry Pi on a standard AMD/Intel-based PC. I would recommend it. I know this is more information than pertains to the original post, but I think that is likely how this error is derived. It is the container age.
edited Jul 25 '18 at 14:03
answered Jul 24 '18 at 15:33
w3techie
11
11
add a comment |
add a comment |
For anyone struggling with this who is attempting to use a live USB or other means of chroot to reinstall or install grub - I've dealt with this a few times and forgot to document it before although I intended to.
The problem you face is grub doesn't have access to the path you are referring to either as the source (/boot) or the destination (can your system and chroot see /dev/sda for example?) or both. When you prepare to chroot you create bind mounts that are accessible in the chroot environment, or you do so within the chroot using mount -t. There are so many guides online that do it either way.
You need to make sure you bind /dev or just the specific partition(s) containing the boot files in /boot (e.g. /dev/sda1). /boot is either a separate partition or a directory in / The chroot needs access to the drive that you will be (re)installing grub to so do fdisk -l in the chroot to make sure you can see the device listed in the output. Also note, if you don't have a separate boot partition, but you do have a boot directory in /root with the boot files (not just a mount point) then you only have to mount the partition containing root. You then don't have to mount anything to /root/boot.
You also need to make sure you bind the proc fileystem and the sys filesystem, but every guide I've seen has those two. I've just seen /dev missed out sometimes. There might be some cases when you don't need it, but I don't know of them.
tl;dr: make sure you bind mount /dev
Why are you talking aboutchroot
when the question isn't about`` chroot``?
– G-Man
Dec 19 '18 at 4:05
add a comment |
For anyone struggling with this who is attempting to use a live USB or other means of chroot to reinstall or install grub - I've dealt with this a few times and forgot to document it before although I intended to.
The problem you face is grub doesn't have access to the path you are referring to either as the source (/boot) or the destination (can your system and chroot see /dev/sda for example?) or both. When you prepare to chroot you create bind mounts that are accessible in the chroot environment, or you do so within the chroot using mount -t. There are so many guides online that do it either way.
You need to make sure you bind /dev or just the specific partition(s) containing the boot files in /boot (e.g. /dev/sda1). /boot is either a separate partition or a directory in / The chroot needs access to the drive that you will be (re)installing grub to so do fdisk -l in the chroot to make sure you can see the device listed in the output. Also note, if you don't have a separate boot partition, but you do have a boot directory in /root with the boot files (not just a mount point) then you only have to mount the partition containing root. You then don't have to mount anything to /root/boot.
You also need to make sure you bind the proc fileystem and the sys filesystem, but every guide I've seen has those two. I've just seen /dev missed out sometimes. There might be some cases when you don't need it, but I don't know of them.
tl;dr: make sure you bind mount /dev
Why are you talking aboutchroot
when the question isn't about`` chroot``?
– G-Man
Dec 19 '18 at 4:05
add a comment |
For anyone struggling with this who is attempting to use a live USB or other means of chroot to reinstall or install grub - I've dealt with this a few times and forgot to document it before although I intended to.
The problem you face is grub doesn't have access to the path you are referring to either as the source (/boot) or the destination (can your system and chroot see /dev/sda for example?) or both. When you prepare to chroot you create bind mounts that are accessible in the chroot environment, or you do so within the chroot using mount -t. There are so many guides online that do it either way.
You need to make sure you bind /dev or just the specific partition(s) containing the boot files in /boot (e.g. /dev/sda1). /boot is either a separate partition or a directory in / The chroot needs access to the drive that you will be (re)installing grub to so do fdisk -l in the chroot to make sure you can see the device listed in the output. Also note, if you don't have a separate boot partition, but you do have a boot directory in /root with the boot files (not just a mount point) then you only have to mount the partition containing root. You then don't have to mount anything to /root/boot.
You also need to make sure you bind the proc fileystem and the sys filesystem, but every guide I've seen has those two. I've just seen /dev missed out sometimes. There might be some cases when you don't need it, but I don't know of them.
tl;dr: make sure you bind mount /dev
For anyone struggling with this who is attempting to use a live USB or other means of chroot to reinstall or install grub - I've dealt with this a few times and forgot to document it before although I intended to.
The problem you face is grub doesn't have access to the path you are referring to either as the source (/boot) or the destination (can your system and chroot see /dev/sda for example?) or both. When you prepare to chroot you create bind mounts that are accessible in the chroot environment, or you do so within the chroot using mount -t. There are so many guides online that do it either way.
You need to make sure you bind /dev or just the specific partition(s) containing the boot files in /boot (e.g. /dev/sda1). /boot is either a separate partition or a directory in / The chroot needs access to the drive that you will be (re)installing grub to so do fdisk -l in the chroot to make sure you can see the device listed in the output. Also note, if you don't have a separate boot partition, but you do have a boot directory in /root with the boot files (not just a mount point) then you only have to mount the partition containing root. You then don't have to mount anything to /root/boot.
You also need to make sure you bind the proc fileystem and the sys filesystem, but every guide I've seen has those two. I've just seen /dev missed out sometimes. There might be some cases when you don't need it, but I don't know of them.
tl;dr: make sure you bind mount /dev
answered Dec 19 '18 at 3:24
user327540
1
1
Why are you talking aboutchroot
when the question isn't about`` chroot``?
– G-Man
Dec 19 '18 at 4:05
add a comment |
Why are you talking aboutchroot
when the question isn't about`` chroot``?
– G-Man
Dec 19 '18 at 4:05
Why are you talking about
chroot
when the question isn't about`` chroot``?– G-Man
Dec 19 '18 at 4:05
Why are you talking about
chroot
when the question isn't about`` chroot``?– G-Man
Dec 19 '18 at 4:05
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f96977%2fgrub-wont-install%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
OK, that edit is a step in the right direction. Are we to assume that you already have a Linux system installed? Does it boot from
sda6
? Does my answer here help?– terdon♦
Oct 21 '13 at 14:34