Tag: Linux

How to boot into VirtualBox from USB

In this post I will tell you how to connect a USB disk (or USB flash drive) to a virtual machine so that the guest system treats it like a regular hard disk.

This trick will allow you not only to boot from the installation USB – which is rather pointless. If you connect a USB disk or flash drive to the guest system as a regular disk, you can do such interesting things as:

  • boot from physical SATA disk via USB adapter
  • install Windows on a USB disk or flash drive

If you do not have the ability to connect a SATA disk directly to a computer – for example, to a laptop – but you really need to boot into the operating system that is deployed on it, then the trick described here will help you do this: plug the SATA disk to the computer via a USB adapter, and then connect the USB disk to the virtual machine as a regular disk, as shown in this guide.

Regarding the second point – installing Windows on a USB drive – if you want to install Linux on a USB flash drive (not to write a Live image, but to install a full-fledged system), then you do not have to do the trick shown here to install it – since Linux is perfectly installed on a portable media. But in Windows there is a prohibition for installation on USB disks and flash drives.

I will show you how to boot from USB on Windows and Linux. The principle is the same in both of these operating systems, but the commands differ slightly due to the specifics of the OS.

How to Boot into VirtualBox from USB on Windows

Plug a USB flash drive or disk to your computer. Then press Win+r and execute diskmgmt.msc.

Find your USB flash drive and remember the disk number:

For example, in my screenshot, the flash drive has the number 2.

Close all VirtualBox windows if they are open.

Next, we need to open a command prompt as administrator. To do this, press Win+x and select “Windows PowerShell (Admin)”.

Now go to the folder where you have VirtualBox installed. If this program is installed in the default directory, then the command to go:

cd $Env:programfiles\Oracle\VirtualBox

If you chose a different location for VirtualBox, then edit the previous command accordingly.

Now, in the command line, paste the following command, in which replace # with the disk number that we looked at just above, then press Enter:

.\VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive#

For example, I have this second disk, then the command looks like this:

.\VBoxManage internalcommands createrawvmdk -filename C:\usb.vmdk -rawdisk \\.\PhysicalDrive2

If everything went well, the following message should appear:

RAW host disk access VMDK file C:\usb.vmdk created successfully.

Note that you can replace C:\ usb.vmdk with any file location you want.

This command creates a virtual machine disk file (VMDK) pointing to the physical disk you selected. When you use a VMDK file as a disk in VirtualBox, then VirtualBox will actually have access to the physical disk.

Now open VirtualBox as administrator - this is a must, otherwise it will not work as it should. To do this, click the Start button, type in “VirtualBox” and select “Run as administrator”:

VirtualBox can only access raw disk devices with administrator privileges.

Now in VirtualBox create a new virtual machine, select the appropriate operating system and when it comes to choosing a hard disk, instead of creating a new one, select “Use an existing virtual hard disk file”:

Click “Add”:

Now open the file C:\usb.vmdk (or another one if you saved it in a different location or under a different name):

Choose it:

Press “Create” button:

Boot your virtual machine, now it should see your USB flash drive as an ordinary hard drive. That is, if it is a correctly written boot disk or USB flash drive, then the system will boot from it.

Please note that the USB device must be the first hard drive in your VirtualBox virtual machine, otherwise it will not boot. If you are connecting a new USB disk to an existing machine, then try changing the order of the media in the settings of this machine, or select the appropriate disk at the beginning of the boot.

How to Boot into VirtualBox from USB in Linux

To understand the principle, read the previous section on Windows.

To do without root rights in Linux, you need to add the user (yourself) to the “disk” group:

sudo usermod -a -G disk $USER

Then reboot.

If you do not add yourself to the “disk” group, then you will need to run VirtualBox as root or with sudo, otherwise you will encounter an error:

VD: error VERR_ACCESS_DENIED opening image file '/home/mial/VirtualBox VMs/usb.vmdk' (VERR_ACCESS_DENIED).

On Linux, to find out the name of the USB drive, run the command:

sudo fdisk -l

In my case, the disk name is /dev/sdb.

To create a virtual disk file pointing to a real disk, run a command like this:

VBoxManage internalcommands createrawvmdk -filename '~/VirtualBox VMs/usb.vmdk' -rawdisk /dev/sdX

Where, instead of X, write the letter of the corresponding drive. An example for my conditions:

sudo VBoxManage internalcommands createrawvmdk -filename '~/VirtualBox VMs/usb.vmdk' -rawdisk /dev/sdb

In this command, you can replace '~/VirtualBox VMs/usb.vmdk' with a different location of your choice.

Everything else – creating a virtual machine and choosing an existing virtual disk as a hard disk – just like in Windows.

Note that the usb.vmdk file is a simple text file that you can move to any location and even edit.

Instead of a name like /dev/sdX, you can use a by-id based persistent name, for example:

VBoxManage internalcommands createrawvmdk -filename flash.vmdk -rawdisk '/dev/disk/by-id/usb-Samsung_Flash_Drive_0325121050019952-0:0'

This will allow you to avoid an unavailable disk error if its name changes. See the article “Persistent names for block devices” for details.

How to pause GIF on Windows, Linux, Mac OS

GIF animation can be used as a visual demonstration of anything: the operation of programs, physical processes, the sequence of actions during repairs or exercise – anything.

GIF animation is like a small looped video without sound. This way of presenting changing data and schemas is very popular because when inserted into the HTML of the page, the GIF is treated like any other image. Yes, modern HTML and modern web browsers also make it easy to embed real videos on web pages, but GIF animation is still popular.

What is inconvenient with GIF images is that the animation cannot be paused (for example, to look at something in fast-changing data), nor rewound (to find a point of interest, and not watch the animation many times in the hope of catching the right moment).

You can save the GIF to your computer and open it with almost any image viewer or web browser: the animation will play fine, but you still cannot pause or rewind it to a certain place.

Program for frame-by-frame GIF animation

In fact, GIF frames are of little use – you can open the animation in the GIMP image editor and you will be shown the individual frames, but thanks to optimization, each frame contains only the difference of the images. In short, GIMP won't help.

But video players will help! For example, Windows users can open GIFs in Windows Media Player.

And in this video player, you can pause the GIF and use the scroll bar to find a specific location.

But there is a more versatile method that works on Windows, Linux, and Mac OS. This is SMPlayer.

SMPlayer is a free media player for Windows, Linux and Mac OS with built-in codecs, which can also play Youtube videos, search and download subtitles, and includes other features like a thumbnail generator and audio and video filters.

You can find the version for Window and macOS on this page: https://www.smplayer.info/en/downloads

On Linux, install SMPlayer from your distribution's standard repositories.

On Debian derivatives (Linux Mint, Ubuntu, Kali Linux), use the command:

sudo apt install smplayer

On Arch Linux derivatives (Manjaro, BlackArch), use the command:

sudo pacman -S smplayer

Save the GIF you want to pause to your computer.

Open SMPlayer and drag your GIF animation file there.

Now you can pause GIF video, jump to any GIF frame.

In the lower right corner, you will see the total duration of the GIF animation.

This method with SMPlayer is cross-platform, you can stop GIF animation in Windows, Linux and Mac OS.

libpcap-dev for Cygwin

When compiling programs from source in Cygwin, an error may occur containing the line “when searching for -lwpcap”.

The essence of the error is that the headers of the pcap library are searched.

These header files are present in the libpcap-dev package (Debian and derivatives). This package may also be called libpcap (for example, on Arch Linux). There are no such packages in the Cygwin repositories, since their functioning is closely related to the operating system drivers and libpcap is intended for Linux, while Cygwin runs on Windows.

When traversing the file system looking for the correct header files, the following messages may be displayed:

/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lwpcap
collect2: error: ld returned 1 exit status

As an alternative to libpcap for Windows (and therefore also for Cygwin) you can use:

  • WinPCAP – popular software, but no longer developed and maintained
  • Npcap – based on WinPCAP and is actively developing at the present time

To compile programs that require the libpcap library, you need source files, WinPCAP or Npcap headers.

The WinPCAP header files are in the Developer's Pack, and the Npcap header files can be found in the Npcap SDK.

WinPCAP for Cygwin

Follow the steps below to install WinPCAP headers in Cygwin.

Go to https://www.winpcap.org/devel.htm and download the developer pack.

Unpack the downloaded archive.

Copy the libraries:

  • WpdPack\Lib\libpacket.a in cygwin\lib\
  • WpdPack\Lib\libwpcap.a in cygwin\lib\

Copy headers from WpdPack\Include to cygwin\usr\include\.

Make sure you have the Winpcap libraries installed and that they are available in the PATH by running the commands:

which Packet.dll
which wpcap.dll

They should be in /cygdrive/c/WINDOWS/system32/.

Npcap for Cygwin

Go to https://nmap.org/npcap/ and download the Npcap SDK.

Unpack the downloaded archive.

Copy headers from Include to cygwin\usr\include\.

Make sure you have the Npcap libraries installed and that they are available in the PATH by running the commands:

which Packet.dll
which wpcap.dll

They should be in /cygdrive/c/WINDOWS/system32/.

All about MAC addresses: what are they for, how to view and find out the manufacturer by MAC address

A media access control address (MAC address) of a computer is a unique identifier assigned to network interfaces for communications at the data link layer of a network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet and Wi-Fi.

MAC addresses are most often assigned by the manufacturer of a network interface controller (NIC) and are stored in its hardware, such as the card's read-only memory or some other firmware mechanism. If assigned by the manufacturer, a MAC address usually encodes the manufacturer's registered identification number and may be referred to as the burned-in address (BIA). It may also be known as an Ethernet hardware address (EHA), hardware address or physical address (not to be confused with a memory physical address). This can be contrasted to a programmed address, where the host device issues commands to the NIC to use an arbitrary address (https://en.wikipedia.org/wiki/MAC_address).

If MAC-address is known, you are able to lookup it that allows you to easily find the company details (company name, address, and country) according to the MAC address of a product.

How to determine the manufacturer of the device by MAC address

In Windows, there is a free program MACAddressView to determine the vendor (manufacturer) of a device by MAC address.

You can search by MAC address, company name, company address, company country, all MAC addresses. The input rules are as follows:

  • Enter one or more MAC addresses, separated by spaces or by pressing <Enter>. You can specify the complete address (for example, 01-02-03-04-05-06) or only its first 3 bytes (for example, 01-02-03).
  • Enter one or more company names to search for, separating each search string with <Enter>.
  • Enter one or more addresses to search, separating each search string with <Enter>.
  • Enter one or more countries to search for, separating each search string with <Enter>.

How to find my MAC address

On Windows, you can find out your MAC address in several ways – from the GUI and from the command line.

To find out your MAC address, open Control Panel → Network and Internet → Network and Sharing Center → Change adapter settings or you can just run the command:

ncpa.cpl

Select the adapter (network connection) you are interested in, right-click on it and select “Status” in the context menu. Then click the “Details…” button:

In the window that opens, the item “Physical Address” is the MAC address of this network adapter:

To find out your MAC address in Windows from the command line, open a command prompt, to do this press Win+x and select “Windows PowerShell”. You can use two commands, the first one

getmac

shows brief information about all the MAC addresses of the system, while it is not always easy to map an interface to specific matching MAC address.

Command

ipconfig /all

displays more advanced information about the connection, using it you can navigate which physical address (MAC) belongs to which interface:

How to find the MAC address of devices on the local network

Using the nmap program, both in Windows and in Linux, you can find devices connected to the local network and find out their MAC addresses. Example command for subnet 192.168.0.0/24:

sudo nmap -sn -n 192.168.0.0/24

How to find the MAC address and manufacturers of wireless access points

You can find out which Wi-Fi networks are working near you, as well as find out their manufacturer using the WifiInfoView program.

WifiInfoView scans wireless networks in range and displays extended information about them, including: network name (SSID), MAC address, PHY type (802.11g or 802.11n), RSSI, signal quality, frequency, channel number, maximum speed, company name , router model and router name (only for routers that provide this information) and more.

Pay attention to the columns “Router Model” and “Router Name”, for some routers (which send this information themselves) the exact model is written in them.

Lookup MAC-address to find device manufacturer online

If you know the MAC address and you want to know the manufacturer of this device, you can use the free online service to query the database: https://w-e-b.site/?act=mac

Error in LMDE “cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries nor crypto modules” (SOLVED)

When updating the system, if it was necessary to rebuild initramfs (usually necessary after every Linux kernel update), a warning appeared in LMDE and other Linux distributions. This is not a critical warning and not an error – in fact, this is information about incorrect system configuration. Example of this notification:

cryptsetup: WARNING: The initramfs image may not contain cryptsetup binaries
    nor crypto modules. If that's on purpose, you may want to uninstall the
    'cryptsetup-initramfs' package in order to disable the cryptsetup initramfs
    integration and avoid this warning.

The message in the screenshot says, “that the initramfs image may not contain cryptsetup executables, nor crypto modules. If this is intended, then you can remove the cryptsetup-initramfs package to disable the integration of cryptsetup and initramfs and so that this warning disappears. "

Now cryptsetup and its dependencies are added to the initramfs image only when a device is found that needs to be unlocked at the initramfs stage.

Depending on your plans, there are two options:

  • if you don’t know if in the future you will create encrypted partitions or partitions that should be unlocked at the initramfs stage, then just do nothing and do not change – ignore this informational message, it is harmless
  • if you definitely won’t create encrypted partitions, then delete cryptsetup-initramfs package

So, if you would not create encrypted partitions and do not plan to do this, then you can remove the cryptsetup-initramfs package:

sudo apt remove cryptsetup-initramfs
sudo apt autoremove

By the way, you can reinstall the cryptsetup-initramfs package later if you need it.

How to configure Linux LMDE login without entering a password

LMDE is the Linux Mint Debian Edition. As with all Linux Mint, during installation, you can select the option “automatic login”, that is, login to Linux without entering a user and password.

If during installation you did not select this option, and then changed your mind and decided to configure login without a password in LMDE, then this instruction will step-by-step explain how to enable automatic login to the system. If you are the only user of your computer, then automatic login (as is done on Windows) will make using the OS a little more convenient.

LMDE uses the LightDM display manager. To automatically enter LightDM, open the configuration text file /etc/lightdm/lightdm.conf:

sudo xed /etc/lightdm/lightdm.conf

Find the [Seat:*] section there, and in this section two commented lines:

#autologin-user=
#autologin-user-timeout=0

Uncomment them (remove the # character at the beginning of the line), and after autologin-user, enter the name of the user to be automatically logged in, for example, if this is the root user, then the lines look like this:

autologin-user=root
autologin-user-timeout=0

If you don’t know or forgot your Linux system username, you can find out by executing the command in the terminal:

whoami

If the lightdm.conf file is completely absent, then create it:

sudo xed /etc/lightdm/lightdm.conf

Copy to this file:

[Seat:*]
autologin-guest=false
autologin-user=mial
autologin-user-timeout=0

Pay attention to the autologin-user directive and the username that comes after it is mial. Of course, you need to replace this name with your own system username.

Now open the file /etc/pam.d/lightdm-autologin:

sudo xed /etc/pam.d/lightdm-autologin

Find the line there:

auth      required pam_succeed_if.so user != root quiet_success

and replace it with:

auth      required pam_succeed_if.so user != anything quiet_success

Reboot – after this, an automatic login should be performed without entering a password.

If it doesn’t work, to check whether the settings from the configuration file lightdm.conf are applied, run the command:

/usr/sbin/lightdm --show-config

How to install VirtualBox Guest Additions in Linux LMDE

LMDE is the Linux Mint Debian Edition, i.e. Linux Mint based on Debian.

VirtualBox Guest Additions are kernel modules (drivers) that are needed if you run Linux LMDE in a VirtualBox virtual machine.

Thanks to guest additions it is possible:

  • enable a shared clipboard between the real operating system and the guest OS
  • enable file drag and drop between host and guest OS
  • expand the guest OS screen to a larger size or use the guest OS in full screen mode, as well as enable display integration.

Guest Additions are not available in the standard Linux LMDE repositories (Linux Mint Debian Edition).

There are two installation options:

  • install Guest Additions from the disk that comes with VirtualBox
  • add a third-party repository

I prefer the first option, so let’s consider it.

Start by fully upgrading and rebooting the system:

sudo apt update && sudo apt full-upgrade -y
reboot

Install the dependencies needed to compile the kernel module:

sudo apt install build-essential module-assistant

Configure the system to build kernel modules:

sudo m-a prepare

Connect the disk with Guest Add-ons, for this, in the VirtualBox menu of the virtual machine, select «Devices» → «Insert Guest Additions CD image»:

Return to the system again and do type in console:

cd /media/*/VBox*
sudo sh VBoxLinuxAdditions.run

Wait for the installation to finish, pay attention that everything goes without errors.

After the installation is complete, reboot again for the changes to take effect:

reboot

In the VirtualBox menu, turn on “Shared Clipboard” and other functions that you need:

WordPress: A critical error occurred on the site – impossible to enter the control panel (SOLVED)

After updating the plugins in WordPress on my VPS server, the site stopped opening. And it was even impossible to open the control panel – a message was displayed during all attempts (you can see a screenshot in the header of this article):

A critical error occurred on the site. Please check the incoming admin mail for further instructions.

Learn more about debugging in WordPress.

That is, it is impossible to fix the error through the control panel – it is impossible to get there, not change the settings, and not roll back the changes.

I didn’t receive the mentioned email – because it’s an experimental VPS and the mail service is not configured there.

In general, it is impossible to open the control panel, I did not receive a letter in the mailbox, and even if I received it, what can I do if the control panel is not available?!

It would seem a stalemate. The WordPress forums recommend “look for where you have the PHP error log on your hosting (you can ask for technical support of the hosting if you yourself can’t find it), see what's there at the end of the file, critical errors are marked as Fatal”.

I opened the error log for this site:

tail -n 50 /var/log/httpd/site.ru-error_log

But it turned out to be completely empty (maybe for this host I did not configure something).

By the way, Apache error logs on Debian, Linux Mint, Ubuntu, Kali Linux and their derivatives are placed in the /var/log/apache2/* files. And the Apache logs on Arch Linux and derivatives are placed in the /var/log/httpd/* files. This is the default – in fact, the logs can be anywhere in the file system, check the settings for a specific virtual host.

What to do if you cannot log in to your WordPress dashboard

So, the strategy is as follows:

  • since the problem arose after the update, I need to find the ability to roll back updates
  • I do not have access to the WordPress admin area, so I have to roll back changes at the file system level
  • I don’t remember which plugin or theme was updated, as a result the site stopped working. Therefore, to find out which plugins have been updated, I will look at the timestamps, when folders and files were changed.

So, by default (this can be changed by the settings of the web server and individual virtual hosts), website files in Debian, Linux Mint, Ubuntu and their derivatives are stored in the /var/www/html/ directory. And with Arch Linux, site files are stored along the/srv/http/ path.

So, I go to the folder with the site:

cd /srv/http/site.ru/

The plugin files are located in the wp-content/plugins/ folder, I run the ls command (shows the contents of the folder) with the options -l (list the files with file information) and -t (sort files in the list by time of change):

ls -lt wp-content/plugins/

And here is what I see:

Today, February 18th, only one folder was changed, it is sitetree. The solution is very simple – remove the sitetree plugin.

How to remove WordPress plugin without access to control panel

You can install and remove WordPress plugins simply by unpacking their contents into the wp-content/plugins folder or by removing files of a plugin in this folder. That is, I run the rm command:

rm -rf wp-content/plugins/sitetree/

It is dangerous to use the rm command on a working (production) server, so here is a description of the arguments:

-f	means ignore non-existent files and arguments, don't ask anything. Delete non empty folders
-r, -R, --recursive	means recursively delete directories and their contents

And… the problem is solved – the website is working, the entrance to the WordPress admin panel is open. The only change is that the sitetree plugin is no longer installed. But this does not matter, this plugin, after a long period of lack of updates, already had one unsuccessful update, as a result of which the links from the “All Articles”/“Site Tree” sections disappeared and on my more popular sites I already found an alternative to this plugin. That is, I do not need to figure out what exactly this plugin did not like in my server with PHP 7.4.

WordPress does not work after updating the theme

By the way, if the problem is caused by updating the theme, then you can view the last changed themes like this:

ls -lt wp-content/themes/

If the problem is caused by updating the theme, then you can delete the folder even with the current active theme, in this case, the site will stop working with something like this error:

The catalog of the theme "........" does not exist.

But this is not a very big problem – entering the WordPress dashboard will still be available and you can select and install a new theme in the Appearance → Themes settings.

Conclusion

Errors caused by updating website or web server components are rarely so serious that you need to remove everything and install/configure it again. Even if the site “doesn’t work at all”, just find the reason and fix it.

By the way, for Linux users, what I described, that is, the ls and rm commands are the most elementary things. But for Windows users, perhaps, even after reading, nothing is clear. It’s not even clear where to enter these commands. Therefore, I recommend that webmasters switch to Linux, this will help to better understand this operating system.

UPD: email ‘Technical problems occurred on the site’

I managed to get the email that was mentioned in the first error (I updated the same plugin on another site laugh):

Starting with version 5.2, WordPress can detect errors with plugins or a theme on the site and send you similar messages automatically.

This time WordPress found an error with one of the plugins - SiteTree.

First go to your website (https:/site.ru/) and check all the visible problems. Next, go to the page on which the error occurred (https://site.ru/wp-admin/) and check the visible problems on it.

Please contact hosting technical support to further diagnose this problem.

Most importantly, this post indicates the plugin that caused the problem. If you have access to the admin panel, then delete it.

But, as I described my situation, it may be that there is no access to the admin panel, and therefore the second part is especially interesting:

If your site is broken and you can’t log into the console normally, you can now use the special “recovery mode”, which will allow you to safely log into the console for further actions.

https://site.ru/wp-login.php?action=enter_recovery_mode&rm_token=Cc24PdWJ5chCGvpGLGZuSG&rm_key=cx647dVHksN3m4Gk64FBZP

For security reasons, this link expires in 1 day. But do not worry, if the error occurs again after this time, a new link will be sent to you.

To solve the problem, you need the following information:

WordPress Version 5.3.2

Current theme: Asteroid (version 1.2.8)

Problem plugin: SiteTree (version 2.1)

PHP Version 7.2.23

That is, with the help of the sent link there is even a chance to go into a broken WordPress.

How to check if a package is installed on Linux Mint

All Linux distributions consist of the same components: kernel, display manager, graphical desktop environment, pre-installed programs. To make users somehow distinguish distributions from each other, their builders install different wallpapers and add their own programs.

Unfortunately, the desire of distributors to stand out and become more “friendly” to the user leads to ridiculous (let's say bluntly, idiotic) problems. And, most likely, you already guessed about it from the title of this article.

Any distribution that is derived from Debian uses the apt file manager. To find out if a particular package is installed, just use the apt search command and specify the package name:

apt search PACKAGE

For example, I am wondering if kernel headers are installed already:

apt search linux-headers-

Well, the command is poor, because there are many different kernels, let's issue a more specific one and ask the question “are the headers of the current kernel set”:

apt search linux-headers-`uname -r`

Can you answer whether this package is installed or not? In fact, the answer is present but not clear, because instead of the original program, the file /usr/local/bin/apt is used, which is a Python script using the aptitude (!) program, the output format is completely different from the one we are expecting.

The answer is in the very first column, where there is only one character. The meaning of the characters is as follows:

  • p, meaning that no trace of the package exists on the system,
  • c,meaning that the package was deleted but its configuration files remain on the system,
  • i, meaning that the package is installed, and
  • v, meaning that the package is virtual.

How to use apt instead of aptitude on Linux Mint

For many years I have been working with the apt program, and aptitude is not installed at all on many distributions derived from Debian. Therefore, the original apt program is much more familiar to me.

To use apt instead of aptitude, run a command of the form:

/usr/bin/apt search PACKAGE

For instance:

/usr/bin/apt search linux-headers-`uname -r`

Well, that’s exactly what I wanted, brief information about the package with the unambiguous inscription “[installed]”:

Always issue /usr/local/bin/apt is inconvenient, so the question arises, how to get rid of this idiotic Python script? It is enough to run the command:

sudo mv /usr/local/bin/apt /usr/local/bin/-apt

And now a program of the form:

apt search PACKAGE

will give exactly the result that you expect.

For instance:

apt search linux-headers-`uname -r`

If you want to return the script back, then simply run the command:

sudo mv /usr/local/bin/-apt /usr/local/bin/apt
Loading...
X