auto mount.ntfs read-only when boot grml.iso which store on a ntfs partition
grml is useful for testing software installation. My PC just have one MBR partition and installed Windows 10 22H2. I am going to use grub-2.12-for-windows to load my grml.iso which stored as /dev/sda1/iso/grml.iso. My grub.cfg menuentry as:
menuentry "grml" {
set root=(hd0,1)
loopback loop /iso/grml.iso
linux (loop)/boot/grml/vmlinuz boot=live live-media-path=/live/grml/ bootid=grml001 findiso=/iso/grml.iso toram=grml.squashfs
initrd (loop)/boot/grml/initrd.img
}
grml booted success. But when I tried to run reboot or poweroff command, sometimes it not working, Crtl + Alt + Del not working too, have to press reset or power physics buttom . I saw some information on monitor:
Finished systemd-poweroff.service - System Power off
Reached target poweroff.target - system Power Off
I/O error, dev loop0, sector 0 op 0x1 write flags 0x800 phys_seg 0 prio class 2
......
I/O error, dev loop0, sector 0 op 0x1 write flags 0x800 phys_seg 0 prio class 2
blk_print_req_error: 1331 callbacks suppressed
Then I tried searched on Internel, as https://freedesktop.org/wiki/Software/systemd/Debugging/#index2h1 said, I can reboot or poweroff with --force option. I tried to enable systemd debug. There are some information on monitor after reboot or poweroff, such as:
Detaching loop devices.
Detaching loopback /dev/loop1
Could not detach loopback /dev/loop1: Device or resource busy
Detaching loopback /dev/loop0.
Not all loop devices detached, 1 left.
......
Detaching loop devices.
Detaching loopback /dev/loop1
Could not detach loopback /dev/loop1: Device or resource busy
Detaching loopback /dev/loop0.
Not all loop devices detached, 1 left.
I tried to do the same testing, but stored grml.iso on a USB stick(same PC) or a ext4 partition(another PC), reboot or poweroff success. So I listed grml mount device to compare:
a. grml.iso on a ntfs partition:
/dev/sda1 on /run/live/fromiso type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/loop0 on /run/live/medium type iso9660 (ro,noatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
/dev/loop1 on /run/live/rootfs/grml.squashfs type squashfs (ro,noatime,errors=continue)
b. grml.iso on a vfat pariton:
/dev/sdb1 on /run/live/medium type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
/dev/loop0 on /run/live/rootfs/grml.squashfs type squashfs (ro,noatime,errors=continue)
c. grml.iso on a ext4 pariton:
/dev/sda2 on /run/live/findiso type ext4 (ro,noatime)
/dev/loop0 on /run/live/medium type iso9660 (ro,noatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
/dev/loop1 on /run/live/rootfs/grml.squashfs type squashfs (ro,noatime,errors=continue)
So, reboot/poweroff issue maybe happen when mount ntfs partition as read-write. I tried to find more information, about ntfs-3g, like this https://github.com/tuxera/ntfs-3g/wiki/NTFS-3G-FAQ . powercfg /h off looks like not working here. I do more testing.
a. when from Windows do restart action , ntfs-3g will consider /dev/sda1 is a clean file system, so grml auto mount it as read-write, then issues happen.
b. when from Windows do shutdown action, ntfs-3g will consider /dev/sda1 is a unclean file system, so grml mount it as read-only, then no problem
If I added toram=grml.squashfs or toram as kernel parameters as https://wiki.grml.org/doku.php?id=rescueboot said, grml will not auto mount /dev/sda1, so no problem
Describe the solution you'd like Auto mount.ntfs partition as read-only, no matter is clean filesystem or not.
Describe alternatives you've considered
- reboot or poweroff with
--forceoption - added
toram=grml.squashfskernel parameters to boot
Disk usage of the software
I created debian 12 stable iso using grml64-full, grml-live -s stable -c GRMLBASE,GRML_SMALL,AMD64 -o /srv/grml-live
Nice find, thanks!
Would it be possible that you boot the system when it's failing with added debug=1 boot option and provide us the resulting /var/log/live/boot.log? This would certainly be useful for looking further into this issue.
Nice find, thanks!
Would it be possible that you boot the system when it's failing with added
debug=1boot option and provide us the resulting/var/log/live/boot.log? This would certainly be useful for looking further into this issue.
I got journal.txt as freedesktop.org said journal.txt before, maybe this is what you want.
The journal (the output of journalctl -b > journal.txt) ideally after booting with systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M printk.devkmsg=on
There is such:
Jan 29 08:08:18 grml systemd-fstab-generator[1606]: Found entry what=/dev/disk/by-label/新加卷 where=/media/新加卷 type=ntfs makefs=no growfs=no noauto=yes nofail=no
it should be /dev/sda1, ntfs partition.
Nice find, thanks! Would it be possible that you boot the system when it's failing with added
debug=1boot option and provide us the resulting/var/log/live/boot.log? This would certainly be useful for looking further into this issue.I got journal.txt as freedesktop.org said journal.txt before, maybe this is what you want.
The journal (the output of journalctl -b > journal.txt) ideally after booting with systemd.log_level=debug systemd.log_target=kmsg log_buf_len=1M printk.devkmsg=on
Thanks, that's also good to have! But with debug=1 the code triggered during bootup would also be logged (and available as /var/log/live/boot.log after booting) and that would be useful to see what exactly is going on in your situation. Thx
Thanks, that's also good to have! But with
debug=1the code triggered during bootup would also be logged (and available as/var/log/live/boot.logafter booting) and that would be useful to see what exactly is going on in your situation. Thx
Okay, I got /var/log/live/boot.log now.
boot.log
There is mount -t ntfs -o ro,noatime /dev/sda1 /run/live/medium in boot.log, but Shell show rw as below output:
root@grml ~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 3979948 0 3979948 0% /dev
tmpfs 800736 952 799784 1% /run
/dev/sda1 125032444 76365112 48667332 62% /run/live/findiso
/dev/loop0 501760 501760 0 100% /run/live/medium
/dev/loop1 441344 441344 0 100% /run/live/rootfs/grml.squashfs
tmpfs 4003676 8468 3995208 1% /run/live/overlay
overlay 4003676 8468 3995208 1% /
tmpfs 4003676 0 4003676 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 4003676 4 4003672 1% /tmp
tmpfs 800732 0 800732 0% /run/user/0
root@grml ~ # mount | grep /dev/sda1
/dev/sda1 on /run/live/findiso type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/sda1 on /lib/live/mount/findiso type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
root@grml ~ # ps aux | grep mount.ntfs
root 296 0.0 0.0 3544 2000 ? Ss 20:19 0:00 mount.ntfs /dev/sda1 /run/live/findiso
root 2417 0.0 0.0 8088 2188 pts/0 S+ 20:25 0:00 grep --color=auto mount.ntfs
root@grml ~ #
If I run reboot, then screen scroll with:
systemd-shutdown[1]: Not all file system unmounted. 2 left.
systemd-shutdown[1]: Detaching loop devices.
systemd-shutdown[1]: Detaching loopback /dev/loop1
systemd-shutdown[1]: Could not detach loopback /dev/loop1: Device or reource busy
systemd-shutdown[1]: Detaching loopback /dev/loop0
systemd-shutdown[1]: Not all loop devices detached. 1 left.
systemd-shutdown[1]: Unmounting file systems.
(sd-umount) [58311]: Unmounting '/run/live/medium'
(sd-umount) [58311]: Failed to umount /run/live/medium: Device or resource busy
(sd-reount) [58312]: Remounting '/run/live/findiso' ready-only with options 'user_id=0,group_id=0,allow_other...
(sd-reount) [58312]: Failed to remount '/run/live/findiso' read-only: Device or resource busy
(sd-umount) [58313]: Unmounting '/run/live/findiso'
(sd-umount) [58313]: Failed to umount /run/live/findis: Device or resource busy
Thanks, yeah the log says that all relevant mounts take place in r/o mode, this is what I expected also from the code perspective, so that's definitely interesting what's going on here. :)
You could try booting with an additional break=init boot option, which will drop you into the initramfs during bootup before handing over to main user-space. There you can verify whether the NTFS partition is actually used r/o or r/w at that stage (check with mount and creating files at the accordingly please with e.g. touch /root/run/...).
Hi, mika, thanks for your guidance.
a. Windows -> restart, mount | grep sda show as /dev/sda1 as rw in initrams, then continute to user-space, also rw. reboot or shutdown not working.
b. Windows -> shutdow, mount | grep sda show as /dev/sda1 as ro in initrams, then continute to user-space, also ro. reboot or shutdown working.
Not sure why Windows restart / shutdown will result grml livecd reboot success or not.