System freezing after safely remove external drive

Forum Forums New users New Users and General Questions System freezing after safely remove external drive

  • This topic has 18 replies, 5 voices, and was last updated Jun 11-11:17 am by RJP.
Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #144865
    Member
    Alex63646t

      Hello everyone,

      Sometimes, after I safely remove my external hard drive, system total freez, nothing working. In linux Mint i use Alt+SysRq keys and type the REISUB, but in antiX it doesn’t work.

      How do you think, why system freez after I safely remove it (using icon in taskbar), and why it happens sometimes, not every time?

      ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
      - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

      #144868
      Member
      anti-apXos

        The Alt+SysRq commands should work on antiX. I just tested and confirmed, though I did have to use the LEFT ALT key, which I don’t remember being the case in the past.

        This is not in any way a proper solution to your issue, though, of course.

        Do you mean that you have had this same freezing when you unplug the drive in Linux Mint also?

        Do you have only one external drive that causes this or all? Does it matter which USB port it’s plugged into? Have you tried using a different cable to connect it?

        #144869
        Member
        Alex63646t

          Hello

          1. No, in linux mint on another laptop it not happen

          2. It happens with both my external hard drives, but not every time.

          3. It doest depend of which port I insert drives

          • This reply was modified 1 week, 3 days ago by Alex63646t.

          ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
          - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

          #144874
          Member
          RJP

            I have met same issue with mechanical external hard drive, I suppose that it is a pumount issue, when pumount stops all hard drives.

            #144875
            Member
            Alex63646t

              Thank you for your information, I forgot to say that I use mechanical external hard drive. I will try to make a test with my external SSD

              ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
              - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

              #144876
              Member
              abc-nix

                I don’t remember if the taskbar option to unmount is with or without sudo. @Robin explained in another thread that the behavior with sudo is different to the one without sudo.

                When you have time, test unmounting the external HD running from the command line without sudo
                unplugdrive.sh
                See if this also makes the system freeze, compared to running it with sudo
                sudo unplugdrive.sh

                Reading the source, it seems like the non-sudo way uses pumount, while the sudo way uses umount plus hdparm to spin down the HD.
                Let us know if both of the methods lead to the same result or if one of them doesn’t freeze the system.

                #144894
                Member
                Robin

                  @Abc-nix is right, running the script in sudoed mode uses the umount+hdparm commands, while running unsudoed a by @Xecure modified pumount version is engaged in 0.93b. (You could try downgrading to the 0.90 version to see whether the freeze happens also with this version, which has the very same processing structure and concept, but is written in old bash scripting style. Please note you can run 0.90 only sudoed.)

                  I had implemented two debug modes into unplugdrive from version 0.90 onwards, and Xecure has kept them when porting my script code from 0.90 version to the more modern scripting style as found in recent 0.93b version. See unplugdrive -h or -​-help for details about valid command line options.

                  The first debug mode, -g or -​-debug will write each step which is processed along with the relevant data to the console. Observe it while processing to learn in which step the freeze happens.

                  The second debug mode, -p or -​-pretend will perform the full processing cycle, while the actual unmount commands are deactivated internally.

                  The two modes can be combined. This way you can run unplugdrive repeatedly, simulating unplugging several different usb storage devices and SD cards, without the need of physically unplugging and replugging them again and again. In the console output you can see then the actual command lines which would be used when running in non-debug mode. Try feeding these very commands manually to console to learn whether one of these causes the issue.

                  sudoed mode:
                  sudo unplugdrive.sh -g -p

                  non-sudoed mode:
                  unplugdrive.sh -g -p

                  → Does the freeze for you also happen when the -p pretend mode is set? Then there would be possibly a bug in the script logic we have to trace down, or maybe we have to add one more exclusion to the blocked devices detection.

                  As per abc-nix:
                  → Does the freeze for you also happen when using unplugdrive in its sudoed mode?

                  And then:
                  → Does the freeze also happen to you when feeding the unmount commands manually?

                  ( commands from sudoed mode: )

                  $ sync
                  $ sudo umount ‹/path/to/mountpoint›
                  $ sudo hdparm -Y /dev/‹devicename›

                  ( commands from non-sudoed mode: )

                  $ sync
                  $ pumount --luks-force ‹/path/to/mountpoint›
                  $ pumount -D /dev/‹devicename›
                  

                  → To understand what precisely causes the freeze, please let us know the full debug output from console, in sudoed and unsudoed mode both:

                  $ sudo unplugdrive.sh -g (-p)
                  ...
                  $ unplugdrive.sh -g (-p)
                  ...

                  Windows is like a submarine. Open a window and serious problems will start.

                  #144946
                  Member
                  Alex63646t

                    Is it possible to make a link/shortcut for this command on desktop?:

                    sudo unplugdrive.sh

                    ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
                    - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

                    #144973
                    Member
                    Robin

                      Is it possible to make a link/shortcut for this command on desktop?:

                      Yes. Please see these threads/postings for details how to make the sudoed mode the default on your system.

                      https://www.antixforum.com/forums/topic/unplugdrive-sh/#post-77646
                      https://www.antixforum.com/forums/topic/cant-find-source-of-unplugdrive/page/3/#post-69234

                      Windows is like a submarine. Open a window and serious problems will start.

                      #144974
                      Member
                      Alex63646t

                        It seems that unplug with sudo work great, can I make shortcut in taskbar to run with sudo? This laptop use my wife and she doesn’t want to use terminal

                        ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
                        - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

                        #144982
                        Member
                        Robin

                          an I make shortcut in taskbar to run with sudo?

                          There is a file ~/.icewm/toolbar, just edit the unplug line in it respectively. (For the other window managers exist similar files in their folders, e.g. ~/.jwm/tray, edit them also. Not sure about fluxbox.)

                          And make sure to apply the edit to the sudoers file described in the old threads, so you don’t need to enter the password. Otherwise you’ll need to use gksu instead of sudo, and it will constantly ask for the sudo password…

                          Windows is like a submarine. Open a window and serious problems will start.

                          #144984
                          Member
                          Alex63646t

                            I made this steps:

                            1. Added alias
                            alias unplugdrive.sh=’sudo /usr/local/bin/unplugdrive.sh’

                            2. make new button on taskbar
                            prog /usr/share/icons/papirus-antix/48×48/devices/drive-removable-media-usb.png sudo /usr/local/bin/unplugdrive.sh

                            unfortunately behaviouг of unplug show that is run without sudo, when I unplug it with sudo from terminal It doesn’t shows message, that I write below.
                            When I unplug it without sudo and from taskbar, using button with text I was written in step 2, it shows this message:

                            Unmounted:

                            Device sda1
                            /media/pcation/New volume

                            But, despite the fact that the following devices were rotating
                            they did not respond to the deceleration command:
                            54a
                            Please check if they are rotating before unplugging.
                            Once the rotating drives have stopped, they can be safely switched off.

                            OK

                            So I make conclusion that it runs without sudo. And one time system freeze again

                            Please, help me make a correct button in taskbar, that will run with sudo

                            • This reply was modified 1 week, 2 days ago by Alex63646t.
                            • This reply was modified 1 week, 2 days ago by Alex63646t.
                            • This reply was modified 1 week, 2 days ago by Alex63646t.

                            ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
                            - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

                            #145113
                            Member
                            Alex63646t

                              I solve problem by creating .sh file this content:

                              sudo /usr/local/bin/unplugdrive.sh

                              and write to toolbar config file:

                              prog “Извлечь съемное устройство” /usr/share/icons/papirus-antix/48×48/devices/drive-removable-media-usb.png /home/pcation/unplug.sh

                              So now I can unplug devices with sudo rights and system not freeze, but behaviour of unpluged HDD is strnge, it flash the lights like something write. In windows, after unplug, he just turn off.

                              ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
                              - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

                              #145121
                              Member
                              Robin

                                I guess you will face another issue when not either adding the line described in the links I have already pointed to above to your sudoers configuration (see screenshot).

                                While sudo works fine when you start a command from commandline, it will fail in GUI (e.g. by calling sudo unplugdrive from the toolbar). Then it can’t ask for credentials, so it works only in the short period of time an arbitrary former sudo call is still valid, otherwise the sudoed command will be silently dropped. (Alternatively you can use gksu instead of sudo, but then you’ll be asked again and again for your sudoer password just to remove an USB device, which is not ideal.) So I guess better edit your sudoers config to have it working properly always.

                                Windows is like a submarine. Open a window and serious problems will start.

                                #145132
                                Member
                                Alex63646t

                                  Thank you, I have already added it to sudoers

                                  Attachments:

                                  ▪ 64-bit antix23.1-full (runit) zzzFM + iceWM install on:
                                  - (2021) ASUS L210MA (GJ163T) – dual CPU Intel Celeron N4020 1.1GHz, 4GB RAM. Intel UHD Graphics 600, integrated graphics

                                Viewing 15 posts - 1 through 15 (of 19 total)
                                • You must be logged in to reply to this topic.