You are not logged in.

#1 2014-06-18 13:16:55

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

[SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

hi everyone,

(Edit)
I encounter this issue: The shutdown process takes much more time than usual to proceed, (about 20" to 1 minute, against a couple of seconds before)
It displays an error message, repeated for hundreds of times, before to finally turn off the computer.

device-mapper: remove ioctl on root failed: Device or resource busy

(Notice lvm on luks configuration installed with lot of help.)
The laptop usualy has 2 other non-encrypted devices plugged in:
- one SSD Card. containing the luks key to boot without asking the passphrase (which works fine)
- one external hard drive.
However, the issue happens with theese devices mounted or not.

Notice that It is a lvm ON luks configuration.
Here the result of lsblk -f, to have a clear view on devices:

% lsblk -f 
NAME              FSTYPE      LABEL      UUID                                   MOUNTPOINT
sda                                                                             
├─sda1            ext4                   322d1dd7-5902-45e8-afe4-b5f912967b28   /boot
└─sda2            crypto_LUKS            f3fff5f5-b041-46e5-8749-01143684eb21   
  └─main          LVM2_member            f1T4qO-XAfD-8TYs-gTbO-JzzQ-jX0E-vGvE8h 
    ├─main-syst   ext4                   12b8cae3-897a-4d5b-9d7b-06bb54344d47   /
    ├─main-usr    ext4                   dda9f80d-f926-4fef-8438-7229117157b2   /usr
    ├─main-var    ext4                   da735d67-318f-4684-a1cb-e8803afe3de9   /var
    ├─main-home   ext4                   2920b1cb-145b-4b7e-a608-c7692cfdfb52   /home
    ├─main-srv    ext4                   5380d8f9-a783-4c2b-b900-c9919ebea07a   /srv
    ├─main-opt    ext4                   354028d1-3f51-497b-8654-2d9fb73648bc   /opt
    ├─main-swap   swap                   00a4ddd0-c4ed-4bcd-8080-a8c198de7d0d   [SWAP]
    └─main-jarlax ext4                   57a32943-1da8-4218-ae82-906e92bb4978   /mnt/Me
sdb                                                                             
└─sdb1            ext2        SD1GB      7ea4a77e-b639-4862-9503-4d8d612aaa7a   /media/Boot
sdc                                                                             
└─sdc1            ext4        ExtHD	 3fca6c29-1988-4ccd-9d84-dec5b44ffe80   /run/media/me/ExtHD

And here a couple of configuration files' lines that might be relevant:

- /etc/mkinitcpio.conf's HOOKS:

HOOKS="base udev autodetect modconf block encrypt lvm2 shutdown usr filesystems keyboard fsck"

- /etc/fstab (SSD_card's line):

UUID=7ea4a77e-b639-4862-9503-4d8d612aaa7a 	/media/Boot    	ext2      	defaults,noauto	0 2 

- /etc/default/grub's default line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet cryptdevice=/dev/sda2:main cryptkey=/dev/disk/by-uuid/7ea4a77e-b639-4862-9503-4d8d612aaa7a:ext2:/secretkey init=/usr/lib/systemd/systemd allow-discards root_trim=yes" 

From the Dm-crypt's wiki, I replaced root by main. In this case, the error message just changes the concerned device accordingly.

I tried to follow This thread, but I get confused since it doesn't seem to be related to the plugged in devices, I didn't really know what to do with it.

Do you have any idea ?

Last edited by OlaffTheGreat (2014-07-06 18:47:05)


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#2 2014-06-18 15:24:03

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,175
Website

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

I get this with both my LVM on LUKS setups (both on laptops with HDDs), but I've had no problems so I'm not worried.


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#3 2014-06-18 17:40:19

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Do you have just one of the message then turn off ?
Perhaps I had to precise there are a bunch of those messages running for around 20" before turning off. (I go for an edit).
The fact is I had none of these messages originaly.


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#4 2014-06-18 18:12:46

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,175
Website

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

OlaffTheGreat wrote:

Do you have just one of the message then turn off ?
Perhaps I had to precise there are a bunch of those messages running for around 20" before turning off. (I go for an edit).

No, when I get the message (on about half of my shutdowns), I usually get something close to 60/80 before turning off.


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#5 2014-06-18 19:15:57

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,496

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

What happens when you remove the "shutdown" hook?


The painting in my profile is "Eros" by Paul Klee. He is credited in the lower left, but that got blurry during the downscale.

Offline

#6 2014-06-18 19:47:42

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,175
Website

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Strike0 wrote:

What happens when you remove the "shutdown" hook?

Last time I did that after that mkinitcpio update, nothing changed with regards to that message. IIRC, I did start having problems shutting down altogether.

I'll have a play around tomorrow with it.

EDIT: A quick re-build of [core] and the message seems to have disappeared for now, with no problems. I'll give it a few more days with the myriad of other kernels I play around with to see what happens.

Last edited by clfarron4 (2014-06-18 20:14:10)


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#7 2014-06-18 20:26:43

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Strike0 wrote:

What happens when you remove the "shutdown" hook?

I reboot the machine tonight, I'll see if I have a similar result than clfarron4
However, I see in the wiki that this shutdown hook is "strongly recommended" in case of a separated /usr, which is my case.

A quick re-build of [core] and the message seems to have disappeared for now, with no problems. I'll give it a few more days with the myriad of other kernels I play around with to see what happens.

I look forward your results too.
And what do you mean by "a quick" rebuild?

Last edited by OlaffTheGreat (2014-06-18 20:32:27)


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#8 2014-06-18 22:10:53

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

So, it turned out removing shutdown hook didn't affect the error. Still long time to turn off.


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#9 2014-06-18 22:40:44

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

For whatever it is worth, I get this too. Sometimes I get issues on reboot but that seems to be entirely independent of the errors and they have seemed to be little more than a cosmetic issue. [That is, I've been ignoring them.]


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#10 2014-06-19 09:29:20

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

mmh... Perhaps I shall rename the title, and insist in the 1st post on the fact the system takes a long time to turn off than usual.
The error message itself does not disturb me. It is more the hundred of them for 20 - 30" before to shutdown that does.

So the problem would not be the unmounting of the device, but the time it takes to do so.


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#11 2014-06-19 18:52:31

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,496

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Just to reconfirm: you did re-generate the initramfs after removing the hook, yes?
Another question: was there a specific reason to put "init=" on the kernel line? I remember reading about some users' problems without it, but it should not be necessary.

Your grub options for "discard" are not valid on Arch btw, the ones you have are for debian (this should not cause the delay). Please post the full kernel line from /boot/grub/grub.cfg.

To troubleshoot it yourself further, have a look at: http://freedesktop.org/wiki/Software/sy … eventually


The painting in my profile is "Eros" by Paul Klee. He is credited in the lower left, but that got blurry during the downscale.

Offline

#12 2014-06-19 18:55:02

clfarron4
Member
From: London, UK
Registered: 2013-06-28
Posts: 2,175
Website

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

OlaffTheGreat wrote:
clfarron4 wrote:

A quick re-build of [core] and the message seems to have disappeared for now, with no problems. I'll give it a few more days with the myriad of other kernels I play around with to see what happens.

I look forward your results too.
And what do you mean by "a quick" rebuild?

I issued the following command to re-build the initramfs only and rebooted a few times after removing shutdown from my hooks line in /etc/mkinitcpio.conf (instead of re-installing the kernel):

 sudo mkinitcpio -p linux 

Last edited by clfarron4 (2014-06-19 18:55:40)


Claire is fine.
Problems? I have dysgraphia, so clear and concise please.
My public GPG key for package signing
My x86_64 package repository

Offline

#13 2014-06-22 09:33:09

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

...too much work this days... exhausted!

So,
@Strike0: I indeed re-generated the initramfs after have remove the shutdown hook with $ mkinitcpio -p linux, and once again after putting back the shutdown.

About grub. in fact, I followed the wiki page, 'Basic configuration'/'Aditional arguments'.
I  did read from posts too,   also telling about init=/usr/lib/systemd/systemd. I still can try without this option.

Concerning the discard option, thank you to mention it. Informations related to SSD settings are "a bit everywhere", and not always clear ot accurate.
So, I tried to read from different sources, trying to gather and sort all different informations, but obviously I need some more cleaning!

Here an extract from /boot/grub/grub.cfg

linux	/vmlinuz-linux-lts root=UUID=12b8cae3-897a-4d5b-9d7b-06bb54344d47 rw  quiet cryptdevice=/dev/sda2:main cryptkey=/dev/disk/by-uuid/7ea4a77e-b639-4862-9503-4d8d612aaa7a:ext2:/secretkey init=/usr/lib/systemd/systemd allow-discards root_trim=yes

If necessary, here a pastebin.

Finally, I followed the proceedure from the link you suggested. Here the results of the shutdown.txt from the debug.sh script:
The end says:

[  229.825525] systemd-shutdown[3375]: Spawned /usr/lib/systemd/system-shutdown/debug.sh as 3376.
[  229.825804] systemd-shutdown[3375]: Spawned /usr/lib/systemd/system-shutdown/mdadm.shutdown as 3377.
[  229.920788] EXT4-fs (dm-1): re-mounted. Opts: data=ordered,commit=600

However, from the 2nd boot, instead It says "Not all DM devices attached", so here the pastebin.

@clfarron4
First, I only gave one reboot without the shutdown hook.
After have read your reply, I rebooted the system a couple of time to see if any change. No change.


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#14 2014-06-23 20:20:07

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Issue update:
it seems the shutdown time increases. It is now about one minute before turn off


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#15 2014-06-30 09:08:31

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Shutdown proceedure is up to 1 mn 30 seconds now


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

#16 2014-07-03 17:51:15

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,496

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Maybe someone else does, but I don't see any reason hinting towards the lengthy shutdown in the script output in the pastebin.
The error you mention:

[   48.676489] systemd-shutdown[1]: Detaching DM 254:8.
[   48.676518] device-mapper: ioctl: ioctl interface mismatch: kernel(4.24.0), user(4.27.0), cmd(4)
[   48.676541] systemd-shutdown[1]: Could not detach DM /dev/dm-8: Invalid argument

you can ignore in that respect (I would say).
Something you want to follow up:

[   31.282084] EXT4-fs (sdb1): warning: mounting unchecked fs, running e2fsck is recommended
[   31.291351] EXT4-fs (sdb1): mounted filesystem without journal. Opts: (null)

What happens, if you manually unmount "sdb" and "sdc" in the console before you shutdown?


The painting in my profile is "Eros" by Paul Klee. He is credited in the lower left, but that got blurry during the downscale.

Offline

#17 2014-07-04 09:50:33

OlaffTheGreat
Member
Registered: 2013-06-03
Posts: 107

Re: [SOLVED] shutdown too long. "device-mapper: remove ioctl failed"

Umount sdb or sdc just before shutdown has no effect on the issue, nor does not to mount any of them.

However, I performed an e2fsck on sdb1 (which is the sdcard with the luks key to auto connect) ,
it seems to have solved the issue.
But since the issue appeared also without this sdb1 sdcard plugged, (but does not after the e2fsck proceedure),
I would prefere to wait and observe the system a little longer before to mark the thread as [solved].

FYI, another point perhaps also related that I didn't realize before:
The system disables the wifi card into the BIOS, close to each time.
(I didn't see it before because the laptop was connected only to a wire for a while)
But same thing, the boot after e2fsck worked well.
Again, I'll wait a little before to mark the thread solved.

I thank you all for your time and help.


Lenovo Thinkpad x230 i5-3320M 2.6GHz 250GB SSD (M4) 16GB
SSD | SeaBIOS | GPT | BTRFS | OpenRC | Xfce4 | Zsh | Tmux | Spacemacs
* "Aware Newbie" *
Ibus IM for language script support (e.g. 日本語 - 中文)

Offline

Board footer

Powered by FluxBB