You are not logged in.

#26 2013-09-23 00:11:38

philip
Member
Registered: 2011-09-14
Posts: 2

Re: [Solved] - Systemd 207 upgrade - swap service failed

WonderWoofy wrote:

Is the systemd GUID for swap the same as the regular GUID Linux swap as applied by gdisk's  8200?

I'm pretty sure that's the case. At least my GPT swap-partition had this GUID assigned, although I have created it long before systemd implemented this automounting. That's why I think (see my previous comment in this thread) that there is still a bug in systemd, as it really should not create two units for these partitions if they are specified in /etc/fstab.

Offline

#27 2013-09-23 00:35:30

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,677

Re: [Solved] - Systemd 207 upgrade - swap service failed

Also, there really should be a way to mask it even if it is not in fstab. There could be reasons you don't want to use swap - maybe you only want to use it with another distro or just don't want it enabled for now or... or... you just don't want your system to do that!

I would also like to know why

systemctl list-units --type swap --all --full --no-pager

lists no fewer than 8 units of which 7 appear to be loaded and active. If I do not pass --all, it lists only 1 unit and mentions that it is excluding loaded but inactive units but --all suggests those are active as well. At least, that's what the output says.

Last edited by cfr (2013-09-23 00:43:56)


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#28 2013-09-23 03:13:29

Jristz
Member
From: America/Santiago
Registered: 2011-06-11
Posts: 931

Re: [Solved] - Systemd 207 upgrade - swap service failed

by-uuid not work here but all others yes; so I have swap but a failed service
and I assign the proper ID 8200 at creation


Well, I suppose that this is somekind of signature, no?

Offline

#29 2013-09-24 10:33:17

ico
Member
Registered: 2011-01-25
Posts: 23

Re: [Solved] - Systemd 207 upgrade - swap service failed

I commented the swap line in my fstab to get rid of the message.

So, there isn't a way to switch off systemd's mounting of swap at the moment?

Offline

#30 2013-09-24 11:29:02

progandy
Member
Registered: 2012-05-17
Posts: 2,152

Re: [Solved] - Systemd 207 upgrade - swap service failed

ico wrote:

I commented the swap line in my fstab to get rid of the message.

So, there isn't a way to switch off systemd's mounting of swap at the moment?

Delete /usr/lib/systemd/system-generators/systemd-gpt-auto-generator and set it as NoExtract in pacman.conf
You could also get the unit name of the failed swap mount and try to mask it with "systemctl mask"

Last edited by progandy (2013-09-24 11:31:43)

Offline

#31 2013-09-24 13:37:59

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,412

Re: [Solved] - Systemd 207 upgrade - swap service failed

I don't have swap at all, but what if you just changed the partition type code (the GUID) to something else?  The fact that Linux is able to use a swap file indicates to me that it does not have to be marked specifically as Linux swap n=in order to be used as swap.

Offline

#32 2013-09-28 16:29:02

eigengrau
Member
Registered: 2013-09-19
Posts: 41

Re: [Solved] - Systemd 207 upgrade - swap service failed

The weird thing is that I have two GPT systems, and I only get the failed swap dependencies on one of them, although I'm pretty sure the GPT partition type is 8200 in both cases.

Offline

#33 2013-10-02 23:11:30

ksolsim
Member
Registered: 2012-06-26
Posts: 28

Re: [Solved] - Systemd 207 upgrade - swap service failed

today I noticed that the swap was not loaded and I had to uncomment the line containing the swap-definition in /etc/fstab (on systemd 204).

Offline

#34 2013-10-02 23:24:14

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,677

Re: [Solved] - Systemd 207 upgrade - swap service failed

ksolsim wrote:

today I noticed that the swap was not loaded and I had to uncomment the line containing the swap-definition in /etc/fstab (on systemd 204).

Since this feature is new in the 207 upgrade, I assume this is the expected behaviour with 204.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#35 2013-10-03 06:52:19

ksolsim
Member
Registered: 2012-06-26
Posts: 28

Re: [Solved] - Systemd 207 upgrade - swap service failed

O_o...  I was too tired.. I didn't remember that this is a new feature of systemd 207...

Last edited by ksolsim (2013-10-03 06:53:00)

Offline

#36 2013-10-08 15:21:41

fujur
Member
Registered: 2013-10-08
Posts: 4

Re: [Solved] - Systemd 207 upgrade - swap service failed

Hi! I think I am having a related problem here.

Today I noticed the same "failed to activate swap" message. As I have my swap partition encrypted as instructed here ("Without suspend-to-disk support" section), I think the problem is systemd not being able to handle it. So, commenting the related line on fstab did not solve the problem for me (error message is still being shown).

I was able to solve this issue only by deleting /usr/lib/systemd/system-generators/systemd-gpt-auto-generator as stated by progandy (thanks!) but it does not seem a clean long term solution to me. I don't like to mess around with files supposed to be handled by pacman.

So, any suggestions about this? After reading this forum thread I am not even sure of being right with my explanation about what causes the problem.

Thanks!

Offline

#37 2013-10-08 19:52:09

ico
Member
Registered: 2011-01-25
Posts: 23

Re: [Solved] - Systemd 207 upgrade - swap service failed

fujur wrote:

Hi! I think I am having a related problem here.

Today I noticed the same "failed to activate swap" message. As I have my swap partition encrypted as instructed here ("Without suspend-to-disk support" section), I think the problem is systemd not being able to handle it. So, commenting the related line on fstab did not solve the problem for me (error message is still being shown).

I was able to solve this issue only by deleting /usr/lib/systemd/system-generators/systemd-gpt-auto-generator as stated by progandy (thanks!) but it does not seem a clean long term solution to me. I don't like to mess around with files supposed to be handled by pacman.

So, any suggestions about this? After reading this forum thread I am not even sure of being right with my explanation about what causes the problem.

Thanks!

This might be of some help - http://unix.stackexchange.com/questions … -swap-file

Offline

#38 2013-10-09 08:28:15

fujur
Member
Registered: 2013-10-08
Posts: 4

Re: [Solved] - Systemd 207 upgrade - swap service failed

Thanks, ico.

I followed up the instructions given on that link, so now I have the encrypted swap fully managed by systemd, without using fstab, nor crypttab... But it seems like systemd is still trying to mount the swap partition after executing the new service, so the error message is still being shown.

After that error the new service manages the encrypted swap correctly, so everything is working ok, but I still would want to get rid of this error message.

Offline

#39 2013-10-09 11:03:49

89c51
Member
Registered: 2012-06-05
Posts: 677

Re: [Solved] - Systemd 207 upgrade - swap service failed

Not sure if related but i get this in my logs: (systemd 208)

Oct 09 12:00:16 mainland systemd[1]: Found device SAMSUNG_SSD_830_Series.
Oct 09 12:00:16 mainland systemd[1]: Found device SAMSUNG_SSD_830_Series.
Oct 09 12:00:16 mainland systemd[1]: Activating swap /dev/sda2...
Oct 09 12:00:16 mainland systemd[1]: Activating swap /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652...
Oct 09 12:00:16 mainland swapon[278]: swapon: /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652: swapon failed: Device or resource busy
Oct 09 12:00:16 mainland systemd[1]: Activated swap /dev/sda2.
Oct 09 12:00:16 mainland systemd[1]: dev-disk-by\x2duuid-8fa200a9\x2d4cd4\x2d4967\x2d853c\x2d887ee6cae652.swap swap process exited, code=exited status=255
Oct 09 12:00:16 mainland systemd[1]: Failed to activate swap /dev/disk/by-uuid/8fa200a9-4cd4-4967-853c-887ee6cae652.
Oct 09 12:00:16 mainland systemd[1]: Dependency failed for Swap.
Oct 09 12:00:16 mainland systemd[1]: Unit dev-disk-by\x2duuid-8fa200a9\x2d4cd4\x2d4967\x2d853c\x2d887ee6cae652.swap entered failed state.
Oct 09 12:00:16 mainland kernel: Adding 12582908k swap on /dev/sda2.  Priority:-1 extents:1 across:12582908k SSFS
Oct 09 12:00:16 mainland systemd[1]: Found device SAMSUNG_SSD_830_Series.

I also got a systemctl swap related error but that doesn't seem to happen all the time after the 208 update.

Offline

#40 2013-10-09 15:22:02

ico
Member
Registered: 2011-01-25
Posts: 23

Re: [Solved] - Systemd 207 upgrade - swap service failed

fujur wrote:

Thanks, ico.

I followed up the instructions given on that link, so now I have the encrypted swap fully managed by systemd, without using fstab, nor crypttab... But it seems like systemd is still trying to mount the swap partition after executing the new service, so the error message is still being shown.

After that error the new service manages the encrypted swap correctly, so everything is working ok, but I still would want to get rid of this error message.

ok do the following to disable systemd's automounting of swap. Change GPT partition type for your swap partition.

In my case, the partition was /dev/sda6. GPT partition type code for 'Linux swap' is 8200.

# pacman -S gdisk
# gdisk

It will ask for device name. I entered /dev/sda

Then enter t at the prompt. It will ask your partition number. Enter the number. In my case it was 6.

Then change the type to something else - like 8300 for 'Linux filesystem'.

Then use w to save changes and quit.

Reboot.

Offline

#41 2013-10-09 16:02:36

fujur
Member
Registered: 2013-10-08
Posts: 4

Re: [Solved] - Systemd 207 upgrade - swap service failed

ico wrote:

ok do the following to disable systemd's automounting of swap. Change GPT partition type for your swap partition.

In my case, the partition was /dev/sda6. GPT partition type code for 'Linux swap' is 8200.

# pacman -S gdisk
# gdisk

It will ask for device name. I entered /dev/sda

Then enter t at the prompt. It will ask your partition number. Enter the number. In my case it was 6.

Then change the type to something else - like 8300 for 'Linux filesystem'.

Then use w to save changes and quit.

Reboot.

Won't that ruin the usage of that partition as swap? I still want to use that partition (/dev/sda2, by the way) mapped to /dev/mapper/swap.

Now, this is done by the new systemd service this way:

/usr/lib/systemd/systemd-cryptsetup attach 'swap' 'by-id_link_to_sda2' '/dev/urandom' 'swap,cipher=aes-cbc-essiv:sha256,size=256'

Last edited by fujur (2013-10-09 16:02:56)

Offline

#42 2013-10-09 16:35:50

ico
Member
Registered: 2011-01-25
Posts: 23

Re: [Solved] - Systemd 207 upgrade - swap service failed

fujur wrote:

Won't that ruin the usage of that partition as swap? I still want to use that partition (/dev/sda2, by the way) mapped to /dev/mapper/swap.

Now, this is done by the new systemd service this way:

/usr/lib/systemd/systemd-cryptsetup attach 'swap' 'by-id_link_to_sda2' '/dev/urandom' 'swap,cipher=aes-cbc-essiv:sha256,size=256'

It shouldn't. May be you can give it a shot.

Like you said, systemd is trying to use swap two times.

One time it is failing. The way this works is - systemd searches for a GPT partition with type 8200. Then simply tries to use it swap. This won't work for encrypted partitions. So, it fails.

The second time, it is succeeding. Because of the unit file which you created.

I'm trying to disable the unsuccessful attempt. It can also be useful to those who don't want systemd to mount their swap partitions. Cleaner than deleting  /usr/lib/systemd/system-generators/systemd-gpt-auto-generator.

Last edited by ico (2013-10-09 16:37:15)

Offline

#43 2013-10-14 08:06:17

fujur
Member
Registered: 2013-10-08
Posts: 4

Re: [Solved] - Systemd 207 upgrade - swap service failed

I thought it would not be possible to swap on a partition not marked as swap. Now I realize what crypttab(5) states about the created unit file:

The encrypted block device will be used as a swap device, and will be formatted accordingly after setting up the encrypted block device, with mkswap(8).

Done as suggested above by ico, and working. Issue solved. Many thanks smile

Offline

Board footer

Powered by FluxBB