udev rule triggers error “Read-only file system”
I created an udev rule that launches a shell script that creates a directory /media/my-disk when some specific USB HD is connected. It has been working many months, but after a reboot (probably some packages were updated) it shows the following message (in syslog) everytime I plug the drive in:
mkdir: cannot create directory '/media/my-disk': Read-only file system
I have added the following lines to the script:
whoami
mount
And the result is:
root
usb-mount.sh: /dev/mapper/sda3_crypt on / type btrfs (ro,relatime,ssd,space_cache,subvolid=257,subvol=/@)
So it seems udev is seeing the root filesystem as readonly, but if I execute sudo mount manually it shows it mounted as read/write:
/dev/mapper/sda3_crypt on / type btrfs (rw,relatime,ssd,space_cache,subvolid=257,subvol=/@)
I've searched on the Internet and I've found the same exact problem but without a solution:
https://www.raspberrypi.org/forums/viewtopic.php?t=210243
Restarting the udev service solves the problem until the next reboot.
What can I check solve it permanently?
NOTE: I am running Ubuntu 18.04.1 LTS
ubuntu udev
add a comment |
I created an udev rule that launches a shell script that creates a directory /media/my-disk when some specific USB HD is connected. It has been working many months, but after a reboot (probably some packages were updated) it shows the following message (in syslog) everytime I plug the drive in:
mkdir: cannot create directory '/media/my-disk': Read-only file system
I have added the following lines to the script:
whoami
mount
And the result is:
root
usb-mount.sh: /dev/mapper/sda3_crypt on / type btrfs (ro,relatime,ssd,space_cache,subvolid=257,subvol=/@)
So it seems udev is seeing the root filesystem as readonly, but if I execute sudo mount manually it shows it mounted as read/write:
/dev/mapper/sda3_crypt on / type btrfs (rw,relatime,ssd,space_cache,subvolid=257,subvol=/@)
I've searched on the Internet and I've found the same exact problem but without a solution:
https://www.raspberrypi.org/forums/viewtopic.php?t=210243
Restarting the udev service solves the problem until the next reboot.
What can I check solve it permanently?
NOTE: I am running Ubuntu 18.04.1 LTS
ubuntu udev
add a comment |
I created an udev rule that launches a shell script that creates a directory /media/my-disk when some specific USB HD is connected. It has been working many months, but after a reboot (probably some packages were updated) it shows the following message (in syslog) everytime I plug the drive in:
mkdir: cannot create directory '/media/my-disk': Read-only file system
I have added the following lines to the script:
whoami
mount
And the result is:
root
usb-mount.sh: /dev/mapper/sda3_crypt on / type btrfs (ro,relatime,ssd,space_cache,subvolid=257,subvol=/@)
So it seems udev is seeing the root filesystem as readonly, but if I execute sudo mount manually it shows it mounted as read/write:
/dev/mapper/sda3_crypt on / type btrfs (rw,relatime,ssd,space_cache,subvolid=257,subvol=/@)
I've searched on the Internet and I've found the same exact problem but without a solution:
https://www.raspberrypi.org/forums/viewtopic.php?t=210243
Restarting the udev service solves the problem until the next reboot.
What can I check solve it permanently?
NOTE: I am running Ubuntu 18.04.1 LTS
ubuntu udev
I created an udev rule that launches a shell script that creates a directory /media/my-disk when some specific USB HD is connected. It has been working many months, but after a reboot (probably some packages were updated) it shows the following message (in syslog) everytime I plug the drive in:
mkdir: cannot create directory '/media/my-disk': Read-only file system
I have added the following lines to the script:
whoami
mount
And the result is:
root
usb-mount.sh: /dev/mapper/sda3_crypt on / type btrfs (ro,relatime,ssd,space_cache,subvolid=257,subvol=/@)
So it seems udev is seeing the root filesystem as readonly, but if I execute sudo mount manually it shows it mounted as read/write:
/dev/mapper/sda3_crypt on / type btrfs (rw,relatime,ssd,space_cache,subvolid=257,subvol=/@)
I've searched on the Internet and I've found the same exact problem but without a solution:
https://www.raspberrypi.org/forums/viewtopic.php?t=210243
Restarting the udev service solves the problem until the next reboot.
What can I check solve it permanently?
NOTE: I am running Ubuntu 18.04.1 LTS
ubuntu udev
ubuntu udev
asked Aug 16 '18 at 17:52
KilianKilian
11
11
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I see two possibilities:
- The
systemd-udevdprocess was started before the root filesystem was remounted read-write, and see it read-only. - The
systemd-udevdprocess is constraint by some security mechanism, AppArmor in the Ubuntu case.
But the fact that it works when you restart udev manually strongly indicates the first possibility. I would try to remount the rootfs read-write in usb-mount.sh, with a command like:
mount -o remount,rw /
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%2f463031%2fudev-rule-triggers-error-read-only-file-system%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
I see two possibilities:
- The
systemd-udevdprocess was started before the root filesystem was remounted read-write, and see it read-only. - The
systemd-udevdprocess is constraint by some security mechanism, AppArmor in the Ubuntu case.
But the fact that it works when you restart udev manually strongly indicates the first possibility. I would try to remount the rootfs read-write in usb-mount.sh, with a command like:
mount -o remount,rw /
add a comment |
I see two possibilities:
- The
systemd-udevdprocess was started before the root filesystem was remounted read-write, and see it read-only. - The
systemd-udevdprocess is constraint by some security mechanism, AppArmor in the Ubuntu case.
But the fact that it works when you restart udev manually strongly indicates the first possibility. I would try to remount the rootfs read-write in usb-mount.sh, with a command like:
mount -o remount,rw /
add a comment |
I see two possibilities:
- The
systemd-udevdprocess was started before the root filesystem was remounted read-write, and see it read-only. - The
systemd-udevdprocess is constraint by some security mechanism, AppArmor in the Ubuntu case.
But the fact that it works when you restart udev manually strongly indicates the first possibility. I would try to remount the rootfs read-write in usb-mount.sh, with a command like:
mount -o remount,rw /
I see two possibilities:
- The
systemd-udevdprocess was started before the root filesystem was remounted read-write, and see it read-only. - The
systemd-udevdprocess is constraint by some security mechanism, AppArmor in the Ubuntu case.
But the fact that it works when you restart udev manually strongly indicates the first possibility. I would try to remount the rootfs read-write in usb-mount.sh, with a command like:
mount -o remount,rw /
answered Feb 5 at 9:14
Olivier L.Olivier L.
1
1
add a comment |
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%2f463031%2fudev-rule-triggers-error-read-only-file-system%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