You are not logged in.
Often it happens that I insert a USB storage device, and then expect it to find it in the output of
sudo fdisk -lbut I don't.
At that point I just reboot the machine, and the command above will show the device too. No need for me to even remove and re-plug the USB device.
So something must be happening while my system is up.
Is there something I can do now (I've just rebooted, so the USB has been detected) or next time the issue occurs to gather more info for you to help me?
At https://wiki.archlinux.org/title/USB_storage_devices, the https://wiki.archlinux.org/title/USB_st … e_detected section doesn't seem to apply to me, because in my case a reboot is enough to get the USBs detected.
Last edited by Enrico1989 (2026-02-24 10:50:53)
Offline
Next time it happens, check uname -r and pacman -Q linux (substitute with your kernel package). This usually happens because you've updated the kernel and don't have the necessary modules loaded. Since the modules for the old kernel are no longer on disk, it can't load anything new.
Offline
Well, I suppose given I often keep the system up for days and days, and that I'm running pacman -Syu everytime I see even a single update, I suppose it's most likely that's exactly what's happening.
(substitute with your kernel package)
pacman -Q linux tab-completes to just
linux linux-api-headers linux-firmware-whence linux-headersaccording to that and to https://wiki.archlinux.org/title/Kernel, I assume I've got the "linux" kernel package, right?
Next time it happens, check uname -r and pacman -Q linux
I suppose the expectation is that the former would give me an older version than the latter?
So is there nothing I can check now to verify that between the last boot and the previous one there was indeed a kernel update?
Offline
Check the /var/log/pacman.log if the previous update included the linux package that will be the relevant difference.
Offline
Although it is recommended to boot new kernel as soon as it is updated, sometimes you can't reboot immediately. To avoid lack of modules in such situation you can force some modules to be always loaded after boot.
E.g. in /etc/modules-load.d/usb.conf:
usb_storage
uas/etc/modules-load.d/filesystem.conf:
vfat
nls_utf8
nls_cp437
nls_iso8859-1Drawback is some tiny extra RAM usage. There is also another option to load important modules in kernel hook before update, but it's more tricky.
Offline
If you can get kernel logs from the last few boots (journalctl or something) then the first few lines of each log should tell which kernel version was booted.
Next time you see something like that it would make sense to run dmesg and see the final lines - was the device detected, are any drivers loading, are there any errors.
Last edited by mmy8x (2026-02-23 23:41:40)
Offline
Check the /var/log/pacman.log if the previous update included the linux package that will be the relevant difference.
Thanks.
For my own reference, this tells me when the last update to the linux package occurred:
grep ' linux ' /var/log/pacman.log | tail -1
/var/log/pacman.log:[2026-02-14T10:18:05+0100] [ALPM] upgraded linux (6.18.8.arch2-1 -> 6.18.9.arch1-2)so last update to linux was on February the 14th.
This tells me the first time yesterday I was surprised running fdisk wouldn't show the usb drive I had physically plugged in:
history | grep ' 23/02/26 .* fdisk' | head -1
25097 23/02/26 14:11:55 sudo fdisk -lThis tells me the times of the last reboots:
for ((i=0; i<5; ++i)); do journalctl -b -$i 2>/dev/null | head -n 1; done | tac | cut -d' ' -f 1-3
Jan 30 23:13:28
Feb 03 17:00:05
Feb 10 17:00:56
Feb 23 14:19:34
Feb 24 07:41:38So yeah, when I experienced the issue, I had not rebooted since the last update to the linux package, and rebooting fixed the issue.
Although it is recommended to boot new kernel as soon as it is updated
I should keep this in mind!
Offline
If you want to fix this more globally: https://archlinux.org/packages/extra/an … ules-hook/ contains alpm hooks and systemd services to maintain at least a current boot's worth of kernel modules and cleaning them up once booted into a new one.
Offline
I have a simple follow up question regarding this
pacman -Q linux (substitute with your kernel package)
I suppose the various "linux-*"-named packages at https://wiki.archlinux.org/title/Kernel are alternative kernels that might be in use, but what is the programmatic way to determine the name of the kernel package in use on a system?
Even uname -a doesn't seem to contain the name of the package.
(I'm asking because I show the number of available updates in a status bar, and I could change the message to tell if one if the updates is the kernel update, so I know I have to reboot afterwards.)
Offline
what is the programmatic way to determine the name of the kernel package in use on a system?
The kernel is identified by version string including EXTRAVERSION suffix, not by package name. I have written small python program "linux-version" to extract version string from vmlinuz image. I use it in shell script to list running and installed versions:
#!/bin/bash
echo -n "Running: "; uname -r
for file in /usr/lib/modules/*/vmlinuz; do
echo -n "Installed: "
linux-version "$file" | sed 's/ .*$//'
doneYou can also iterate installed /usr/lib/modules/*/vmlinuz files, and if vmlinuz version matches "uname -r" value, query which package owns that vmlinuz file with "pacman -Qoq /path/to/vmlinuz".
Offline
You can also iterate installed /usr/lib/modules/*/vmlinuz files, and if vmlinuz version matches "uname -r" value
Ah, I just realized this won't work if update already happened. So you should scan installed images right after boot before any update may happen, and store package name somewhere.
Or try to parse suffix from the version string, e.g.
#!/bin/bash
flavor()
{
sed -n 's/.*-\([[:alpha:]_]\+\).*/\1/p'
}
running_flavor=$(uname -r | flavor)
linux_package=''
for file in /usr/lib/modules/*/vmlinuz; do
if [[ $(linux-version "$file" | flavor) == "$running_flavor" ]]; then
linux_package=$(pacman -Qoq "$file")
break;
fi
done
if [[ -n "$linux_package" ]]; then
echo "Running kernel from package '$linux_package'"
else
echo "Running kernel from unknown package"
fiHowever, this is volatile to version naming policy.
Last edited by dimich (2026-03-01 02:07:16)
Offline